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)
64 : m_type(SIGNER_TYPE_PIB_ID)
65 , m_identity(identity)
71 : m_type(SIGNER_TYPE_PIB_KEY)
81 if (signingStr.empty()) {
85 size_t pos = signingStr.find(
':');
87 if (pos == std::string::npos) {
88 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Invalid signing string cannot represent SigningInfo"));
91 std::string scheme = signingStr.substr(0, pos);
92 std::string nameArg = signingStr.substr(pos + 1);
102 else if (scheme ==
"key") {
105 else if (scheme ==
"cert") {
109 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Invalid signing string scheme"));
133 m_name = certificateName;
150 m_identity = identity;
166 m_info = signatureInfo;
187 return os <<
"key:" << si.
getPibKey().getName();
190 BOOST_THROW_EXCEPTION(std::invalid_argument(
"Unknown signer type"));
SigningInfo & setPibIdentity(const Identity &identity)
Set signer as a PIB identity handler identity.
Copyright (c) 2013-2016 Regents of the University of California.
given PIB identity handle, use its default key and default certificate
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.
std::ostream & operator<<(std::ostream &os, CommandInterestValidator::ErrorCode error)
const Identity & getPibIdentity() const
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.
Name abstraction to represent 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;.
given PIB key handle, use its default certificate
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
const Key & getPibKey() const
SigningInfo & setPibKey(const Key &key)
Set signer as a PIB key handler key.
void clear()
Clear all the components.
SignerType getSignerType() const
SigningInfo & setSigningKeyName(const Name &keyName)
Set signer as a key with name keyName.