Package org.apache.wss4j.dom.util
Class EncryptionUtils
java.lang.Object
org.apache.wss4j.dom.util.EncryptionUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic WSDataRefdecryptEncryptedData(Document doc, String dataRefURI, Element encData, SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler) Decrypt the EncryptedData argument using a SecretKey.static WSDataRefdecryptEncryptedData(Document doc, String dataRefURI, Element encData, SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler, org.apache.xml.security.encryption.Serializer encryptionSerializer) Decrypt the EncryptedData argument using a SecretKey.static ElementfindEncryptedDataElement(WSDocInfo wsDocInfo, String dataRefURI) Look up the encrypted data.static ElementgetCipherValueFromEncryptedData(Element encData) static byte[]getDecodedBase64EncodedData(Element element) Method getDecodedBase64EncodedDatastatic StringgetDigestAlgorithm(Node encBodyData) static StringgetMGFAlgorithm(Node encBodyData) static byte[]getPSource(Node encBodyData) static StringgetXOPURIFromCipherValue(Element cipherValue) static String
-
Method Details
-
findEncryptedDataElement
public static Element findEncryptedDataElement(WSDocInfo wsDocInfo, String dataRefURI) throws WSSecurityException Look up the encrypted data. First try Id="someURI". If no such Id then try wsu:Id="someURI".- Parameters:
wsDocInfo- The WSDocInfo object to usedataRefURI- The URI of EncryptedData- Returns:
- The EncryptedData element
- Throws:
WSSecurityException- if the EncryptedData element referenced by dataRefURI is not found
-
decryptEncryptedData
public static WSDataRef decryptEncryptedData(Document doc, String dataRefURI, Element encData, SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler) throws WSSecurityException Decrypt the EncryptedData argument using a SecretKey.- Parameters:
doc- The (document) owner of EncryptedDatadataRefURI- The URI of EncryptedDataencData- The EncryptedData elementsymmetricKey- The SecretKey with which to decrypt EncryptedDatasymEncAlgo- The symmetric encryption algorithm to useattachmentCallbackHandler- The CallbackHandler from which to get attachments- Throws:
WSSecurityException
-
decryptEncryptedData
public static WSDataRef decryptEncryptedData(Document doc, String dataRefURI, Element encData, SecretKey symmetricKey, String symEncAlgo, CallbackHandler attachmentCallbackHandler, org.apache.xml.security.encryption.Serializer encryptionSerializer) throws WSSecurityException Decrypt the EncryptedData argument using a SecretKey.- Parameters:
doc- The (document) owner of EncryptedDatadataRefURI- The URI of EncryptedDataencData- The EncryptedData elementsymmetricKey- The SecretKey with which to decrypt EncryptedDatasymEncAlgo- The symmetric encryption algorithm to useattachmentCallbackHandler- The CallbackHandler from which to get attachments- Throws:
WSSecurityException
-
getCipherValueFromEncryptedData
-
getXOPURIFromCipherValue
-
getXPath
- Parameters:
decryptedNode- the decrypted node- Returns:
- a fully built xpath
(eg. "/soapenv:Envelope/soapenv:Body/ns:decryptedElement")
if the decryptedNode is an Element or an Attr node and is not detached
from the document.
nullotherwise
-
getDigestAlgorithm
- Throws:
WSSecurityException
-
getMGFAlgorithm
- Throws:
WSSecurityException
-
getPSource
- Throws:
WSSecurityException
-
getDecodedBase64EncodedData
Method getDecodedBase64EncodedData- Parameters:
element-- Returns:
- a byte array containing the decoded data
- Throws:
WSSecurityException
-