Feature/gateway shared key generation (#272)

* Changed identity keypair to use ed25519

* Encryption key is now x25519 based + compatibiltiy with sphinx

* Pathing and import fixes

* Moved all asymmetric keys to sub-module in crypto

* Extracted aes to separate module

* kdf module in crypto

* Ability to perform diffie hellman on encryption keys

* ecdsa on identity keys

* Extremely rough and incomplete registration handshake

* Authentication primitives

* Creating new random authenticationIV

* Wrapper type for the derived shared key

* Removed AuthToken in favour of using SharedKey for authentication

* Gateway identity keys

* Registration handshake without error mapping

* Gateway address in client config

* Added extra key for gateway presence

* Updated pemstore to work on borrows instead

* Gateway client trying to perform the handshake

* Gateway changes to allow for handshake and shared key

* Debug trait on sharedkey

* native client using updated gateway client

* Slightly updated gateway API

* Minor cleanup

* Fixed pemstore to correctly save multiple keypairs

* Gateway actually deriving shared key during handshake

* Gateway sending correct mid-handshake message

* Missing quotation mark in client config template

* Fixed template for correct shared key serialization

* Fixed gateway authentication

* Fixed tests

* Using correct gateway key when converting to sphinx node

* "get_all_clients" takes them from gateways as opposed to providers now

* cargo fmt

* Renamed pemstore methods

* Unused import

* Encryption of forward requests between client and gateway

* Updated sphinx dependency to use public revision

* Sending 'error' on handshake processing error

* Removed some dead code
This commit is contained in:
Jędrzej Stuczyński
2020-06-30 12:01:45 +01:00
committed by GitHub
parent cf2c200116
commit e849e45b12
68 changed files with 2736 additions and 1045 deletions
+1 -1
View File
@@ -14,7 +14,7 @@
use crate::config::Config;
use crate::node::packet_processing::PacketProcessor;
use crypto::encryption;
use crypto::asymmetric::encryption;
use directory_client::DirectoryClient;
use futures::channel::mpsc;
use log::*;
+2 -4
View File
@@ -13,7 +13,7 @@
// limitations under the License.
use crate::node::metrics;
use crypto::encryption;
use crypto::asymmetric::encryption;
use log::*;
use nymsphinx::addressing::nodes::{NymNodeRoutingAddress, NymNodeRoutingAddressError};
use nymsphinx::{
@@ -21,7 +21,6 @@ use nymsphinx::{
};
use std::convert::TryFrom;
use std::net::SocketAddr;
use std::ops::Deref;
use std::sync::Arc;
#[derive(Debug)]
@@ -96,8 +95,7 @@ impl PacketProcessor {
) -> Result<MixProcessingResult, MixProcessingError> {
// we received something resembling a sphinx packet, report it!
self.metrics_reporter.report_received();
match packet.process(self.secret_key.deref().inner()) {
match packet.process(&self.secret_key.as_ref().into()) {
Ok(ProcessedPacket::ProcessedPacketForwardHop(packet, address, delay)) => {
self.process_forward_hop(packet, address, delay).await
}