Skip to content

Certificates

Endi S. Dewata edited this page Jul 29, 2022 · 1 revision

Finding Certificates

cm.findCertByNickname();
cm.findCertsByNickname();
cm.getCACerts();
cm.getPermCerts();

Importing CA certificate

To import a chain of CA certificates (none of which is a user certificate):

CryptoManager manager = CryptoManager.getInstance();
manager.importCACertPackage(bytes);

The nicknames will be automatically generated based on the Subject DN.

Importing user CA certificate

To import a chain of CA certificates where the leaf certificate is also a user certificate:

CryptoManager manager = CryptoManager.getInstance();
manager.importUserCACertPackage(bytes, nickname);

Importing user certificate

To import a chain of certificates where the leaf certificate is a user certificate:

CryptoManager manager = CryptoManager.getInstance();
manager.importCertPackage(bytes, nickname);

Importing SSL certificate into NSS database

To import SSL certificate into NSS database:

public class Main implements SSLCertificateApprovalCallback {

    public boolean approve(X509Certificate cert, ValidityStatus status) {

        CryptoManager cm = CryptoManager.getInstance();
        cm.importCertToPerm(cert, nickname);
    }
}