xrpld
Loading...
Searching...
No Matches
xrpl::PublicKey Class Reference

A public key. More...

#include <PublicKey.h>

Collaboration diagram for xrpl::PublicKey:

Public Types

using const_iterator = std::uint8_t const*

Public Member Functions

 PublicKey ()=delete
 PublicKey (PublicKey const &other)
PublicKeyoperator= (PublicKey const &other)
 PublicKey (Slice const &slice)
 Create a public key.
std::uint8_t const * data () const noexcept
const_iterator begin () const noexcept
const_iterator cbegin () const noexcept
const_iterator end () const noexcept
const_iterator cend () const noexcept
Slice slice () const noexcept
 operator Slice () const noexcept

Static Public Member Functions

static std::size_t size () noexcept

Protected Attributes

std::uint8_t buf_ [kSize] {}

Static Protected Attributes

static constexpr std::size_t kSize = 33

Detailed Description

A public key.

Public keys are used in the public-key cryptography system used to verify signatures attached to messages.

The format of the public key is XRPL specific, information needed to determine the cryptosystem parameters used is stored inside the key.

As of this writing two systems are supported:

secp256k1
ed25519

secp256k1 public keys consist of a 33 byte compressed public key, with the lead byte equal to 0x02 or 0x03.

The ed25519 public keys consist of a 1 byte prefix constant 0xED, followed by 32 bytes of public key data.

Definition at line 41 of file PublicKey.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 50 of file PublicKey.h.

Constructor & Destructor Documentation

◆ PublicKey() [1/3]

xrpl::PublicKey::PublicKey ( )
delete

◆ PublicKey() [2/3]

xrpl::PublicKey::PublicKey ( PublicKey const & other)

Definition at line 189 of file PublicKey.cpp.

◆ PublicKey() [3/3]

xrpl::PublicKey::PublicKey ( Slice const & slice)
explicit

Create a public key.

Preconditions: publicKeyType(slice) != std::nullopt

Definition at line 175 of file PublicKey.cpp.

Member Function Documentation

◆ operator=()

PublicKey & xrpl::PublicKey::operator= ( PublicKey const & other)

Definition at line 195 of file PublicKey.cpp.

◆ data()

std::uint8_t const * xrpl::PublicKey::data ( ) const
nodiscardnoexcept

Definition at line 67 of file PublicKey.h.

◆ size()

std::size_t xrpl::PublicKey::size ( )
staticnoexcept

Definition at line 73 of file PublicKey.h.

◆ begin()

const_iterator xrpl::PublicKey::begin ( ) const
nodiscardnoexcept

Definition at line 79 of file PublicKey.h.

◆ cbegin()

const_iterator xrpl::PublicKey::cbegin ( ) const
nodiscardnoexcept

Definition at line 85 of file PublicKey.h.

◆ end()

const_iterator xrpl::PublicKey::end ( ) const
nodiscardnoexcept

Definition at line 91 of file PublicKey.h.

◆ cend()

const_iterator xrpl::PublicKey::cend ( ) const
nodiscardnoexcept

Definition at line 97 of file PublicKey.h.

◆ slice()

Slice xrpl::PublicKey::slice ( ) const
nodiscardnoexcept

Definition at line 103 of file PublicKey.h.

◆ operator Slice()

xrpl::PublicKey::operator Slice ( ) const
noexcept

Definition at line 108 of file PublicKey.h.

Member Data Documentation

◆ kSize

std::size_t xrpl::PublicKey::kSize = 33
staticconstexprprotected

Definition at line 46 of file PublicKey.h.

◆ buf_

std::uint8_t xrpl::PublicKey::buf_[kSize] {}
protected

Definition at line 47 of file PublicKey.h.