10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
Crypto.h
1#ifndef TENDUKE_CRYPTO_CRYPTO_H
2#define TENDUKE_CRYPTO_CRYPTO_H
3
4#include <memory>
5
6#include "./Ciphers.h"
7#include "./asymmetric/PublicKeyFactory.h"
8#include "./kdf/KDFProvider.h"
9#include "./msgauthn/HashFactory.h"
10#include "../utl/random/RandomBytes.h"
11
12namespace tenduke { namespace crypto {
13
18class Crypto
19{
20public:
21 virtual ~Crypto() = default;
22
31 explicit Crypto(
32 const std::shared_ptr<::tenduke::crypto::Ciphers> &ciphersService,
33 const std::shared_ptr<::tenduke::crypto::HashFactory> &hashFactory,
34 const std::shared_ptr<::tenduke::crypto::KDFProvider> &kdf,
35 const std::shared_ptr<::tenduke::crypto::PublicKeyFactory> &publicKeyFactory,
36 const std::shared_ptr<::tenduke::utl::random::RandomBytes> &randomBytes
37 )
38 : ciphersService(ciphersService)
39 , hashFactory_(hashFactory)
40 , kdf_(kdf)
41 , publicKeyFactory(publicKeyFactory)
42 , randomBytes_(randomBytes)
43 {
44 }
45
49 virtual std::shared_ptr<const ::tenduke::crypto::Ciphers> ciphers() const { return ciphersService; }
50
53 virtual std::shared_ptr<const ::tenduke::crypto::KDFProvider> kdf() const { return kdf_; }
54
57 virtual std::shared_ptr<const ::tenduke::crypto::HashFactory> hash() const { return hashFactory_; }
58
61 virtual std::shared_ptr<const ::tenduke::crypto::PublicKeyFactory> publicKeys() const { return publicKeyFactory; }
62
63
66 virtual std::shared_ptr<::tenduke::utl::random::RandomBytes> randomBytes() {return randomBytes_;}
67
68private:
69 std::shared_ptr<const ::tenduke::crypto::Ciphers> ciphersService;
70 std::shared_ptr<const ::tenduke::crypto::HashFactory> hashFactory_;
71 std::shared_ptr<const ::tenduke::crypto::PublicKeyFactory> publicKeyFactory;
72 std::shared_ptr<const ::tenduke::crypto::KDFProvider> kdf_;
73 std::shared_ptr<::tenduke::utl::random::RandomBytes> randomBytes_;
74};
75
76
77}}
78
79#endif //TENDUKE_CRYPTO_CRYPTO_H
Crypto(const std::shared_ptr<::tenduke::crypto::Ciphers > &ciphersService, const std::shared_ptr<::tenduke::crypto::HashFactory > &hashFactory, const std::shared_ptr<::tenduke::crypto::KDFProvider > &kdf, const std::shared_ptr<::tenduke::crypto::PublicKeyFactory > &publicKeyFactory, const std::shared_ptr<::tenduke::utl::random::RandomBytes > &randomBytes)
Constructs a new instance.
Definition Crypto.h:31
virtual std::shared_ptr< const ::tenduke::crypto::HashFactory > hash() const
Returns hash factory.
Definition Crypto.h:57
virtual std::shared_ptr< const ::tenduke::crypto::Ciphers > ciphers() const
Returns "Ciphers"-service.
Definition Crypto.h:49
virtual std::shared_ptr< const ::tenduke::crypto::PublicKeyFactory > publicKeys() const
Returns "Public keys"-service.
Definition Crypto.h:61
virtual std::shared_ptr<::tenduke::utl::random::RandomBytes > randomBytes()
Returns cryptographically secure random number generator.
Definition Crypto.h:66
virtual std::shared_ptr< const ::tenduke::crypto::KDFProvider > kdf() const
Returns registered Key Derivation Functions.
Definition Crypto.h:53
Crypto(const std::shared_ptr<::tenduke::crypto::Ciphers > &ciphersService, const std::shared_ptr<::tenduke::crypto::HashFactory > &hashFactory, const std::shared_ptr<::tenduke::crypto::KDFProvider > &kdf, const std::shared_ptr<::tenduke::crypto::PublicKeyFactory > &publicKeyFactory, const std::shared_ptr<::tenduke::utl::random::RandomBytes > &randomBytes)
Constructs a new instance.
Definition Crypto.h:31
Cryptography services.
Definition AbstractCiphers.h:18
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4