Elliptic Curve Cryptography
From Crypto++ Wiki
Elliptic Curve Cryptography (ECC) is based on the algebraic structure of elliptic curves over finite fields. The use of elliptic curves in cryptography was independently suggested by Neal Koblitz and Victor Miller in 1985. Certicom holds a majority of patents in the Elliptic Curve Cryptography arena.
From a high level, Crypto++ offers a numbers of schemes and alogrithms which operate over elliptic curves. Fields include both Fp and F2m. The systems include:
- Elliptic Curve Diffie-Hellman Key Agreement (ECDH)
- Elliptic Curve Menezes-Qu-Vanstone Key Agreement (ECMQV)
- Elliptic Curve Integrated Encryption Scheme (ECIES)
- Elliptic Curve Digital Signature Algorithm (ECDSA)
- Elliptic Curve Nyberg Rueppel Signature Scheme (ECNR)
Minimizing Key Size for Persistence
Taking from Wei Dai on the Crypto++ mailing list:
To minimize the size of public and private keys, what you need to do is encode only the private exponent of the private key, and the public point of the public key.
// save private exponent
PrivateKey.GetPrivateExponent().DEREncode(privFile);
// load private exponent
Integer x;
x.BERDecode(privFile);
PrivateKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp160k1());
PrivateKey.SetPrivateExponent(x);
// save public element
PublicKey.GetGroupParameters().GetCurve().EncodePoint(pubFile,
PublicKey.GetPublicElement(), true);
// load public element
ECP::Point p;
PublicKey.AccessGroupParameters().Initialize(CryptoPP::ASN1::secp160k1());
PublicKey.GetGroupParameters().GetCurve().DecodePoint(p, pubFile,
PublicKey.GetGroupParameters().GetCurve().EncodedPointSize(true));
PublicKey.SetPublicElement(p);
Downloads
DPVal.zip - Elliptic Curve Domain Parameter Validation. The program dumps the Public and Private keys, and validates the curve per Certicom's SEC 2 Whitepaper. The curve used for demonstartion purposes is NIST P-112. In addition, it demonstrates mathematics with the Point of Infinity and Scalar Multiplications using Crypto++.
ECCTest.zip - Exercises encryption and decryption using ANSI and NIST curves by way of #define - 5.8Kb
ECDSA-Test.zip - Crypto++ ECDSA sample program - 7KB
