santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andi00 <andreas.sch...@hs-furtwangen.de>
Subject Decryption Fail
Date Fri, 04 Jan 2013 18:07:06 GMT
Hi,
i have a problem with the decription and i hope someone can help.

I want to decrypt following xml file:
<?xml version = "1.0" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
  <soapenv:Header>
    <wsse:Security
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                   soapenv:mustUnderstand="1">
      <xenc:EncryptedKey Id="EncKeyId-26E69448E326611862135732149116720">
        <xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5" />
        <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <wsse:SecurityTokenReference>
            <ds:X509Data>
              <ds:X509IssuerSerial>
                <ds:X509IssuerName>CN=Sample
Client,OU=Rampart,O=Apache,L=Colombo,ST=Western,C=LK</ds:X509IssuerName>
                <ds:X509SerialNumber>1261391591</ds:X509SerialNumber>
              </ds:X509IssuerSerial>
            </ds:X509Data>
          </wsse:SecurityTokenReference>
        </ds:KeyInfo>
        <xenc:CipherData>
         
<xenc:CipherValue>P6bo3Aa2IWQy96j2NDQKy+lxpD8kNxg2h1tI9ZxoNd0yPAHFNggZJjyfBxM8MBKT8SE6r525pSjUC3YRbTsDyXwLn7/726yyQ1zr9WoparByLQNSSyGNAwfcxbVRHMifG09RdOlYVPZFWTxzk3i3s+OUfFwBE+ryF62QYHwrjNs=</xenc:CipherValue>
        </xenc:CipherData>
        <xenc:ReferenceList>
          <xenc:DataReference URI="#EncDataId-20" />
        </xenc:ReferenceList>
      </xenc:EncryptedKey>
      <wsse11:SignatureConfirmation
xmlns:wsse11="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd"
                                   
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                                    wsu:Id="SigConf-19" />
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <xenc:EncryptedData Id="EncDataId-20"
                        Type="http://www.w3.org/2001/04/xmlenc#Content">
      <xenc:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc" />
      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <wsse:SecurityTokenReference
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
          <wsse:Reference URI="#EncKeyId-26E69448E326611862135732149116720"
/>
        </wsse:SecurityTokenReference>
      </ds:KeyInfo>
      <xenc:CipherData>
       
<xenc:CipherValue>tuYeiT3qOuwcheLnh43RmTEGMKr4gE1QgAEohROfAs1rGfuVGEQfgjLSw8LzlQlEXaYPfchMR+te
k211oS8unIs51y8R8AYqLBuidBI6yn62UT71G7f+2GZu+DG5J2uKhrs7bm0pSWWiPdPe3anzUeCv
bZwYriR+HdXstNZeh0fJfTGyG1bXD35i66rgS+WUhy7UAwAeLH0tXUb3fjkK/nK18Dpy3zNuAm2r
v2TTS6NWs3pugn2cFEbyjcbT8YTBNqeQO8LqH6woCMeZ9861441hXW7L2L7yHmwRacGwQuR1N6oQ
WHZbgMfCov1YdZAjVDa+4KLfetXnLCU6UEsMnw==</xenc:CipherValue>
      </xenc:CipherData>
    </xenc:EncryptedData>
  </soapenv:Body>
</soapenv:Envelope>


My decryption function looks like:
public void decrypte(InputStream in) throws Exception {
        Document doc = SoapHeader.loadDocument(in);

        Element encryptedDataElement =
            (Element) doc.getElementsByTagNameNS(
                EncryptionConstants.EncryptionSpecNS,
                EncryptionConstants._TAG_ENCRYPTEDDATA).item(0);
       
        Key kek = loadKeyEncryptionKey();

        XMLCipher xmlCipher = XMLCipher.getInstance();
        xmlCipher.init(XMLCipher.DECRYPT_MODE, null);
        xmlCipher.setKEK(kek);
        xmlCipher.doFinal(doc, encryptedDataElement);
    }

But if i try it i get the exception "No Key Encryption Key loaded and cannot
determine using key resolvers".

I hope someone can help me.



--
View this message in context: http://apache-xml.6118.n7.nabble.com/Decryption-Fail-tp39619.html
Sent from the Apache XML - Security - Dev mailing list archive at Nabble.com.

Mime
View raw message