All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
ndn::SigningInfo Class Reference

A SigningInfo holds the signing parameters passed to the KeyChain. More...

#include <signing-info.hpp>

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=Name())
 Create a SigningInfo with the optional signerType and signerName and other default values. More...
 
 SigningInfo (const ptr_lib::shared_ptr< PibIdentity > &identity)
 Create a SigningInfo of type SIGNER_TYPE_ID according to the given PibIdentity. More...
 
 SigningInfo (const ptr_lib::shared_ptr< PibKey > &key)
 Create a SigningInfo of type SIGNER_TYPE_KEY according to the given PibKey. More...
 
 SigningInfo (const std::string &signingString)
 Create a SigningInfo from its string representation. More...
 
SigningInfosetSigningIdentity (const Name &identityName)
 Set this to type SIGNER_TYPE_ID and an identity with name identityName. More...
 
SigningInfosetSigningKeyName (const Name &keyName)
 Set this to type SIGNER_TYPE_KEY and a key with name keyName. More...
 
SigningInfosetSigningCertificateName (const Name &certificateName)
 Set this to type SIGNER_TYPE_CERT and a certificate with name certificateName. More...
 
SigningInfosetSha256Signing ()
 Set this to type SIGNER_TYPE_SHA256, and set the digest algorithm to DIGEST_ALGORITHM_SHA256. More...
 
SigningInfosetPibIdentity (const ptr_lib::shared_ptr< PibIdentity > &identity)
 Set this to type SIGNER_TYPE_ID according to the given PibIdentity. More...
 
SigningInfosetPibKey (const ptr_lib::shared_ptr< PibKey > &key)
 Set this to type SIGNER_TYPE_KEY according to the given PibKey. More...
 
SignerType getSignerType () const
 Get the type of the signer. More...
 
const NamegetSignerName () const
 Get the name of signer. More...
 
const ptr_lib::shared_ptr
< PibIdentity > & 
getPibIdentity () const
 Get the PibIdentity of the signer. More...
 
const ptr_lib::shared_ptr
< PibKey > & 
getPibKey () const
 Get the PibKey of the signer. More...
 
SigningInfosetDigestAlgorithm (DigestAlgorithm digestAlgorithm)
 Set the digest algorithm for public key operations. More...
 
DigestAlgorithm getDigestAlgorithm () const
 Get the digest algorithm for public key operations. More...
 
SigningInfosetValidityPeriod (const ValidityPeriod &validityPeriod)
 Set the validity period for the signature info. More...
 
const ValidityPeriodgetValidityPeriod () const
 Get the validity period for the signature info. More...
 
std::string toString () const
 Get the string representation of this SigningInfo. More...
 

Static Public Member Functions

static Name getDigestSha256Identity ()
 Get the localhost identity which indicates that the signature is generated using SHA-256. More...
 

Detailed Description

A SigningInfo holds the signing parameters passed to the KeyChain.

A SigningInfo is invalid if the specified identity/key/certificate does not exist, or the PibIdentity or PibKey instance is not valid.

Member Enumeration Documentation

Enumerator
SIGNER_TYPE_NULL 

No signer is specified.

Use default settings or follow the trust schema.

SIGNER_TYPE_ID 

The signer is an identity.

Use its default key and default certificate.

SIGNER_TYPE_KEY 

The signer is a key.

Use its default certificate.

SIGNER_TYPE_CERT 

The signer is a certificate.

Use it directly.

SIGNER_TYPE_SHA256 

Use a SHA-256 digest.

No signer needs to be specified.

Constructor & Destructor Documentation

ndn::SigningInfo::SigningInfo ( SignerType  signerType = SIGNER_TYPE_NULL,
const Name signerName = Name() 
)
inline

Create a SigningInfo with the optional signerType and signerName and other default values.

The digest algorithm is set to DIGEST_ALGORITHM_SHA256.

Parameters
signerType(optional) The type of signer. If omitted, use SIGNER_TYPE_NULL.
signerName(optional) The name of signer. The interpretation of the signerName differs based on the signerType. This copies the Name. If omitted, use an empty Name.
ndn::SigningInfo::SigningInfo ( const ptr_lib::shared_ptr< PibIdentity > &  identity)
inline

Create a SigningInfo of type SIGNER_TYPE_ID according to the given PibIdentity.

The digest algorithm is set to DIGEST_ALGORITHM_SHA256.

Parameters
identityAn existing PibIdentity which is not copied, or a null PibIdentity. If this is a null ptr_lib::shared_ptr<PibIdentity>() then use the default identity, otherwise use identity->getName().
ndn::SigningInfo::SigningInfo ( const ptr_lib::shared_ptr< PibKey > &  key)
inline

Create a SigningInfo of type SIGNER_TYPE_KEY according to the given PibKey.

The digest algorithm is set to DIGEST_ALGORITHM_SHA256.

Parameters
keyAn existing PibKey which is not copied, or a null PibKey. If this is a null ptr_lib::shared_ptr<PibKey>() then use the default key for the identity, otherwise use key->getName().
ndn::SigningInfo::SigningInfo ( const std::string &  signingString)

Create a SigningInfo from its string representation.

The digest algorithm is set to DIGEST_ALGORITHM_SHA256.

Parameters
signingStringThe representative signing string for the signing method, as follows: Default signing: "" (the empty string). Signing with the default certificate of the default key for the identity with the specified name: id:/my-identity. Signing with the default certificate of the key with the specified name: key:/my-identity/ksk-1. Signing with the certificate with the specified name: cert:/my-identity/KEY/ksk-1/ID-CERT/FD%01. Signing with sha256 digest: id:/localhost/identity/digest-sha256 (the value returned by getDigestSha256Identity()).
Exceptions
std::invalid_argumentif the signingString format is invalid.

Member Function Documentation

DigestAlgorithm ndn::SigningInfo::getDigestAlgorithm ( ) const
inline

Get the digest algorithm for public key operations.

Returns
The digest algorithm.
static Name ndn::SigningInfo::getDigestSha256Identity ( )
inlinestatic

Get the localhost identity which indicates that the signature is generated using SHA-256.

Returns
A new Name of the SHA-256 identity.
const ptr_lib::shared_ptr< PibIdentity > & ndn::SigningInfo::getPibIdentity ( ) const

Get the PibIdentity of the signer.

Returns
The PibIdentity handler of the signer, or a null ptr_lib::shared_ptr<PibIdentity>() if getSignerName() should be used to find the identity.
Exceptions
std::runtime_errorif the signer type is not SIGNER_TYPE_ID.
const ptr_lib::shared_ptr< PibKey > & ndn::SigningInfo::getPibKey ( ) const

Get the PibKey of the signer.

Returns
The PibKey handler of the signer, or a null ptr_lib::shared_ptr<PibKey>() if getSignerName() should be used to find the key.
Exceptions
std::runtime_errorif the signer type is not SIGNER_TYPE_KEY.
const Name& ndn::SigningInfo::getSignerName ( ) const
inline

Get the name of signer.

Returns
The name of signer. The interpretation differs based on the signerType.
SignerType ndn::SigningInfo::getSignerType ( ) const
inline

Get the type of the signer.

Returns
The type of the signer
const ValidityPeriod& ndn::SigningInfo::getValidityPeriod ( ) const
inline

Get the validity period for the signature info.

Note that the equivalent ndn-cxx method uses a semi-prepared SignatureInfo, but this method only uses the ValidityPeriod from the SignatureInfo.

Returns
The validity period.
SigningInfo& ndn::SigningInfo::setDigestAlgorithm ( DigestAlgorithm  digestAlgorithm)
inline

Set the digest algorithm for public key operations.

Parameters
digestAlgorithmThe digest algorithm.
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setPibIdentity ( const ptr_lib::shared_ptr< PibIdentity > &  identity)
inline

Set this to type SIGNER_TYPE_ID according to the given PibIdentity.

This does not change the digest algorithm.

Parameters
identityAn existing PibIdentity which is not copied, or a null PibIdentity. If this is a null ptr_lib::shared_ptr<PibIdentity>() then use the default identity, otherwise use identity->getName().
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setPibKey ( const ptr_lib::shared_ptr< PibKey > &  key)
inline

Set this to type SIGNER_TYPE_KEY according to the given PibKey.

This does not change the digest algorithm.

Parameters
keyAn existing PibKey which is not copied, or a null PibKey. If this is a null ptr_lib::shared_ptr<PibKey>() then use the default key for the identity, otherwise use key->getName().
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setSha256Signing ( )
inline

Set this to type SIGNER_TYPE_SHA256, and set the digest algorithm to DIGEST_ALGORITHM_SHA256.

Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setSigningCertificateName ( const Name certificateName)
inline

Set this to type SIGNER_TYPE_CERT and a certificate with name certificateName.

This does not change the digest algorithm.

Parameters
certificateNameThe name of the certificate. This copies the Name.
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setSigningIdentity ( const Name identityName)
inline

Set this to type SIGNER_TYPE_ID and an identity with name identityName.

This does not change the digest algorithm.

Parameters
identityNameThe name of the identity. This copies the Name.
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setSigningKeyName ( const Name keyName)
inline

Set this to type SIGNER_TYPE_KEY and a key with name keyName.

This does not change the digest algorithm.

Parameters
keyNameThe name of the key. This copies the Name.
Returns
This SigningInfo.
SigningInfo& ndn::SigningInfo::setValidityPeriod ( const ValidityPeriod validityPeriod)
inline

Set the validity period for the signature info.

Note that the equivalent ndn-cxx method uses a semi-prepared SignatureInfo, but this method only uses the ValidityPeriod from the SignatureInfo.

Parameters
validityPeriodThe validity period, which is copied.
Returns
This SigningInfo.
string ndn::SigningInfo::toString ( ) const

Get the string representation of this SigningInfo.

Returns
The string representation.

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