[#CKey] = CKey :mrdocs: An encapsulated private key. == Synopsis Declared in `<key.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class CKey; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:CKey/2constructor-09.adoc[`CKey`] [.small]#[constructor]# | Constructors | xref:CKey/operator_assign-08.adoc[`operator=`] | Assignment operators | xref:CKey/ComputeBIP324ECDHSecret.adoc[`ComputeBIP324ECDHSecret`] | Compute a BIP324‐style ECDH shared secret. | xref:CKey/ComputeKeyPair.adoc[`ComputeKeyPair`] | Compute a KeyPair | xref:CKey/Derive.adoc[`Derive`] | Derive BIP32 child key. | xref:CKey/EllSwiftCreate.adoc[`EllSwiftCreate`] | Create an ellswift‐encoded public key for this key, with specified entropy. | xref:CKey/GetPrivKey.adoc[`GetPrivKey`] | Convert the private key to a CPrivKey (serialized OpenSSL private key data). This is expensive. | xref:CKey/GetPubKey.adoc[`GetPubKey`] | Compute the public key from a private key. This is expensive. | xref:CKey/IsCompressed.adoc[`IsCompressed`] | Check whether the public key corresponding to this private key is (to be) compressed. | xref:CKey/IsValid.adoc[`IsValid`] | Check whether this private key is valid. | xref:CKey/Load.adoc[`Load`] | Load private key and check that public key matches. | xref:CKey/MakeNewKey.adoc[`MakeNewKey`] | Generate a new private key using a cryptographic PRNG. | xref:CKey/Set.adoc[`Set`] | Initialize using begin and end iterators to byte data. | xref:CKey/Sign.adoc[`Sign`] | Create a DER‐serialized signature. The test_case parameter tweaks the deterministic nonce. | xref:CKey/SignCompact.adoc[`SignCompact`] | Create a compact signature (65 bytes), which allows reconstructing the used public key. The format is one header byte, followed by two times 32 bytes for the serialized r and s values. The header byte: 0x1B = first key with even y, 0x1C = first key with odd y, 0x1D = second key with even y, 0x1E = second key with odd y, add 0x04 for compressed keys. | xref:CKey/SignSchnorr.adoc[`SignSchnorr`] | Create a BIP‐340 Schnorr signature, for the xonly‐pubkey corresponding to *this, optionally tweaked by *merkle_root. Additional nonce entropy is provided through aux. | xref:CKey/VerifyPubKey.adoc[`VerifyPubKey`] | Verify thoroughly whether a private key and a public key match. This is done using a different mechanism than just regenerating it. | xref:CKey/begin.adoc[`begin`] | Iterator to the first key byte. | xref:CKey/data.adoc[`data`] | Pointer to the first key byte, or nullptr if the key is invalid. | xref:CKey/end.adoc[`end`] | Iterator past the last key byte. | xref:CKey/size-09.adoc[`size`] | Number of key bytes, or 0 if the key is invalid. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:CKey/COMPRESSED_SIZE.adoc[`COMPRESSED_SIZE`] | Size in bytes of a serialized private key whose public key is compressed. | xref:CKey/SIZE-0d.adoc[`SIZE`] | secp256k1: |=== == Friends [cols="1,4"] |=== | Name| Description | `xref:operator_eq-0e7.adoc[operator==]` | Compare two private keys for equality of compression flag and key material. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:DecodeSecret.adoc[`DecodeSecret`] | Decode a WIF‐encoded private key. | xref:EncodeSecret.adoc[`EncodeSecret`] | Encode a private key in WIF format. | xref:GenerateRandomKey.adoc[`GenerateRandomKey`] | Generate a new random private key. | xref:MessageSign.adoc[`MessageSign`] | Sign a message. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#