Skip to content

Commit

Permalink
Merge pull request #13 from CoLearn-Dev/remove-openssl
Browse files Browse the repository at this point in the history
- remove openssl
  • Loading branch information
stneng authored Oct 2, 2022
2 parents 2876381 + 88d3a73 commit f5a82b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "colink"
version = "0.1.17"
version = "0.1.18"
edition = "2021"
description = "CoLink Rust SDK"
license = "MIT"
Expand All @@ -16,7 +16,7 @@ chrono = "0.4"
ctrlc = { version = "3.2", features = ["termination"] }
futures-lite = "1.12"
lapin = "2.1"
openssl = { version = "0.10", features = ["vendored"] }
sha2 = "0.10"
prost = "0.10"
rand = { version = "0.8.4", features = ["std_rng"] }
secp256k1 = { version = "0.21.2", features = ["rand-std"] }
Expand Down
7 changes: 5 additions & 2 deletions src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use lapin::{
types::FieldTable,
Connection, ConnectionProperties, Consumer,
};
use openssl::sha::sha256;
use secp256k1::Secp256k1;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use tonic::{
metadata::MetadataValue,
transport::{Certificate, Channel, ClientTlsConfig, Identity},
Expand Down Expand Up @@ -516,8 +516,11 @@ pub fn prepare_import_user_signature(
msg.extend_from_slice(&signature_timestamp.to_le_bytes());
msg.extend_from_slice(&expiration_timestamp.to_le_bytes());
msg.extend_from_slice(&core_pub_key.serialize());
let mut hasher = Sha256::new();
hasher.update(&msg);
let sha256 = hasher.finalize();
let signature = secp.sign_ecdsa(
&secp256k1::Message::from_slice(&sha256(&msg)).unwrap(),
&secp256k1::Message::from_slice(&sha256).unwrap(),
user_sec_key,
);
(signature_timestamp, signature.serialize_compact().to_vec())
Expand Down

0 comments on commit f5a82b0

Please sign in to comment.