userver: crypto::PrivateKey Class Reference
Loading...
Searching...
No Matches
crypto::PrivateKey Class Reference

#include <userver/crypto/private_key.hpp>

Detailed Description

Loaded into memory private key

Definition at line 20 of file private_key.hpp.

Public Types

using NativeType = EVP_PKEY
 

Public Member Functions

NativeType * GetNative () const noexcept
 
 operator bool () const noexcept
 
std::optional< std::string > GetPemString (std::string_view password) const
 
std::optional< std::string > GetPemStringUnencrypted () const
 

Static Public Member Functions

static PrivateKey LoadFromString (std::string_view key, std::string_view password)
 
static PrivateKey LoadFromString (std::string_view key)
 

Member Typedef Documentation

◆ NativeType

using crypto::PrivateKey::NativeType = EVP_PKEY

Definition at line 22 of file private_key.hpp.

Member Function Documentation

◆ GetNative()

NativeType * crypto::PrivateKey::GetNative ( ) const
inlinenoexcept

Definition at line 26 of file private_key.hpp.

◆ GetPemString()

std::optional< std::string > crypto::PrivateKey::GetPemString ( std::string_view password) const

Returns a PEM-encoded representation of stored private key encrypted by the provided password.

Exceptions
crypto::SerializationErrorif the password is empty or serialization fails.

◆ GetPemStringUnencrypted()

std::optional< std::string > crypto::PrivateKey::GetPemStringUnencrypted ( ) const

Returns a PEM-encoded representation of stored private key in an unencrypted form.

Exceptions
crypto::SerializationErrorif serialization fails.

◆ LoadFromString() [1/2]

static PrivateKey crypto::PrivateKey::LoadFromString ( std::string_view key)
static

Accepts a string that contains a private key (not protected with password), checks the key and password, loads it into OpenSSL structures and returns as a PrivateKey variable.

Exceptions
crypto::KeyParseErrorif failed to load the key.

◆ LoadFromString() [2/2]

static PrivateKey crypto::PrivateKey::LoadFromString ( std::string_view key,
std::string_view password )
static

Accepts a string that contains a private key and a password, checks the key and password, loads it into OpenSSL structures and returns as a PrivateKey variable.

Exceptions
crypto::KeyParseErrorif failed to load the key.

◆ operator bool()

crypto::PrivateKey::operator bool ( ) const
inlineexplicitnoexcept

Definition at line 27 of file private_key.hpp.


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