santuario-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Butler <>
Subject XMLCipher loadEncryptedKey error
Date Fri, 14 Dec 2007 07:39:23 GMT
Hi all,

I tried to use XMLCipher to load a EncryptedKey element into EncryptedKey

<xenc:EncryptedKey xmlns:xenc="" Id="KEK"
  <xenc:EncryptionMethod Algorithm=""
  <ds:KeyInfo xmlns:ds="">


    <xenc:DataReference URI="#ED"></xenc:DataReference>

It's ok to load, however, when I try to call the getRecipient() function, it
return null.
After I traced the program, I found the problem is caused by the following
code in XMLCipher.newEncryptedKey(ELement) function:

        try {
            result.setId (element.getAttributeNS(
                    null, EncryptionConstants._ATT_ID));
            result.setType(new URI(
                        null, EncryptionConstants._ATT_TYPE)).toString());
                    null, EncryptionConstants._ATT_MIMETYPE));
            result.setEncoding(new URI(
                        null, Constants._ATT_ENCODING)).toString());
            result.setRecipient (element.getAttributeNS(
                    null, EncryptionConstants._ATT_RECIPIENT));
        } catch (URI.MalformedURIException mfue) {
            // do nothing

The problem is caused by calling new URI() of _ATT_TYPE & _ATT_ENCODING and
these 2 parameters are not required for EncryptedKey.
it throws MalformedURIException so the recipient is never been set.

sorry for my poor english.


View raw message