Package org.certificateservices.messages
Interface MessageSecurityProvider
-
- All Known Subinterfaces:
ContextMessageSecurityProvider,HSMMessageSecurityProvider
- All Known Implementing Classes:
DummyMessageSecurityProvider,PKCS11MessageSecurityProvider,SimpleMessageSecurityProvider
public interface MessageSecurityProviderPKI Message Security Provider used by the generator of messages to sign the PKI messages before they are sent.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_DECRYPTIONKEY
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.security.cert.X509CertificategetDecryptionCertificate(java.lang.String keyId)Fetches the decryption certificate of related key id.java.security.cert.X509Certificate[]getDecryptionCertificateChain(java.lang.String keyId)Fetches the decryption certificate chain of related key id can be one or more in size..java.security.PrivateKeygetDecryptionKey(java.lang.String keyId)Fetches a private key given it's unique identifier.java.util.Set<java.lang.String>getDecryptionKeyIds()Returns key identifiers of all available decryption keys.EncryptionAlgorithmSchemegetEncryptionAlgorithmScheme()Method to fetch the EncryptionAlgorithmScheme to use when encrypting messages.java.lang.StringgetProvider()Method to retrieve JCE provider that should be used with keys provided by this provider.SigningAlgorithmSchemegetSigningAlgorithmScheme()Method to fetch the SigningAlgorithmScheme to use when signing messages.java.security.cert.X509CertificategetSigningCertificate()Fetches the signing certificate used to create the digital signatures of the XML file.java.security.PrivateKeygetSigningKey()Fetches the signing key used to create the digital signatures of the XML file.booleanisValidAndAuthorized(java.security.cert.X509Certificate signCertificate, java.lang.String organisation)Method in charge of validating a certificate used to sign a PKI message and also check if the certificate is authorized to generate messages.
-
-
-
Method Detail
-
getSigningKey
java.security.PrivateKey getSigningKey() throws MessageProcessingExceptionFetches the signing key used to create the digital signatures of the XML file.- Returns:
- the signing key used.
- Throws:
MessageProcessingException- if key isn't accessible or activated.
-
getSigningCertificate
java.security.cert.X509Certificate getSigningCertificate() throws MessageProcessingExceptionFetches the signing certificate used to create the digital signatures of the XML file.- Returns:
- the signing certificate used.
- Throws:
MessageProcessingException- if certificate isn't accessible.
-
getDecryptionKey
java.security.PrivateKey getDecryptionKey(java.lang.String keyId) throws MessageProcessingExceptionFetches a private key given it's unique identifier.- Parameters:
keyId- unique identifier of the key, if null should a default key be retrieved- Returns:
- the related decryption key.
- Throws:
MessageProcessingException
-
getDecryptionCertificate
java.security.cert.X509Certificate getDecryptionCertificate(java.lang.String keyId) throws MessageProcessingExceptionFetches the decryption certificate of related key id.- Parameters:
keyId- unique identifier of the key, if null should a default key certificate be retrieved- Returns:
- the related decryption certificate.
- Throws:
MessageProcessingException- if certificate isn't accessible.
-
getDecryptionCertificateChain
java.security.cert.X509Certificate[] getDecryptionCertificateChain(java.lang.String keyId) throws MessageProcessingExceptionFetches the decryption certificate chain of related key id can be one or more in size..- Parameters:
keyId- unique identifier of the key, if null should a default key certificate be retrieved- Returns:
- the related decryption certificate chain
- Throws:
MessageProcessingException- if certificate isn't accessible.
-
getDecryptionKeyIds
java.util.Set<java.lang.String> getDecryptionKeyIds() throws MessageProcessingExceptionReturns key identifiers of all available decryption keys.- Returns:
- key identifiers of all available decryption keys.
- Throws:
MessageProcessingException
-
isValidAndAuthorized
boolean isValidAndAuthorized(java.security.cert.X509Certificate signCertificate, java.lang.String organisation) throws java.lang.IllegalArgumentException, MessageProcessingExceptionMethod in charge of validating a certificate used to sign a PKI message and also check if the certificate is authorized to generate messages.- Parameters:
signCertificate- the certificate used to sign the message.organisation- the related organisation to the message, null if no organisation lookup should be done.- Returns:
- true if the sign certificate is valid and authorized to sign messages.
- Throws:
java.lang.IllegalArgumentException- if arguments were invalid.MessageProcessingException- if internal error occurred validating the certificate.
-
getEncryptionAlgorithmScheme
EncryptionAlgorithmScheme getEncryptionAlgorithmScheme() throws MessageProcessingException
Method to fetch the EncryptionAlgorithmScheme to use when encrypting messages.- Returns:
- Configured EncryptionAlgorithmScheme to use.
- Throws:
MessageProcessingException- if internal error determining algorithm scheme to use
-
getSigningAlgorithmScheme
SigningAlgorithmScheme getSigningAlgorithmScheme() throws MessageProcessingException
Method to fetch the SigningAlgorithmScheme to use when signing messages.- Returns:
- Configured SigningAlgorithmScheme to use.
- Throws:
MessageProcessingException- if internal error determining algorithm scheme to use
-
getProvider
java.lang.String getProvider()
Method to retrieve JCE provider that should be used with keys provided by this provider.- Returns:
- name of an JCE Provider that should be installed prior to usage of this MessageSecurityProvider if null should the JRE configured list of security providers be used.
-
-