NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::SigningInfo Class Reference

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
}
 

Public Member Functions

 SigningInfo (SignerType signerType=SIGNER_TYPE_NULL, const Name &signerName=getEmptyName(), const SignatureInfo &signatureInfo=getEmptySignatureInfo())
 Constructor. More...
 
 SigningInfo (const Identity &identity)
 Create a signingInfo using pib identity;. More...
 
 SigningInfo (const Key &key)
 Create a signingInfo using pib key;. More...
 
 SigningInfo (const std::string &signingStr)
 Construct SigningInfo from its string representation. More...
 
SigningInfosetSigningIdentity (const Name &identity)
 Set signer as an identity with name identity. More...
 
SigningInfosetSigningKeyName (const Name &keyName)
 Set signer as a key with name keyName. More...
 
SigningInfosetSigningCertName (const Name &certificateName)
 Set signer as a certificate with name certificateName. More...
 
SigningInfosetSha256Signing ()
 Set Sha256 as the signing method. More...
 
SigningInfosetPibIdentity (const Identity &identity)
 Set signer as a PIB identity handler identity. More...
 
SigningInfosetPibKey (const Key &key)
 Set signer as a PIB key handler key. More...
 
SignerType getSignerType () const
 
const NamegetSignerName () const
 
const IdentitygetPibIdentity () const
 
const KeygetPibKey () const
 
SigningInfosetDigestAlgorithm (const DigestAlgorithm &algorithm)
 Set the digest algorithm for public key operations. More...
 
DigestAlgorithm getDigestAlgorithm () const
 
SigningInfosetSignatureInfo (const SignatureInfo &signatureInfo)
 Set a semi-prepared SignatureInfo;. More...
 
const SignatureInfogetSignatureInfo () const
 
bool operator== (const SigningInfo &rhs) const
 
bool operator!= (const SigningInfo &rhs) const
 

Static Public Member Functions

static const NamegetEmptyName ()
 
static const SignatureInfogetEmptySignatureInfo ()
 
static const NamegetDigestSha256Identity ()
 A localhost identity to indicate that the signature is generated using SHA-256. More...
 

Detailed Description

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 40 of file signing-info.hpp.

Member Enumeration Documentation

◆ SignerType

Enumerator
SIGNER_TYPE_NULL 

no signer is specified, use default setting or follow the trust schema

SIGNER_TYPE_ID 

signer is an identity, use its default key and default certificate

SIGNER_TYPE_KEY 

signer is a key, use its default certificate

SIGNER_TYPE_CERT 

signer is a certificate, use it directly

SIGNER_TYPE_SHA256 

use sha256 digest, no signer needs to be specified

Definition at line 53 of file signing-info.hpp.

Constructor & Destructor Documentation

◆ SigningInfo() [1/4]

ndn::security::SigningInfo::SigningInfo ( SignerType  signerType = SIGNER_TYPE_NULL,
const Name signerName = getEmptyName(),
const SignatureInfo signatureInfo = getEmptySignatureInfo() 
)
explicit

Constructor.

Parameters
signerTypeThe type of signer
signerNameThe name of signer; interpretation differs per signerType
signatureInfoA semi-prepared SignatureInfo which contains other information except SignatureType and KeyLocator. If SignatureType and KeyLocator are specified, they may be overwritten by KeyChain.

Definition at line 48 of file signing-info.cpp.

References ndn::SHA256, SIGNER_TYPE_CERT, SIGNER_TYPE_ID, SIGNER_TYPE_KEY, SIGNER_TYPE_NULL, and SIGNER_TYPE_SHA256.

◆ SigningInfo() [2/4]

ndn::security::SigningInfo::SigningInfo ( const Identity identity)
explicit

Create a signingInfo using pib identity;.

Definition at line 63 of file signing-info.cpp.

References setPibIdentity().

◆ SigningInfo() [3/4]

ndn::security::SigningInfo::SigningInfo ( const Key key)
explicit

Create a signingInfo using pib key;.

Definition at line 69 of file signing-info.cpp.

References setPibKey().

◆ SigningInfo() [4/4]

ndn::security::SigningInfo::SigningInfo ( const std::string &  signingStr)
explicit

Construct SigningInfo from its string representation.

Parameters
signingStrThe representative signing string for SigningInfo signing method

Structure of the representative string is as follows:

  • default signing: "" (empty string)
  • signing with a default certificate of a default key for the identity: id:/my-identity
  • signing with a default certificate of the key: key:/my-identity/ksk-1
  • signing with the certificate: cert:/my-identity/KEY/ksk-1/ID-CERT/FD%01
  • signing with sha256 digest: id:/localhost/identity/digest-sha256

Definition at line 75 of file signing-info.cpp.

References getDigestSha256Identity(), setSha256Signing(), setSigningCertName(), setSigningIdentity(), and setSigningKeyName().

Member Function Documentation

◆ setSigningIdentity()

SigningInfo & ndn::security::SigningInfo::setSigningIdentity ( const Name identity)

Set signer as an identity with name identity.

Postcondition
Change the signerType to SIGNER_TYPE_ID

Definition at line 110 of file signing-info.cpp.

References SIGNER_TYPE_ID.

Referenced by SigningInfo().

◆ setSigningKeyName()

SigningInfo & ndn::security::SigningInfo::setSigningKeyName ( const Name keyName)

Set signer as a key with name keyName.

Postcondition
Change the signerType to SIGNER_TYPE_KEY

Definition at line 119 of file signing-info.cpp.

References SIGNER_TYPE_KEY.

Referenced by SigningInfo().

◆ setSigningCertName()

SigningInfo & ndn::security::SigningInfo::setSigningCertName ( const Name certificateName)

Set signer as a certificate with name certificateName.

Postcondition
Change the signerType to SIGNER_TYPE_CERT

Definition at line 128 of file signing-info.cpp.

References SIGNER_TYPE_CERT.

Referenced by SigningInfo().

◆ setSha256Signing()

SigningInfo & ndn::security::SigningInfo::setSha256Signing ( )

Set Sha256 as the signing method.

Postcondition
Reset signerName, also change the signerType to SIGNER_TYPE_SHA256

Definition at line 136 of file signing-info.cpp.

References ndn::Name::clear(), and SIGNER_TYPE_SHA256.

Referenced by SigningInfo().

◆ setPibIdentity()

SigningInfo & ndn::security::SigningInfo::setPibIdentity ( const Identity identity)

Set signer as a PIB identity handler identity.

Postcondition
Change the signerType to SIGNER_TYPE_ID

Definition at line 144 of file signing-info.cpp.

References ndn::security::pib::Identity::getName(), ns3::ndn::Name, and SIGNER_TYPE_ID.

Referenced by SigningInfo().

◆ setPibKey()

SigningInfo & ndn::security::SigningInfo::setPibKey ( const Key key)

Set signer as a PIB key handler key.

Postcondition
Change the signerType to SIGNER_TYPE_KEY

Definition at line 153 of file signing-info.cpp.

References ndn::security::pib::Key::getName(), ns3::ndn::Name, and SIGNER_TYPE_KEY.

Referenced by SigningInfo().

◆ getSignerType()

SignerType ndn::security::SigningInfo::getSignerType ( ) const
inline
Returns
Type of the signer

Definition at line 154 of file signing-info.hpp.

Referenced by ndn::security::operator<<(), and operator==().

◆ getSignerName()

const Name& ndn::security::SigningInfo::getSignerName ( ) const
inline
Returns
Name of signer; interpretation differs per signerType

Definition at line 163 of file signing-info.hpp.

Referenced by ndn::security::operator<<(), and operator==().

◆ getPibIdentity()

const Identity& ndn::security::SigningInfo::getPibIdentity ( ) const
inline
Precondition
signerType must be SIGNER_TYPE_ID
Returns
the identity handler of signer, or Identity() if getSignerName() should be used to find the identity

Definition at line 174 of file signing-info.hpp.

References SIGNER_TYPE_ID.

◆ getPibKey()

const Key& ndn::security::SigningInfo::getPibKey ( ) const
inline
Precondition
signerType must be SIGNER_TYPE_KEY
Returns
the key handler of signer, or Key() if getSignerName() should be used to find the key

Definition at line 185 of file signing-info.hpp.

References SIGNER_TYPE_KEY.

◆ setDigestAlgorithm()

SigningInfo& ndn::security::SigningInfo::setDigestAlgorithm ( const DigestAlgorithm algorithm)
inline

Set the digest algorithm for public key operations.

Definition at line 195 of file signing-info.hpp.

◆ getDigestAlgorithm()

DigestAlgorithm ndn::security::SigningInfo::getDigestAlgorithm ( ) const
inline
Returns
The digest algorithm for public key operations

Definition at line 205 of file signing-info.hpp.

Referenced by operator==(), and ndn::security::v2::KeyChain::sign().

◆ setSignatureInfo()

SigningInfo & ndn::security::SigningInfo::setSignatureInfo ( const SignatureInfo signatureInfo)

Set a semi-prepared SignatureInfo;.

Definition at line 162 of file signing-info.cpp.

◆ getSignatureInfo()

const SignatureInfo& ndn::security::SigningInfo::getSignatureInfo ( ) const
inline
Returns
Semi-prepared SignatureInfo

Definition at line 220 of file signing-info.hpp.

Referenced by operator==().

◆ getEmptyName()

const Name & ndn::security::SigningInfo::getEmptyName ( )
static

Definition at line 28 of file signing-info.cpp.

◆ getEmptySignatureInfo()

const SignatureInfo & ndn::security::SigningInfo::getEmptySignatureInfo ( )
static

Definition at line 35 of file signing-info.cpp.

◆ getDigestSha256Identity()

const Name & ndn::security::SigningInfo::getDigestSha256Identity ( )
static

A localhost identity to indicate that the signature is generated using SHA-256.

Definition at line 42 of file signing-info.cpp.

Referenced by ndn::security::operator<<(), and SigningInfo().

◆ operator==()

bool ndn::security::SigningInfo::operator== ( const SigningInfo rhs) const

◆ operator!=()

bool ndn::security::SigningInfo::operator!= ( const SigningInfo rhs) const
inline

Definition at line 242 of file signing-info.hpp.


The documentation for this class was generated from the following files: