20 #include <ripple/basics/contract.h>
21 #include <ripple/crypto/GenerateDeterministicKey.h>
22 #include <ripple/crypto/impl/ec_key.h>
23 #include <ripple/crypto/impl/openssl.h>
24 #include <ripple/crypto/secure_erase.h>
25 #include <ripple/protocol/digest.h>
27 #include <openssl/pem.h>
41 group = EC_GROUP_new_by_curve_name(NID_secp256k1);
45 "The OpenSSL library on this system lacks elliptic curve "
62 using namespace openssl;
74 template <
class FwdIt>
79 *
out++ = (v >> 16) & 0xff;
80 *
out++ = (v >> 8) & 0xff;
104 privKey.
assign(root.data(), root.size());
155 assert(pubGen.
size() == 33);
166 result.
assign(root.data(), root.size());
168 }
while (result.
is_zero() || result >= order);
std::vector< unsigned char > Blob
Storage for linear binary data.
uint256 uint256_from_bignum_clear(bignum &number)
uint256 generateRootDeterministicPrivateKey(uint128 const &seed)
sha512_half_hasher_s::result_type sha512Half_s(Args const &... args)
Returns the SHA512-Half of a series of objects.
static bignum makeHash(Blob const &pubGen, int seq, bignum const &order)
void serialize_ec_point(ec_point const &point, std::uint8_t *ptr)
void add_to(EC_GROUP const *group, ec_point const &a, ec_point &b, bn_ctx &ctx)
static bignum generateRootDeterministicKey(uint128 const &seed)
static ec_point generateRootPubKey(bignum &&pubGenerator)
Blob generateRootDeterministicPublicKey(uint128 const &seed)
static secp256k1_data const & secp256k1curve()
uint256 generatePrivateDeterministicKey(Blob const &family, uint128 const &seed, int n)
bignum get_order(EC_GROUP const *group, bn_ctx &ctx)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
sha512_half_hasher::result_type sha512Half(Args const &... args)
Returns the SHA512-Half of a series of objects.
void assign(uint8_t const *data, size_t size)
Blob generatePublicDeterministicKey(Blob const &generator, int n)
ec_point bn2point(EC_GROUP const *group, BIGNUM const *number)
ec_point multiply(EC_GROUP const *group, bignum const &n, bn_ctx &ctx)
void copy_uint32(FwdIt out, std::uint32_t v)
void secure_erase(void *dest, std::size_t bytes)
Attempts to clear the given blob of memory.