Project

General

Profile

Feature #2922

Updated by Junxiao Shi almost 9 years ago

Currently, it requires too much typing to actually write a signing command. 
    For example, to sign with a cert name, one has to write 

     keyChain.sign(packet, security::SigningInfo(security::SigningInfo::SIGNER_TYPE_CERT, certName)); security::SigningInfo(security::SigningInfo::SIGNER_TYPE_NAME, name)); 

 We should One problem is too much typing and second is not really obvious what's going on. 

 I'm proposing to create a few helper functions for `SigningInfo` creation. classes (exported to ::ndn namespace, not just kept in ndn::security).    I think a simple thing like the following will do the job 

     class SigningInfoIdentity : public SigningInfo { ... }; 
     signingByIdentity(const Name& identity); 

     class SigningInfoCert : public SigningInfo { ... }; 
     signingByKey(const Name& identity, const name::Component& keyId); 

     class SigningInfoSha256 : public SigningInfo 
     signingByCertificate(const Name& certName); 

     SigningInfo 
     signingWithSha256(); { ... }; 

 These free functions should I'm not sure about proper names for these helper classes.    May be declared in `ndn::security` namespace, and exported it would be better to `ndn` namespace. 

 After this change, the above example can be written as: 

     keyChain.sign(packet, signingByCertificate(certName)); write `SignBy*` or `SignWith*`. 

Back