Class DigitalSignatureConfiguration
- java.lang.Object
-
- org.apache.camel.component.crypto.DigitalSignatureConfiguration
-
-
Constructor Summary
Constructors Constructor Description DigitalSignatureConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 andCertificates
to be used in signing and verifying exchanges.Integer
getBufferSize()
Get the size of the buffer used to read in the Exchange payload data.org.apache.camel.CamelContext
getCamelContext()
Certificate
getCertificate()
Get the explicitly configuredCertificate
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.String
getCertificateName()
CryptoOperation
getCryptoOperation()
Gets the Crypto operation that was supplied in the crypto scheme in the endpoint uriKeyStore
getKeystore()
Gets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges.String
getKeystoreName()
org.apache.camel.support.jsse.KeyStoreParameters
getKeyStoreParameters()
String
getName()
String
getPassword()
Gets the password used to access an aliasedPrivateKey
in the KeyStore.PrivateKey
getPrivateKey()
Get the PrivateKey that should be used to sign the exchangePrivateKey
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
getPrivateKeyName()
String
getProvider()
Get the id of the security provider that provides the configuredSignature
algorithm.PublicKey
getPublicKey()
get the PublicKey that should be used to verify the signature in the exchange.String
getPublicKeyName()
SecureRandom
getSecureRandom()
Get the SecureRandom used to initialize the Signature serviceString
getSecureRandomName()
String
getSignatureHeaderName()
Get the name of the message header that should be used to store the base64 encoded signature.boolean
isClearHeaders()
Determines if the Signature specific headers be cleared after signing and verification.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 andCertificates
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(org.apache.camel.CamelContext camelContext)
void
setCertificate(Certificate certificate)
Set the Certificate that should be used to verify the signature in the exchange based on its payload.void
setCertificateName(String certificateName)
Sets the reference name for a PrivateKey that can be found 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
setCryptoOperation(CryptoOperation operation)
void
setKeystore(KeyStore keystore)
Sets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges.void
setKeystoreName(String keystoreName)
Sets the reference name for a Keystore that can be found in the registry.void
setKeyStoreParameters(org.apache.camel.support.jsse.KeyStoreParameters keyStoreParameters)
Sets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges based on the given KeyStoreParameters.void
setName(String name)
The logical name of this operation.void
setPassword(String password)
Sets the password used to access an aliasedPrivateKey
in the KeyStore.void
setPrivateKey(PrivateKey privateKey)
Set the PrivateKey that should be used to sign the exchangevoid
setPrivateKeyName(String privateKeyName)
Sets the reference name for a PrivateKey that can be found in the registry.void
setProvider(String provider)
Set the id of the security provider that provides the configuredSignature
algorithm.void
setPublicKey(PublicKey publicKey)
Set the PublicKey that should be used to verify the signature in the exchange.void
setPublicKeyName(String publicKeyName)
Sets the reference name for a publicKey that can be found in the registry.void
setSecureRandom(SecureRandom secureRandom)
Set the SecureRandom used to initialize the Signature servicevoid
setSecureRandomName(String randomName)
Sets the reference name for a SecureRandom that can be found in the registry.void
setSignatureHeaderName(String signatureHeaderName)
Set the name of the message header that should be used to store the base64 encoded signature.
-
-
-
Method Detail
-
copy
public DigitalSignatureConfiguration copy()
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
- Specified by:
getCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
getName
public String getName()
-
setName
public void setName(String name)
The logical name of this operation.
-
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 andCertificates
to be used in signing and verifying exchanges. This value can be provided at runtime via the message headerDigitalSignatureConstants.KEYSTORE_ALIAS
-
setAlias
public void setAlias(String alias)
Sets the alias used to query the KeyStore for keys andCertificates
to be used in signing and verifying exchanges. This value can be provided at runtime via the message headerDigitalSignatureConstants.KEYSTORE_ALIAS
-
getPrivateKey
public PrivateKey getPrivateKey()
Get the PrivateKey that should be used to sign the exchange
-
getPrivateKey
public PrivateKey getPrivateKey(String alias)
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.
-
getPrivateKey
public PrivateKey getPrivateKey(String alias, char[] password)
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.
-
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.
-
getPrivateKeyName
public String getPrivateKeyName()
-
setPrivateKeyName
public void setPrivateKeyName(String privateKeyName)
Sets the reference name for a PrivateKey that can be found in the registry.
-
setPublicKey
public void setPublicKey(PublicKey publicKey)
Set the PublicKey that should be used to verify the signature in the exchange.
-
getPublicKeyName
public String getPublicKeyName()
-
setPublicKeyName
public void setPublicKeyName(String publicKeyName)
Sets the reference name for a publicKey that can be found 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 aKeyStore
has been configured then this will attempt to retrieve theCertificate
from 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()
Get the explicitly configuredCertificate
that should be used to verify the signature in the exchange.
-
setCertificate
public void setCertificate(Certificate certificate)
Set the Certificate that should be used to verify the signature in the exchange based on its payload.
-
getCertificateName
public String getCertificateName()
-
setCertificateName
public void setCertificateName(String certificateName)
Sets the reference name for a PrivateKey that can be found in the registry.
-
getKeystore
public KeyStore getKeystore()
Gets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges. AKeyStore
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. AKeyStore
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.
-
getKeystoreName
public String getKeystoreName()
-
setKeystoreName
public void setKeystoreName(String keystoreName)
Sets the reference name for a Keystore that can be found in the registry.
-
getPassword
public String getPassword()
Gets the password used to access an aliasedPrivateKey
in the KeyStore.
-
setPassword
public void setPassword(String password)
Sets the password used to access an aliasedPrivateKey
in the KeyStore.
-
getKeyStoreParameters
public org.apache.camel.support.jsse.KeyStoreParameters getKeyStoreParameters()
-
setKeyStoreParameters
public void setKeyStoreParameters(org.apache.camel.support.jsse.KeyStoreParameters keyStoreParameters)
Sets the KeyStore that can contain keys and Certficates for use in signing and verifying exchanges based on the given KeyStoreParameters. AKeyStore
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.
-
getSecureRandom
public SecureRandom getSecureRandom()
Get the SecureRandom used to initialize the Signature service
-
getSecureRandomName
public String getSecureRandomName()
-
setSecureRandomName
public void setSecureRandomName(String randomName)
Sets the reference name for a SecureRandom that can be found 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 configuredSignature
algorithm.
-
setProvider
public void setProvider(String provider)
Set the id of the security provider that provides the configuredSignature
algorithm.- Parameters:
provider
- the id of the security provider
-
getSignatureHeaderName
public String getSignatureHeaderName()
Get the name of the message header that should be used to store the base64 encoded signature. This defaults to 'CamelDigitalSignature'
-
setSignatureHeaderName
public void setSignatureHeaderName(String signatureHeaderName)
Set the name of the message header that should be used to store the base64 encoded signature. This defaults to 'CamelDigitalSignature'
-
isClearHeaders
public boolean isClearHeaders()
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
-
setCryptoOperation
public void setCryptoOperation(CryptoOperation operation)
-
getCryptoOperation
public CryptoOperation getCryptoOperation()
Gets the Crypto operation that was supplied in the crypto scheme in the endpoint uri
-
-