A SigningInfo holds the signing parameters passed to the KeyChain.
More...
#include <signing-info.hpp>
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.
| 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.
|
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
-
| identity | An 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
-
| key | An 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
-
| signingString | The 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_argument | if the signingString format is invalid. |
| 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_error | if 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_error | if 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
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
-
| digestAlgorithm | The digest algorithm. |
- Returns
- This SigningInfo.
Set this to type SIGNER_TYPE_ID according to the given PibIdentity.
This does not change the digest algorithm.
- Parameters
-
| identity | An 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
-
| key | An 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.
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
-
| certificateName | The 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
-
| identityName | The name of the identity. This copies the Name. |
- Returns
- This SigningInfo.
Set this to type SIGNER_TYPE_KEY and a key with name keyName.
This does not change the digest algorithm.
- Parameters
-
| keyName | The name of the key. This copies the Name. |
- Returns
- This SigningInfo.
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
-
| validityPeriod | The 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: