plebble
us::gov::crypto::ec Class Reference

#include <ec.h>

Collaboration diagram for us::gov::crypto::ec:

Classes

struct  keys
 

Public Types

typedef secp256k1_ecdsa_signature signature
 
typedef sha256 sigmsg_hasher_t
 
typedef vector< unsigned char > sig_t
 

Public Member Functions

 ec ()
 
 ec (const ec &)=delete
 
ecoperator= (const ec &)=delete
 
 ~ec ()
 
ko sign (const keys::priv_t &pk, const string &text, sig_t &signature) const
 
ko sign (const keys::priv_t &pk, const vector< unsigned char > &msg, sig_t &signature) const
 
ko sign (const keys::priv_t &pk, const sigmsg_hasher_t::value_type &, sig_t &signature) const
 
bool verify (const keys::pub_t &pk, const string &text, const sig_t &signature_der) const
 
bool verify (const keys::pub_t &pk, const vector< unsigned char > &msg, const sig_t &signature_der) const
 
bool verify (const keys::pub_t &pk, const sigmsg_hasher_t::value_type &msgh, const sig_t &signature_der) const
 
bool verify (const keys::pub_t &pk, const sigmsg_hasher_t::value_type &msgh, const sig_t &signature_der, ostream &err) const
 
bool verify_not_normalized (const keys::pub_t &pk, const string &text, const sig_t &signature_der) const
 
bool verify_not_normalized (const keys::pub_t &pk, const vector< unsigned char > &msg, const sig_t &signature_der) const
 
bool verify_not_normalized (const keys::pub_t &pk, const sigmsg_hasher_t::value_type &, const sig_t &signature_der) const
 
ko generate_shared_key (unsigned char *, size_t, const keys::priv_t &, const keys::pub_t &)
 
byte[] getPublicKey (byte[] priv)
 
KeyPair getKeyPair ()
 
byte[] generate_shared_key (byte[] priv, byte[] pub, int length)
 
String to_b58 (byte[] k)
 
bool verify (byte[] pub, String text, String signature_der_b58)
 
byte[] sign (byte[] priv, String message)
 
String sign_encode (byte[] priv, String message)
 
 ec (String curve_name, String algorithm, String signature_algorithm) throws GeneralSecurityException
 
BigInteger generate_private_int ()
 
BigInteger get_private_int (PrivateKey k0)
 
PrivateKey get_private_key (BigInteger k)
 
KeyPair generate_keypair ()
 
KeyPair generate_keypair (PrivateKey k)
 
KeyPair get_keypair (BigInteger priv)
 
byte[] generate_shared_key (PrivateKey priv, PublicKey pub, int length)
 
byte[] to_vector (PublicKey pub)
 
byte[] to_vector (PrivateKey priv)
 
String to_b58 (PublicKey k)
 
String to_b58 (PrivateKey k)
 
PrivateKey get_private_key (byte[] privateKey)
 
PrivateKey get_private_key (byte[] buffer, int offset)
 
PublicKey get_public_key (byte[] buffer, int offset)
 
ECPoint multiply (ECPoint point, BigInteger d)
 
PublicKey get_public_key (BigInteger priv)
 
PublicKey get_public_key (PrivateKey priv)
 
PublicKey get_public_key (ECPoint point)
 
PublicKey get_public_key (byte[] public_key)
 
boolean verify (PublicKey pub, sha256.hash_t msgh, byte[] signature_der)
 
byte[] sign (PrivateKey priv, sha256.hash_t msgh)
 

Static Public Member Functions

static constexpr uint32_t bit_size ()
 
static vector< unsigned char > from_b58 (const string &hex)
 

Public Attributes

secp256k1_context * ctx
 

Static Public Attributes

static ec instance
 

Static Package Functions

 [static initializer]
 

Package Attributes

linux_secure_random secure_random
 
KeyFactory factory
 
ECParameterSpec spec
 
ECDomainParameters curve
 
KeyPairGenerator generator
 
Signature dsa
 

Properties

static ec Instance [get]
 

Private Member Functions

 ec ()
 
BigInteger get_private_int (KeyPair keypair)
 
ECPoint get_point (byte[] pub)
 

Static Private Attributes

static readonly ec _instance = new ec()
 

Member Typedef Documentation

◆ sig_t

typedef vector<unsigned char> us::gov::crypto::ec::sig_t

◆ sigmsg_hasher_t

◆ signature

typedef secp256k1_ecdsa_signature us::gov::crypto::ec::signature

Constructor & Destructor Documentation

◆ ec() [1/4]

us::gov::crypto::ec::ec ( )

Referenced by [static initializer]().

Here is the caller graph for this function:

◆ ec() [2/4]

us::gov::crypto::ec::ec ( const ec )
delete

◆ ~ec()

us::gov::crypto::ec::~ec ( )

◆ ec() [3/4]

us.gov.crypto.ec.ec ( )
inlineprivate

◆ ec() [4/4]

us.gov.crypto.ec.ec ( String  curve_name,
String  algorithm,
String  signature_algorithm 
) throws GeneralSecurityException
inline

References curve, dsa, factory, generator, secure_random, and spec.

Member Function Documentation

◆ [static initializer]()

us.gov.crypto.ec.[static initializer]
inlinestaticpackage

References ec(), and instance.

Here is the call graph for this function:

◆ bit_size()

static constexpr uint32_t us::gov::crypto::ec::bit_size ( )
inlinestaticconstexpr

◆ from_b58()

static vector<unsigned char> us::gov::crypto::ec::from_b58 ( const string &  hex)
static

◆ generate_keypair() [1/2]

◆ generate_keypair() [2/2]

KeyPair us.gov.crypto.ec.generate_keypair ( PrivateKey  k)
inline

References get_public_key().

Here is the call graph for this function:

◆ generate_private_int()

BigInteger us.gov.crypto.ec.generate_private_int ( )
inline

References generate_keypair(), and get_private_int().

Referenced by us.gov.crypto.test.ec.test_key_conversion(), and us::gov::io::cfg1.write_k().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_shared_key() [1/3]

byte [] us.gov.crypto.ec.generate_shared_key ( byte[]  priv,
byte[]  pub,
int  length 
)
inline

◆ generate_shared_key() [2/3]

byte [] us.gov.crypto.ec.generate_shared_key ( PrivateKey  priv,
PublicKey  pub,
int  length 
)
inline

References us::gov::crypto::sha256.hash(), and multiply().

Here is the call graph for this function:

◆ generate_shared_key() [3/3]

ko us::gov::crypto::ec::generate_shared_key ( unsigned char *  ,
size_t  ,
const keys::priv_t ,
const keys::pub_t  
)

◆ get_keypair()

KeyPair us.gov.crypto.ec.get_keypair ( BigInteger  priv)
inline

References generate_keypair(), and get_private_key().

Here is the call graph for this function:

◆ get_point()

ECPoint us.gov.crypto.ec.get_point ( byte[]  pub)
inlineprivate

References spec.

Referenced by get_public_key().

Here is the caller graph for this function:

◆ get_private_int() [1/2]

BigInteger us.gov.crypto.ec.get_private_int ( KeyPair  keypair)
inlineprivate

References get_private_int().

Here is the call graph for this function:

◆ get_private_int() [2/2]

BigInteger us.gov.crypto.ec.get_private_int ( PrivateKey  k0)
inline

Referenced by generate_private_int(), get_private_int(), get_public_key(), and us.gov.crypto.test.ec.test_key_conversion().

Here is the caller graph for this function:

◆ get_private_key() [1/3]

◆ get_private_key() [2/3]

PrivateKey us.gov.crypto.ec.get_private_key ( byte[]  buffer,
int  offset 
)
inline

References get_private_key().

Here is the call graph for this function:

◆ get_private_key() [3/3]

PrivateKey us.gov.crypto.ec.get_private_key ( byte[]  privateKey)
inline

References get_private_key().

Here is the call graph for this function:

◆ get_public_key() [1/5]

PublicKey us.gov.crypto.ec.get_public_key ( BigInteger  priv)
inline

References get_public_key(), multiply(), and spec.

Here is the call graph for this function:

◆ get_public_key() [2/5]

◆ get_public_key() [3/5]

PublicKey us.gov.crypto.ec.get_public_key ( byte[]  public_key)
inline

References get_point(), and get_public_key().

Here is the call graph for this function:

◆ get_public_key() [4/5]

PublicKey us.gov.crypto.ec.get_public_key ( ECPoint  point)
inline

References factory, and spec.

◆ get_public_key() [5/5]

PublicKey us.gov.crypto.ec.get_public_key ( PrivateKey  priv)
inline

References get_private_int(), and get_public_key().

Here is the call graph for this function:

◆ getKeyPair()

KeyPair us.gov.crypto.ec.getKeyPair ( )
inline

◆ getPublicKey()

byte [] us.gov.crypto.ec.getPublicKey ( byte[]  priv)
inline

◆ multiply()

ECPoint us.gov.crypto.ec.multiply ( ECPoint  point,
BigInteger  d 
)
inline

References spec.

Referenced by generate_shared_key(), and get_public_key().

Here is the caller graph for this function:

◆ operator=()

ec& us::gov::crypto::ec::operator= ( const ec )
delete

◆ sign() [1/5]

byte [] us.gov.crypto.ec.sign ( byte[]  priv,
String  message 
)
inline

◆ sign() [2/5]

ko us::gov::crypto::ec::sign ( const keys::priv_t pk,
const sigmsg_hasher_t::value_type ,
sig_t signature 
) const

◆ sign() [3/5]

ko us::gov::crypto::ec::sign ( const keys::priv_t pk,
const string &  text,
sig_t signature 
) const

Referenced by us::gov::id::peer_t::process_peer_challenge(), us::gov::id::peer_t::process_request(), and sign_encode().

Here is the caller graph for this function:

◆ sign() [4/5]

ko us::gov::crypto::ec::sign ( const keys::priv_t pk,
const vector< unsigned char > &  msg,
sig_t signature 
) const

◆ sign() [5/5]

byte [] us.gov.crypto.ec.sign ( PrivateKey  priv,
sha256.hash_t  msgh 
)
inline

References dsa.

◆ sign_encode()

String us.gov.crypto.ec.sign_encode ( byte[]  priv,
String  message 
)
inline

References us.gov.crypto.base58.encode(), and sign().

Referenced by us::gov::id::peer_t.process_peer_challenge(), and us::gov::id::peer_t.process_request().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_b58() [1/3]

String us.gov.crypto.ec.to_b58 ( byte[]  k)
inline

References us.gov.crypto.base58.encode().

Referenced by us::gov::id::peer_t.process_peer_challenge(), us::gov::id::peer_t.process_request(), us.wallet.cli.hmi.run_offline(), and us.wallet.api_stream_parseable.write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ to_b58() [2/3]

String us.gov.crypto.ec.to_b58 ( PrivateKey  k)
inline

References us.gov.crypto.base58.encode(), and to_vector().

Here is the call graph for this function:

◆ to_b58() [3/3]

String us.gov.crypto.ec.to_b58 ( PublicKey  k)
inline

References us.gov.crypto.base58.encode(), and to_vector().

Here is the call graph for this function:

◆ to_vector() [1/2]

byte [] us.gov.crypto.ec.to_vector ( PrivateKey  priv)
inline

◆ to_vector() [2/2]

byte [] us.gov.crypto.ec.to_vector ( PublicKey  pub)
inline

Referenced by us::gov::socket::datagram.datagram(), and to_b58().

Here is the caller graph for this function:

◆ verify() [1/6]

bool us.gov.crypto.ec.verify ( byte[]  pub,
String  text,
String  signature_der_b58 
)
inline

References us.gov.crypto.base58.decode().

Here is the call graph for this function:

◆ verify() [2/6]

bool us::gov::crypto::ec::verify ( const keys::pub_t pk,
const sigmsg_hasher_t::value_type msgh,
const sig_t signature_der 
) const

◆ verify() [3/6]

bool us::gov::crypto::ec::verify ( const keys::pub_t pk,
const sigmsg_hasher_t::value_type msgh,
const sig_t signature_der,
ostream &  err 
) const

◆ verify() [4/6]

bool us::gov::crypto::ec::verify ( const keys::pub_t pk,
const string &  text,
const sig_t signature_der 
) const

Referenced by us::gov::id::peer_t::process_challenge_response(), and us::gov::id::peer_t::process_peer_challenge().

Here is the caller graph for this function:

◆ verify() [5/6]

bool us::gov::crypto::ec::verify ( const keys::pub_t pk,
const vector< unsigned char > &  msg,
const sig_t signature_der 
) const

◆ verify() [6/6]

boolean us.gov.crypto.ec.verify ( PublicKey  pub,
sha256.hash_t  msgh,
byte[]  signature_der 
)
inline

References dsa.

◆ verify_not_normalized() [1/3]

bool us::gov::crypto::ec::verify_not_normalized ( const keys::pub_t pk,
const sigmsg_hasher_t::value_type ,
const sig_t signature_der 
) const

◆ verify_not_normalized() [2/3]

bool us::gov::crypto::ec::verify_not_normalized ( const keys::pub_t pk,
const string &  text,
const sig_t signature_der 
) const

◆ verify_not_normalized() [3/3]

bool us::gov::crypto::ec::verify_not_normalized ( const keys::pub_t pk,
const vector< unsigned char > &  msg,
const sig_t signature_der 
) const

Member Data Documentation

◆ _instance

readonly ec us.gov.crypto.ec._instance = new ec()
staticprivate

◆ ctx

◆ curve

ECDomainParameters us.gov.crypto.ec.curve
package

Referenced by ec().

◆ dsa

Signature us.gov.crypto.ec.dsa
package

Referenced by ec(), sign(), and verify().

◆ factory

KeyFactory us.gov.crypto.ec.factory
package

Referenced by ec(), get_private_key(), and get_public_key().

◆ generator

KeyPairGenerator us.gov.crypto.ec.generator
package

Referenced by ec(), and generate_keypair().

◆ instance

static ec us::gov::crypto::ec::instance
static

Referenced by [static initializer](), us::gov::io::cfg1::cfg1(), us::gov::crypto::ec::keys::pub_t::compute_hash(), main::create_instance_k(), main::create_instance_p(), us::gov::socket::datagram::datagram(), us::gov::crypto::symmetric_encryption::init(), us::gov::io::cfg1::load(), us::gov::io::cfg1::load_sk(), us.gov.crypto.test.symmetric_encryption::main(), us::gov::io::shell_args::next_priv(), us::gov::io::shell_args::next_pub(), us::gov::socket::datagram::parse_Hpv(), us::gov::socket::datagram::parse_k(), us::gov::socket::datagram::parse_kph(), us::gov::socket::datagram::parse_p(), us::gov::socket::datagram::parse_ph(), us::gov::socket::datagram::parse_pss(), us::gov::socket::datagram::parse_pv(), us::gov::socket::datagram::parse_sk(), us::gov::socket::datagram::parse_u2u2u2k(), us::gov::socket::datagram::parse_vk(), us::gov::socket::datagram::parse_vkp(), us::gov::socket::datagram::parse_vpk(), us::gov::socket::datagram::parse_vpv(), us::gov::id::peer_t::process_challenge_response(), us::gov::id::peer_t::process_peer_challenge(), us::gov::id::peer_t::process_request(), us::gov::crypto::ec::keys::pub_t::read_ser(), us.wallet.cli.hmi::run_offline(), us::gov::crypto::symmetric_encryption::test(), us.gov.crypto.test.symmetric_encryption::test_decrypt_multiple(), us.gov.crypto.test.symmetric_encryption::test_decrypt_nulls(), us.gov.crypto.test.symmetric_encryption::test_encrypt_decrypt(), us.gov.crypto.test.symmetric_encryption::test_encrypt_multiple(), us.gov.crypto.test.ec::test_key_conversion(), us.gov.crypto.test.ec::test_shared_secret(), us.gov.crypto.test.ec::test_shared_secret_raw_keys(), us::gov::crypto::ec::keys::pub_t::to_vector(), us.wallet.api_stream_parseable::write(), and us::gov::io::cfg1::write_k().

◆ secure_random

linux_secure_random us.gov.crypto.ec.secure_random
package

Referenced by ec().

◆ spec

ECParameterSpec us.gov.crypto.ec.spec
package

Property Documentation

◆ Instance


The documentation for this class was generated from the following files: