new CertificateV2(data)
CertificateV2 represents a certificate following the certificate format
naming convention.
Overview of the NDN certificate format:
CertificateV2 ::= DATA-TLV TLV-LENGTH
Name (= //KEY/[KeyId]/[IssuerId]/[Version])
MetaInfo (.ContentType = KEY)
Content (= X509PublicKeyContent)
SignatureInfo (= CertificateV2SignatureInfo)
SignatureValue
X509PublicKeyContent ::= CONTENT-TLV TLV-LENGTH
BYTE+ (= public key bits in PKCS#8 format)
CertificateV2SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
SignatureType
KeyLocator
ValidityPeriod
... optional critical or non-critical extension blocks ...
An example of NDN certificate name:
/edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E
\_________________/ \___________/ \___________/\___________/
Certificate Namespace Key Id Issuer Id Version
(Identity)
\__________________________________/
Key Name
Notes:
- `Key Id` is an opaque name component to identify the instance of the public
key for the certificate namespace. The value of `Key ID` is controlled by
the namespace owner. The library includes helpers for generating key IDs
using an 8-byte random number, SHA-256 digest of the public key, timestamp,
and the specified numerical identifiers.
- `Issuer Id` is sn opaque name component to identify the issuer of the
certificate. The value is controlled by the issuer. The library includes
helpers to set issuer the ID to an 8-byte random number, SHA-256 digest of
the issuer's public key, and the specified numerical identifiers.
- `Key Name` is a logical name of the key used for management purposes. the
Key Name includes the certificate namespace, keyword `KEY`, and `KeyId`
components.
Parameters:
Name | Type | Description |
---|---|---|
data |
Data | (optional) The data packet with the content to copy. If omitted, create a CertificateV2 with content type KEY and default or unspecified values. |
Classes
Methods
getIdentity() → {Name}
Get the identity name from the certificate name.
- Source:
Returns:
The identity name as a new Name.
- Type
- Name
getIssuerId() → {Name.Component}
Get the issuer ID component from the certificate name.
- Source:
Returns:
The issuer ID component.
- Type
- Name.Component
getKeyId() → {Name.Component}
Get the key ID component from the certificate name.
- Source:
Returns:
The key ID name component.
- Type
- Name.Component
getKeyName() → {Name}
Get key name from the certificate name.
- Source:
Returns:
The key name as a new Name.
- Type
- Name
getPublicKey() → {Blob}
Get the public key DER encoding.
- Source:
Throws:
CertificateV2.Error If the public key is not set.
Returns:
The DER encoding Blob.
- Type
- Blob
getValidityPeriod() → {ValidityPeriod}
Get the certificate validity period from the SignatureInfo.
- Source:
Throws:
InvalidArgumentException If the SignatureInfo doesn't have a
ValidityPeriod.
Returns:
The ValidityPeriod object.
- Type
- ValidityPeriod
isValid(time) → {boolean}
Check if the time falls within the validity period.
Parameters:
Name | Type | Description |
---|---|---|
time |
number | (optional) The time to check as milliseconds since Jan 1, 1970 UTC. If omitted, use the current time. |
- Source:
Throws:
InvalidArgumentException If the SignatureInfo doesn't have a
ValidityPeriod.
Returns:
True if the beginning of the validity period is less than
or equal to time and time is less than or equal to the end of the validity
period.
- Type
- boolean
toString() → {string}
Get a string representation of this certificate.
- Source:
Returns:
The string representation.
- Type
- string
wireDecode(input, wireFormat)
Override to call the base class wireDecode then check the certificate format.
Parameters:
Name | Type | Description |
---|---|---|
input |
Blob | Buffer | The buffer with the bytes to decode. |
wireFormat |
WireFormat | (optional) A WireFormat object used to decode this object. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
(static) extractIdentityFromCertName(certificateName) → {Name}
Extract the identity namespace from certificateName.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
- Source:
Returns:
The identity namespace as a new Name.
- Type
- Name
(static) extractKeyNameFromCertName(certificateName) → {Name}
Extract key name from certificateName.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
- Source:
Returns:
The key name as a new Name.
- Type
- Name
(static) isValidName(certificateName) → {boolean}
Check if certificateName follows the naming convention for a certificate.
Parameters:
Name | Type | Description |
---|---|---|
certificateName |
Name | The name of the certificate. |
- Source:
Returns:
True if certificateName follows the naming convention.
- Type
- boolean