| scclib
    Stable Cloud Computing C++ Library | 
Elliptic curve cryptography over Galois prime field GF(p) curve. More...
#include <ecc.h>
| Public Types | |
| enum class | Type { std_p192r1 , std_p224r1 , std_p256r1 , std_p384r1 , std_p521r1 , std_p256sm2 } | 
| Standard field type.  More... | |
| Public Member Functions | |
| EccGfp (Type type=Type::std_p256r1) | |
| void | reset (Type type) | 
| Reset the curve to a new standard type. | |
| bool | valid () const | 
| int | bit_width () const | 
| Elliptic curve ordinal bit width. | |
| void | generate_key_pair (Bignum &priv_key, EccGfpPoint &pub_key) | 
| Generate a private and public key pair for this curve.  More... | |
| void | private_key (Bignum &) | 
| Generate a private key.  More... | |
| void | public_key (const Bignum &, EccGfpPoint &) | 
| Generate a public key corresponding to a private key.  More... | |
| void | generate_public_key (const Bignum &, EccGfpPoint &) | 
| Generate a public key from the private key. | |
| Static Public Member Functions | |
| static bool | valid (const EccGfp &) | 
| Verify the curve.  More... | |
| static bool | validate_key_pair (const Bignum &, const EccGfpPoint &) | 
| Validate a key pair.  More... | |
| static void | sign_ecdsa (const void *, int, const EccGfp &, const scc::crypto::Bignum &, scc::crypto::Bignum &, scc::crypto::Bignum &, scc::crypto::Bignum &) | 
| Sign a message using ECDSA.  More... | |
| static void | sign_ecdsa (const void *loc, int len, const EccGfp::Type &t, const scc::crypto::Bignum &rk, scc::crypto::Bignum &tk, scc::crypto::Bignum &x, scc::crypto::Bignum &y) | 
| static bool | verify_ecdsa (const void *, int, const EccGfpPoint &, const scc::crypto::Bignum &, const scc::crypto::Bignum &) | 
| Verify a message using the ECDSA.  More... | |
| static void | dh_shared_secret (const scc::crypto::Bignum &, const EccGfpPoint &, scc::crypto::Bignum &) | 
| Calculate a shared secret using the Diffie-Hellman scheme.  More... | |
| Friends | |
| class | EccGfpPoint | 
Elliptic curve cryptography over Galois prime field GF(p) curve.
Uses standard fields only, does not allow custom parameters.
See https://www.secg.org/ for details on ec cryptography.
For X25519 and X448 (montgomery curves), see: https://tools.ietf.org/html/rfc7748
For security considerations, see: https://www.websecurity.digicert.com/content/dam/websitesecurity/digitalassets/desktop/pdfs/whitepaper/Elliptic_Curve_Cryptography_ECC_WP_en_us.pdf
Security level means the equivalent security strength to a symmetric key with the stated bit size. Use of algorithms with security below 128 bits is not recommended.
| 
 | strong | 
Standard field type.
| 
 | static | 
Calculate a shared secret using the Diffie-Hellman scheme.
| my_private | My private key. | 
| other_public | Other public key. | 
| shared_secret | Shared private key. | 
Given a private key and other parties public key on a curve, generate a shared secreet key (x coordinate on the curve), which will be the same for both parties.
| 
 | inline | 
| void scc::crypto::EccGfp::private_key | ( | Bignum & | ) | 
Generate a private key.
| priv_key | Private key on the elliptic curve | 
| void scc::crypto::EccGfp::public_key | ( | const Bignum & | , | 
| EccGfpPoint & | |||
| ) | 
Generate a public key corresponding to a private key.
| priv_key | Private key on the elliptic curve. | 
| pub_key | Public key point corresponding to the private key | 
| 
 | static | 
Sign a message using ECDSA.
A curve, temporary private and public key, and a regular private key should be provided.
The signature output is two coordinate points on the elliptic curve.
Generating a signature using ecdsa_secp256r1_sha256 (for example), is a two step process. First generate a hash of the data using sha256, then sign_ecdsa with the hash value.
| loc | Signing data buffer. | 
| len | Signing data size. Must be > 0. | 
| curve | Elliptical curve. | 
| reg_private | Regular private key derived from the curve. | 
| temp_private | Temporary (ephemeral) private key derived from the curve. Must be different than the regular key. | 
| sig_x | Signature X coordinate output. | 
| sig_y | Signature Y coordinate output. | 
| 
 | static | 
Verify the curve.
Failure means the curve parameters are invalid or insecure.
| 
 | static | 
Validate a key pair.
Both must be a key pair on the public key's elliptical curve.
| priv_key | Private key | 
| pub_key | Public key | 
Public key must be valid on the elliptic curve.
| 
 | static | 
Verify a message using the ECDSA.
| loc | Signing data buffer. | 
| len | Signing data size. Must be > 0. | 
| reg_public | Regular public key corresponding to the regular private key used to sign. | 
| sig_x | Signature X coordinate. | 
| sig_y | Signature Y coordinate. | 
Uses the curve associated with the point.