Class SAMLObjectEncrypter
java.lang.Object
se.swedenconnect.opensaml.xmlsec.encryption.support.SAMLObjectEncrypter
Utility class for encrypting an element for a SAML entity.
- Author:
- Martin Lindström (martin@idsec.se)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents the peer when performing encryption. -
Constructor Summary
ConstructorsConstructorDescriptionSets up the object encrypter without a metadata provider.SAMLObjectEncrypter(MetadataResolver metadataResolver) Sets up the object encrypter with a metadata resolver from where we find the peer credentials. -
Method Summary
Modifier and TypeMethodDescriptionencrypt(XMLObject xmlObject, SAMLObjectEncrypter.Peer peer) Maps toencrypt(XMLObject, Peer, EncryptionConfiguration)where the default encryption configuration is supplied.encrypt(XMLObject xmlObject, SAMLObjectEncrypter.Peer peer, EncryptionConfiguration configuration) Encrypts the supplied XML object by locating the peer encryption credentials and using the supplied configuration.voidsetAlgorithmRegistry(AlgorithmRegistry algorithmRegistry) Sets theAlgorithmRegistryinstance used when resolving algorithm URIs.voidsetDefaultEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) Sets the default encryption configuration to use.voidsetEncrypter(Encrypter encrypter) The encrypter to use.
-
Constructor Details
-
SAMLObjectEncrypter
Sets up the object encrypter without a metadata provider. This means that the peer metadata has to be supplied in calls toencrypt(XMLObject, Peer)andencrypt(XMLObject, Peer, EncryptionConfiguration).- Throws:
ComponentInitializationException- for init errors
-
SAMLObjectEncrypter
public SAMLObjectEncrypter(MetadataResolver metadataResolver) throws ComponentInitializationException Sets up the object encrypter with a metadata resolver from where we find the peer credentials.- Parameters:
metadataResolver- the metadata resolver- Throws:
ComponentInitializationException- for init errors
-
-
Method Details
-
encrypt
public EncryptedData encrypt(XMLObject xmlObject, SAMLObjectEncrypter.Peer peer) throws EncryptionException Maps toencrypt(XMLObject, Peer, EncryptionConfiguration)where the default encryption configuration is supplied.- Parameters:
xmlObject- the object to encryptpeer- the peer to whom we encrypt for- Returns:
- an
EncryptedDataobject - Throws:
EncryptionException- for encryption errors
-
encrypt
public EncryptedData encrypt(XMLObject xmlObject, SAMLObjectEncrypter.Peer peer, EncryptionConfiguration configuration) throws EncryptionException Encrypts the supplied XML object by locating the peer encryption credentials and using the supplied configuration.- Parameters:
xmlObject- the object to encryptpeer- the peer to whom we encrypt forconfiguration- the encryption configuration- Returns:
- an
EncryptedDataobject - Throws:
EncryptionException- for encryption errors
-
setEncrypter
The encrypter to use.- Parameters:
encrypter- the encrypter
-
setDefaultEncryptionConfiguration
Sets the default encryption configuration to use.If not assigned, the system defaults will be used.
- Parameters:
encryptionConfiguration- default encryption configuration
-
setAlgorithmRegistry
Sets theAlgorithmRegistryinstance used when resolving algorithm URIs. Defaults to the registry resolved viaAlgorithmSupport.getGlobalAlgorithmRegistry().- Parameters:
algorithmRegistry- the new algorithm registry instance
-