1

I am looking for a very simple easy-to-use stand-alone command-line .exe file for DOS which can do the following three things:

  1. Generate a very secure public-secret key pair.

  2. Encrypt a text string with the public key.

  3. Decrypt the text string with the secret key.

Does anyone here know of such a utility?

1

The most well known for public private key encryption is OpenSSL. You can download it here.

OpenSSL is a software library for applications that secure communications over computer networks against eavesdropping or need to identify the party at the other end. It is widely used by Internet servers, including the majority of HTTPS websites.


  1. Generate a public and private RSA key pair

    # openssl genrsa -aes256 -out private.key 2048
    
    # openssl rsa -in private.key -pubout -out public.key
    
  2. Encrypt

    # openssl rsautl -encrypt -pubin -inkey public.key -in plaintext.txt -out encrypted.txt
    
  3. Decrypt

    # openssl rsautl -decrypt -inkey private.key -in encrypted.txt -out plaintext.txt
    

I have tested this tutorial myself (on a mac, but the tooling is a direct port) and it worked. Here is the output to verify:

enter image description here

  • Hi Thomas, Thank you very much. I will try it out. – tim.tub May 29 at 10:11
  • I typed "openssl genrsa -aes256 -out private.key 8912" but it created a zero-byte private key. Does anyone know why? – tim.tub May 29 at 10:37
  • Probably because I took the example from a bad source, please try openssl genrsa -aes256 -out private.key 2048 8912 is a really weird numbits to use – Thomas May 29 at 11:43
  • Thank you Thomas. I actually tried again with 8912 a couple of times and it worked. The first time when it did not work must have been some weird glitch. What do you think? Do you think that using 2048 is more reliable? – tim.tub May 29 at 12:10
  • No, it's the size of the private key and bigger is probably better. But 2048 is enough – Thomas May 29 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.