Created
April 30, 2023 08:49
-
-
Save ryu1/84bfd0b144b601156004552ee3f97769 to your computer and use it in GitHub Desktop.
Big file encryption
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 秘密鍵を作成する(パスフレーズ有り) | |
openssl genrsa -aes256 4096 > private.key | |
# X.509 証明書生成 (自己署名証明書) | |
openssl req -new -x509 -key private.key -out cert.pem -days 36500 -subj /CN="sample" | |
# 証明書情報の確認 | |
openssl x509 -noout -subject -dates -in cert.pem | |
# 暗号化 | |
openssl smime \ | |
-encrypt \ | |
-binary \ | |
-aes-256-cbc \ | |
-in largefile.bin \ | |
-out largefile.bin.encrypted \ | |
-outform DER \ | |
cert.pem | |
# 復号化 | |
openssl smime \ | |
-decrypt \ | |
-in largefile.bin.encrypted \ | |
-binary \ | |
-inform DER \ | |
-inkey private.key \ | |
-out largefile.bin.dat.decrypted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment