Package org.forgerock.openig.filter
Class CryptoHeaderFilter
- java.lang.Object
-
- org.forgerock.openig.filter.CryptoHeaderFilter
-
- All Implemented Interfaces:
Filter
public class CryptoHeaderFilter extends Object implements 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 class
CryptoHeaderFilter.Heaplet
Creates and initializes a header filter in a heap environment.static class
CryptoHeaderFilter.Operation
Should the filter encrypt or decrypt the given headers ?
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_ALGORITHM
Default 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 Promise<Response,NeverThrowsException>
filter(Context context, Request request, Handler next)
Filters the request and/or response of an exchange.Set<String>
getHeaders()
Returns the headers whose values should be processed for encryption or decryption.void
setAlgorithm(String algorithm)
Sets the cryptographic algorithm.void
setCharset(Charset charset)
TheCharset
to use to encrypt/decrypt values.void
setKey(Key key)
Sets the encryption key.void
setMessageType(MessageType messageType)
Sets the type of message to process headers for.void
setOperation(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 operation: encryption or 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)
TheCharset
to use to encrypt/decrypt values.- Parameters:
charset
- The charset used to encrypt/decrypt 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 Promise<Response,NeverThrowsException> filter(Context context, Request request, Handler next)
Description copied from interface:Filter
Filters the request and/or response of an exchange. To pass the request to the next filter or handler in the chain, the filter callsnext.handle(context, request)
.This method may elect not to pass the request to the next filter or handler, and instead handle the request itself. It can achieve this by merely avoiding a call to
next.handle(context, request)
and creating its own response object. The filter is also at liberty to replace a response with another of its own by intercepting the response returned by the next handler.
-
-