Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
3 : * http://soramitsu.co.jp
4 : *
5 : * Licensed under the Apache License, Version 2.0 (the "License");
6 : * you may not use this file except in compliance with the License.
7 : * You may obtain a copy of the License at
8 : *
9 : * http://www.apache.org/licenses/LICENSE-2.0
10 : *
11 : * Unless required by applicable law or agreed to in writing, software
12 : * distributed under the License is distributed on an "AS IS" BASIS,
13 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 : * See the License for the specific language governing permissions and
15 : * limitations under the License.
16 : */
17 :
18 : #include "cryptography/ed25519_sha3_impl/signer.hpp"
19 : #include "crypto/hash_types.hpp"
20 : #include "cryptography/ed25519_sha3_impl/internal/ed25519_impl.hpp"
21 : #include "cryptography/ed25519_sha3_impl/internal/sha3_hash.hpp"
22 :
23 : namespace shared_model {
24 : namespace crypto {
25 : Signed Signer::sign(const Blob &blob, const Keypair &keypair) {
26 5187 : return Signed(
27 5081 : iroha::sign(
28 5188 : iroha::sha3_256(crypto::toBinaryString(blob)).to_string(),
29 5188 : iroha::pubkey_t::from_string(toBinaryString(keypair.publicKey())),
30 5187 : iroha::privkey_t::from_string(
31 5189 : toBinaryString(keypair.privateKey())))
32 5161 : .to_string());
33 1 : }
34 : } // namespace crypto
35 : } // namespace shared_model
|