<?xml version="1.0" encoding="UTF-8"?> <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Element"> <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" /> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate></ds:X509Certificate> </ds:X509Data> <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"> <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" /> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedKey> </ds:KeyInfo> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData>
<?xml version="1.0" encoding="UTF-8"?>
<Selos>
<Selo>
<CodigoSequencialUnico> </CodigoSequencialUnico>
<CodigoDeSeguranca> </CodigoDeSeguranca>
</Selo>
</Selos>
<?xml version="1.0" encoding="UTF-8"?> <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Element"> <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/> <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:X509Data> <ds:X509Certificate></ds:X509Certificate> </ds:X509Data> <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedKey> </ds:KeyInfo> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData>
public static Document descriptografarDocumentoXml(Document doc, Key rsaKey) throws Exception {
if (doc == null || rsaKey == null) {
return null;
}
if (!org.apache.xml.security.Init.isInitialized()) {
org.apache.xml.security.Init.init();
}
XMLCipher cipher = null;
cipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5);
Element ee = (Element) doc.getElementsByTagName("xenc:EncryptedData").item(0);
cipher = XMLCipher.getInstance(XMLCipher.AES_256);
cipher.init(XMLCipher.DECRYPT_MODE, null);
cipher.setKEK(rsaKey);
return cipher.doFinal(doc, ee);
}
Sistema Integrado de Apoio à Fiscalização dos Serviços Notariais e
de Registro
Portal do Desenvolvedor de Sistemas para
Serventias
Av. Afonso Pena, 4001 - Serra - 30.130-008 - Belo Horizonte - MG - Brasil - TEL.: (31) 3306-3100 - [ + Contatos ]
© Copyright 1997-, Tribunal de Justiça do Estado de Minas Gerais.