encrypt.sh 417 Bytes
Newer Older
ccarlos's avatar
ccarlos committed
1
2
#!/bin/bash

ccarlos's avatar
ccarlos committed
3
if [ ! -e slt2021_pub.pem ]
ccarlos's avatar
ccarlos committed
4
then
ccarlos's avatar
ccarlos committed
5
    echo "> Public key ./slt2021_pub.pem does not exist."
ccarlos's avatar
ccarlos committed
6
7
8
9
10
11
12
13
14
15
    exit 1
fi

notebookfile=$1

if [ ! -e "$notebookfile" ]
then
    echo "> Notebook file $notebookfile does not exist."
else
    openssl smime -encrypt -aes256 -in "$notebookfile" -binary -outform DEM \
ccarlos's avatar
ccarlos committed
16
        -out "$notebookfile.encr" slt2021_pub.pem
ccarlos's avatar
ccarlos committed
17
18
19
    
    echo "> File encrypted as $notebookfile.encr"
fi