Package org.forgerock.openig.filter
Class CryptoHeaderFilter
- java.lang.Object
-
- org.forgerock.openig.filter.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCryptoHeaderFilter.HeapletCreates and initializes a header filter in a heap environment.static classCryptoHeaderFilter.OperationShould the filter encrypt or decrypt the given headers ?
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_ALGORITHMDefault cipher algorithm to be used when none is specified.
-
Constructor Summary
Constructors Constructor Description CryptoHeaderFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)Set<String>getHeaders()Returns the headers whose values should be processed for encryption or decryption.voidsetAlgorithm(String algorithm)Sets the cryptographic algorithm.voidsetCharset(Charset charset)TheCharsetto use for decrypted values.voidsetKey(Key key)Sets the encryption key.voidsetMessageType(MessageType messageType)Sets the type of message to process headers for.voidsetOperation(CryptoHeaderFilter.Operation operation)Sets the operation (encryption/decryption) to apply to the headers.
-
-
-
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
-
-
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)
TheCharsetto 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:
filterin interfaceorg.forgerock.http.Filter
-
-