<?xml version="1.0" standalone="yes"?> <Data> <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#"><EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" /> <CipherData> <CipherValue>ZW97bGRnZHljagIZZV0Ifq160IptZMvv</CipherValue> </CipherData> </EncryptedData> </Data>
NodeList list = doc.getElementsByTagName("EncryptedData"); Element node = (Element)list.item(0); String val = node.getNodeValue(); //create the decryption context DOMDecryptContext dctx = new DOMDecryptContext(keys, node); //unmarshal encrypted data EncryptedData encdata = (EncryptedData)fac.unmarshalEncryptedType(dctx); javax.crypto.spec.IvParameterSpec ivspec = new javax.crypto.spec.IvParameterSpec(ivbyte); javax.crypto.Cipher cipher = javax.crypto.Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(javax.crypto.Cipher.DECRYPT_MODE, keys, ivspec); byte[] bytes = encdata.getEncoding().getBytes(); byte[] decrypted = cipher.doFinal(node.); //Stuck here... No idea what to pass here String str = new String(decrypted);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)