StaticnewGenerate a new random ECPrivateKey.
StaticrandomGenerate a new random ECPrivateKey.
StaticnewGenerate a new random ECPrivateKey using provided RNG.
StatickeypairGenerate a new random ECPrivateKey and corresponding ECPublicKey.
StatickeypairGenerate a new random ECPrivateKey and corresponding ECPublicKey using the given random number generator.
StaticderiveDerive an ECPrivateKey from the given key material.
The key material to derive from
A new ECPrivateKey derived from the key material
StaticfromRestore an ECPrivateKey from a fixed-size array of bytes.
StaticfromRestore an ECPrivateKey from a reference to an array of bytes. Validates the length.
StaticfromCreate an ECPrivateKey from raw bytes (legacy alias).
StaticfromGet a reference to the fixed-size array of bytes.
Get the raw private key bytes (copy).
Get hex string representation.
Get hex string representation (alias for hex()).
Get base64 representation.
Get the ECPublicKey (compressed) corresponding to this ECPrivateKey.
Get the SchnorrPublicKey (x-only) corresponding to this ECPrivateKey.
Sign a message using ECDSA.
The message to sign
A 64-byte signature
Sign a message using Schnorr signature (BIP-340).
The message to sign
A 64-byte signature
Sign a message using Schnorr signature with custom RNG.
The message to sign
Random number generator for auxiliary randomness
A 64-byte signature
Get string representation.
Returns the CBOR tags associated with ECPrivateKey.
Returns the untagged CBOR encoding.
Format: { 2: true, 3: h'<32-byte-key>' }
Returns the tagged CBOR encoding.
Returns the tagged value in CBOR binary representation.
Creates an ECPrivateKey by decoding it from untagged CBOR.
Format: { 2: true, 3: h'<32-byte-key>' }
Creates an ECPrivateKey by decoding it from tagged CBOR.
StaticfromStaticfromStatic method to decode from tagged CBOR binary data.
StaticfromStatic method to decode from untagged CBOR binary data.
Returns the UR representation of the ECPrivateKey. Note: URs use untagged CBOR since the type is conveyed by the UR type itself.
Returns the UR string representation.
StaticfromStaticfrom
An interface for elliptic curve keys that can derive a public key.
This interface extends
ECKeyBaseto provide a method for deriving the corresponding compressed public key. It is implemented by both private keys (where it generates the public key) and public keys (where it may return self or convert between formats).