Hi,

I'm trying to make an application encypting data on the server side using a public key and decrypting it on the client side using the related private key. Now i've run in two problems: I have a private key and a related certificate file created from a certificate request (CSR) and signed by an own CA. Both are created using OpenSSL. The first problem is that I can't get the public key out of the cerificate using PEM_read_RSA_PUBKEY. I've exported the public key alone to a single file, from that I can load the public key. Trying to load it from the certificate gives an "no starting line" error. Second, and maybe even worse, when encrypting data with the public key using RSA_public_encrypt and again decrypting it with the private one using RSA_private_decrypt, the decrypted data differs widely from the original data. When I try the same using OpenSSL's rsautl command-line tool, it works perfectly with this key pair (public key/private key as well as certificate/private key). Both keys and certificate are in PEM format. The certificates signature is valid.
Could anyone give me some hint what might be going on here?

Thanks and regards
Till Elsner
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to