aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/hicn/transport/utils/identity.cc
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2020-01-07 11:46:02 +0100
committerMauro Sardara <msardara@cisco.com>2020-02-21 15:48:18 +0100
commit35058cdfe0134c88f1aa8d23342d1d7b9d39e296 (patch)
tree978ca9c2232ac381c8391b3d1eeb0f875670d5b1 /libtransport/src/hicn/transport/utils/identity.cc
parent0710f1ff754ebf01ae5befabb055349fe472b0c2 (diff)
[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 <acompagn+fdio@cisco.com> Signed-off-by: Olivier Roques <oroques+fdio@cisco.com> Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/hicn/transport/utils/identity.cc')
-rw-r--r--libtransport/src/hicn/transport/utils/identity.cc32
1 files changed, 8 insertions, 24 deletions
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<PARCCryptoSuite>(suite)));
- signer_ = std::make_shared<Signer>(signer);
-
- signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer);
+ signer_ = std::make_shared<Signer>(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<PARCCryptoHashType>(hash_algorithm));
- signer_ = std::make_shared<Signer>(signer);
-
- signature_length_ = (unsigned int)parcSigner_GetSignatureSize(signer);
+ signer_ = std::make_shared<Signer>(
+ 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<Signer> Identity::getSigner() { return signer_; }
-unsigned int Identity::getSignatureLength() const { return signature_length_; }
+size_t Identity::getSignatureLength() const {
+ return signer_->getSignatureLength();
+}
} // namespace utils