Package com.sun.identity.saml2.xmlenc
Interface EncProvider
-
- All Known Implementing Classes:
FMEncProvider
public interface EncProvider
EncProvider
is an interface for encrypting and decrypting SAML2 XML documents.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Element
decrypt(String xmlString, Set<PrivateKey> privateKeys)
Decrypts an XML document that contains encrypted data.Element
encrypt(String xmlString, Key recipientPublicKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID, String outerElementName)
Encrypts the root element of the given XML document.Element
encrypt(String xmlString, Key recipientPublicKey, SecretKey secretKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID, String outerElementName)
Encrypts the root element of the given XML document.SecretKey
getSecretKey(String xmlString, Set<PrivateKey> privateKeys)
Returns the secret key that encrypts encrypted data and is encrypted with recipient's public key in the XML document.
-
-
-
Method Detail
-
encrypt
Element encrypt(String xmlString, Key recipientPublicKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID, String outerElementName) throws SAML2Exception
Encrypts the root element of the given XML document.- Parameters:
xmlString
- String representing an XML document whose root element is to be encrypted.recipientPublicKey
- Public key used to encrypt the data encryption (secret) key, it is the public key of the recipient of the XML document to be encrypted.dataEncAlgorithm
- Data encryption algorithm.dataEncStrength
- Data encryption strength.recipientEntityID
- Unique identifier of the recipient, it is used as the index to the cached secret key so that the key can be reused for the same recipient; It can be null in which case the secret key will be generated every time and will not be cached and reused. Note that the generation of a secret key is a relatively expensive operation.outerElementName
- Name of the element that will wrap around the encrypted data and encrypted key(s) sub-elements- Returns:
- org.w3c.dom.Element Root element of the encypted document; The name of this root element is indicated by the last input parameter
- Throws:
SAML2Exception
- if there is an error during the encryption process
-
encrypt
Element encrypt(String xmlString, Key recipientPublicKey, SecretKey secretKey, String dataEncAlgorithm, int dataEncStrength, String recipientEntityID, String outerElementName) throws SAML2Exception
Encrypts the root element of the given XML document.- Parameters:
xmlString
- String representing an XML document whose root element is to be encrypted.recipientPublicKey
- Public key used to encrypt the data encryption (secret) key, it is the public key of the recipient of the XML document to be encrypted.secretKey
- the secret key used to encrypted data.dataEncAlgorithm
- Data encryption algorithm.dataEncStrength
- Data encryption strength.recipientEntityID
- Unique identifier of the recipient, it is used as the index to the cached secret key so that the key can be reused for the same recipient; It can be null in which case the secret key will be generated every time and will not be cached and reused. Note that the generation of a secret key is a relatively expensive operation.outerElementName
- Name of the element that will wrap around the encrypted data and encrypted key(s) sub-elements- Returns:
- org.w3c.dom.Element Root element of the encypted document; The name of this root element is indicated by the last input parameter
- Throws:
SAML2Exception
- if there is an error during the encryption process
-
getSecretKey
SecretKey getSecretKey(String xmlString, Set<PrivateKey> privateKeys) throws SAML2Exception
Returns the secret key that encrypts encrypted data and is encrypted with recipient's public key in the XML document.- Parameters:
xmlString
- String representing an XML document with encrypted secret key.privateKeys
- Private keys used to decrypt the secret key.- Returns:
- the secret key.
- Throws:
SAML2Exception
- if there is an error during the decryption process
-
decrypt
Element decrypt(String xmlString, Set<PrivateKey> privateKeys) throws SAML2Exception
Decrypts an XML document that contains encrypted data.- Parameters:
xmlString
- String representing an XML document with encrypted data.privateKeys
- Private keys used to decrypt the secret key.- Returns:
- org.w3c.dom.Element Decrypted XML document. For example, if the input document's root element is EncryptedID, then the return element will be NameID
- Throws:
SAML2Exception
- if there is an error during the decryption process
-
-