[#CPubKey]
= CPubKey
:mrdocs:

An encapsulated public key&period;

== Synopsis

Declared in `&lt;pubkey&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CPubKey;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CPubKey/2constructor-00.adoc[`CPubKey`]         [.small]#[constructor]#
| Constructors
| xref:CPubKey/Decompress.adoc[`Decompress`] 
| Turn this public key into an uncompressed public key&period;
| xref:CPubKey/Derive.adoc[`Derive`] 
| Derive BIP32 child pubkey&period;
| xref:CPubKey/GetHash.adoc[`GetHash`] 
| Get the 256&hyphen;bit hash of this public key&period;
| xref:CPubKey/GetID.adoc[`GetID`] 
| Get the KeyID of this public key (hash of its serialization)
| xref:CPubKey/IsCompressed.adoc[`IsCompressed`] 
| Check whether this is a compressed public key&period;
| xref:CPubKey/IsFullyValid.adoc[`IsFullyValid`] 
| fully validate whether this is a valid public key (more expensive than IsValid())
| xref:CPubKey/IsValid.adoc[`IsValid`] 
| Check syntactic correctness&period;
| xref:CPubKey/IsValidNonHybrid.adoc[`IsValidNonHybrid`] 
| Check if a public key is a syntactically valid compressed or uncompressed key&period;
| xref:CPubKey/RecoverCompact.adoc[`RecoverCompact`] 
| Recover a public key from a compact signature&period;
| xref:CPubKey/Serialize.adoc[`Serialize`] 
| Implement serialization, as if this was a byte vector&period;
| xref:CPubKey/Set.adoc[`Set`] 
| Initialize a public key using begin&sol;end iterators to byte data&period;
| xref:CPubKey/Unserialize.adoc[`Unserialize`] 
| Deserialize the public key from a stream, as if it were a byte vector&period;
| xref:CPubKey/Verify.adoc[`Verify`] 
| Verify a DER signature (&#126;72 bytes)&period; If this public key is not fully valid, the return value will be false&period;
| xref:CPubKey/begin.adoc[`begin`] 
| Iterator to the first byte of the serialized public key&period;
| xref:CPubKey/data.adoc[`data`] 
| Pointer to the first byte of the serialized public key&period;
| xref:CPubKey/end.adoc[`end`] 
| Iterator past the last byte of the serialized public key&period;
| xref:CPubKey/operator_subs.adoc[`operator&lsqb;&rsqb;`] 
| Access the byte at the given position&period;
| xref:CPubKey/size-0a.adoc[`size`] 
| Number of bytes in the serialized public key&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CPubKey/CheckLowS.adoc[`CheckLowS`] 
| Check whether a signature is normalized (lower&hyphen;S)&period;
| xref:CPubKey/ValidSize.adoc[`ValidSize`] 
| Check whether a byte vector has a valid public key length for its header byte&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CPubKey/COMPACT_SIGNATURE_SIZE.adoc[`COMPACT&lowbar;SIGNATURE&lowbar;SIZE`] 
| Size in bytes of a compact (recoverable) ECDSA signature&period;
| xref:CPubKey/COMPRESSED_SIZE.adoc[`COMPRESSED&lowbar;SIZE`] 
| Size in bytes of a compressed public key&period;
| xref:CPubKey/SIGNATURE_SIZE.adoc[`SIGNATURE&lowbar;SIZE`] 
| Maximum size in bytes of a DER&hyphen;encoded ECDSA signature&period;
| xref:CPubKey/SIZE-04.adoc[`SIZE`] 
| secp256k1&colon;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:operator_gt-0f.adoc[operator&gt;]`
| Order two public keys lexicographically by their serialized bytes&period;
| `xref:operator_lt-05.adoc[operator&lt;]`
| Order two public keys lexicographically by their serialized bytes&period;
| `xref:operator_eq-05d.adoc[operator&equals;&equals;]`
| Comparator implementation&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CreateMuSig2SyntheticXpub.adoc[`CreateMuSig2SyntheticXpub`]
| Construct the BIP 328 synthetic xpub for a pubkey
| xref:GetScriptForRawPubKey.adoc[`GetScriptForRawPubKey`]
| Generate a P2PK script for the given pubkey&period;
| xref:HexToPubKey.adoc[`HexToPubKey`]
| Parse a hex&hyphen;encoded public key, throwing an RPC error if it is invalid&period;
| xref:MuSig2AggregatePubkeys-04.adoc[`MuSig2AggregatePubkeys`]
| Compute the full aggregate pubkey from the given participant pubkeys in their current order&period; Outputs the secp256k1&lowbar;musig&lowbar;keyagg&lowbar;cache and validates that the computed aggregate pubkey matches an expected aggregate pubkey&period; This is necessary for most MuSig2 operations&period;
| xref:MuSig2AggregatePubkeys-09.adoc[`MuSig2AggregatePubkeys`]
| Compute the full aggregate pubkey from the given participant pubkeys in their current order&period;
| xref:MuSig2SessionID.adoc[`MuSig2SessionID`]
| Computes an arbitrary unique session ID to identify ongoing signing sessions&period; It is the SHA256 of the signing (aggregate) pubkey, the participant pubkey, the sighash, and the pubnonce
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
