support for non-proprietary secure encrypt&sign format?

Hi,

I want to embed data in my application which I have encrypted and signed using strong cryptography, so that the application can verify the data (assuming the application itself doesn't get changed).

Currently I construct three byte[] arrays:

1.) DESede encrypted data

2.) RSA encrypted DESede key

3.) Signature of unencrypted data using the

Signature signature = Signature.getInstance("SHA1withRSA")

signature.initSign(rsaPrivateKey)

signature.update(unencryptedData)

I turn each of these three byte[]s into Strings using Base64Coder and then concatenate them ":" separated.

While this works (I can decrypt and verify the data), the format in which I represent the encrypted and signed data (Base64 encoding and ":" separation) is not any widely used standard and also doesn't contain any metadata about the encryption algorithm used, as would e.g. a gnupg encrypted block.

So I was wondering, why is there no static method in the JCE that just says

String or byte[] encrypted = SomeClass.encryptAndSign(data, "RSAwithDESede")

or something like that, which then encrypts and signs the data according to some standard format? E.g. such that I could then decrypt and verify the data with PGP/GnuPG/OpenSSL/... ?

Is there any library that does this, and which preferrably provides a simple facade to the complexity of JCE?

Any help is appreciated - thanks in advance!

Tobias

[1486 byte] By [Kiwiguya] at [2007-11-27 4:32:16]
# 1

Other standards have addressed this problem. See XML Encryption (http://www.w3.org/Encryption/2001/) and XML Signature (http://www.w3.org/Signature/).

XML Signature is now a standard component of J2SE 6.0 (http://java.sun.com/javase/6/docs/technotes/guides/security/xmldsig/XMLDigitalSignature.html)

arshad.noora at 2007-7-12 9:41:53 > top of Java-index,Security,Cryptography...