Aktualizr
C++ SOTA Client
Static Public Member Functions | List of all members
Crypto Class Reference

Static Public Member Functions

static std::string sha256digest (const std::string &text)
 
static std::string sha512digest (const std::string &text)
 
static std::string RSAPSSSign (ENGINE *engine, const std::string &private_key, const std::string &message)
 
static std::string Sign (KeyType key_type, ENGINE *engine, const std::string &private_key, const std::string &message)
 
static std::string ED25519Sign (const std::string &private_key, const std::string &message)
 
static bool parseP12 (BIO *p12_bio, const std::string &p12_password, std::string *out_pkey, std::string *out_cert, std::string *out_ca)
 
static std::string extractSubjectCN (const std::string &cert)
 
static StructGuard< EVP_PKEY > generateRSAKeyPairEVP (KeyType key_type)
 
static StructGuard< EVP_PKEY > generateRSAKeyPairEVP (const int bits)
 
static bool generateRSAKeyPair (KeyType key_type, std::string *public_key, std::string *private_key)
 Generate a RSA keypair. More...
 
static bool generateEDKeyPair (std::string *public_key, std::string *private_key)
 
static bool generateKeyPair (KeyType key_type, std::string *public_key, std::string *private_key)
 
static bool RSAPSSVerify (const std::string &public_key, const std::string &signature, const std::string &message)
 
static bool ED25519Verify (const std::string &public_key, const std::string &signature, const std::string &message)
 
static bool IsRsaKeyType (KeyType type)
 
static KeyType IdentifyRSAKeyType (const std::string &public_key_pem)
 
static StructGuard< X509 > generateCert (const int rsa_bits, const int cert_days, const std::string &cert_c, const std::string &cert_st, const std::string &cert_o, const std::string &cert_cn, bool self_sign=false)
 
static void signCert (const std::string &cacert_path, const std::string &capkey_path, X509 *const certificate)
 
static void serializeCert (std::string *pkey, std::string *cert, X509 *const certificate)
 

Detailed Description

Definition at line 74 of file crypto.h.

Member Function Documentation

◆ generateRSAKeyPair()

bool Crypto::generateRSAKeyPair ( KeyType  key_type,
std::string *  public_key,
std::string *  private_key 
)
static

Generate a RSA keypair.

Parameters
key_typeAlgorithm used to generate the key
public_keyGenerated public part of key
private_keyGenerated private part of key
Returns
true if the keys are present at the end of this function (either they were created or existed already) false if key generation failed

Definition at line 405 of file crypto.cc.


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