Class CryptoHeaderFilter

  • All Implemented Interfaces:
    org.forgerock.http.Filter

    public class CryptoHeaderFilter
    extends Object
    implements org.forgerock.http.Filter
    Encrypts and decrypts header fields. All cipher algorithms provided by SunJCE Provider are supported for encryption but, for now CryptoHeaderFilter does not implement a way to set/retrieve the initialization vector(IV) (OPENIG-42) therefore, the CryptoHeader can not decrypt cipher algorithm using IV.
    • Field Detail

      • DEFAULT_ALGORITHM

        public static final String DEFAULT_ALGORITHM
        Default cipher algorithm to be used when none is specified.
        See Also:
        Constant Field Values
    • Constructor Detail

      • CryptoHeaderFilter

        public CryptoHeaderFilter()
    • Method Detail

      • setOperation

        public void setOperation​(CryptoHeaderFilter.Operation operation)
        Sets the operation (encryption/decryption) to apply to the headers.
        Parameters:
        operation - The encryption/decryption) to apply to the headers.
      • setMessageType

        public void setMessageType​(MessageType messageType)
        Sets the type of message to process headers for.
        Parameters:
        messageType - The type of message to process headers for.
      • setAlgorithm

        public void setAlgorithm​(String algorithm)
        Sets the cryptographic algorithm.
        Parameters:
        algorithm - The cryptographic algorithm.
      • setKey

        public void setKey​(Key key)
        Sets the encryption key.
        Parameters:
        key - The encryption key to set.
      • setCharset

        public void setCharset​(Charset charset)
        The Charset to use for decrypted values.
        Parameters:
        charset - The charset used for decrypted values.
      • getHeaders

        public Set<String> getHeaders()
        Returns the headers whose values should be processed for encryption or decryption.
        Returns:
        The headers whose values should be processed for encryption or decryption.
      • filter

        public org.forgerock.util.promise.Promise<org.forgerock.http.protocol.Response,​org.forgerock.util.promise.NeverThrowsException> filter​(org.forgerock.services.context.Context context,
                                                                                                                                                     org.forgerock.http.protocol.Request request,
                                                                                                                                                     org.forgerock.http.Handler next)
        Specified by:
        filter in interface org.forgerock.http.Filter