Feature #2871
closedKeyChain: general signing API
Description
In the current implementation, when signing a packet, KeyChain prepares the SignatureInfo for the packet, because current SignatureInfo only contains KeyLocator and SignatureType which may only be determined by KeyChain.
Now the extension to SignatureInfo introduces new fields which cannot be determined by KeyChain (such as validity period, additional description, etc.), it would be desired to define a general interface of KeyChain to pass those information.
A solution is to pass an incomplete SignatureInfo (with KeyLocator and SignatureType missing) as an argument of the sign method. Caller of the sign method should prepare all the other field if necessary, and KeyChain will fill the missing SignatureType and KeyLocator.
A more general signing interface is to define a SigningInfo class which may contain the signer information (such as signing identity name, or signing key name, or signing certificate name, or nothing) and the incomplete SignatureInfo, so all the signing methods can be unified as:
void
sign(Data&, const SigningInfo&);
void
sign(Interest&, const SigningInfo&);