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_VERIFIER_HPP
7 : #define IROHA_CRYPTO_VERIFIER_HPP
8 :
9 : #include "cryptography/crypto_provider/crypto_defaults.hpp"
10 :
11 : namespace shared_model {
12 : namespace crypto {
13 :
14 : class Signed;
15 : class Blob;
16 : class PublicKey;
17 :
18 : /**
19 : * CryptoVerifier - adapter for generalization verification of cryptographic
20 : * signatures
21 : * @tparam Algorithm - cryptographic algorithm for verification
22 : */
23 : template <typename Algorithm = DefaultCryptoAlgorithmType>
24 : class CryptoVerifier {
25 : public:
26 : /**
27 : * Verify signature attached to source data
28 : * @param signedData - cryptographic signature
29 : * @param source - data that was signed
30 : * @param pubKey - public key of signatory
31 : * @return true if signature correct
32 : */
33 : static bool verify(const Signed &signedData,
34 : const Blob &source,
35 : const PublicKey &pubKey) {
36 16115 : return Algorithm::verify(signedData, source, pubKey);
37 : }
38 :
39 : /// close constructor for forbidding instantiation
40 : CryptoVerifier() = delete;
41 : };
42 : } // namespace crypto
43 : } // namespace shared_model
44 :
45 : #endif // IROHA_CRYPTO_VERIFIER_HPP
|