Class XMLEncryptionUtil
- java.lang.Object
-
- org.keycloak.saml.processing.core.util.XMLEncryptionUtil
-
public class XMLEncryptionUtil extends Object
Utility for XML Encryption Note: This utility is currently using Apache XML Security library API. JSR-106 is not yet final. Until that happens,we rely on the non-standard API.- Since:
- May 4, 2009
- Author:
- [email protected]
-
-
Field Summary
Fields Modifier and Type Field Description static String
DS_KEY_INFO
-
Constructor Summary
Constructors Constructor Description XMLEncryptionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Element
decryptElementInDocument(Document documentWithEncryptedElement, PrivateKey privateKey)
Decrypt an encrypted element inside a documentstatic void
encryptElement(QName elementQName, Document document, PublicKey publicKey, SecretKey secretKey, int keySize, QName wrappingElementQName, boolean addEncryptedKeyInKeyInfo)
Given an element in a Document, encrypt the element and replace the element in the document with the encrypted data
-
-
-
Field Detail
-
DS_KEY_INFO
public static final String DS_KEY_INFO
- See Also:
- Constant Field Values
-
-
Method Detail
-
encryptElement
public static void encryptElement(QName elementQName, Document document, PublicKey publicKey, SecretKey secretKey, int keySize, QName wrappingElementQName, boolean addEncryptedKeyInKeyInfo) throws ProcessingException
Given an element in a Document, encrypt the element and replace the element in the document with the encrypted data- Parameters:
elementQName
- QName of the element that we like to encryptdocument
-publicKey
-secretKey
-keySize
-wrappingElementQName
- A QName of an element that will wrap the encrypted elementaddEncryptedKeyInKeyInfo
- Need for the EncryptedKey to be placed in ds:KeyInfo- Throws:
ProcessingException
-
decryptElementInDocument
public static Element decryptElementInDocument(Document documentWithEncryptedElement, PrivateKey privateKey) throws ProcessingException
Decrypt an encrypted element inside a document- Parameters:
documentWithEncryptedElement
-privateKey
- key need to unwrap the encryption key- Returns:
- the document with the encrypted element replaced by the data element
- Throws:
ProcessingException
-
-