201309090
This commit is contained in:
12
encryptFileByRSA.sh
Executable file
12
encryptFileByRSA.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
FILE=$1
|
||||
KEY=$2
|
||||
openssl rand 128 > key
|
||||
ssh-keygen -f $KEY -e -m PKCS8 > key.pub
|
||||
openssl rsautl -encrypt -inkey key.pub -pubin -in key -out key.enc
|
||||
openssl enc -aes-256-cbc -salt -in $FILE -out $FILE.enc -kfile key
|
||||
openssl base64 -in key.enc -out key.b64
|
||||
openssl base64 -in $FILE.enc -out $FILE.b64
|
||||
sha512sum key.b64 > key.b64.sha512
|
||||
sha512sum $FILE.b64 > $FILE.b64.sha512
|
||||
rm key key.enc key.pub $FILE $FILE.enc
|
||||
Reference in New Issue
Block a user