Certificate Stores

In addition to smart card operations, the SCWS can also manipulate the system certificate stores.

SCWS.getCertStores()

Retrieves the list of known system certificate stores. Note that the way certificates are organized is system-dependant, and that the returned items may only be a subset of the actual system stores. For a list of returned stores, refer to the CertStore.systemName() method.

Returns

A Promise resolving to the array of SCWS.CertStore() items.

class SCWS.CertStore()

Represents a system certificate store.

CertStore.systemName

System name of the store. The standard names depend on the host system.

For Windows systems, the following stores are supported:

  • "MY": Personal store

  • "AddressBook": Other people

  • "CA": Intermediate authorities

  • "Root": Trusted root authorities

For Mac OS systems, the following stores are supported:

  • "AppleSession": Session store

  • "AppleSystem": System store

  • "AppleRoots": System roots store

CertStore.name

Human-readable name of the store (may depend on the user language settings as configured in the operating system preferences).

CertStore.authority

Boolean indicating whether the store may contain certification authorities. Modifications made in an authority store may invalidate previously obtained certificates trust status.

CertStore.getObjects()

Retrieves all certificates found in the store.

Returns

A Promise resolving to the array of SCWS.Certificate() items.

CertStore.import(formData)

Imports a X.509 certificate in a certificate store (Windows only).

The data to import must be provided as a FormData object. This allows direct use of this method with HTML forms (e.g. using <input type="file"> tags), or with dynamically created forms (using formData.append and Blob objects). The form must correspond to a multipart MIME structure with the following field:

  • file: The certificate data, provided either in raw binary (DER-encoded) form, or encoded in PEM form.

When the operation completes, the newly created certificate is returned as a JavaScript object with the following field:

Arguments
  • formData – The FormData object containing the certificate data to import.

Returns

A Promise object resolving to an object containing the newly created certificate.