decrypt.sh 453 Bytes
Newer Older
ccarlos's avatar
ccarlos committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [ ! -e ~/.ssh/slt2020_prv.pem ]
then
    echo "> Private key ~/.ssh/slt2020_prv.pem does not exist."
    exit 1
fi

notebookfile=$1

if [ ! -e "$notebookfile" ]
then
    echo "> Notebook file $notebookfile does not exist."
else
    openssl smime -decrypt -aes256 -in "$notebookfile" -binary -inform DEM \
        -inkey ~/.ssh/slt2020_prv.pem -out "${notebookfile%'.encr'}"
    
    echo "> File decrypted as ${notebookfile%'.encr'}"
fi