IPWorks OpenPGP 2020 Node.js Edition

Questions / Feedback?

CreateCertificate Method

Creates a new self-signed certificate in the current store.

Syntax

certmgr.createCertificate(certSubject, serialNumber, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

This method creates a new self-signed certificate in the current store, containing the following:

CertSubject specifies the subject of the new certificate. A new keyset (public/private key pair) is generated and associated with the new certificate.

The certificate subject is a comma separated list of distinguished name fields and values. For instance "CN=www.server.com, OU=test, C=US, E=support@nsoftware.com". Common fields and their meanings are displayed below.

FieldMeaning
CNCommon Name. This is commonly a host name like www.server.com.
OOrganization
OUOrganizational Unit
LLocality
SState
CCountry
EEmail Address

If a field value contains a comma it must be quoted.

SerialNumber specifies the certificate serial number. All certificates signed by the same issuer must have different (unique) serial numbers.

The time validity of the new certificate is determined by the CertValidityTime configuration setting, and the key size by the CertKeyLength configuration setting.

In the Unix edition of the toolkit the certificate will be created in memory. Call ExportCertificate to export the newly created certificate to a PEM file.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks OpenPGP 2020 Node.js Edition - Version 20.0 [Build 8249]