new SafeBag(certificate, {Blob), password, digestAlgorithm:, wireFormat)
A SafeBag represents a container for sensitive related information such as a
certificate and private key.
There are two forms of the SafeBag constructor:
SafeBag(certificate, privateKeyBag) - Create a SafeBag with the given
certificate and private key.
SafeBag(keyName, privateKeyBag, publicKeyEncoding [, password,
digestAlgorithm, wireFormat]) - Create a SafeBag with given private
key and a new self-signed certificate for the given public key.
Parameters:
Name | Type | Description |
---|---|---|
certificate |
Data | The certificate data packet (used only for SafeBag(certificate, privateKeyBag)). This copies the object. |
{Blob) |
privateKeyBag The encoded private key. If encrypted, this is a PKCS #8 EncryptedPrivateKeyInfo. If not encrypted, this is an unencrypted PKCS #8 PrivateKeyInfo. | |
password |
Buffer | (optional) The password for decrypting the private key in order to sign the self-signed certificate. If the password is supplied, use it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is omitted or null, privateKeyBag is an unencrypted PKCS #8 PrivateKeyInfo. |
digestAlgorithm: |
number | (optional) The digest algorithm for signing the self-signed certificate (as an int from the DigestAlgorithm enum). If omitted, use DigestAlgorithm.SHA256 . |
wireFormat |
WireFormat | (optional) A WireFormat object used to encode the self-signed certificate in order to sign it. If omitted, use WireFormat.getDefaultWireFormat(). |
- Source:
Methods
getCertificate() → {Data}
Get the certificate data packet.
- Source:
Returns:
The certificate as a Data packet. If you need to process it
as a certificate object then you must create a new CertificateV2(data).
- Type
- Data
getPrivateKeyBag() → {Blob}
Get the encoded private key.
- Source:
Returns:
The encoded private key. If encrypted, this is a PKCS #8
EncryptedPrivateKeyInfo. If not encrypted, this is an unencrypted PKCS #8
PrivateKeyInfo.
- Type
- Blob