Pure ElGamal Cryptosystem
ElGamal Parameters Generation
edgetk -pkey setup -algorithm elgamal -bits 1024
ElGamal parameters generated successfully:
-----BEGIN ELGAMAL PARAMETERS-----
KH8DAQENRWxHYW1hbFBhcmFtcwH/gAABAgEBUAH/ggABAUcB/4IAAAAK/4EFAQL/
hAAAAP4BC/+AAf+BAqk1Q2UDGnHM7ftTMoSgrTXyImPAsLAybSrztPeT4wB+pxWD
yuChaXetRnyfa++N5GgaRrs4NO1Rwzt9nMf/2gBfXG87szm0Zz7qDPNXkhEcGdA6
UfsRZxTG0aE2hfMtCgPFUwIOZWnXAuBUVHTcXwZOGVjmMrkY3a8WguWusUfvAf+B
AjkRsUSVejL3g9RRY3oGCL0BzKMS/T8CogZgAZRaM4cK243ej87uk644JBzA8RIU
yNk+rZXxqkyUaTyuy2vVMghJZIdg91Ma2ZwWX87dJUm3g6dsxid9HLE1j7zTsbZt
zL5S+wMoAlf9aZiBUY/Bhxcp1IJvURNPHZ82syspLgocAA==
-----END ELGAMAL PARAMETERS-----
ElGamal Parameters Details
edgetk -pkey text -params Params.pem
ElGamal parameters details:
-----BEGIN ELGAMAL PARAMETERS-----
KH8DAQENRWxHYW1hbFBhcmFtcwH/gAABAgEBUAH/ggABAUcB/4IAAAAK/4EFAQL/
hAAAAP4BC/+AAf+BAqk1Q2UDGnHM7ftTMoSgrTXyImPAsLAybSrztPeT4wB+pxWD
yuChaXetRnyfa++N5GgaRrs4NO1Rwzt9nMf/2gBfXG87szm0Zz7qDPNXkhEcGdA6
UfsRZxTG0aE2hfMtCgPFUwIOZWnXAuBUVHTcXwZOGVjmMrkY3a8WguWusUfvAf+B
AjkRsUSVejL3g9RRY3oGCL0BzKMS/T8CogZgAZRaM4cK243ej87uk644JBzA8RIU
yNk+rZXxqkyUaTyuy2vVMghJZIdg91Ma2ZwWX87dJUm3g6dsxid9HLE1j7zTsbZt
zL5S+wMoAlf9aZiBUY/Bhxcp1IJvURNPHZ82syspLgocAA==
-----END ELGAMAL PARAMETERS-----ElGamal Parameters:
Prime(p):
a9:35:43:65:03:1a:71:cc:ed:fb:53:32:84:a0:ad:
35:f2:22:63:c0:b0:b0:32:6d:2a:f3:b4:f7:93:e3:
00:7e:a7:15:83:ca:e0:a1:69:77:ad:46:7c:9f:6b:
ef:8d:e4:68:1a:46:bb:38:34:ed:51:c3:3b:7d:9c:
c7:ff:da:00:5f:5c:6f:3b:b3:39:b4:67:3e:ea:0c:
f3:57:92:11:1c:19:d0:3a:51:fb:11:67:14:c6:d1:
a1:36:85:f3:2d:0a:03:c5:53:02:0e:65:69:d7:02:
e0:54:54:74:dc:5f:06:4e:19:58:e6:32:b9:18:dd:
af:16:82:e5:ae:b1:47:ef
Generator(g):
39:11:b1:44:95:7a:32:f7:83:d4:51:63:7a:06:08:
bd:01:cc:a3:12:fd:3f:02:a2:06:60:01:94:5a:33:
87:0a:db:8d:de:8f:ce:ee:93:ae:38:24:1c:c0:f1:
12:14:c8:d9:3e:ad:95:f1:aa:4c:94:69:3c:ae:cb:
6b:d5:32:08:49:64:87:60:f7:53:1a:d9:9c:16:5f:
ce:dd:25:49:b7:83:a7:6c:c6:27:7d:1c:b1:35:8f:
bc:d3:b1:b6:6d:cc:be:52:fb:03:28:02:57:fd:69:
98:81:51:8f:c1:87:17:29:d4:82:6f:51:13:4f:1d:
9f:36:b3:2b:29:2e:0a:1c
ElGamal Key Pair Generation
edgetk -pkey keygen -algorithm elgamal -params Params.pem -prv "Private.pem" -pass nil -pub "Public.pem" 2>&1
ElGamal key pair generated successfully:
Private Key saved to: albanese.atwebpages.com/directrix/Private.pem
Public Key saved to: albanese.atwebpages.com/directrix/Public.pem
Fingerprint: IWlU844WI3Trv0kVJ9xvvy0/zgdIr3S23v+Pb/A/RPs=
ElGamal (1024-bits)
+-----------------+
| oXX^^^^^^^^^^^|
| oo%*^^E^^^^^^^|
| +.o.OBO^^^^^^^^|
| + *.= +@%B/&^^^^|
| O o o+So@o%&/^@|
| = . . . * +oB*.o|
| o *..o |
| . . o |
| |
+-----------------+
Private Key Details
edgetk -pkey text -key "Private.pem"
Error displaying private key:
Public Key Details
edgetk -pkey text -key "Public.pem"
Public key details:
-----BEGIN ELGAMAL PUBLIC KEY-----
MIIBBwKBgQCpNUNlAxpxzO37UzKEoK018iJjwLCwMm0q87T3k+MAfqcVg8rgoWl3
rUZ8n2vvjeRoGka7ODTtUcM7fZzH/9oAX1xvO7M5tGc+6gzzV5IRHBnQOlH7EWcU
xtGhNoXzLQoDxVMCDmVp1wLgVFR03F8GThlY5jK5GN2vFoLlrrFH7wKBgDkRsUSV
ejL3g9RRY3oGCL0BzKMS/T8CogZgAZRaM4cK243ej87uk644JBzA8RIUyNk+rZXx
qkyUaTyuy2vVMghJZIdg91Ma2ZwWX87dJUm3g6dsxid9HLE1j7zTsbZtzL5S+wMo
Alf9aZiBUY/Bhxcp1IJvURNPHZ82syspLgocVrbK2mLC7KAvfp4f7eID4XoOsJne
biPuCDwuA8qZVyP8nZiJWwayIYZkrfvr2Dc+9gTqGUFnaBEyMPCmfbcB8e8xi8q9
JdV0qFjjl1Nkn5uH1XVjF9oq8WXyKDL+VnSisOti78rTVwnmCtMgpTJ0HE0yi4hd
y/9fqbM7i2USd/A=
-----END ELGAMAL PUBLIC KEY-----
Public Key Parameters:
Prime(p):
a9:35:43:65:03:1a:71:cc:ed:fb:53:32:84:a0:ad:
35:f2:22:63:c0:b0:b0:32:6d:2a:f3:b4:f7:93:e3:
00:7e:a7:15:83:ca:e0:a1:69:77:ad:46:7c:9f:6b:
ef:8d:e4:68:1a:46:bb:38:34:ed:51:c3:3b:7d:9c:
c7:ff:da:00:5f:5c:6f:3b:b3:39:b4:67:3e:ea:0c:
f3:57:92:11:1c:19:d0:3a:51:fb:11:67:14:c6:d1:
a1:36:85:f3:2d:0a:03:c5:53:02:0e:65:69:d7:02:
e0:54:54:74:dc:5f:06:4e:19:58:e6:32:b9:18:dd:
af:16:82:e5:ae:b1:47:ef
Generator(g):
39:11:b1:44:95:7a:32:f7:83:d4:51:63:7a:06:08:
bd:01:cc:a3:12:fd:3f:02:a2:06:60:01:94:5a:33:
87:0a:db:8d:de:8f:ce:ee:93:ae:38:24:1c:c0:f1:
12:14:c8:d9:3e:ad:95:f1:aa:4c:94:69:3c:ae:cb:
6b:d5:32:08:49:64:87:60:f7:53:1a:d9:9c:16:5f:
ce:dd:25:49:b7:83:a7:6c:c6:27:7d:1c:b1:35:8f:
bc:d3:b1:b6:6d:cc:be:52:fb:03:28:02:57:fd:69:
98:81:51:8f:c1:87:17:29:d4:82:6f:51:13:4f:1d:
9f:36:b3:2b:29:2e:0a:1c
PublicKey(Y):
56:b6:ca:da:62:c2:ec:a0:2f:7e:9e:1f:ed:e2:03:
e1:7a:0e:b0:99:de:6e:23:ee:08:3c:2e:03:ca:99:
57:23:fc:9d:98:89:5b:06:b2:21:86:64:ad:fb:eb:
d8:37:3e:f6:04:ea:19:41:67:68:11:32:30:f0:a6:
7d:b7:01:f1:ef:31:8b:ca:bd:25:d5:74:a8:58:e3:
97:53:64:9f:9b:87:d5:75:63:17:da:2a:f1:65:f2:
28:32:fe:56:74:a2:b0:eb:62:ef:ca:d3:57:09:e6:
0a:d3:20:a5:32:74:1c:4d:32:8b:88:5d:cb:ff:5f:
a9:b3:3b:8b:65:12:77:f0
Digital Signature Generation
edgetk -pkey sign -algorithm elgamal -key "Private.pem" -md bmw256 "test.txt" > sign.txt
Error generating digital signature:
Digital Signature Verification
edgetk -pkey verify -algorithm elgamal -key "Public.pem" -signature "" -md bmw256 "test.txt"
Error verifying digital signature:
Verified: false
Shared Key Negotiation
edgetk -pkey wrapkey -algorithm elgamal -key "Public.pem" -bits 256
Ciphertext (Wrapped key) generated:
Cipher= 308201070281810089c419cc3f214031283ac49e6c9308c191e5d845be92e319f8e805b26d51d5dcb0920ae346ce98d46e76d29472092f4006d245f8ff9d0a52d7ca87584d5857ca5c093fb959b503f984cbcb3017c96dbf03245948257cef8a7b853c2020bbdb6b9ae4460fffacc715317ee3aacd6975702ffcfe01bdc711e7732663b0e764ff3f028180783fca48ec6c90133950c6ea4ecda603becdd7a8f08b60b18b18941f2708d143b07946e03b11a6aaf81c173265aa14a7482da1f4c8cdfc79cebdbbb4c110941b833e32301d9ed18085b9cb169c3e94a2ee983d46a6a061556176965e554e30363c9b57da1f65bbe7faca6c4c0328d710c1560080c48ad7176f10a10422220eec
Shared= be61db4549f5f78b11233dd739b55e286b671d38ef7d0abbbcfb524844ca5b79
Unwrapping the Ciphertext
edgetk -pkey unwrapkey -algorithm elgamal -key "Private.pem" -cipher 308201070281810089c419cc3f214031283ac49e6c9308c191e5d845be92e319f8e805b26d51d5dcb0920ae346ce98d46e76d29472092f4006d245f8ff9d0a52d7ca87584d5857ca5c093fb959b503f984cbcb3017c96dbf03245948257cef8a7b853c2020bbdb6b9ae4460fffacc715317ee3aacd6975702ffcfe01bdc711e7732663b0e764ff3f028180783fca48ec6c90133950c6ea4ecda603becdd7a8f08b60b18b18941f2708d143b07946e03b11a6aaf81c173265aa14a7482da1f4c8cdfc79cebdbbb4c110941b833e32301d9ed18085b9cb169c3e94a2ee983d46a6a061556176965e554e30363c9b57da1f65bbe7faca6c4c0328d710c1560080c48ad7176f10a10422220eec
Error decrypting shared key:
Warning: unlink(Private.pem) [function.unlink]: No such file or directory in /srv/disk4/2366897/www/albanese.atwebpages.com/directrix/ElGamal.php on line 190