org.apache.camel.component.crypto
Class DigitalSignatureConfiguration

java.lang.Object
  extended by org.apache.camel.component.crypto.DigitalSignatureConfiguration
All Implemented Interfaces:
Cloneable, CamelContextAware

public class DigitalSignatureConfiguration
extends Object
implements Cloneable, CamelContextAware


Constructor Summary
DigitalSignatureConfiguration()
           
 
Method Summary
 DigitalSignatureConfiguration copy()
           
 String getAlgorithm()
          Gets the JCE name of the Algorithm that should be used for the signer.
 String getAlias()
          Gets the alias used to query the KeyStore for keys and Certificates to be used in signing and verifying exchanges.
 Integer getBufferSize()
          Get the size of the buffer used to read in the Exchange payload data.
 CamelContext getCamelContext()
          Get the CamelContext
 Certificate getCertificate()
          Get the explicitly configured Certificate that should be used to verify the signature in the exchange.
 Certificate getCertificate(String alias)
          Set the Certificate that should be used to verify the signature in the exchange.
 boolean getClearHeaders()
          Determines if the Signature specific headers be cleared after signing and verification.
 String getCryptoOperation()
          Gets the Crypto operation that was supplied in the the crypto scheme in the endpoint uri
 KeyStore getKeystore()
          Gets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges.
 char[] getPassword()
          Gets the password used to access an aliased PrivateKey in the KeyStore.
 PrivateKey getPrivateKey()
          Get the PrivateKey that should be used to sign the exchange
 PrivateKey getPrivateKey(String alias)
          Get the PrivateKey that should be used to sign the signature in the exchange using the supplied alias.
 PrivateKey getPrivateKey(String alias, char[] password)
          Get the PrivateKey that should be used to sign the signature in the exchange using the supplied alias.
 String getProvider()
          Get the id of the security provider that provides the configured Signature algorithm.
 PublicKey getPublicKey()
          get the PublicKey that should be used to verify the signature in the exchange.
 SecureRandom getSecureRandom()
          Get the SecureRandom used to initialize the Signature service
 String getSignatureHeader()
          Get the name of the message header that should be used to store the base64 encoded signature.
 void setAlgorithm(String algorithm)
          Sets the JCE name of the Algorithm that should be used for the signer.
 void setAlias(String alias)
          Sets the alias used to query the KeyStore for keys and Certificates to be used in signing and verifying exchanges.
 void setBufferSize(Integer bufferSize)
          Set the size of the buffer used to read in the Exchange payload data.
 void setCamelContext(CamelContext camelContext)
          Injects the CamelContext
 void setCertificate(Certificate certificate)
          Set the Certificate that should be used to verify the signature in the exchange based on its payload.
 void setCertificate(String certificateName)
          Sets the reference name for a PrivateKey that can be fond in the registry.
 void setClearHeaders(boolean clearHeaders)
          Determines if the Signature specific headers be cleared after signing and verification.
 void setCryptoOperation(String operation)
          Set the Crypto operation from that supplied after the crypto scheme in the endpoint uri e.g.
 void setKeystore(KeyStore keystore)
          Sets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges.
 void setKeystore(String keystoreName)
          Sets the reference name for a Keystore that can be fond in the registry.
 void setPassword(char[] password)
          Sets the password used to access an aliased PrivateKey in the KeyStore.
 void setPrivateKey(PrivateKey privateKey)
          Set the PrivateKey that should be used to sign the exchange
 void setPrivateKey(String privateKeyName)
          Sets the reference name for a PrivateKey that can be fond in the registry.
 void setProvider(String provider)
          Set the id of the security provider that provides the configured Signature algorithm.
 void setPublicKey(PublicKey publicKey)
          Set the PublicKey that should be used to verify the signature in the exchange.
 void setPublicKey(String publicKeyName)
          Sets the reference name for a publicKey that can be fond in the registry.
 void setSecureRandom(SecureRandom secureRandom)
          Set the SecureRandom used to initialize the Signature service
 void setSecureRandom(String randomName)
          Sets the reference name for a SecureRandom that can be fond in the registry.
 void setSignatureHeader(String signatureHeaderName)
          Set the name of the message header that should be used to store the base64 encoded signature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DigitalSignatureConfiguration

public DigitalSignatureConfiguration()
Method Detail

copy

public DigitalSignatureConfiguration copy()

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: CamelContextAware
Get the CamelContext

Specified by:
getCamelContext in interface CamelContextAware
Returns:
camelContext the Camel context

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware
Parameters:
camelContext - the Camel context

getAlgorithm

public String getAlgorithm()
Gets the JCE name of the Algorithm that should be used for the signer.


setAlgorithm

public void setAlgorithm(String algorithm)
Sets the JCE name of the Algorithm that should be used for the signer.


getAlias

public String getAlias()
Gets the alias used to query the KeyStore for keys and Certificates to be used in signing and verifying exchanges. This value can be provided at runtime via the message header DigitalSignatureConstants.KEYSTORE_ALIAS


setAlias

public void setAlias(String alias)
Sets the alias used to query the KeyStore for keys and Certificates to be used in signing and verifying exchanges. This value can be provided at runtime via the message header DigitalSignatureConstants.KEYSTORE_ALIAS


getPrivateKey

public PrivateKey getPrivateKey()
                         throws Exception
Get the PrivateKey that should be used to sign the exchange

Throws:
Exception

getPrivateKey

public PrivateKey getPrivateKey(String alias)
                         throws Exception
Get the PrivateKey that should be used to sign the signature in the exchange using the supplied alias.

Parameters:
alias - the alias used to retrieve the Certificate from the keystore.
Throws:
Exception

getPrivateKey

public PrivateKey getPrivateKey(String alias,
                                char[] password)
                         throws Exception
Get the PrivateKey that should be used to sign the signature in the exchange using the supplied alias.

Parameters:
alias - the alias used to retrieve the Certificate from the keystore.
Throws:
Exception

setPrivateKey

public void setPrivateKey(PrivateKey privateKey)
Set the PrivateKey that should be used to sign the exchange

Parameters:
privateKey - the key with with to sign the exchange.

setPrivateKey

public void setPrivateKey(String privateKeyName)
Sets the reference name for a PrivateKey that can be fond in the registry.


setPublicKey

public void setPublicKey(PublicKey publicKey)
Set the PublicKey that should be used to verify the signature in the exchange.


setPublicKey

public void setPublicKey(String publicKeyName)
Sets the reference name for a publicKey that can be fond in the registry.


getPublicKey

public PublicKey getPublicKey()
get the PublicKey that should be used to verify the signature in the exchange.


getCertificate

public Certificate getCertificate(String alias)
                           throws Exception
Set the Certificate that should be used to verify the signature in the exchange. If a KeyStore has been configured then this will attempt to retrieve the Certificatefrom it using hte supplied alias. If either the alias or the Keystore is invalid then the configured certificate will be returned

Parameters:
alias - the alias used to retrieve the Certificate from the keystore.
Throws:
Exception

getCertificate

public Certificate getCertificate()
                           throws Exception
Get the explicitly configured Certificate that should be used to verify the signature in the exchange.

Throws:
Exception

setCertificate

public void setCertificate(Certificate certificate)
Set the Certificate that should be used to verify the signature in the exchange based on its payload.


setCertificate

public void setCertificate(String certificateName)
Sets the reference name for a PrivateKey that can be fond in the registry.


getKeystore

public KeyStore getKeystore()
Gets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges. A KeyStore is typically used with an alias, either one supplied in the Route definition or dynamically via the message header "CamelSignatureKeyStoreAlias". If no alias is supplied and there is only a single entry in the Keystore, then this single entry will be used.


setKeystore

public void setKeystore(KeyStore keystore)
Sets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges. A KeyStore is typically used with an alias, either one supplied in the Route definition or dynamically via the message header "CamelSignatureKeyStoreAlias". If no alias is supplied and there is only a single entry in the Keystore, then this single entry will be used.


setKeystore

public void setKeystore(String keystoreName)
Sets the reference name for a Keystore that can be fond in the registry.


getPassword

public char[] getPassword()
Gets the password used to access an aliased PrivateKey in the KeyStore.


setPassword

public void setPassword(char[] password)
Sets the password used to access an aliased PrivateKey in the KeyStore.


getSecureRandom

public SecureRandom getSecureRandom()
Get the SecureRandom used to initialize the Signature service


setSecureRandom

public void setSecureRandom(String randomName)
Sets the reference name for a SecureRandom that can be fond in the registry.


setSecureRandom

public void setSecureRandom(SecureRandom secureRandom)
Set the SecureRandom used to initialize the Signature service

Parameters:
secureRandom - the random used to init the Signature service

getBufferSize

public Integer getBufferSize()
Get the size of the buffer used to read in the Exchange payload data.


setBufferSize

public void setBufferSize(Integer bufferSize)
Set the size of the buffer used to read in the Exchange payload data.


getProvider

public String getProvider()
Get the id of the security provider that provides the configured Signature algorithm.


setProvider

public void setProvider(String provider)
Set the id of the security provider that provides the configured Signature algorithm.

Parameters:
provider - the id of the security provider

getSignatureHeader

public String getSignatureHeader()
Get the name of the message header that should be used to store the base64 encoded signature. This defaults to 'CamelDigitalSignature'


setSignatureHeader

public void setSignatureHeader(String signatureHeaderName)
Set the name of the message header that should be used to store the base64 encoded signature. This defaults to 'CamelDigitalSignature'


getClearHeaders

public boolean getClearHeaders()
Determines if the Signature specific headers be cleared after signing and verification. Defaults to true, and should only be made otherwise at your extreme peril as vital private information such as Keys and passwords may escape if unset.

Returns:
true if the Signature headers should be unset, false otherwise

setClearHeaders

public void setClearHeaders(boolean clearHeaders)
Determines if the Signature specific headers be cleared after signing and verification. Defaults to true, and should only be made otherwise at your extreme peril as vital private information such as Keys and passwords may escape if unset.


setCryptoOperation

public void setCryptoOperation(String operation)
Set the Crypto operation from that supplied after the crypto scheme in the endpoint uri e.g. crypto:sign sets sign as the operation.

Parameters:
operation - the operation supplied after the crypto scheme

getCryptoOperation

public String getCryptoOperation()
Gets the Crypto operation that was supplied in the the crypto scheme in the endpoint uri



Apache CAMEL