>       From: owner-openssl-us...@openssl.org On Behalf Of Panikulam Vivek
>       Sent: Monday, 20 September, 2010 10:52

>       I am using the below openssl command to encrypt a string using a 
> public key and get a binary output (symm_key_string_enc.txt). Is this 
> an example of assymetric encryption? 

Yes, a simple one. Actual crypto schemes need to tie together 
the recipient key identity in some form, the encrypted-DEK, 
usually an IV, and the encrypted data under it. The encrypted key 
*by itself* is not useful, and a mix-up of which keys to use 
when is worse than useless. Besides SSL see e.g. CMS PGP SMIME.

> and is there a way to get the output in a text/ASCII format?
         
>       openssl rsautl -encrypt -inkey pub_key.txt -pubin 
> -in symm_key_string.txt -out symm_key_string_enc.txt
         
Directly in rsautl, -hexdump displays in a form good for humans 
to read, but not particularly convenient for another program.

If you want the latter, base64 is the most common method 
but far from the only one. You can put the binary in a file 
as you did and then encode to base64 e.g.
  openssl base64 -e -in symmkey_enc -out symmkey_enc_b64.txt 
  # or less mnemonically
  openssl enc -a -e -in symmkey_enc -out symmkey_enc_b64.txt 

There are lots of other tools that can display, or convert, 
a binary file in various human-readable forms. Unix (and 
quasi-Unix like cygwin) has 'od' standard, and there are 
any number of 'progammer's editors' for many system types.

I think it's a poor idea to label files .txt if they aren't 
(at least) readable chars, and I hope your symmetric keys 
aren't; that would reduce your keyspace unnecessarily.



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to