Package se.litsec.opensaml.xmlsec
Class SAMLObjectEncrypter
- java.lang.Object
-
- se.litsec.opensaml.xmlsec.SAMLObjectEncrypter
-
public class SAMLObjectEncrypter extends Object
Utility class for encrypting an element for a SAML entity.- Author:
- Martin Lindström (martin.lindstrom@litsec.se)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSAMLObjectEncrypter.PeerRepresents the peer when performing encryption.
-
Constructor Summary
Constructors Constructor Description SAMLObjectEncrypter()Sets up the object encrypter without a metadata provider.SAMLObjectEncrypter(MetadataProvider metadataProvider)Sets up the object encrypter with a metadata provider from where we find the peer credentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EncryptedDataencrypt(XMLObject xmlObject, SAMLObjectEncrypter.Peer peer)Maps toencrypt(XMLObject, Peer, EncryptionConfiguration)where the default encryption configuration is supplied.EncryptedDataencrypt(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 Detail
-
SAMLObjectEncrypter
public SAMLObjectEncrypter() throws ComponentInitializationExceptionSets 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(MetadataProvider metadataProvider) throws ComponentInitializationException
Sets up the object encrypter with a metadata provider from where we find the peer credentials.- Parameters:
metadataProvider- the metadata provider- Throws:
ComponentInitializationException- for init errors
-
-
Method Detail
-
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
public void setEncrypter(Encrypter encrypter)
The encrypter to use.If not assigned, an instance of
Encrypteris used.- Parameters:
encrypter- the encrypter
-
setDefaultEncryptionConfiguration
public void setDefaultEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration)
Sets the default encryption configuration to use.If not assigned, the system defaults will be used.
- Parameters:
encryptionConfiguration- default encryption configuration
-
setAlgorithmRegistry
public void setAlgorithmRegistry(AlgorithmRegistry algorithmRegistry)
Sets theAlgorithmRegistryinstance used when resolving algorithm URIs. Defaults to the registry resolved viaAlgorithmSupport.getGlobalAlgorithmRegistry().- Parameters:
algorithmRegistry- the new algorithm registry instance
-
-