Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #ifndef IROHA_CRYPTO_SIGNER_HPP
7 : #define IROHA_CRYPTO_SIGNER_HPP
8 :
9 : #include "cryptography/blob.hpp"
10 : #include "cryptography/crypto_provider/crypto_defaults.hpp"
11 : #include "cryptography/keypair.hpp"
12 : #include "cryptography/signed.hpp"
13 :
14 : namespace shared_model {
15 : namespace crypto {
16 : /**
17 : * CryptoSigner - wrapper for generalization signing for different
18 : * cryptographic algorithms
19 : * @tparam Algorithm - cryptographic algorithm for singing
20 : */
21 : template <typename Algorithm = DefaultCryptoAlgorithmType>
22 : class CryptoSigner {
23 : public:
24 : /**
25 : * Generate signature for target data
26 : * @param blob - data for signing
27 : * @param keypair - (public, private) keys for signing
28 : * @return signature's blob
29 : */
30 : static Signed sign(const Blob &blob, const Keypair &keypair) {
31 6001 : return Algorithm::sign(blob, keypair);
32 : }
33 :
34 : /// close constructor for forbidding instantiation
35 : CryptoSigner() = delete;
36 : };
37 : } // namespace crypto
38 : } // namespace shared_model
39 : #endif // IROHA_CRYPTO_SIGNER_HPP
|