Signing parameters passed to KeyChain. More...
#include <signing-info.hpp>
Classes | |
class | Error |
Public Types | |
enum | SignerType { SIGNER_TYPE_NULL = 0, SIGNER_TYPE_ID = 1, SIGNER_TYPE_KEY = 2, SIGNER_TYPE_CERT = 3, SIGNER_TYPE_SHA256 = 4, SIGNER_TYPE_HMAC = 5 } |
Public Member Functions | |
SigningInfo (SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=Name(), const SignatureInfo &signatureInfo=SignatureInfo()) | |
Constructor. More... | |
SigningInfo (const Identity &identity) | |
Construct from a PIB identity. More... | |
SigningInfo (const Key &key) | |
Construct from a PIB key. More... | |
SigningInfo (const std::string &signingStr) | |
Construct SigningInfo from its string representation. More... | |
SigningInfo & | setSigningIdentity (const Name &identity) |
Set signer as an identity with name identity . More... | |
SigningInfo & | setSigningKeyName (const Name &keyName) |
Set signer as a key with name keyName . More... | |
SigningInfo & | setSigningCertName (const Name &certificateName) |
Set signer as a certificate with name certificateName . More... | |
SigningInfo & | setSigningHmacKey (const std::string &hmacKey) |
Set signer to a base64-encoded HMAC key. More... | |
SigningInfo & | setSha256Signing () |
Set SHA-256 as the signing method. More... | |
SigningInfo & | setPibIdentity (const Identity &identity) |
Set signer as a PIB identity handler identity . More... | |
SigningInfo & | setPibKey (const Key &key) |
Set signer as a PIB key handler key . More... | |
SignerType | getSignerType () const |
const Name & | getSignerName () const |
const Identity & | getPibIdentity () const |
const Key & | getPibKey () const |
shared_ptr< transform::PrivateKey > | getHmacKey () const |
SigningInfo & | setDigestAlgorithm (const DigestAlgorithm &algorithm) |
Set the digest algorithm for signing operations. More... | |
DigestAlgorithm | getDigestAlgorithm () const |
SigningInfo & | setSignatureInfo (const SignatureInfo &signatureInfo) |
Set a semi-prepared SignatureInfo. More... | |
const SignatureInfo & | getSignatureInfo () const |
SigningInfo & | setSignedInterestFormat (SignedInterestFormat signedInterestFormat) |
Set signed Interest format. More... | |
SignedInterestFormat | getSignedInterestFormat () const |
Static Public Member Functions | |
static const Name & | getDigestSha256Identity () |
A localhost identity to indicate that the signature is generated using SHA-256. More... | |
static const Name & | getHmacIdentity () |
A localhost identity to indicate that the signature is generated using an HMAC key. More... | |
Friends | |
bool | operator== (const SigningInfo &lhs, const SigningInfo &rhs) |
bool | operator!= (const SigningInfo &lhs, const SigningInfo &rhs) |
Signing parameters passed to KeyChain.
A SigningInfo is invalid if the specified identity/key/certificate does not exist, or the PIB Identity or Key instance is not valid.
Definition at line 52 of file signing-info.hpp.
Definition at line 61 of file signing-info.hpp.
|
explicit |
Constructor.
signerType | The type of signer |
signerName | The name of the signer; interpretation differs with the type of signer |
signatureInfo | A semi-prepared SignatureInfo that contains all necessary information except SignatureType and KeyLocator. If SignatureType and/or KeyLocator is set, they will be overwritten by KeyChain::sign(). |
Definition at line 47 of file signing-info.cpp.
References ndn::SHA256, SIGNER_TYPE_HMAC, and SIGNER_TYPE_NULL.
|
explicit |
Construct from a PIB identity.
Definition at line 59 of file signing-info.cpp.
References setPibIdentity().
|
explicit |
|
explicit |
Construct SigningInfo from its string representation.
signingStr | The representative signing string for SigningInfo signing method |
Syntax of the representative string is as follows:
id:/<my-identity>
key:/<my-identity>/ksk-1
cert:/<my-identity>/KEY/ksk-1/ID-CERT/FD%01
hmac-sha256:<base64-encoded-key>
id:/localhost/identity/digest-sha256
Definition at line 71 of file signing-info.cpp.
References getDigestSha256Identity(), NDN_THROW, setDigestAlgorithm(), setSha256Signing(), setSigningCertName(), setSigningHmacKey(), setSigningIdentity(), setSigningKeyName(), and ndn::SHA256.
SigningInfo & ndn::security::SigningInfo::setSigningIdentity | ( | const Name & | identity | ) |
Set signer as an identity with name identity
.
Definition at line 110 of file signing-info.cpp.
References SIGNER_TYPE_ID.
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setSigningKeyName | ( | const Name & | keyName | ) |
Set signer as a key with name keyName
.
Definition at line 119 of file signing-info.cpp.
References SIGNER_TYPE_KEY.
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setSigningCertName | ( | const Name & | certificateName | ) |
Set signer as a certificate with name certificateName
.
Definition at line 128 of file signing-info.cpp.
References SIGNER_TYPE_CERT.
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setSigningHmacKey | ( | const std::string & | hmacKey | ) |
Set signer to a base64-encoded HMAC key.
Definition at line 136 of file signing-info.cpp.
References ndn::Name::append(), ndn::security::transform::base64Decode(), ndn::OBufferStream::buf(), getHmacIdentity(), ndn::HMAC, ndn::SHA256, SIGNER_TYPE_HMAC, and ndn::security::transform::streamSink().
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setSha256Signing | ( | ) |
Set SHA-256 as the signing method.
Definition at line 155 of file signing-info.cpp.
References ndn::Name::clear(), and SIGNER_TYPE_SHA256.
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setPibIdentity | ( | const Identity & | identity | ) |
Set signer as a PIB identity handler identity
.
Definition at line 163 of file signing-info.cpp.
References ndn::security::pib::Identity::getName(), ns3::ndn::Name, and SIGNER_TYPE_ID.
Referenced by SigningInfo().
SigningInfo & ndn::security::SigningInfo::setPibKey | ( | const Key & | key | ) |
Set signer as a PIB key handler key
.
Definition at line 172 of file signing-info.cpp.
References ndn::security::pib::Key::getName(), ns3::ndn::Name, and SIGNER_TYPE_KEY.
Referenced by SigningInfo().
|
inline |
Definition at line 172 of file signing-info.hpp.
Referenced by ndn::security::operator<<(), and ndn::security::v2::parseLocatorUri().
|
inline |
Definition at line 181 of file signing-info.hpp.
Referenced by ndn::security::operator<<(), and ndn::security::v2::parseLocatorUri().
|
inline |
Definition at line 192 of file signing-info.hpp.
Referenced by ndn::security::v2::parseLocatorUri().
|
inline |
Definition at line 203 of file signing-info.hpp.
Referenced by ndn::security::v2::parseLocatorUri().
|
inline |
Definition at line 210 of file signing-info.hpp.
Referenced by ndn::security::v2::parseLocatorUri().
|
inline |
Set the digest algorithm for signing operations.
Definition at line 220 of file signing-info.hpp.
Referenced by SigningInfo().
|
inline |
Definition at line 230 of file signing-info.hpp.
Referenced by ndn::security::v2::parseLocatorUri(), and ndn::security::v2::KeyChain::sign().
SigningInfo & ndn::security::SigningInfo::setSignatureInfo | ( | const SignatureInfo & | signatureInfo | ) |
Set a semi-prepared SignatureInfo.
Definition at line 181 of file signing-info.cpp.
Referenced by ndn::security::InterestSigner::makeSignedInterest(), and ndn::security::v2::parseLocatorUri().
|
inline |
Definition at line 245 of file signing-info.hpp.
Referenced by ndn::security::InterestSigner::makeSignedInterest(), and ndn::security::v2::parseLocatorUri().
|
inline |
Set signed Interest format.
Definition at line 256 of file signing-info.hpp.
Referenced by ndn::security::InterestSigner::makeSignedInterest().
|
inline |
Definition at line 268 of file signing-info.hpp.
Referenced by ndn::security::v2::KeyChain::sign().
|
static |
A localhost identity to indicate that the signature is generated using SHA-256.
Definition at line 34 of file signing-info.cpp.
Referenced by ndn::security::v2::extractIdentityNameFromKeyLocator(), ndn::security::v2::getKeyLocatorName(), ndn::security::operator<<(), ndn::security::v2::parseLocatorUri(), SigningInfo(), and ndn::security::v2::Validator::validate().
|
static |
A localhost identity to indicate that the signature is generated using an HMAC key.
Definition at line 41 of file signing-info.cpp.
Referenced by ndn::security::v2::extractIdentityNameFromKeyLocator(), ndn::security::v2::KeyChain::getTpm(), and setSigningHmacKey().
|
friend |
Definition at line 291 of file signing-info.hpp.
|
friend |
Definition at line 297 of file signing-info.hpp.