StormByte-Crypto 2.0.0
C++26 cryptography module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Crypto::KeyPair Namespace Reference

Keypairs of the Crypto module. More...

Classes

class  DSA
 DSA keypair. More...
 
class  ECC
 ECC keypair. More...
 
class  ECDH
 ECDH keypair. More...
 
class  ECDSA
 ECDSA keypair. More...
 
class  ED25519
 Ed25519 keypair. More...
 
class  Exception
 Exception from the key-pair component. More...
 
class  Generic
 Abstract keypair. More...
 
class  RSA
 RSA keypair. More...
 
class  X25519
 X25519 keypair. More...
 

Enumerations

enum class  Type {
  DSA , ECC , ECDH , ECDSA ,
  ED25519 , RSA , X25519
}
 Available keypair algorithms. More...
 
enum class  StorageFormat { PEM , DER }
 On-disk encoding. More...
 

Functions

Generic::PointerType Create (Type type, unsigned short bits) noexcept
 Generate a keypair.
 
Generic::PointerType Load (const std::filesystem::path &publicKeyPath, const std::filesystem::path &privateKeyPath) noexcept
 Load from separate public and private files.
 
Generic::PointerType Load (const std::filesystem::path &publicKeyPath, const std::filesystem::path &privateKeyPath, const Secure::Password &password) noexcept
 Load from separate files; decrypt the private key if needed.
 
Generic::PointerType Load (const std::filesystem::path &path) noexcept
 Load from one file (public, private, or concatenated PEM).
 
Generic::PointerType Load (const std::filesystem::path &path, const Secure::Password &password) noexcept
 Load from one file; decrypt if needed.
 

Detailed Description

Keypairs of the Crypto module.

Key pairs of the Crypto module.

Enumeration Type Documentation

◆ StorageFormat

On-disk encoding.

Enumerator
PEM 

OpenSSL PEM.

DER 

Binary DER.

◆ Type

Available keypair algorithms.

Enumerator
DSA 

DSA.

ECC 

Elliptic-curve encryption.

ECDH 

ECDH.

ECDSA 

ECDSA.

ED25519 

Ed25519.

RSA 

RSA.

X25519 

X25519.

Function Documentation

◆ Create()

Generic::PointerType StormByte::Crypto::KeyPair::Create ( Type  type,
unsigned short  bits 
)
noexcept

Generate a keypair.

Parameters
typeAlgorithm.
bitsKey size in bits.
Returns
Keypair pointer.

◆ Load() [1/4]

Generic::PointerType StormByte::Crypto::KeyPair::Load ( const std::filesystem::path &  path)
noexcept

Load from one file (public, private, or concatenated PEM).

Parameters
pathKey file.
Returns
Keypair pointer, or nullptr.

◆ Load() [2/4]

Generic::PointerType StormByte::Crypto::KeyPair::Load ( const std::filesystem::path &  path,
const Secure::Password &  password 
)
noexcept

Load from one file; decrypt if needed.

Parameters
pathKey file.
passwordPassword for encrypted private material.
Returns
Keypair pointer, or nullptr.

◆ Load() [3/4]

Generic::PointerType StormByte::Crypto::KeyPair::Load ( const std::filesystem::path &  publicKeyPath,
const std::filesystem::path &  privateKeyPath 
)
noexcept

Load from separate public and private files.

Format is auto-detected.

Parameters
publicKeyPathPublic file, or empty.
privateKeyPathPrivate file, or empty. No default: a single path is Load(const std::filesystem::path&).
Returns
Keypair pointer, or nullptr.

◆ Load() [4/4]

Generic::PointerType StormByte::Crypto::KeyPair::Load ( const std::filesystem::path &  publicKeyPath,
const std::filesystem::path &  privateKeyPath,
const Secure::Password &  password 
)
noexcept

Load from separate files; decrypt the private key if needed.

Parameters
publicKeyPathPublic file, or empty.
privateKeyPathPrivate file.
passwordPassword for an encrypted private key.
Returns
Keypair pointer, or nullptr.