NAP
Functions
nap::openssl Namespace Reference

Functions

bool createSignature (const std::string &privkey, const std::string &message, const std::string &signingScheme, std::string &outSignature)
 
bool verifyMessage (const std::string &pubkey, const std::string &message, const std::string &signingScheme, const std::string &signature)
 
bool generateRSAKey (unsigned int bits, std::string &outPrivKey, std::string &outPubKey)
 
std::string sha256 (const std::string &str)
 
std::string encode64 (const std::string &str)
 
std::string decode64 (const std::string &str)
 

Function Documentation

◆ createSignature()

bool nap::openssl::createSignature ( const std::string &  privkey,
const std::string &  message,
const std::string &  signingScheme,
std::string &  outSignature 
)

Creates a signature for a given message using the given signing scheme and private key

Parameters
privkeythe private key to use
messagethe message to sign
signingSchemethe signing scheme to use
outSignaturethe created signature
Returns
true if the signature was created successfully

◆ decode64()

std::string nap::openssl::decode64 ( const std::string &  str)

Decodes a base64 string

Parameters
strthe string to decode
Returns
the decoded string

◆ encode64()

std::string nap::openssl::encode64 ( const std::string &  str)

Encodes a string to base64

Parameters
strthe string to encode
Returns
the encoded string

◆ generateRSAKey()

bool nap::openssl::generateRSAKey ( unsigned int  bits,
std::string &  outPrivKey,
std::string &  outPubKey 
)

Generates a RSA key pair

Parameters
bitsnumber of bits
outPrivKeythe private key generated
outPubKeythe public key generated
Returns
true if the key pair was generated successfully

◆ sha256()

std::string nap::openssl::sha256 ( const std::string &  str)

Generates a SHA256 hash of a string

Parameters
strthe string to hash
Returns
the hash

◆ verifyMessage()

bool nap::openssl::verifyMessage ( const std::string &  pubkey,
const std::string &  message,
const std::string &  signingScheme,
const std::string &  signature 
)

Verifies a message against a signature using the given signing scheme and public key

Parameters
pubkeythe public key to use
messagethe message to verify
signingSchemethe signing scheme to use
signaturethe signature to verify against
Returns
true if the message was verified successfully