Object Creation
To create a keystore object, first load the brightsign/keystore
module using the require()
method. Then create an instance of the keystore class.
Code Block | ||
---|---|---|
| ||
var keystoreClass = require("@brightsign/keystore"); var keystore = new keystoreClass(); |
KeyStore
Use this interface to add certificates to the certificate database.
addCaCertificate()
Code Block | ||
---|---|---|
| ||
Promise<> addCaCertificate(DOMString filename) |
Registers the specified CA certificate with the certificate database. Client certificates can be either self-signed or signed using a 3rd-party certificate issuer (Versign, DigiCert, etc.).
addCaPackage()
Code Block | ||
---|---|---|
| ||
Promise<> addCaPackage(DOMString filename) |
Adds the specified CA package file to the certificate database. The package name resides in the file and does not need to be the same as the filename. See the roKeyStore page for more information on generating CA packages.
Note
Attempting to modify a CA package file that has been added to the database will invalidate it. If a package is invalidated, it will need to be removed from the database (using the removeCaPackage()
method) and added again.
removeCaPackage()
Code Block | ||
---|---|---|
| ||
Promise<> removeCaPackage(DOMString filename) |
Removes the specified CA package from the certificate database. Use the getCaPackagesInstalled()
method to retrieve a list of package names in the database.
getCaPackagesInstalled()
Code Block | ||
---|---|---|
| ||
Promise<PackageList> getCaPackagesInstalled() |
Returns a list of names of CA packages contained in the certificate database.
addClientCertificate()
Code Block | ||
---|---|---|
| ||
Promise<> addClientCertificate(ClientCertificateObject object) |
Registers a .p12 client certificate with the certificate database.
ClientCertificateObject
This interface represents a .p12 certificate file.
[certificateFile
String] certificateFile: The file name and path of the .p12 client certificate[passphrase
String] passphrase: A passphrase for the .p12 client certificate[obfuscatedPassphrase
String] obfuscatedPassphrase: An obfuscated passphrase for the .p12 client certificate
Warning |
---|
Important Only one of |
Example
Code Block |
---|
ksf = require('@brightsign/keystore'); k = new ksf() k.addCaPackage("/storage/sd/example.bsca").then(() => console.log('ok'), () => console.log('failed')) k.getCaPackagesInstalled().then((pkgs) => console.log(pkgs)) k.removeCaPackage('example').then(() => console.log('ok'), () => console.log('failed')) |