harris
unread,Dec 16, 2008, 1:34:52 AM12/16/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to As3Crypto Discussion List
Hi there. I am trying to use AS3Crypto to decrypt information within
a Flex client that was encrypted using a private key. I have read in
the corresponding certificate within ActionScript and confirmed it is
being done correctly via:
var bytes:ByteArray = decoder.toByteArray();
var certificate:X509Certificate = new X509Certificate( bytes );
var commonName:String = certificate.getCommonName()
trace("common name: " + commonName );
However... when I try to use the public key associated with this
certificate I get an error:
var publicKey:RSAKey = certificate.getPublicKey();
var encryptedBytes:ByteArray = decoder.toByteArray();
var decryptedBytes:ByteArray = new ByteArray();
publicKey.decrypt( encryptedBytes, decryptedBytes,
encryptedBytes.length );
Calling the decrypt method throws an error; after looking at the
getPublicKey method of X509Certificate it is clear that the returned
RSAKey will never be able to perform decryption b/c the "D" parameter
is not populated.
Can someone give me a quick example of how to use the RSAKey.decrypt
method that is derived from an X509Certificate ? Is this possible?
Thanks,
~harris