Passwordfile library 5.1.0
C++ library to read/write passwords from/to encrypted files
Loading...
Searching...
No Matches
Util::OpenSsl Namespace Reference

Contains functions utilizing the usage of OpenSSL. More...

Classes

struct  Sha256Sum
struct  TOTP

Functions

PASSWORD_FILE_EXPORT void init ()
 Initializes OpenSSL.
PASSWORD_FILE_EXPORT void clean ()
 Cleans resources of OpenSSL.
PASSWORD_FILE_EXPORT Sha256Sum computeSha256Sum (const unsigned char *buffer, std::size_t size)
 Computes a SHA-256 sum using OpenSSL.
PASSWORD_FILE_EXPORT std::uint32_t generateRandomNumber (std::uint32_t min, std::uint32_t max)
 Generates a random number using OpenSSL.
PASSWORD_FILE_EXPORT TOTP computeTOTP (std::string_view url, CppUtilities::DateTime time)
 Compute a token following the TOTP standard (RFC 6238).

Detailed Description

Contains functions utilizing the usage of OpenSSL.

Function Documentation

◆ clean()

void Util::OpenSsl::clean ( )

Cleans resources of OpenSSL.

Definition at line 119 of file openssl.cpp.

◆ computeSha256Sum()

Sha256Sum Util::OpenSsl::computeSha256Sum ( const unsigned char * buffer,
std::size_t size )

Computes a SHA-256 sum using OpenSSL.

Definition at line 130 of file openssl.cpp.

◆ computeTOTP()

TOTP Util::OpenSsl::computeTOTP ( std::string_view url,
CppUtilities::DateTime time )

Compute a token following the TOTP standard (RFC 6238).

Parameters
urlSpecifies a URL containing the secret and parameters, e.g. "otpauth://totp/some/path?secret=ABCDABCDABCDABCD&period=30&digits=6&issuer=some_issuer".
timeSpecifies the time to compute the for (UTC).
Returns
Returns the token with as many number of digits as specified in the URL.
Exceptions

Throws a CppUtilities::ConversionException if URL parameters are invalid/missing.

Definition at line 157 of file openssl.cpp.

◆ generateRandomNumber()

std::uint32_t Util::OpenSsl::generateRandomNumber ( std::uint32_t min,
std::uint32_t max )

Generates a random number using OpenSSL.

Definition at line 140 of file openssl.cpp.

◆ init()

void Util::OpenSsl::init ( )

Initializes OpenSSL.

Definition at line 108 of file openssl.cpp.