public static byte[] serializeAndEncodeObject(final EncodableCipher cipher,
                                                  final Serializable object,
                                                  final Object[] parameters) {
        return FunctionUtils.doUnchecked(() -> {
            val outBytes = serialize(object);
            return (byte[]) cipher.encode(outBytes, parameters);
        });
    }
Serialize and encode object.

@param cipher     the cipher
@param object     the object
@param parameters the parameters
@return the byte []
@since 4.2
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java