dht::crypto::PrivateKey Struct Reference

`#include <crypto.h>`

## Public Member Functions

| PrivateKey (gnutls_x509_privkey_t k)
| PrivateKey (PrivateKey &&o) noexcept
PrivateKey & | operator= (PrivateKey &&o) noexcept
| PrivateKey (const Blob &import, const std::string &password={})
| operator bool () const
PublicKey | getPublicKey () const
Blob | serialize (const std::string &password={}) const
Blob | sign (const Blob &) const
Blob | decrypt (const Blob &cypher) const

## Static Public Member Functions

static PrivateKey | generate (unsigned key_length=4096)
static PrivateKey | generateEC ()

## Public Attributes

gnutls_privkey_t | key {}
gnutls_x509_privkey_t | x509_key {}

## Detailed Description

A private key, including the corresponding public key.

Definition at line 120 of file crypto.h.

## Constructor & Destructor Documentation

## PrivateKey()

dht::crypto::PrivateKey::PrivateKey | ( | gnutls_x509_privkey_t | k | ) |

Takes ownership of an existing gnutls_x509_privkey.

## Member Function Documentation

## decrypt()

Blob dht::crypto::PrivateKey::decrypt | ( | const Blob & | cypher | ) | const

Try to decrypt the provided cypher text. In case of failure a CryptoException is thrown.

Returns
  the decrypted data.

## generate()

static PrivateKey dht::crypto::PrivateKey::generate | ( | unsigned | key_length = `4096` | ) |

static

Generate a new RSA key pair

Parameters

  key_length | : size of the modulus in bits Minimim value: 2048 Recommended values: 4096, 8192

## operator bool()

dht::crypto::PrivateKey::operator bool | ( |  | ) | const

inline explicit

Definition at line 135 of file crypto.h.

## sign()

Blob dht::crypto::PrivateKey::sign | ( | const Blob & |  | ) | const

Sign the provided binary object.

Returns
  the signature data.

## Member Data Documentation

## key

gnutls_privkey_t dht::crypto::PrivateKey::key {}

Definition at line 161 of file crypto.h.

## x509_key

gnutls_x509_privkey_t dht::crypto::PrivateKey::x509_key {}

Definition at line 162 of file crypto.h.

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

- /tmp/slackbuilds_libs/opendht-1.7.4/include/opendht/crypto.h