forked from abumq/ripe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interoperability.sh
executable file
·50 lines (34 loc) · 1.66 KB
/
interoperability.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
if [ "$RIPE" = "" ];then
RIPE=ripe
fi
#################################################=- KEY USING RIPE -=###################################################
# Generate keys with $RIPE
$RIPE -g --rsa --out-private private.pem --out-public public.pem
# Fix public key with openssl-cli (don't need this anymore)
# openssl rsa -in private.pem -pubout -out public.pem
# Encrypt using openssl-cli (Always 256 bytes)
echo 'plain text' | openssl rsautl -encrypt -pubin -inkey public.pem > /tmp/e.enc
# Decrypt using $RIPE
cat /tmp/e.enc | $RIPE -d --rsa --in-key private.pem
# Encrypt using $RIPE
echo 'plain text' | $RIPE -e --rsa --in-key public.pem --out /tmp/e.enc
# Decrypt using openssl-cli
cat /tmp/e.enc | $RIPE -d --base64 | openssl rsautl -decrypt -inkey private.pem
# Decrypt using $RIPE
cat /tmp/e.enc | $RIPE -d --rsa --in-key private.pem --base64
#################################################=- KEY USING OPENSSL -=###################################################
# Generate key pair with openssl-cli
openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem
# Encrypt using openssl-cli (Always 256 bytes)
echo 'plain text' | openssl rsautl -encrypt -pubin -inkey public.pem > /tmp/e.enc
# Decrypt using $RIPE
cat /tmp/e.enc | $RIPE -d --rsa --in-key private.pem
# Decrypt using openssl-cli
cat /tmp/e.enc | openssl rsautl -decrypt -inkey private.pem
# Encrypt using $RIPE
echo 'plain text' | $RIPE -e --rsa --in-key public.pem --out /tmp/e.enc
# Decrypt using openssl-cli
cat /tmp/e.enc | $RIPE -d --base64 | openssl rsautl -decrypt -inkey private.pem
# Decrypt using $RIPE
cat /tmp/e.enc | $RIPE -d --rsa --in-key private.pem --base64