36 static Name emptyName;
44 return emptySignatureInfo;
50 static Name digestSha256Identity(
"/localhost/identity/digest-sha256");
51 return digestSha256Identity;
57 static Name hmacIdentity(
"/localhost/identity/hmac");
62 const Name& signerName,
67 , m_info(signatureInfo)
88 if (signingStr.empty()) {
92 size_t pos = signingStr.find(
':');
93 if (pos == std::string::npos) {
94 NDN_THROW(std::invalid_argument(
"Invalid signing string cannot represent SigningInfo"));
97 std::string scheme = signingStr.substr(0, pos);
98 std::string nameArg = signingStr.substr(pos + 1);
100 if (scheme ==
"id") {
108 else if (scheme ==
"key") {
111 else if (scheme ==
"cert") {
114 else if (scheme ==
"hmac-sha256") {
119 NDN_THROW(std::invalid_argument(
"Invalid signing string scheme"));
145 m_name = certificateName;
158 m_hmacKey = make_shared<transform::PrivateKey>();
181 m_identity = identity;
197 m_info = signatureInfo;
218 NDN_THROW(std::invalid_argument(
"Unknown signer type"));
227 return os <<
"Signed Interest v0.3";
229 return os <<
"Signed Interest v0.2";
231 NDN_THROW(std::invalid_argument(
"Unknown signed Interest format"));
SigningInfo & setPibIdentity(const Identity &identity)
Set signer as a PIB identity handler identity.
Sign Interest using Packet Specification v0.3 semantics.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
SigningInfo & setDigestAlgorithm(const DigestAlgorithm &algorithm)
Set the digest algorithm for signing operations.
Use a SHA-256 digest only, no signer needs to be specified.
Sign Interest using Packet Specification v0.2 semantics.
Name & append(const Component &component)
Append a component.
Signing parameters passed to KeyChain.
HMAC key, supports sign/verify operations.
const Name & getSignerName() const
A frontend handle of a key instance.
SigningInfo & setSha256Signing()
Set SHA-256 as the signing method.
No signer is specified, use default setting or follow the trust schema.
static const Name & getDigestSha256Identity()
A localhost identity to indicate that the signature is generated using SHA-256.
Use the SHA-256 hash of the public key as key id.
Represents an absolute name.
const Name & getName() const
Get key name.
Signer is a certificate, use it directly.
static const SignatureInfo & getEmptySignatureInfo()
Get a SignatureInfo constructed with default values.
SigningInfo & setSigningCertName(const Name &certificateName)
Set signer as a certificate with name certificateName.
Signer is a key, use its default certificate.
SigningInfo & setSignatureInfo(const SignatureInfo &signatureInfo)
Set a semi-prepared SignatureInfo.
Represents a name component.
static const Name & getEmptyName()
shared_ptr< Buffer > buf()
Flush written data to the stream and return shared pointer to the underlying buffer.
const Name & getName() const
Get the name of the identity.
SigningInfo(SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=Name(), const SignatureInfo &signatureInfo=SignatureInfo())
Constructor.
SigningInfo & setSigningIdentity(const Name &identity)
Set signer as an identity with name identity.
Signer is an identity, use its default key and default certificate.
A frontend handle of an Identity.
implements an output stream that constructs ndn::Buffer
SigningInfo & setPibKey(const Key &key)
Set signer as a PIB key handler key.
void clear()
Remove all components.
std::ostream & operator<<(std::ostream &os, const SigningInfo &si)
static const Name & getHmacIdentity()
A localhost identity to indicate that the signature is generated using an HMAC key.
SigningInfo & setSigningHmacKey(const std::string &hmacKey)
Set signer to a base64-encoded HMAC key.
SigningInfo & setSigningKeyName(const Name &keyName)
Set signer as a key with name keyName.
SignerType getSignerType() const