public class SAMLObjectDecrypter extends Object
For some reason, OpenSAML offers two ways to represent decryption parameters, the DecryptionParameters
and
the DecryptionConfiguration
. This bean supports being initialized by either of these two, but also, and
perhaps easier to use; it supports initialization with just the encryption credentials and assigns the following
defaults:
ChainingKeyInfoCredentialResolver
instance is used that chains a
LocalKeyInfoCredentialResolver
and a InlineEncryptedKeyResolver
.ChainingEncryptedKeyResolver
instance chaining the resolvers:
InlineEncryptedKeyResolver
, EncryptedElementTypeEncryptedKeyResolver
,
SimpleRetrievalMethodEncryptedKeyResolver
and SimpleKeyInfoReferenceEncryptedKeyResolver
.Constructor and Description |
---|
SAMLObjectDecrypter(Credential decryptionCredential)
Constructor given the credential to use to decrypt the messages (certificate or key pair).
|
SAMLObjectDecrypter(DecryptionConfiguration decryptionConfiguration)
Initializes the decrypter using
DecryptionConfiguration . |
SAMLObjectDecrypter(DecryptionParameters decryptionParameters)
Initializes the decrypter using
DecryptionParameters . |
SAMLObjectDecrypter(List<Credential> decryptionCredentials)
Constructor accepting several credentials (certificates or key pairs) to be used when decrypting.
|
Modifier and Type | Method and Description |
---|---|
<T extends XMLObject,E extends EncryptedElementType> |
decrypt(E encryptedObject,
Class<T> destinationClass)
Decrypts the supplied encrypted object into an object of the given type.
|
void |
setBlacklistedAlgorithms(Collection<String> blacklistedAlgorithms)
Assigns a list of black listed algorithms
|
void |
setPkcs11testMode(boolean pkcs11testMode)
For internal testing only.
|
void |
setPkcs11Workaround(boolean pkcs11Workaround)
If using a HSM it is likely that the SunPKCS11 crypto provider is used.
|
void |
setWhitelistedAlgorithms(Collection<String> whitelistedAlgorithms)
Assigns a list of white listed algorithms
|
public SAMLObjectDecrypter(Credential decryptionCredential)
decryptionCredential
- decryption credentialpublic SAMLObjectDecrypter(List<Credential> decryptionCredentials)
decryptionCredentials
- decryption credentialspublic SAMLObjectDecrypter(DecryptionParameters decryptionParameters)
DecryptionParameters
.decryptionParameters
- parameterspublic SAMLObjectDecrypter(DecryptionConfiguration decryptionConfiguration)
DecryptionConfiguration
.decryptionConfiguration
- parameterspublic <T extends XMLObject,E extends EncryptedElementType> T decrypt(E encryptedObject, Class<T> destinationClass) throws DecryptionException
T
- the type of the destination objectE
- the type of the encrypted objectencryptedObject
- the encrypted objectdestinationClass
- the class of the destination objectDecryptionException
- for decryption errorspublic void setBlacklistedAlgorithms(Collection<String> blacklistedAlgorithms)
blacklistedAlgorithms
- non allowed algorithmspublic void setWhitelistedAlgorithms(Collection<String> whitelistedAlgorithms)
whitelistedAlgorithms
- white listed algorithmspublic void setPkcs11Workaround(boolean pkcs11Workaround)
http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
is the default algorithm to use for key encryption. This
class has a workaround for this limitation that is enabled by setting the pkcs11Workaround
flag.pkcs11Workaround
- whether to run in PKCS11 workaround modepublic void setPkcs11testMode(boolean pkcs11testMode)
pkcs11testMode
- test flagCopyright © 2018 Litsec AB. All rights reserved.