libsshpp v0.1.7
Modern C++17 wrapper for libssh
Loading...
Searching...
No Matches
sshpp::Key Class Reference

#include <key.hpp>

Public Member Functions

 Key ()=default
 
 ~Key ()
 
 Key (Key &&) noexcept
 
Keyoperator= (Key &&) noexcept
 
 Key (const Key &)=delete
 
Keyoperator= (const Key &)=delete
 
 operator bool () const noexcept
 
native_key native_handle () const noexcept
 
Result< std::string > to_public_base64 () const
 
Result< std::string > to_authorized_keys_line (std::string_view comment={}) const
 
Result< void > write_public_file (const std::filesystem::path &) const
 
Result< Keypublic_part () const
 
KeyType type () const noexcept
 
std::string type_name () const
 
int bits () const noexcept
 
bool is_private () const noexcept
 
bool is_public () const noexcept
 
Result< Fingerprintfingerprint (HashType=HashType::sha256) const
 
bool equals (const Key &other, bool compare_private=false) const noexcept
 

Static Public Member Functions

static Key from_native (native_key, Ownership)
 
static Result< Keyfrom_private_file (const std::filesystem::path &, PassphraseCallback={})
 
static Result< Keyfrom_public_file (const std::filesystem::path &)
 
static Result< Keyfrom_public_base64 (std::string_view b64, KeyType type)
 
static Result< Keyfrom_authorized_keys_line (std::string_view line)
 
static Result< Keygenerate (KeyType, int bits=0)
 

Detailed Description

A public or private SSH key. See docs/design/04 ยง4.5. PublicKey in host-key APIs is an alias for this type with the invariant is_public().

Constructor & Destructor Documentation

◆ Key() [1/3]

sshpp::Key::Key ( )
default

◆ ~Key()

SSHPP_INLINE sshpp::Key::~Key ( )

◆ Key() [2/3]

SSHPP_INLINE sshpp::Key::Key ( Key &&  other)
noexcept

◆ Key() [3/3]

sshpp::Key::Key ( const Key )
delete

Member Function Documentation

◆ operator=() [1/2]

SSHPP_INLINE Key & sshpp::Key::operator= ( Key &&  other)
noexcept

◆ operator=() [2/2]

Key & sshpp::Key::operator= ( const Key )
delete

◆ operator bool()

sshpp::Key::operator bool ( ) const
inlineexplicitnoexcept

◆ native_handle()

native_key sshpp::Key::native_handle ( ) const
inlinenoexcept

◆ from_native()

SSHPP_INLINE Key sshpp::Key::from_native ( native_key  n,
Ownership  o 
)
static

◆ from_private_file()

SSHPP_INLINE Result< Key > sshpp::Key::from_private_file ( const std::filesystem::path &  path,
PassphraseCallback  cb = {} 
)
static

◆ from_public_file()

SSHPP_INLINE Result< Key > sshpp::Key::from_public_file ( const std::filesystem::path &  path)
static

◆ from_public_base64()

SSHPP_INLINE Result< Key > sshpp::Key::from_public_base64 ( std::string_view  b64,
KeyType  type 
)
static

◆ from_authorized_keys_line()

SSHPP_INLINE Result< Key > sshpp::Key::from_authorized_keys_line ( std::string_view  line)
static

◆ to_public_base64()

SSHPP_INLINE Result< std::string > sshpp::Key::to_public_base64 ( ) const

◆ to_authorized_keys_line()

SSHPP_INLINE Result< std::string > sshpp::Key::to_authorized_keys_line ( std::string_view  comment = {}) const

◆ write_public_file()

SSHPP_INLINE Result< void > sshpp::Key::write_public_file ( const std::filesystem::path &  path) const

◆ public_part()

SSHPP_INLINE Result< Key > sshpp::Key::public_part ( ) const

◆ type()

SSHPP_INLINE KeyType sshpp::Key::type ( ) const
noexcept

◆ type_name()

SSHPP_INLINE std::string sshpp::Key::type_name ( ) const

◆ bits()

SSHPP_INLINE int sshpp::Key::bits ( ) const
noexcept

◆ is_private()

SSHPP_INLINE bool sshpp::Key::is_private ( ) const
noexcept

◆ is_public()

SSHPP_INLINE bool sshpp::Key::is_public ( ) const
noexcept

◆ fingerprint()

SSHPP_INLINE Result< Fingerprint > sshpp::Key::fingerprint ( HashType  type = HashType::sha256) const

◆ equals()

SSHPP_INLINE bool sshpp::Key::equals ( const Key other,
bool  compare_private = false 
) const
noexcept

◆ generate()

SSHPP_INLINE Result< Key > sshpp::Key::generate ( KeyType  type,
int  bits = 0 
)
static

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