]>
git.scottworley.com Git - overonion/blob - overonion
a33351a7ece4153b72b765c204c01ac66c37f975
9 die
"usage: overonion e|d keyfile"
12 if [[ "$mode" != e
&& "$mode" != d
]];then
13 die
"Use 'e' for encrypt or 'd' for decrypt"
16 if [[ ! -e "$keyfile" ]];then
17 die
"Keyfile not found"
19 if [[ ! -r "$keyfile" ]];then
20 die
"Cannot read keyfile"
23 num_layers
=$(wc -l < "$keyfile")
24 if (( num_layers
< 20 ));then
25 die
"Keyfile doesn't have enough layers to be an onion"
28 if [[ "$mode" == e
]];then
29 first_layer
=$num_layers
40 if (( layer
== 0 || layer
> num_layers
));then
43 openssl enc
$openssl_decrypt "-$(sed -n "${layer}s/ .*//p" "$keyfile")" \
44 -pass fd
:37 37< <(sed -n "${layer}s/^[^ ]* //p" "$keyfile") |
45 go
$(( layer + next_layer ))