… | |
… | |
38 | |
38 | |
39 | # verify, but croak on failure |
39 | # verify, but croak on failure |
40 | Crypt::Ed25519:eddsa_verify_croak $message, $pubkey, $signature; |
40 | Crypt::Ed25519:eddsa_verify_croak $message, $pubkey, $signature; |
41 | |
41 | |
42 | ############################################ |
42 | ############################################ |
43 | # Key exchange |
43 | # Curve25519 key exchange |
44 | |
44 | |
45 | # side A: |
45 | # side A: |
46 | ($pubkey_a, $privkey_a) = Crypt::Ed25519::generate_keypair; |
46 | ($pubkey_a, $privkey_a) = Crypt::Ed25519::generate_keypair; |
47 | # send $pubkey to side B |
47 | # send $pubkey to side B |
48 | |
48 | |
… | |
… | |
206 | derive the public key as needed. On the other hand, signing using the |
206 | derive the public key as needed. On the other hand, signing using the |
207 | private key is faster than using the secret key, so converting the secret |
207 | private key is faster than using the secret key, so converting the secret |
208 | key to a public/private key pair allows you to sign a small message, or |
208 | key to a public/private key pair allows you to sign a small message, or |
209 | many messages, faster. |
209 | many messages, faster. |
210 | |
210 | |
211 | =head1 Key Exchange |
211 | =head1 Curve25519 Key Exchange |
212 | |
212 | |
213 | As an extension to Ed25519, this module implements a key exchange similar |
213 | As an extension to Ed25519, this module implements a key exchange similar |
214 | to Curve25519, which should be compatible to other implementations of |
214 | to Curve25519, which should be compatible to other implementations of |
215 | Curv25519, depending on how the resulting shared secret is hashed. |
215 | Curv25519, depending on how the resulting shared secret is hashed. |
216 | |
216 | |