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 --- libtransport/src/hicn/transport/utils/identity.cc | 32 ++++++----------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'libtransport/src/hicn/transport/utils/identity.cc') diff --git a/libtransport/src/hicn/transport/utils/identity.cc b/libtransport/src/hicn/transport/utils/identity.cc index d84129537..c5ab03e44 100644 --- a/libtransport/src/hicn/transport/utils/identity.cc +++ b/libtransport/src/hicn/transport/utils/identity.cc @@ -49,18 +49,14 @@ Identity::Identity(const std::string &keystore_name, identity_, parcCryptoSuite_GetCryptoHash(static_cast(suite))); - signer_ = std::make_shared(signer); - - signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer); + signer_ = std::make_shared(signer, suite); parcSigner_Release(&signer); parcIdentityFile_Release(&identity_file); } Identity::Identity(const Identity &other) - : signer_(other.signer_), - hash_algorithm_(other.hash_algorithm_), - signature_length_(other.signature_length_) { + : signer_(other.signer_), hash_algorithm_(other.hash_algorithm_) { parcSecurity_Init(); identity_ = parcIdentity_Acquire(other.identity_); } @@ -90,27 +86,13 @@ Identity::Identity(std::string &file_name, std::string &password, PARCSigner *signer = parcIdentity_CreateSigner( identity_, static_cast(hash_algorithm)); - signer_ = std::make_shared(signer); - - signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer); + signer_ = std::make_shared( + signer, CryptoSuite(parcSigner_GetCryptoSuite(signer))); parcSigner_Release(&signer); parcIdentityFile_Release(&identity_file); } -// Identity::Identity(Identity &&other) { -// identity_ = parcIdentity_Acquire(other.identity_); -//} - -// Identity& Identity::operator=(const Identity& other) { -// signer_ = other.signer_; -// hash_algorithm_ = other.hash_algorithm_; -// signature_length_ = other.signature_length_; -// identity_ = parcIdentity_Acquire(other.identity_); - -// parcSecurity_Init(); -// } - Identity::~Identity() { parcIdentity_Release(&identity_); parcSecurity_Fini(); @@ -124,8 +106,10 @@ std::string Identity::getPassword() { return std::string(parcIdentity_GetPassWord(identity_)); } -Signer &Identity::getSigner() { return *signer_; } +std::shared_ptr Identity::getSigner() { return signer_; } -unsigned int Identity::getSignatureLength() const { return signature_length_; } +size_t Identity::getSignatureLength() const { + return signer_->getSignatureLength(); +} } // namespace utils -- cgit 1.2.3-korg