Package com.sun.identity.xmlenc
Class XMLEncryptionManager
- java.lang.Object
-
- com.sun.identity.xmlenc.XMLEncryptionManager
-
public class XMLEncryptionManager extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
XMLEncryptionManager()
Constructorprotected
XMLEncryptionManager(EncryptionProvider encProvider, KeyProvider keyProvider)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Document
decryptAndReplace(Document encryptedDoc, String kekAlias)
Decrypts and replaces the XML element in a given XML DOM Document.Document
decryptAndReplace(Document encryptedDoc, Key privKey)
Decrypts an XML Document that contains encrypted data.Key
decryptKey(Element encryptedKey, String certAlias)
Decrypts key and returns the associated secret key.Document
encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, int kekStrength)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, String providerID)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength, String providerID)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplaceResourceID(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, String providerID)
Encrypts the given ResourceID XML element in a given XML Context document.Document
encryptAndReplaceResourceID(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength, String providerID)
Encrypts the given XML element in a given XML Context document.Document
encryptAndReplaceWSSElements(Document doc, Map elmMap, String encDataEncAlg, int encDataEncAlgStrength, String certAlias, int kekStrength, String tokenType, String providerID)
Encrypts the given WSS XML element in a given XML Context document.static XMLEncryptionManager
getInstance()
Gets the instance ofXMLEncryptionManager
with defaultKeyProvider
andEncryptionProvider
.static XMLEncryptionManager
getInstance(EncryptionProvider encProvider, KeyProvider keyProvider)
Gets the instance ofXMLEncryptionManager
with givenKeyProvider
andEncryptionProvider
.
-
-
-
Constructor Detail
-
XMLEncryptionManager
protected XMLEncryptionManager()
Constructor
-
XMLEncryptionManager
protected XMLEncryptionManager(EncryptionProvider encProvider, KeyProvider keyProvider)
Constructor
-
-
Method Detail
-
getInstance
public static XMLEncryptionManager getInstance()
Gets the instance ofXMLEncryptionManager
with defaultKeyProvider
andEncryptionProvider
.- Returns:
XMLEncryptionManager
-
getInstance
public static XMLEncryptionManager getInstance(EncryptionProvider encProvider, KeyProvider keyProvider)
Gets the instance ofXMLEncryptionManager
with givenKeyProvider
andEncryptionProvider
.- Returns:
XMLEncryptionManager
-
encryptAndReplace
public Document encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption key sizecertAlias
- KeyEncryption Key cert alias.- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplace
public Document encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, String providerID) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption key sizecertAlias
- KeyEncryption Key cert alias.providerID
- Unique provider ID.- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplaceResourceID
public Document encryptAndReplaceResourceID(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, String providerID) throws EncryptionException
Encrypts the given ResourceID XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption key sizecertAlias
- KeyEncryption Key cert alias.providerID
- Unique provider ID.- Returns:
- org.w3c.dom.Document XML Document for EncryptedResourceID.
- Throws:
EncryptionException
-
encryptAndReplace
public Document encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, String certAlias, int kekStrength) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption key sizecertAlias
- KeyEncryption Key cert alias.kekStrength
- Key Encryption Key Strength.- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplace
public Document encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption Key Strength.kek
- Key Encryption Key.kekStrength
- Key Encryption Key Strength- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplace
public Document encryptAndReplace(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength, String providerID) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption Key Strength.kek
- Key Encryption Key.kekStrength
- Key Encryption Key StrengthproviderID
- provider entityID- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplaceResourceID
public Document encryptAndReplaceResourceID(Document doc, Element element, String secretKeyAlg, int keySize, Key kek, int kekStrength, String providerID) throws EncryptionException
Encrypts the given XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.element
- Element to be encrypted.secretKeyAlg
- Encryption Key Algorithm.keySize
- Encryption Key Strength.kek
- Key Encryption Key.kekStrength
- Key Encryption Key Strength- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
encryptAndReplaceWSSElements
public Document encryptAndReplaceWSSElements(Document doc, Map elmMap, String encDataEncAlg, int encDataEncAlgStrength, String certAlias, int kekStrength, String tokenType, String providerID) throws EncryptionException
Encrypts the given WSS XML element in a given XML Context document.- Parameters:
doc
- the context XML Document.elmMap
- Map of (Element, wsu_id) to be encrypted.encDataEncAlg
- Encryption Key Algorithm.encDataEncAlgStrength
- Encryption Key Strength.certAlias
- Key Encryption Key cert alias.kekStrength
- Key Encryption Key Strength.tokenType
- Security token type.providerID
- Provider ID.- Returns:
- org.w3c.dom.Document XML Document replaced with encrypted data for a given XML element.
- Throws:
EncryptionException
-
decryptAndReplace
public Document decryptAndReplace(Document encryptedDoc, String kekAlias) throws EncryptionException
Decrypts and replaces the XML element in a given XML DOM Document.- Parameters:
encryptedDoc
- Encrypted XML Document.kekAlias
- Key Encryption Key Cert Alias.- Returns:
- org.w3.dom.Document Decrypted XML Document.
- Throws:
XMLEncryptionException
EncryptionException
-
decryptAndReplace
public Document decryptAndReplace(Document encryptedDoc, Key privKey) throws EncryptionException
Decrypts an XML Document that contains encrypted data.- Parameters:
encryptedDoc
- XML Document with encrypted data.privKey
- Key Encryption Key used for encryption.- Returns:
- org.w3c.dom.Document Decrypted XML Document.
- Throws:
EncryptionException
-
-