From 35058cdfe0134c88f1aa8d23342d1d7b9d39e296 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Tue, 7 Jan 2020 11:46:02 +0100 Subject: [HICN-2] Added P2P confidential communication on hICN P2P confidential communications exploit the TLS 1.3 protocol to let a consumer to establish a secure communication on an hICN name. Currently we don't support the consumer authentication (mutual authentication in TLS) and the 0-rtt session establishment. Change-Id: I2be073847c08a17f28c837d444081920c5e57a07 Signed-off-by: Alberto Compagno Signed-off-by: Olivier Roques Signed-off-by: Mauro Sardara --- .../hicn/transport/interfaces/socket_consumer.cc | 24 ++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libtransport/src/hicn/transport/interfaces/socket_consumer.cc') diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc index fba972fe5..b2c054947 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc +++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc @@ -48,6 +48,7 @@ ConsumerSocket::ConsumerSocket(int protocol, asio::io_service &io_service) rate_estimation_choice_(0), verifier_(std::make_shared()), verify_signature_(false), + key_content_(false), on_interest_output_(VOID_HANDLER), on_interest_timeout_(VOID_HANDLER), on_interest_satisfied_(VOID_HANDLER), @@ -106,9 +107,13 @@ int ConsumerSocket::asyncConsume(const Name &name) { return CONSUMER_RUNNING; } +bool ConsumerSocket::verifyKeyPackets() { + return transport_protocol_->verifyKeyPackets(); +} + void ConsumerSocket::stop() { - if (transport_protocol_->isRunning()) { - transport_protocol_->stop(); + if (transport_protocol_) { + if (transport_protocol_->isRunning()) transport_protocol_->stop(); } } @@ -312,6 +317,11 @@ int ConsumerSocket::setSocketOption(int socket_option_key, result = SOCKET_OPTION_SET; break; + case GeneralTransportOptions::KEY_CONTENT: + key_content_ = socket_option_value; + result = SOCKET_OPTION_SET; + break; + default: return result; } @@ -461,6 +471,7 @@ int ConsumerSocket::setSocketOption( if (!transport_protocol_->isRunning()) { switch (socket_option_key) { case GeneralTransportOptions::VERIFIER: + verifier_.reset(); verifier_ = socket_option_value; result = SOCKET_OPTION_SET; break; @@ -479,10 +490,7 @@ int ConsumerSocket::setSocketOption(int socket_option_key, switch (socket_option_key) { case GeneralTransportOptions::CERTIFICATE: key_id_ = verifier_->addKeyFromCertificate(socket_option_value); - - if (key_id_ != nullptr) { - result = SOCKET_OPTION_SET; - } + if (key_id_ != nullptr) result = SOCKET_OPTION_SET; break; case DataLinkOptions::OUTPUT_INTERFACE: @@ -614,6 +622,10 @@ int ConsumerSocket::getSocketOption(int socket_option_key, socket_option_value = verify_signature_; break; + case GeneralTransportOptions::KEY_CONTENT: + socket_option_value = key_content_; + break; + default: return SOCKET_OPTION_NOT_GET; } -- cgit 1.2.3-korg