separated RsTlvSecurityKey into two incompatible classes to enforce the correct usage of private vs. public keys

This commit is contained in:
csoler 2016-06-02 23:47:57 -04:00
parent cbef01451c
commit 590be092e5
26 changed files with 600 additions and 351 deletions

View file

@ -327,6 +327,7 @@ bool rsa_sanity_check(RSA *rsa)
}
#warning this code should be using GxsSecurity signature code. Not some own made signature call.
bool RsRecogn::signTag(EVP_PKEY *signKey, RsGxsRecognTagItem *item)
{
@ -374,6 +375,8 @@ bool RsRecogn::signTag(EVP_PKEY *signKey, RsGxsRecognTagItem *item)
return true;
}
#warning this code should be using GxsSecurity signature code. Not some own made signature call.
bool RsRecogn::signSigner(EVP_PKEY *signKey, RsGxsRecognSignerItem *item)
{
std::cerr << "RsRecogn::signSigner()";
@ -429,6 +432,7 @@ bool RsRecogn::signSigner(EVP_PKEY *signKey, RsGxsRecognSignerItem *item)
return true;
}
#warning this code should be using GxsSecurity signature code. Not some own made signature call.
bool RsRecogn::signTagRequest(EVP_PKEY *signKey, RsGxsRecognReqItem *item)
{
@ -560,7 +564,7 @@ RsGxsRecognTagItem *RsRecogn::extractTag(const std::string &encoded)
}
bool RsRecogn::createTagRequest(const RsTlvSecurityKey &key, const RsGxsId &id, const std::string &nickname, uint16_t tag_class, uint16_t tag_type, const std::string &comment, std::string &tag)
bool RsRecogn::createTagRequest(const RsTlvPrivateRSAKey &key, const RsGxsId &id, const std::string &nickname, uint16_t tag_class, uint16_t tag_type, const std::string &comment, std::string &tag)
{
EVP_PKEY *signKey = EVP_PKEY_new();
RSA *rsakey = d2i_RSAPrivateKey(NULL, (const unsigned char **)&key.keyData.bin_data, key.keyData.bin_len);

View file

@ -52,7 +52,7 @@ std::string getRsaKeyId(RSA *pubkey);
RsGxsRecognTagItem *extractTag(const std::string &encoded);
bool createTagRequest(const RsTlvSecurityKey &key,
bool createTagRequest(const RsTlvPrivateRSAKey &key,
const RsGxsId &id, const std::string &nickname,
uint16_t tag_class, uint16_t tag_type,
const std::string &comment, std::string &tag);