You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Jobbagy Peter <jo...@mail.datanet.hu> on 2003/08/06 20:50:35 UTC

XML encryption with key encryption

Hi people,

I used your package for xmldsig and it worked fine!
Now I using this for xml encryption (xmlenc).
I can encrypt/decrypt xml messages with the following methods:

Document cryptEN(Document doc,Key key)
  { try
    { EncryptedData enc=
        new EncryptedData(doc,
          EncryptionConstants.ALGO_ID_BLOCKCIPHER_TRIPLEDES,
          null,null,null,null);
      enc.encryptElementAndReplace(doc.getDocumentElement(),key);
    } catch (Exception e) { }
    return (doc);
  };

  Document cryptDE(Document doc,Key key)
  { try
    { EncryptedData enc=
        new EncryptedData(doc.getDocumentElement(),"");
      enc.decryptAndReplace(key);
    } catch (Exception e) { }
    return (doc);
  };

Now I want to extend the methods above to embed the encryption key (perhaps
with EncryptedKey class?)
with the method of "EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA1_5".
I tried it already but I couldn't find the exact way how to make it.
Can anybody help me? How is the EncryptionKey is related with the
EncryptionDocumet?

Thanks for all,
Peter


Re: XML encryption with key encryption

Posted by Berin Lautenbach <be...@ozemail.com.au>.
Jobbagy and others,

Am not clear where this EncryptedData comes from?  Is there something in 
the library over and above Axl's code?

Cheers,
	Berin

Jobbagy Peter wrote:
> Hi people,
> 
> I used your package for xmldsig and it worked fine!
> Now I using this for xml encryption (xmlenc).
> I can encrypt/decrypt xml messages with the following methods:
> 
> Document cryptEN(Document doc,Key key)
>   { try
>     { EncryptedData enc=
>         new EncryptedData(doc,
>           EncryptionConstants.ALGO_ID_BLOCKCIPHER_TRIPLEDES,
>           null,null,null,null);
>       enc.encryptElementAndReplace(doc.getDocumentElement(),key);
>     } catch (Exception e) { }
>     return (doc);
>   };
> 
>   Document cryptDE(Document doc,Key key)
>   { try
>     { EncryptedData enc=
>         new EncryptedData(doc.getDocumentElement(),"");
>       enc.decryptAndReplace(key);
>     } catch (Exception e) { }
>     return (doc);
>   };
> 
> Now I want to extend the methods above to embed the encryption key (perhaps
> with EncryptedKey class?)
> with the method of "EncryptionConstants.ALGO_ID_KEYTRANSPORT_RSA1_5".
> I tried it already but I couldn't find the exact way how to make it.
> Can anybody help me? How is the EncryptionKey is related with the
> EncryptionDocumet?
> 
> Thanks for all,
> Peter
> 
>