new Certificate(data)
Create a Certificate from the content in the data packet (if not omitted).
Parameters:
Name | Type | Description |
---|---|---|
data |
Data | (optional) The data packet with the content to decode. If omitted, create a Certificate with default values and the Data content is empty. |
Methods
(static) to2DigitString(x) → {string}
A private method to zero pad an integer to 2 digits.
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The number to pad. Assume it is a non-negative integer. |
Returns:
The padded string.
- Type
- string
(static) toIsoString(msSince1970) → {string}
Convert a UNIX timestamp to ISO time representation with the "T" in the middle.
Parameters:
Name | Type | Description |
---|---|---|
msSince1970 |
type | Timestamp as milliseconds since Jan 1, 1970. |
Returns:
The string representation.
- Type
- string
addExtension(extension)
Add a certificate extension.
Parameters:
Name | Type | Description |
---|---|---|
extension |
CertificateSubjectDescription | The extension to be added. |
addSubjectDescription(description)
Add a subject description.
Parameters:
Name | Type | Description |
---|---|---|
description |
CertificateSubjectDescription | The description to be added. |
decode()
Populate the fields by the decoding DER data from the Content.
encode()
Encode the contents of the certificate in DER format and set the Content
and MetaInfo fields.
getExtensionList() → {Array.<CertificateExtension>}
Get the certificate extension list.
Returns:
The extension list.
- Type
- Array.<CertificateExtension>
getPublicKeyDer() → {Blob}
Get the public key DER encoding.
Throws:
Error if the public key is not set.
Returns:
The DER encoding Blob.
- Type
- Blob
getSubjectDescriptionList() → {Array.<CertificateSubjectDescription>}
Get the subject description list.
Returns:
The subject description list.
- Type
- Array.<CertificateSubjectDescription>
isTooEarly() → {Boolean}
Check if the certificate is valid.
Returns:
True if the current time is earlier than notBefore.
- Type
- Boolean
isTooLate() → {Boolean}
Check if the certificate is valid.
Returns:
True if the current time is later than notAfter.
- Type
- Boolean
toDer() → {DerSequence}
Encode the certificate fields in DER format.
Returns:
The DER encoded contents of the certificate.
- Type
- DerSequence
wireDecode(input, wireFormat)
Override to call the base class wireDecode then populate the certificate
fields.
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(). |