My Project 3.2.0
C++ Distributed Hash Table
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
dht::crypto::PublicKey Struct Reference

#include <crypto.h>

Public Member Functions

 PublicKey (gnutls_pubkey_t k)
 
 PublicKey (const uint8_t *dat, size_t dat_size)
 
 PublicKey (const Blob &pk)
 
 PublicKey (std::string_view pk)
 
 PublicKey (PublicKey &&o) noexcept
 
 operator bool () const
 
bool operator== (const PublicKey &o) const
 
bool operator!= (const PublicKey &o) const
 
PublicKeyoperator= (PublicKey &&o) noexcept
 
const InfoHashgetId () const
 
const PkIdgetLongId () const
 
bool checkSignature (const uint8_t *data, size_t data_len, const uint8_t *signature, size_t signature_len) const
 
bool checkSignature (const Blob &data, const Blob &signature) const
 
Blob encrypt (const uint8_t *data, size_t data_len) const
 
Blob encrypt (const Blob &data) const
 
Blob encrypt (std::string_view data) const
 
void pack (Blob &b) const
 
int pack (uint8_t *out, size_t *out_len) const
 
void unpack (const uint8_t *dat, size_t dat_size)
 
std::string toString () const
 
template<typename Packer >
void msgpack_pack (Packer &p) const
 
void msgpack_unpack (const msgpack::object &o)
 
gnutls_digest_algorithm_t getPreferredDigest () const
 

Public Attributes

gnutls_pubkey_t pk {nullptr}
 

Detailed Description

A public key.

Definition at line 78 of file crypto.h.

Constructor & Destructor Documentation

◆ PublicKey() [1/5]

dht::crypto::PublicKey::PublicKey ( gnutls_pubkey_t k)
inline

Takes ownership of an existing gnutls_pubkey.

Definition at line 85 of file crypto.h.

◆ PublicKey() [2/5]

dht::crypto::PublicKey::PublicKey ( const uint8_t * dat,
size_t dat_size )

Import public key from serialized data

◆ PublicKey() [3/5]

dht::crypto::PublicKey::PublicKey ( const Blob & pk)
inline

Definition at line 89 of file crypto.h.

◆ PublicKey() [4/5]

dht::crypto::PublicKey::PublicKey ( std::string_view pk)
inline

Definition at line 90 of file crypto.h.

◆ PublicKey() [5/5]

dht::crypto::PublicKey::PublicKey ( PublicKey && o)
inlinenoexcept

Definition at line 91 of file crypto.h.

Member Function Documentation

◆ checkSignature()

bool dht::crypto::PublicKey::checkSignature ( const Blob & data,
const Blob & signature ) const
inline

Definition at line 115 of file crypto.h.

◆ encrypt() [1/2]

Blob dht::crypto::PublicKey::encrypt ( const Blob & data) const
inline

Definition at line 120 of file crypto.h.

◆ encrypt() [2/2]

Blob dht::crypto::PublicKey::encrypt ( std::string_view data) const
inline

Definition at line 123 of file crypto.h.

◆ getId()

const InfoHash & dht::crypto::PublicKey::getId ( ) const

Get public key fingerprint

◆ getLongId()

const PkId & dht::crypto::PublicKey::getLongId ( ) const

Get public key long fingerprint

◆ msgpack_pack()

template<typename Packer >
void dht::crypto::PublicKey::msgpack_pack ( Packer & p) const
inline

Definition at line 133 of file crypto.h.

◆ operator bool()

dht::crypto::PublicKey::operator bool ( ) const
inlineexplicit

Definition at line 94 of file crypto.h.

◆ operator!=()

bool dht::crypto::PublicKey::operator!= ( const PublicKey & o) const
inline

Definition at line 98 of file crypto.h.

◆ operator==()

bool dht::crypto::PublicKey::operator== ( const PublicKey & o) const
inline

Definition at line 95 of file crypto.h.

Member Data Documentation

◆ pk

gnutls_pubkey_t dht::crypto::PublicKey::pk {nullptr}

Definition at line 145 of file crypto.h.


The documentation for this struct was generated from the following file: