MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / CreateECIESP256RandomKeys

Function CreateECIESP256RandomKeys

libi2pd/CryptoKey.cpp:80–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78 }
79
80 void CreateECIESP256RandomKeys (uint8_t * priv, uint8_t * pub)
81 {
82 EC_GROUP * curve = EC_GROUP_new_by_curve_name (NID_X9_62_prime256v1);
83 EC_POINT * p = nullptr;
84 BIGNUM * key = nullptr;
85 GenerateECIESKeyPair (curve, key, p);
86 bn2buf (key, priv, 32);
87 RAND_bytes (priv + 32, 224);
88 BN_free (key);
89 BIGNUM * x = BN_new (), * y = BN_new ();
90 EC_POINT_get_affine_coordinates (curve, p, x, y, NULL);
91 bn2buf (x, pub, 32);
92 bn2buf (y, pub + 32, 32);
93 RAND_bytes (pub + 64, 192);
94 EC_POINT_free (p);
95 BN_free (x); BN_free (y);
96 EC_GROUP_free (curve);
97 }
98
99 ECIESGOSTR3410Encryptor::ECIESGOSTR3410Encryptor (const uint8_t * pub)
100 {

Callers 1

GenerateCryptoKeyPairMethod · 0.85

Calls 2

GenerateECIESKeyPairFunction · 0.85
bn2bufFunction · 0.85

Tested by

no test coverage detected