new SigningInfo(signerType, signerName, identity, key, signingString)
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.
The SigningInfo constructor has multiple forms:
SigningInfo() - Create a default SigningInfo with
SigningInfo.SignerType.NULL and an empty Name.
SigningInfo(signerType, signerName) - Create a SigningInfo with the
signerType and optional signer Name.
Signinginfo(identity) - Create a SigningInfo of type
SigningInfo.SignerType.ID according to the given PibIdentity, where the
digest algorithm is set to DigestAlgorithm.SHA256.
SigningInfo(key) - Create a SigningInfo of type SigningInfo.SignerType.KEY
according to the given PibKey, where the digest algorithm is set to
DigestAlgorithm.SHA256.
SigningInfo(signingString) - Create a SigningInfo from its string
representation, where the digest algorithm is set to DigestAlgorithm.SHA256.
Parameters:
| Name | Type | Description |
|---|---|---|
signerType |
number | The type of signer as an int from the SigningInfo.SignerType enum. |
signerName |
Name | The name of signer. The interpretation of the signerName differs based on the signerType. This copies the Name. |
identity |
PibIdentity | An existing PibIdentity which is not copied. |
key |
PibKey | An existing PibKey which is not copied. |
signingString |
string | 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()). |
- Source:
Throws:
Error If the signingString format is invalid.
Methods
(static) getDigestSha256Identity() → {Name}
Get the localhost identity which indicates that the signature is generated
using SHA-256.
- Source:
Returns:
A new Name of the SHA-256 identity.
- Type
- Name
getDigestAlgorithm() → {number}
Get the digest algorithm for public key operations.
- Source:
Returns:
The digest algorithm, as an int from the DigestAlgorithm
enum.
- Type
- number
getPibIdentity() → {PibIdentity}
Get the PibIdentity of the signer.
- Source:
Throws:
Error if the signer type is not SignerType.ID.
Returns:
The PibIdentity handler of the signer, or null if
getSignerName() should be used to find the identity.
- Type
- PibIdentity
getPibKey() → {PibKey}
Get the PibKey of the signer.
- Source:
Throws:
Error if the signer type is not SignerType.KEY.
Returns:
The PibKey handler of the signer, or null if
getSignerName() should be used to find the key.
- Type
- PibKey
getSignerName() → {Name}
Get the name of signer.
- Source:
Returns:
The name of signer. The interpretation differs based on the
signerType.
- Type
- Name
getSignerType() → {number}
Get the type of the signer.
- Source:
Returns:
The type of the signer, as an int from the
SigningInfo.SignerType enum.
- Type
- number
getValidityPeriod() → {ValidityPeriod}
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.
- Source:
Returns:
The validity period.
- Type
- ValidityPeriod
reset(signerType)
Check and set the signerType, and set others to default values. This does NOT
reset the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
signerType |
number | The type of signer as an int from the SigningInfo.SignerType enum. |
- Source:
setDigestAlgorithm(digestAlgorithm) → {SigningInfo}
Set the digest algorithm for public key operations.
Parameters:
| Name | Type | Description |
|---|---|---|
digestAlgorithm |
number | The digest algorithm, as an int from the DigestAlgorithm enum. |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setPibIdentity(identity) → {SigningInfo}
Set this to type SignerType.ID according to the given PibIdentity. This does
not change the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
identity |
PibIdentity | An existing PibIdentity which is not copied, or null. If this is null then use the default identity, otherwise use identity.getName(). |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setPibKey(key) → {SigningInfo}
Set this to type SignerType.KEY according to the given PibKey. This does not
change the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
PibKey | An existing PibKey which is not copied, or null. If this is null then use the default key for the identity, otherwise use key.getName(). |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setSha256Signing() → {SigningInfo}
Set this to type SignerType.SHA256, and set the digest algorithm to
DigestAlgorithm.SHA256.
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setSigningCertificateName(certificateName) → {SigningInfo}
Set this to type SignerType.CERT and a certificate with name certificateName.
This does not change the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
certificateName |
Name | The name of the certificate. This copies the Name. |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setSigningIdentity(identityName) → {SigningInfo}
Set this to type SignerType.ID and an identity with name identityName. This
does not change the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
identityName |
Name | The name of the identity. This copies the Name. |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setSigningKeyName(keyName) → {SigningInfo}
Set this to type SignerType.KEY and a key with name keyName. This does not
change the digest algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
keyName |
Name | The name of the key. This copies the Name. |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
setValidityPeriod(validityPeriod) → {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:
| Name | Type | Description |
|---|---|---|
validityPeriod |
ValidityPeriod | The validity period, which is copied. |
- Source:
Returns:
This SigningInfo.
- Type
- SigningInfo
toString() → {string}
Get the string representation of this SigningInfo.
- Source:
Returns:
The string representation.
- Type
- string