Hi, I was wondering if anyone knew how to:
* Generate asymmetrical key pairs using openssl.
* Encrypt data using the public key, and then decrypt it using the
private key.. using openssl.
So far, all that I can do is get it to create a private key, then
generate a public key from that using:
[99]mike@loki~:~/ssl~>openssl genrsa > prv.key
warning, not much extra random data, consider using the -rand option
Generating RSA private key, 512 bit long modulus
........++++++++++++
...++++++++++++
e is 65537 (0x10001)
[100]mike@loki~:~/ssl~>openssl rsa -in prv.key -out pub.key -pubout
read RSA key
writing RSA key
Then I use the des encryption cipher to encrypt a file called 'msg' like
so (using my public key):
[111]mike@loki~:~/ssl~>openssl des -in msg -out msg.enc -k pub.key -e
But when I go to unencrypt it using my private key, I get the following:
[114]mike@loki~:~/ssl~>openssl des -in msg.enc -out msg.dec -k prv.key -d
bad decrypt
3147:error:06065064:digital envelope routines:EVP_DecryptFinal:bad
decrypt:evp_enc.c:277:
I'm certain I'm doing something horribly wrong here, and perhaps you can't
even do what I'm trying to do with openssl, but if anyone here could lend
me a hand on this, I'd be much appreciative. Thanks in advance.
________________________________________________________________________
Mike Barrett |
[EMAIL PROTECTED] |
www.daboyz.org |
------------------------+-----------------------------------------------
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]