This article explains how to encrypt large files with OpenSSL and Public/Private keys.
Step 0) Get Private and Public Key
For Windows
Create Private Key:
openssl genrsa -aes256 -out privatekey.pem 8912
Create Public Key:
openssl rsa -in privatekey.pem -pubout -out publickey.pem
For Linux
Create Private Key:
openssl genrsa -aes256 -out privatekey.pem 8912
Create Public Key:
openssl req -x509 -nodes -days 100000 -newkey rsa:2048 -keyout privatekey.pem -out publickey.pem
Step 1) Create Certificate for Windows Only
openssl req -x509 -nodes -days 100000 -newkey rsa:8912 -keyout privatekey.pem -config "C:\Users\USERPC\AppData\Local\VirtualStore\Program Files\GnuWin32\bin\openssl.cnf" -out certificate.pemStep 2) Encrypt our large file
For Windowsopenssl smime -encrypt -binary -aes256 -in test.zip -out testenc.zip -outform PEM certificate.pem
For Linux
openssl smime -encrypt -aes256 -in test.zip -binary -outform DEM -out testenc.zip publickey.pem
Step 3) Decrypt our large file
For Windowsopenssl smime -decrypt -binary -in testenc.zip -inform PEM -out decrypted.zip -inkey privatekey.pem
For Linux
openssl smime -decrypt -in testenc.zip -binary -inform DEM -inkey privatekey.pem -out decrypted.zip
0 Comments