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"));
131 m_name = certificateName;
148 m_identity = identity;
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.
Copyright (c) 2011-2015 Regents of the University of California.
Represents a SignatureInfo TLV element.
const SignatureInfo & getSignatureInfo() const
DigestAlgorithm getDigestAlgorithm() const
SigningInfo(SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=getEmptyName(), const SignatureInfo &signatureInfo=getEmptySignatureInfo())
Constructor.
bool operator==(const SigningInfo &rhs) const
use sha256 digest, no signer needs to be specified
Signing parameters passed to KeyChain.
const Name & getSignerName() const
A frontend handle of a key instance.
SigningInfo & setSha256Signing()
Set Sha256 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 SHA256 hash of the public key as the key id.
Represents an absolute name.
const Name & getName() const
Get key 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()
const Name & getName() const
Get the name of the identity.
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.
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)
SigningInfo & setSigningKeyName(const Name &keyName)
Set signer as a key with name keyName.
SignerType getSignerType() const