class
Ruby latest stable (v2_5_5)
-
0 notes
- Superclass:
cPKey
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (38)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
OpenSSL::PKey::EC provides access to Elliptic Curve Digital Signature Algorithm (ECDSA) and Elliptic Curve Diffie-Hellman (ECDH).
Key exchange
ec1 = OpenSSL::PKey::EC.generate("prime256v1") ec2 = OpenSSL::PKey::EC.generate("prime256v1") # ec1 and ec2 have own private key respectively shared_key1 = ec1.dh_compute_key(ec2.public_key) shared_key2 = ec2.dh_compute_key(ec1.public_key) p shared_key1 == shared_key2 #=> true
Constants
EXPLICIT_CURVE = INT2NUM(OPENSSL_EC_EXPLICIT_CURVE)
NAMED_CURVE = INT2NUM(OPENSSL_EC_NAMED_CURVE)