10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::crypto Namespace Reference

Detailed Description

Cryptography services.

Namespaces

namespace  libcrypto
 libcrypto based implementations of cryptography services.

Classes

class  AbstractCiphers
 Base class for cipher implementations using AES-256-GCM with PBKDF2 key derivation. More...
class  Cipher
 Cipher for encrypting / decrypting data. More...
class  Ciphers
 A "service locator" for cipher-related operations. More...
class  Crypto
 Cryptographic services. More...
class  CryptoException
 Thrown when something goes with crypto. More...
class  CryptographicHash
 A cryptographic hash function, like SHA-256. More...
class  DigitalSignatureVerifier
 Verifies digital signatures. More...
class  HashFactory
 Creates cryptographic hash functions. More...
class  KDFProvider
 Provides key derivation functions. More...
class  MessageDigest
 Simple MessageDigest-service: E.g. More...
class  MessageDigestVerifier
 Verifies a message by computing digest for the message and comparing the computed signature to the provided signature. More...
class  PBKDF2
 Derives keys using PBKDF2. More...
class  PrivateKey
 Private key. More...
class  PublicKey
 Public key. More...
class  PublicKeyFactory
 Creates cryptographical public keys. More...
struct  RSAPublicKeyParameters
 RSA public key parameters that have passed checkRSAPublicKeyParameters(). More...
class  SecretKey
 A secret key. More...

Enumerations

enum class  HashAlgorithm : std::int16_t { UNKNOWN = -1 , NONE = 0 , SHA256 = 1 }
 Currently supported hash algorithms.

Functions

RSAPublicKeyParameters checkRSAPublicKeyParameters (const tenduke::utl::BinaryData &modulus, const tenduke::utl::BinaryData &exponent)
 Checks that RSA public key parameters are safe to use for verifying signatures.
HashAlgorithm toHashAlgorithm (const std::string &algorithm)
 Converts string representation to HashAlgorithm enum.
const char * toString (const HashAlgorithm algorithm)
 Converts HashAlgorithm enum to string representation.

Variables

constexpr std::size_t MIN_RSA_MODULUS_BITS = 2048
 Smallest accepted RSA modulus, in bits.
constexpr std::size_t MAX_RSA_MODULUS_BITS = 16384
 Largest accepted RSA modulus, in bits (same as OpenSSL's OPENSSL_RSA_MAX_MODULUS_BITS).
constexpr std::size_t SHA256_HASH_LENGTH_BYTES = 32
 Length of SHA256 hash binary representation in bytes.

Function Documentation

◆ checkRSAPublicKeyParameters()

xdcrypto::RSAPublicKeyParameters tenduke::crypto::checkRSAPublicKeyParameters ( const tenduke::utl::BinaryData & modulus,
const tenduke::utl::BinaryData & exponent )

Checks that RSA public key parameters are safe to use for verifying signatures.

Requires a modulus of MIN_RSA_MODULUS_BITS to MAX_RSA_MODULUS_BITS bits and an odd public exponent of at least 3 that is smaller than the modulus.

Parameters
modulusmodulus (n) as big-endian unsigned integer
exponentpublic exponent (e) as big-endian unsigned integer
Returns
the parameters with leading zero bytes removed
Exceptions
tenduke::crypto::CryptoExceptionif the parameters are not acceptable

◆ toHashAlgorithm()

HashAlgorithm tenduke::crypto::toHashAlgorithm ( const std::string & algorithm)
inline

Converts string representation to HashAlgorithm enum.

Parameters
algorithmstring representation of hash algorithm
Returns
HashAlgorithm enum value

◆ toString()

const char * tenduke::crypto::toString ( const HashAlgorithm algorithm)
inline

Converts HashAlgorithm enum to string representation.

Parameters
algorithmHashAlgorithm enum value
Returns
string representation of hash algorithm