ethcrypto renamed to ethcore-crypto and moved to ethcore dir (#8340)

* ethcrypto renamed to ethcore-crypto and moved to ethcore dir

* fixed renaming
This commit is contained in:
Marek Kotewicz 2018-04-10 13:56:56 +02:00 committed by GitHub
parent 4f447c50b2
commit bd7273061e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 77 additions and 76 deletions

38
Cargo.lock generated
View File

@ -566,6 +566,18 @@ dependencies = [
name = "ethcore-bytes" name = "ethcore-bytes"
version = "0.1.0" version = "0.1.0"
[[package]]
name = "ethcore-crypto"
version = "0.1.0"
dependencies = [
"eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ethcore-devtools" name = "ethcore-devtools"
version = "1.11.0" version = "1.11.0"
@ -671,8 +683,8 @@ name = "ethcore-network"
version = "1.11.0" version = "1.11.0"
dependencies = [ dependencies = [
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-crypto 0.1.0",
"ethcore-io 1.11.0", "ethcore-io 1.11.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -688,10 +700,10 @@ dependencies = [
"bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-crypto 0.1.0",
"ethcore-io 1.11.0", "ethcore-io 1.11.0",
"ethcore-logger 1.11.0", "ethcore-logger 1.11.0",
"ethcore-network 1.11.0", "ethcore-network 1.11.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "igd 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -725,11 +737,11 @@ dependencies = [
"ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.11.0", "ethcore 1.11.0",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-crypto 0.1.0",
"ethcore-io 1.11.0", "ethcore-io 1.11.0",
"ethcore-logger 1.11.0", "ethcore-logger 1.11.0",
"ethcore-miner 1.11.0", "ethcore-miner 1.11.0",
"ethcore-transaction 0.1.0", "ethcore-transaction 0.1.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethjson 0.1.0", "ethjson 0.1.0",
"ethkey 0.3.0", "ethkey 0.3.0",
@ -760,10 +772,10 @@ dependencies = [
"ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "ethabi-derive 5.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore 1.11.0", "ethcore 1.11.0",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-crypto 0.1.0",
"ethcore-logger 1.11.0", "ethcore-logger 1.11.0",
"ethcore-sync 1.11.0", "ethcore-sync 1.11.0",
"ethcore-transaction 0.1.0", "ethcore-transaction 0.1.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)",
@ -868,18 +880,6 @@ dependencies = [
"unexpected 0.1.0", "unexpected 0.1.0",
] ]
[[package]]
name = "ethcrypto"
version = "0.1.0"
dependencies = [
"eth-secp256k1 0.5.7 (git+https://github.com/paritytech/rust-secp256k1)",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0",
"rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
"subtle 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"tiny-keccak 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ethereum-types" name = "ethereum-types"
version = "0.3.0" version = "0.3.0"
@ -950,7 +950,7 @@ name = "ethstore"
version = "0.2.0" version = "0.2.0"
dependencies = [ dependencies = [
"dir 0.1.0", "dir 0.1.0",
"ethcrypto 0.1.0", "ethcore-crypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2157,6 +2157,7 @@ dependencies = [
"ethash 1.11.0", "ethash 1.11.0",
"ethcore 1.11.0", "ethcore 1.11.0",
"ethcore-bytes 0.1.0", "ethcore-bytes 0.1.0",
"ethcore-crypto 0.1.0",
"ethcore-devtools 1.11.0", "ethcore-devtools 1.11.0",
"ethcore-io 1.11.0", "ethcore-io 1.11.0",
"ethcore-light 1.11.0", "ethcore-light 1.11.0",
@ -2166,7 +2167,6 @@ dependencies = [
"ethcore-private-tx 1.0.0", "ethcore-private-tx 1.0.0",
"ethcore-sync 1.11.0", "ethcore-sync 1.11.0",
"ethcore-transaction 0.1.0", "ethcore-transaction 0.1.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethjson 0.1.0", "ethjson 0.1.0",
"ethkey 0.3.0", "ethkey 0.3.0",
@ -2341,8 +2341,8 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ethcore-crypto 0.1.0",
"ethcore-network 1.11.0", "ethcore-network 1.11.0",
"ethcrypto 0.1.0",
"ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "ethereum-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ethkey 0.3.0", "ethkey 0.3.0",
"hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -1,5 +1,5 @@
[package] [package]
name = "ethcrypto" name = "ethcore-crypto"
version = "0.1.0" version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
@ -7,7 +7,7 @@ authors = ["Parity Technologies <admin@parity.io>"]
rust-crypto = "0.2.36" rust-crypto = "0.2.36"
tiny-keccak = "1.3" tiny-keccak = "1.3"
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", optional = true } eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", optional = true }
ethkey = { path = "../ethkey", optional = true } ethkey = { path = "../../ethkey", optional = true }
ethereum-types = "0.3" ethereum-types = "0.3"
subtle = "0.5" subtle = "0.5"

View File

@ -12,11 +12,11 @@ ethabi-contract = "5.0"
ethabi-derive = "5.0" ethabi-derive = "5.0"
ethcore = { path = ".." } ethcore = { path = ".." }
ethcore-bytes = { path = "../../util/bytes" } ethcore-bytes = { path = "../../util/bytes" }
ethcore-crypto = { path = "../crypto" }
ethcore-io = { path = "../../util/io" } ethcore-io = { path = "../../util/io" }
ethcore-logger = { path = "../../logger" } ethcore-logger = { path = "../../logger" }
ethcore-miner = { path = "../../miner" } ethcore-miner = { path = "../../miner" }
ethcore-transaction = { path = "../transaction" } ethcore-transaction = { path = "../transaction" }
ethcrypto = { path = "../../ethcrypto" }
ethereum-types = "0.3" ethereum-types = "0.3"
ethjson = { path = "../../json" } ethjson = { path = "../../json" }
ethkey = { path = "../../ethkey" } ethkey = { path = "../../ethkey" }

View File

@ -27,7 +27,7 @@ use ethcore::account_provider::AccountProvider;
use ethereum_types::{H128, H256, Address}; use ethereum_types::{H128, H256, Address};
use ethjson; use ethjson;
use ethkey::{Signature, Public}; use ethkey::{Signature, Public};
use ethcrypto; use crypto;
use futures::Future; use futures::Future;
use fetch::{Fetch, Client as FetchClient, Method, BodyReader, Request}; use fetch::{Fetch, Client as FetchClient, Method, BodyReader, Request};
use bytes::{Bytes, ToPretty}; use bytes::{Bytes, ToPretty};
@ -151,7 +151,7 @@ impl SecretStoreEncryptor {
let password = find_account_password(&self.config.passwords, &*accounts, &requester); let password = find_account_password(&self.config.passwords, &*accounts, &requester);
// decrypt Public // decrypt Public
let decrypted_bytes = accounts.decrypt(requester, password, &ethcrypto::DEFAULT_MAC, &encrypted_bytes)?; let decrypted_bytes = accounts.decrypt(requester, password, &crypto::DEFAULT_MAC, &encrypted_bytes)?;
let decrypted_key = Public::from_slice(&decrypted_bytes); let decrypted_key = Public::from_slice(&decrypted_bytes);
// and now take x coordinate of Public as a key // and now take x coordinate of Public as a key
@ -217,7 +217,7 @@ impl Encryptor for SecretStoreEncryptor {
// encrypt data // encrypt data
let mut cypher = Vec::with_capacity(plain_data.len() + initialisation_vector.len()); let mut cypher = Vec::with_capacity(plain_data.len() + initialisation_vector.len());
cypher.extend(repeat(0).take(plain_data.len())); cypher.extend(repeat(0).take(plain_data.len()));
ethcrypto::aes::encrypt(&key, initialisation_vector, plain_data, &mut cypher); crypto::aes::encrypt(&key, initialisation_vector, plain_data, &mut cypher);
cypher.extend_from_slice(&initialisation_vector); cypher.extend_from_slice(&initialisation_vector);
Ok(cypher) Ok(cypher)
@ -243,7 +243,7 @@ impl Encryptor for SecretStoreEncryptor {
let (cypher, iv) = cypher.split_at(cypher_len - INIT_VEC_LEN); let (cypher, iv) = cypher.split_at(cypher_len - INIT_VEC_LEN);
let mut plain_data = Vec::with_capacity(cypher_len - INIT_VEC_LEN); let mut plain_data = Vec::with_capacity(cypher_len - INIT_VEC_LEN);
plain_data.extend(repeat(0).take(cypher_len - INIT_VEC_LEN)); plain_data.extend(repeat(0).take(cypher_len - INIT_VEC_LEN));
ethcrypto::aes::decrypt(&key, &iv, cypher, &mut plain_data); crypto::aes::decrypt(&key, &iv, cypher, &mut plain_data);
Ok(plain_data) Ok(plain_data)
} }

View File

@ -26,11 +26,11 @@ mod messages;
mod error; mod error;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_io as io;
extern crate ethcore_bytes as bytes; extern crate ethcore_bytes as bytes;
extern crate ethcore_transaction as transaction; extern crate ethcore_crypto as crypto;
extern crate ethcore_io as io;
extern crate ethcore_miner; extern crate ethcore_miner;
extern crate ethcrypto; extern crate ethcore_transaction as transaction;
extern crate ethabi; extern crate ethabi;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey; extern crate ethkey;

View File

@ -17,7 +17,7 @@ tiny-keccak = "1.3"
time = "0.1.34" time = "0.1.34"
itertools = "0.5" itertools = "0.5"
parking_lot = "0.5" parking_lot = "0.5"
ethcrypto = { path = "../ethcrypto" } ethcore-crypto = { path = "../ethcore/crypto" }
ethereum-types = "0.3" ethereum-types = "0.3"
dir = { path = "../util/dir" } dir = { path = "../util/dir" }
smallvec = "0.4" smallvec = "0.4"

View File

@ -33,7 +33,7 @@ extern crate time;
extern crate tiny_keccak; extern crate tiny_keccak;
extern crate tempdir; extern crate tempdir;
extern crate ethcrypto as crypto; extern crate ethcore_crypto as crypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey as _ethkey; extern crate ethkey as _ethkey;
extern crate parity_wordlist; extern crate parity_wordlist;

View File

@ -39,6 +39,7 @@ jsonrpc-pubsub = { git = "https://github.com/paritytech/jsonrpc.git", branch = "
ethash = { path = "../ethash" } ethash = { path = "../ethash" }
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
ethcore-crypto = { path = "../ethcore/crypto" }
ethcore-devtools = { path = "../devtools" } ethcore-devtools = { path = "../devtools" }
ethcore-io = { path = "../util/io" } ethcore-io = { path = "../util/io" }
ethcore-light = { path = "../ethcore/light" } ethcore-light = { path = "../ethcore/light" }
@ -49,7 +50,6 @@ ethcore-sync = { path = "../ethcore/sync" }
ethcore-transaction = { path = "../ethcore/transaction" } ethcore-transaction = { path = "../ethcore/transaction" }
ethereum-types = "0.3" ethereum-types = "0.3"
ethcrypto = { path = "../ethcrypto" }
ethjson = { path = "../json" } ethjson = { path = "../json" }
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
ethstore = { path = "../ethstore" } ethstore = { path = "../ethstore" }

View File

@ -46,6 +46,7 @@ extern crate jsonrpc_pubsub;
extern crate ethash; extern crate ethash;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_bytes as bytes; extern crate ethcore_bytes as bytes;
extern crate ethcore_crypto as crypto;
extern crate ethcore_devtools as devtools; extern crate ethcore_devtools as devtools;
extern crate ethcore_io as io; extern crate ethcore_io as io;
extern crate ethcore_light as light; extern crate ethcore_light as light;
@ -54,7 +55,6 @@ extern crate ethcore_miner as miner;
extern crate ethcore_private_tx; extern crate ethcore_private_tx;
extern crate ethcore_sync as sync; extern crate ethcore_sync as sync;
extern crate ethcore_transaction as transaction; extern crate ethcore_transaction as transaction;
extern crate ethcrypto as crypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey; extern crate ethkey;
extern crate ethstore; extern crate ethstore;

View File

@ -24,14 +24,14 @@ tokio-proto = "0.1"
url = "1.0" url = "1.0"
ethcore = { path = "../ethcore" } ethcore = { path = "../ethcore" }
ethcore-bytes = { path = "../util/bytes" } ethcore-bytes = { path = "../util/bytes" }
ethcore-crypto = { path = "../ethcore/crypto" }
ethcore-logger = { path = "../logger" }
ethcore-sync = { path = "../ethcore/sync" } ethcore-sync = { path = "../ethcore/sync" }
ethcore-transaction = { path = "../ethcore/transaction" } ethcore-transaction = { path = "../ethcore/transaction" }
ethereum-types = "0.3" ethereum-types = "0.3"
kvdb = { path = "../util/kvdb" } kvdb = { path = "../util/kvdb" }
kvdb-rocksdb = { path = "../util/kvdb-rocksdb" } kvdb-rocksdb = { path = "../util/kvdb-rocksdb" }
keccak-hash = { path = "../util/hash" } keccak-hash = { path = "../util/hash" }
ethcore-logger = { path = "../logger" }
ethcrypto = { path = "../ethcrypto" }
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
lazy_static = "1.0" lazy_static = "1.0"
ethabi = "5.1" ethabi = "5.1"

View File

@ -21,7 +21,7 @@ use std::sync::mpsc;
use futures::{self, Future}; use futures::{self, Future};
use parking_lot::Mutex; use parking_lot::Mutex;
use tokio_core::reactor::Core; use tokio_core::reactor::Core;
use ethcrypto; use crypto;
use super::acl_storage::AclStorage; use super::acl_storage::AclStorage;
use super::key_storage::KeyStorage; use super::key_storage::KeyStorage;
use super::key_server_set::KeyServerSet; use super::key_server_set::KeyServerSet;
@ -105,7 +105,7 @@ impl DocumentKeyServer for KeyServerImpl {
self.store_document_key(key_id, author, encrypted_document_key.common_point, encrypted_document_key.encrypted_point)?; self.store_document_key(key_id, author, encrypted_document_key.common_point, encrypted_document_key.encrypted_point)?;
// encrypt document key with requestor public key // encrypt document key with requestor public key
let document_key = ethcrypto::ecies::encrypt(&public, &ethcrypto::DEFAULT_MAC, &document_key) let document_key = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &document_key)
.map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?; .map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?;
Ok(document_key) Ok(document_key)
} }
@ -122,7 +122,7 @@ impl DocumentKeyServer for KeyServerImpl {
.decrypted_secret; .decrypted_secret;
// encrypt document key with requestor public key // encrypt document key with requestor public key
let document_key = ethcrypto::ecies::encrypt(&public, &ethcrypto::DEFAULT_MAC, &document_key) let document_key = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &document_key)
.map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?; .map_err(|err| Error::Internal(format!("Error encrypting document key: {}", err)))?;
Ok(document_key) Ok(document_key)
} }
@ -152,7 +152,7 @@ impl MessageSigner for KeyServerImpl {
combined_signature[32..].clone_from_slice(&**message_signature.1); combined_signature[32..].clone_from_slice(&**message_signature.1);
// encrypt combined signature with requestor public key // encrypt combined signature with requestor public key
let message_signature = ethcrypto::ecies::encrypt(&public, &ethcrypto::DEFAULT_MAC, &combined_signature) let message_signature = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &combined_signature)
.map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?; .map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?;
Ok(message_signature) Ok(message_signature)
} }
@ -167,7 +167,7 @@ impl MessageSigner for KeyServerImpl {
let message_signature = signing_session.wait()?; let message_signature = signing_session.wait()?;
// encrypt combined signature with requestor public key // encrypt combined signature with requestor public key
let message_signature = ethcrypto::ecies::encrypt(&public, &ethcrypto::DEFAULT_MAC, &*message_signature) let message_signature = crypto::ecies::encrypt(&public, &crypto::DEFAULT_MAC, &*message_signature)
.map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?; .map_err(|err| Error::Internal(format!("Error encrypting message signature: {}", err)))?;
Ok(message_signature) Ok(message_signature)
} }
@ -229,7 +229,7 @@ pub mod tests {
use std::sync::Arc; use std::sync::Arc;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ethcrypto; use crypto;
use ethkey::{self, Secret, Random, Generator, verify_public}; use ethkey::{self, Secret, Random, Generator, verify_public};
use acl_storage::DummyAclStorage; use acl_storage::DummyAclStorage;
use key_storage::KeyStorage; use key_storage::KeyStorage;
@ -358,12 +358,12 @@ pub mod tests {
let secret = Random.generate().unwrap().secret().clone(); let secret = Random.generate().unwrap().secret().clone();
let signature = ethkey::sign(&secret, &document).unwrap(); let signature = ethkey::sign(&secret, &document).unwrap();
let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap();
let generated_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &generated_key).unwrap(); let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap();
// now let's try to retrieve key back // now let's try to retrieve key back
for key_server in key_servers.iter() { for key_server in key_servers.iter() {
let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap(); let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap();
let retrieved_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap();
assert_eq!(retrieved_key, generated_key); assert_eq!(retrieved_key, generated_key);
} }
} }
@ -380,12 +380,12 @@ pub mod tests {
let secret = Random.generate().unwrap().secret().clone(); let secret = Random.generate().unwrap().secret().clone();
let signature = ethkey::sign(&secret, &document).unwrap(); let signature = ethkey::sign(&secret, &document).unwrap();
let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), *threshold).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), *threshold).unwrap();
let generated_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &generated_key).unwrap(); let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap();
// now let's try to retrieve key back // now let's try to retrieve key back
for (i, key_server) in key_servers.iter().enumerate() { for (i, key_server) in key_servers.iter().enumerate() {
let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap(); let retrieved_key = key_server.restore_document_key(&document, &signature.clone().into()).unwrap();
let retrieved_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap();
assert_eq!(retrieved_key, generated_key); assert_eq!(retrieved_key, generated_key);
let key_share = key_storages[i].get(&document).unwrap().unwrap(); let key_share = key_storages[i].get(&document).unwrap().unwrap();
@ -419,7 +419,7 @@ pub mod tests {
// now let's try to retrieve key back // now let's try to retrieve key back
for key_server in key_servers.iter() { for key_server in key_servers.iter() {
let retrieved_key = key_server.restore_document_key(&server_key_id, &signature.clone().into()).unwrap(); let retrieved_key = key_server.restore_document_key(&server_key_id, &signature.clone().into()).unwrap();
let retrieved_key = ethcrypto::ecies::decrypt(&requestor_secret, &ethcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); let retrieved_key = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap();
let retrieved_key = Public::from_slice(&retrieved_key); let retrieved_key = Public::from_slice(&retrieved_key);
assert_eq!(retrieved_key, generated_key); assert_eq!(retrieved_key, generated_key);
} }
@ -442,7 +442,7 @@ pub mod tests {
// sign message // sign message
let message_hash = H256::from(42); let message_hash = H256::from(42);
let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap();
let combined_signature = ethcrypto::ecies::decrypt(&requestor_secret, &ethcrypto::DEFAULT_MAC, &combined_signature).unwrap(); let combined_signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &combined_signature).unwrap();
let signature_c = Secret::from_slice(&combined_signature[..32]); let signature_c = Secret::from_slice(&combined_signature[..32]);
let signature_s = Secret::from_slice(&combined_signature[32..]); let signature_s = Secret::from_slice(&combined_signature[32..]);
@ -462,14 +462,14 @@ pub mod tests {
let secret = Random.generate().unwrap().secret().clone(); let secret = Random.generate().unwrap().secret().clone();
let signature = ethkey::sign(&secret, &document).unwrap(); let signature = ethkey::sign(&secret, &document).unwrap();
let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap(); let generated_key = key_servers[0].generate_document_key(&document, &signature.clone().into(), threshold).unwrap();
let generated_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &generated_key).unwrap(); let generated_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &generated_key).unwrap();
// remove key from node0 // remove key from node0
key_servers[0].cluster().key_storage().remove(&document).unwrap(); key_servers[0].cluster().key_storage().remove(&document).unwrap();
// now let's try to retrieve key back by requesting it from node0, so that session must be delegated // now let's try to retrieve key back by requesting it from node0, so that session must be delegated
let retrieved_key = key_servers[0].restore_document_key(&document, &signature.into()).unwrap(); let retrieved_key = key_servers[0].restore_document_key(&document, &signature.into()).unwrap();
let retrieved_key = ethcrypto::ecies::decrypt(&secret, &ethcrypto::DEFAULT_MAC, &retrieved_key).unwrap(); let retrieved_key = crypto::ecies::decrypt(&secret, &crypto::DEFAULT_MAC, &retrieved_key).unwrap();
assert_eq!(retrieved_key, generated_key); assert_eq!(retrieved_key, generated_key);
} }
@ -491,7 +491,7 @@ pub mod tests {
// sign message // sign message
let message_hash = H256::from(42); let message_hash = H256::from(42);
let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); let combined_signature = key_servers[0].sign_message_schnorr(&server_key_id, &signature.into(), message_hash.clone()).unwrap();
let combined_signature = ethcrypto::ecies::decrypt(&requestor_secret, &ethcrypto::DEFAULT_MAC, &combined_signature).unwrap(); let combined_signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &combined_signature).unwrap();
let signature_c = Secret::from_slice(&combined_signature[..32]); let signature_c = Secret::from_slice(&combined_signature[..32]);
let signature_s = Secret::from_slice(&combined_signature[32..]); let signature_s = Secret::from_slice(&combined_signature[32..]);
@ -517,7 +517,7 @@ pub mod tests {
// sign message // sign message
let message_hash = H256::random(); let message_hash = H256::random();
let signature = key_servers[0].sign_message_ecdsa(&server_key_id, &signature.into(), message_hash.clone()).unwrap(); let signature = key_servers[0].sign_message_ecdsa(&server_key_id, &signature.into(), message_hash.clone()).unwrap();
let signature = ethcrypto::ecies::decrypt(&requestor_secret, &ethcrypto::DEFAULT_MAC, &signature).unwrap(); let signature = crypto::ecies::decrypt(&requestor_secret, &crypto::DEFAULT_MAC, &signature).unwrap();
let signature: H520 = signature[0..65].into(); let signature: H520 = signature[0..65].into();
// check signature // check signature

View File

@ -1269,8 +1269,8 @@ mod tests {
assert!(decrypted_secret.common_point.is_some()); assert!(decrypted_secret.common_point.is_some());
assert!(decrypted_secret.decrypt_shadows.is_some()); assert!(decrypted_secret.decrypt_shadows.is_some());
// check that KS client is able to restore original secret // check that KS client is able to restore original secret
use ethcrypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use ethcrypto::ecies::decrypt; use crypto::ecies::decrypt;
let decrypt_shadows: Vec<_> = decrypted_secret.decrypt_shadows.unwrap().into_iter() let decrypt_shadows: Vec<_> = decrypted_secret.decrypt_shadows.unwrap().into_iter()
.map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap())) .map(|c| Secret::from_slice(&decrypt(key_pair.secret(), &DEFAULT_MAC, &c).unwrap()))
.collect(); .collect();
@ -1413,8 +1413,8 @@ mod tests {
assert_eq!(1, sessions.iter().skip(1).filter(|s| s.broadcast_shadows().is_none()).count()); assert_eq!(1, sessions.iter().skip(1).filter(|s| s.broadcast_shadows().is_none()).count());
// 4 nodes must be able to recover original secret // 4 nodes must be able to recover original secret
use ethcrypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use ethcrypto::ecies::decrypt; use crypto::ecies::decrypt;
let result = sessions[0].decrypted_secret().unwrap().unwrap(); let result = sessions[0].decrypted_secret().unwrap().unwrap();
assert_eq!(3, sessions.iter().skip(1).filter(|s| s.decrypted_secret() == Some(Ok(result.clone()))).count()); assert_eq!(3, sessions.iter().skip(1).filter(|s| s.decrypted_secret() == Some(Ok(result.clone()))).count());
let decrypt_shadows: Vec<_> = result.decrypt_shadows.unwrap().into_iter() let decrypt_shadows: Vec<_> = result.decrypt_shadows.unwrap().into_iter()

View File

@ -37,7 +37,7 @@ use std::sync::Arc;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use futures::{Future, Poll, Async}; use futures::{Future, Poll, Async};
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use ethcrypto::ecdh::agree; use crypto::ecdh::agree;
use ethkey::{Random, Generator, KeyPair, Public, Signature, verify_public, sign, recover}; use ethkey::{Random, Generator, KeyPair, Public, Signature, verify_public, sign, recover};
use ethereum_types::H256; use ethereum_types::H256;
use key_server_cluster::{NodeId, Error, NodeKeyPair}; use key_server_cluster::{NodeId, Error, NodeKeyPair};

View File

@ -19,7 +19,7 @@ use std::u16;
use std::ops::Deref; use std::ops::Deref;
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use serde_json; use serde_json;
use ethcrypto::ecies; use crypto::ecies;
use ethkey::{Secret, KeyPair}; use ethkey::{Secret, KeyPair};
use ethkey::math::curve_order; use ethkey::math::curve_order;
use ethereum_types::{H256, U256}; use ethereum_types::{H256, U256};
@ -306,7 +306,7 @@ pub mod tests {
use futures::Poll; use futures::Poll;
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use ethkey::{Random, Generator, KeyPair}; use ethkey::{Random, Generator, KeyPair};
use ethcrypto::ecdh::agree; use crypto::ecdh::agree;
use key_server_cluster::Error; use key_server_cluster::Error;
use key_server_cluster::message::Message; use key_server_cluster::message::Message;
use super::{MESSAGE_HEADER_SIZE, CURRENT_HEADER_VERSION, MessageHeader, fix_shared_key, encrypt_message, use super::{MESSAGE_HEADER_SIZE, CURRENT_HEADER_VERSION, MessageHeader, fix_shared_key, encrypt_message,

View File

@ -17,8 +17,8 @@
use std::collections::{BTreeSet, BTreeMap}; use std::collections::{BTreeSet, BTreeMap};
use ethereum_types::H256; use ethereum_types::H256;
use ethkey::{Public, Secret}; use ethkey::{Public, Secret};
use ethcrypto::ecies::encrypt; use crypto::ecies::encrypt;
use ethcrypto::DEFAULT_MAC; use crypto::DEFAULT_MAC;
use key_server_cluster::{Error, NodeId, DocumentKeyShare, EncryptedDocumentKeyShadow}; use key_server_cluster::{Error, NodeId, DocumentKeyShare, EncryptedDocumentKeyShadow};
use key_server_cluster::math; use key_server_cluster::math;
use key_server_cluster::jobs::job_session::{JobPartialRequestAction, JobPartialResponseAction, JobExecutor}; use key_server_cluster::jobs::job_session::{JobPartialRequestAction, JobPartialResponseAction, JobExecutor};

View File

@ -17,7 +17,7 @@
use std::fmt; use std::fmt;
use std::io::Error as IoError; use std::io::Error as IoError;
use ethkey; use ethkey;
use ethcrypto; use crypto;
use super::types::all::ServerKeyId; use super::types::all::ServerKeyId;
pub use super::traits::NodeKeyPair; pub use super::traits::NodeKeyPair;
@ -124,8 +124,8 @@ impl From<ethkey::Error> for Error {
} }
} }
impl From<ethcrypto::Error> for Error { impl From<crypto::Error> for Error {
fn from(err: ethcrypto::Error) -> Self { fn from(err: crypto::Error) -> Self {
Error::EthKey(err.into()) Error::EthKey(err.into())
} }
} }

View File

@ -18,10 +18,10 @@ extern crate byteorder;
extern crate ethabi; extern crate ethabi;
extern crate ethcore; extern crate ethcore;
extern crate ethcore_bytes as bytes; extern crate ethcore_bytes as bytes;
extern crate ethcore_crypto as crypto;
extern crate ethcore_logger as logger; extern crate ethcore_logger as logger;
extern crate ethcore_sync as sync; extern crate ethcore_sync as sync;
extern crate ethcore_transaction as transaction; extern crate ethcore_transaction as transaction;
extern crate ethcrypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey; extern crate ethkey;
extern crate futures_cpupool; extern crate futures_cpupool;

View File

@ -15,7 +15,7 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>. // along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::sync::Arc; use std::sync::Arc;
use ethcrypto::ecdh::agree; use crypto::ecdh::agree;
use ethkey::{KeyPair, Public, Signature, Error as EthKeyError, sign, public_to_address}; use ethkey::{KeyPair, Public, Signature, Error as EthKeyError, sign, public_to_address};
use ethcore::account_provider::AccountProvider; use ethcore::account_provider::AccountProvider;
use ethereum_types::{H256, Address}; use ethereum_types::{H256, Address};

View File

@ -21,13 +21,13 @@ ansi_term = "0.10"
rustc-hex = "1.0" rustc-hex = "1.0"
ethcore-io = { path = "../io" } ethcore-io = { path = "../io" }
ethcore-bytes = { path = "../bytes" } ethcore-bytes = { path = "../bytes" }
ethcore-crypto = { path = "../../ethcore/crypto" }
ethcore-logger = { path ="../../logger" }
ethcore-network = { path = "../network" } ethcore-network = { path = "../network" }
ethereum-types = "0.3" ethereum-types = "0.3"
ethkey = { path = "../../ethkey" } ethkey = { path = "../../ethkey" }
ethcrypto = { path = "../../ethcrypto" }
rlp = { path = "../rlp" } rlp = { path = "../rlp" }
path = { path = "../path" } path = { path = "../path" }
ethcore-logger = { path ="../../logger" }
ipnetwork = "0.12.6" ipnetwork = "0.12.6"
keccak-hash = { path = "../hash" } keccak-hash = { path = "../hash" }
snappy = { git = "https://github.com/paritytech/rust-snappy" } snappy = { git = "https://github.com/paritytech/rust-snappy" }

View File

@ -61,6 +61,7 @@
extern crate ethcore_io as io; extern crate ethcore_io as io;
extern crate ethcore_bytes; extern crate ethcore_bytes;
extern crate ethcore_crypto as crypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate parking_lot; extern crate parking_lot;
extern crate mio; extern crate mio;
@ -73,7 +74,6 @@ extern crate igd;
extern crate libc; extern crate libc;
extern crate slab; extern crate slab;
extern crate ethkey; extern crate ethkey;
extern crate ethcrypto as crypto;
extern crate rlp; extern crate rlp;
extern crate bytes; extern crate bytes;
extern crate path; extern crate path;

View File

@ -7,11 +7,11 @@ version = "1.11.0"
authors = ["Parity Technologies <admin@parity.io>"] authors = ["Parity Technologies <admin@parity.io>"]
[dependencies] [dependencies]
error-chain = { version = "0.11", default-features = false }
ethcore-crypto = { path = "../../ethcore/crypto" }
ethcore-io = { path = "../io" } ethcore-io = { path = "../io" }
ethereum-types = "0.3" ethereum-types = "0.3"
ethkey = { path = "../../ethkey" } ethkey = { path = "../../ethkey" }
ethcrypto = { path = "../../ethcrypto" }
rlp = { path = "../rlp" }
ipnetwork = "0.12.6" ipnetwork = "0.12.6"
rlp = { path = "../rlp" }
snappy = { git = "https://github.com/paritytech/rust-snappy" } snappy = { git = "https://github.com/paritytech/rust-snappy" }
error-chain = { version = "0.11", default-features = false }

View File

@ -16,8 +16,8 @@
#![recursion_limit="128"] #![recursion_limit="128"]
extern crate ethcore_crypto as crypto;
extern crate ethcore_io as io; extern crate ethcore_io as io;
extern crate ethcrypto as crypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey; extern crate ethkey;
extern crate rlp; extern crate rlp;

View File

@ -9,7 +9,7 @@ bitflags = "0.9"
byteorder = "1.0.0" byteorder = "1.0.0"
ethereum-types = "0.3" ethereum-types = "0.3"
ethcore-network = { path = "../util/network" } ethcore-network = { path = "../util/network" }
ethcrypto = { path = "../ethcrypto" } ethcore-crypto = { path = "../ethcore/crypto" }
ethkey = { path = "../ethkey" } ethkey = { path = "../ethkey" }
hex = "0.2" hex = "0.2"
log = "0.3" log = "0.3"

View File

@ -18,8 +18,8 @@
//! interface. //! interface.
extern crate byteorder; extern crate byteorder;
extern crate ethcore_crypto as crypto;
extern crate ethcore_network as network; extern crate ethcore_network as network;
extern crate ethcrypto;
extern crate ethereum_types; extern crate ethereum_types;
extern crate ethkey; extern crate ethkey;
extern crate hex; extern crate hex;

View File

@ -16,6 +16,7 @@
//! Encryption schemes supported by RPC layer. //! Encryption schemes supported by RPC layer.
use crypto;
use ethereum_types::H256; use ethereum_types::H256;
use ethkey::{self, Public, Secret}; use ethkey::{self, Public, Secret};
use ring::aead::{self, AES_256_GCM, SealingKey, OpeningKey}; use ring::aead::{self, AES_256_GCM, SealingKey, OpeningKey};
@ -117,7 +118,7 @@ impl EncryptionInstance {
} }
} }
EncryptionInner::ECIES(valid_public) => { EncryptionInner::ECIES(valid_public) => {
::ethcrypto::ecies::encrypt(&valid_public, &[], plain) crypto::ecies::encrypt(&valid_public, &[], plain)
.expect("validity of public key an invariant of the type; qed") .expect("validity of public key an invariant of the type; qed")
} }
} }
@ -213,7 +214,7 @@ impl DecryptionInstance {
} }
DecryptionInner::ECIES(secret) => { DecryptionInner::ECIES(secret) => {
// secret is checked for validity, so only fails on invalid message. // secret is checked for validity, so only fails on invalid message.
::ethcrypto::ecies::decrypt(&secret, &[], ciphertext).ok() crypto::ecies::decrypt(&secret, &[], ciphertext).ok()
} }
} }
} }