先说结论: gpg 会自动判断文件大小如果文件体积过大,则生成一个 一次性密钥并用 rsa 加密,然后用一次性密钥跑 aes 加密整个大文件。故当需要用 gpg 加密文件的时候不需要考虑文件大小直接加密即可 #加密文件
➜ test time gpg -e 1.mp4 gpg2 -e 1.mp4 32.41s user 1.96s system 97% cpu 35.231 total
➜ test time gpg -o 1.mp4.aes -c 1.mp4 gpg2 -o 1.mp4.aes -c 1.mp4 33.13s user 1.74s system 88% cpu 39.578 total
➜ test time gpg -o 1.mp4.sig.asc -se 1.mp4
You need a passphrase to unlock the secret key for user: "Kevin Zheng [email protected]" 4096-bit RSA key, ID F2DDF43A, created 2016-12-31 (main key ID 76535990)
gpg2 -o 1.mp4.sig.asc -se 1.mp4 34.79s user 1.50s system 99% cpu 36.614 total
#解密文件
➜ test time gpg -o 1.aes.mp4 1.mp4.aes gpg: CAST5 encrypted data gpg: encrypted with 1 passphrase gpg: WARNING: message was not integrity protected gpg2 -o 1.aes.mp4 1.mp4.aes 19.04s user 1.38s system 99% cpu 20.615 total
➜ test time gpg -o 1.gpg.mp4 1.mp4.gpg
You need a passphrase to unlock the secret key for user: "Kevin Zheng [email protected]" 4096-bit RSA key, ID 814CBB13, created 2016-12-31 (main key ID 76535990)
gpg: encrypted with 4096-bit RSA key, ID 814CBB13, created 2016-12-31 "Kevin Zheng [email protected]" gpg2 -o 1.gpg.mp4 1.mp4.gpg 11.92s user 1.35s system 70% cpu 18.754 total
➜ test time gpg -o 1.gpg.sig.mp4 1.mp4.sig.asc
You need a passphrase to unlock the secret key for user: "Kevin Zheng [email protected]" 4096-bit RSA key, ID 814CBB13, created 2016-12-31 (main key ID 76535990)
gpg: encrypted with 4096-bit RSA key, ID 814CBB13, created 2016-12-31 "Kevin Zheng [email protected]" gpg: Signature made Sat Dec 31 21:06:25 2016 CST using RSA key ID F2DDF43A gpg: Good signature from "Kevin Zheng [email protected]" [ultimate] gpg2 -o 1.gpg.sig.mp4 1.mp4.sig.asc 7.18s user 1.34s system 97% cpu 8.714 total