30 static Name emptyName;
38 return emptySignatureInfo;
44 static Name digestSha256Identity(
"/localhost/identity/digest-sha256");
45 return digestSha256Identity;
49 const Name& signerName,
54 , m_info(signatureInfo)
78 if (signingStr.empty()) {
82 size_t pos = signingStr.find(
':');
83 if (pos == std::string::npos) {
84 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Invalid signing string cannot represent SigningInfo"));
87 std::string scheme = signingStr.substr(0, pos);
88 std::string nameArg = signingStr.substr(pos + 1);
98 else if (scheme ==
"key") {
101 else if (scheme ==
"cert") {
105 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Invalid signing string scheme"));
114 m_identity = Identity();
131 m_name = certificateName;
147 m_name = identity ? identity.getName() :
Name();
148 m_identity = identity;
156 m_name = key ? key.getName() :
Name();
164 m_info = signatureInfo;
184 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Unknown signer type"));
SigningInfo & setPibIdentity(const Identity &identity)
Set signer as a PIB identity handler identity.
bool operator==(const SigningInfo &rhs) const
Copyright (c) 2013-2017 Regents of the University of California.
Represents a SignatureInfo TLV element.
const Name & getSignerName() const
SigningInfo(SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=getEmptyName(), const SignatureInfo &signatureInfo=getEmptySignatureInfo())
Constructor.
use sha256 digest, no signer needs to be specified
Signing parameters passed to KeyChain.
SigningInfo & setSha256Signing()
Set Sha256 as the signing method.
no signer is specified, use default setting or follow the trust schema
const SignatureInfo & getSignatureInfo() const
static const Name & getDigestSha256Identity()
A localhost identity to indicate that the signature is generated using SHA-256.
Use the SHA256 hash of the public key as the key id.
Represents an absolute name.
signer is a certificate, use it directly
static const SignatureInfo & getEmptySignatureInfo()
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;.
static const Name & getEmptyName()
SigningInfo & setSigningIdentity(const Name &identity)
Set signer as an identity with name identity.
signer is an identity, use its default key and default certificate
SigningInfo & setPibKey(const Key &key)
Set signer as a PIB key handler key.
DigestAlgorithm getDigestAlgorithm() const
void clear()
Remove all components.
std::ostream & operator<<(std::ostream &os, const SigningInfo &si)
SignerType getSignerType() const
SigningInfo & setSigningKeyName(const Name &keyName)
Set signer as a key with name keyName.