StormByte C++ Library: Crypto module 0.0.9999
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
StormByte::Crypto::KeyPair::Generic Class Reference

A generic class. More...

#include <generic.hxx>

Inheritance diagram for StormByte::Crypto::KeyPair::Generic:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Crypto::KeyPair::Generic:
Collaboration graph
[legend]

Public Member Functions

 Generic (const Generic &other)=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept=default
 Virtual destructor.
 
Genericoperator= (const Generic &other)=default
 Copy assignment operator.
 
Genericoperator= (Generic &&other) noexcept=default
 Move assignment operator.
 
const std::string & PublicKey () const noexcept
 Gets the type of keypair.
 
const std::optional< std::string > & PrivateKey () const noexcept
 Gets the private key of the keypair.
 
enum Type Type () const noexcept
 Gets the type of keypair.
 
bool Save (const std::filesystem::path &path, const std::string &name) const noexcept
 Saves the keypair to the specified file paths.
 

Protected Member Functions

 Generic (enum Type type, const std::string &public_key, std::optional< std::string > private_key=std::nullopt)
 Constructor.
 

Protected Attributes

enum Type m_type
 The type of keypair.
 
std::string m_public_key
 The public key.
 
std::optional< std::string > m_private_key
 The private key.
 

Detailed Description

A generic class.

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Crypto::KeyPair::Generic::Generic ( const Generic other)
default

Copy constructor.

Parameters
otherThe other Generic keypair to copy from.

◆ Generic() [2/3]

StormByte::Crypto::KeyPair::Generic::Generic ( Generic &&  other)
defaultnoexcept

Move constructor.

Parameters
otherThe other Generic keypair to move from.

◆ Generic() [3/3]

StormByte::Crypto::KeyPair::Generic::Generic ( enum Type  type,
const std::string &  public_key,
std::optional< std::string >  private_key = std::nullopt 
)
inlineprotected

Constructor.

Parameters
typeThe type of keypair.

Member Function Documentation

◆ operator=() [1/2]

Generic & StormByte::Crypto::KeyPair::Generic::operator= ( const Generic other)
default

Copy assignment operator.

Parameters
otherThe other Generic keypair to copy from.
Returns
Reference to this Generic keypair.

◆ operator=() [2/2]

Generic & StormByte::Crypto::KeyPair::Generic::operator= ( Generic &&  other)
defaultnoexcept

Move assignment operator.

Parameters
otherThe other Generic keypair to move from.
Returns
Reference to this Generic keypair.

◆ PrivateKey()

const std::optional< std::string > & StormByte::Crypto::KeyPair::Generic::PrivateKey ( ) const
inlinenoexcept

Gets the private key of the keypair.

Returns
The private key of the keypair.

◆ PublicKey()

const std::string & StormByte::Crypto::KeyPair::Generic::PublicKey ( ) const
inlinenoexcept

Gets the type of keypair.

Returns
The type of keypair.

◆ Save()

bool StormByte::Crypto::KeyPair::Generic::Save ( const std::filesystem::path &  path,
const std::string &  name 
) const
noexcept

Saves the keypair to the specified file paths.

Parameters
pathThe directory path to save the keys.
nameThe base name for the key files.
Returns
true if the keypair was saved successfully, false otherwise.

◆ Type()

enum Type StormByte::Crypto::KeyPair::Generic::Type ( ) const
inlinenoexcept

Gets the type of keypair.

Returns
The type of keypair.

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