Skip to content

Public/private key encryption/decryption demo using the RSA cryptosystem.

License

Notifications You must be signed in to change notification settings

wrzlbrmft/ppcrypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ppcrypt

Build Status

Public/private key encryption/decryption demo using the RSA cryptosystem.

Build Instructions

Requirements

To build, run:

mvn package

The ppcrypt.jar file will be stored in the target directory.

Usage

Run:

java -jar ppcrypt.jar

Append -h or --help to get a list of all available options:

java -jar ppcrypt.jar -h

All available options are:

 -d,--decrypt
 -e,--encrypt
 -h,--help            print this help message and exit
 -i,--input <file>    input file
 -k,--key <file>      public-/private-key file for encryption/decryption
 -o,--output <file>   output file
 -v,--version         print version info and exit

Generate RSA Key-pair

To generate a 1024-bit RSA key-pair, run:

openssl genrsa -out private.pem 1024
openssl pkcs8 -topk8 -inform PEM -outform DER -in private.pem -out private.der -nocrypt
openssl rsa -in private.pem -pubout -outform DER -out public.der

The public-key will be stored in public.der, the private-key in private.der.

Encrypt

To encrypt a message stored in message.txt into secret.txt using the public-key, run:

java -jar ppcrypt.jar --encrypt --key public.der --input message.txt --output secret.txt

or short:

java -jar ppcrypt.jar -e -k public.der -i message.txt -o secret.txt

Decrypt

To decrypt a secret stored in secret.txt back to revealed.txt using the private-key, run:

java -jar ppcrypt.jar --decrypt --key private.der --input secret.txt --output revealed.txt

or short:

java -jar ppcrypt.jar -d -k private.der -i secret.txt -o revealed.txt

License

This software is distributed under the terms of the GNU General Public License v3.

About

Public/private key encryption/decryption demo using the RSA cryptosystem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages