rippled
Public Types | Public Member Functions | Protected Attributes | List of all members
ripple::PublicKey Class Reference

A public key. More...

Collaboration diagram for ripple::PublicKey:
Collaboration graph
[legend]

Public Types

using const_iterator = std::uint8_t const *
 

Public Member Functions

 PublicKey ()=default
 
 PublicKey (PublicKey const &other)
 
PublicKeyoperator= (PublicKey const &other)
 
 PublicKey (Slice const &slice)
 Create a public key. More...
 
std::uint8_t const * data () const noexcept
 
std::size_t size () const noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
bool empty () const noexcept
 
Slice slice () const noexcept
 
 operator Slice () const noexcept
 

Protected Attributes

std::size_t size_ = 0
 
std::uint8_t buf_ [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 Ripple 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 59 of file PublicKey.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 66 of file PublicKey.h.

Constructor & Destructor Documentation

◆ PublicKey() [1/3]

ripple::PublicKey::PublicKey ( )
default

◆ PublicKey() [2/3]

ripple::PublicKey::PublicKey ( PublicKey const &  other)

Definition at line 185 of file PublicKey.cpp.

◆ PublicKey() [3/3]

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

Create a public key.

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

Definition at line 177 of file PublicKey.cpp.

Member Function Documentation

◆ operator=()

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

Definition at line 192 of file PublicKey.cpp.

◆ data()

std::uint8_t const* ripple::PublicKey::data ( ) const
noexcept

Definition at line 81 of file PublicKey.h.

◆ size()

std::size_t ripple::PublicKey::size ( ) const
noexcept

Definition at line 87 of file PublicKey.h.

◆ begin()

const_iterator ripple::PublicKey::begin ( ) const
noexcept

Definition at line 93 of file PublicKey.h.

◆ cbegin()

const_iterator ripple::PublicKey::cbegin ( ) const
noexcept

Definition at line 99 of file PublicKey.h.

◆ end()

const_iterator ripple::PublicKey::end ( ) const
noexcept

Definition at line 105 of file PublicKey.h.

◆ cend()

const_iterator ripple::PublicKey::cend ( ) const
noexcept

Definition at line 111 of file PublicKey.h.

◆ empty()

bool ripple::PublicKey::empty ( ) const
noexcept

Definition at line 117 of file PublicKey.h.

◆ slice()

Slice ripple::PublicKey::slice ( ) const
noexcept

Definition at line 123 of file PublicKey.h.

◆ operator Slice()

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

Definition at line 128 of file PublicKey.h.

Member Data Documentation

◆ size_

std::size_t ripple::PublicKey::size_ = 0
protected

Definition at line 62 of file PublicKey.h.

◆ buf_

std::uint8_t ripple::PublicKey::buf_[33]
protected

Definition at line 63 of file PublicKey.h.