Package org.dogtagpki.nss
Class NSSDatabase
java.lang.Object
org.dogtagpki.nss.NSSDatabase
- Author:
- Endi S. Dewata
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNSSDatabase(File directory) NSSDatabase(String directory) NSSDatabase(Path path) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAIAExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.extensions.AuthInfoAccessExtension extension) This method provides the arguments and the standard input for certutil to create a cert/CSR with AIA extension.voidaddAKIDExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.AuthorityKeyIdentifierExtension extension) This method provides the arguments and the standard input for certutil to create a cert/CSR with AKID extension.voidaddBasicConstraintsExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.BasicConstraintsExtension extension) This method provides the arguments and the standard input for certutil to create a cert/CSR with basic constraints extension.voidaddCertificate(String tokenName, String nickname, org.mozilla.jss.netscape.security.x509.X509CertImpl certImpl, String trustFlags) voidaddCertificate(String nickname, org.mozilla.jss.netscape.security.x509.X509CertImpl certImpl, String trustFlags) org.mozilla.jss.crypto.X509CertificateaddCertificate(X509Certificate cert, String trustFlags) voidaddCertificatePoliciesExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.CertificatePoliciesExtension extension) This method provides the arguments and the standard input for certutil to create a cert/CSR with certificate policies extension.voidaddExtendedKeyUsageExtension(List<String> cmd, org.mozilla.jss.netscape.security.extensions.ExtendedKeyUsageExtension extension) This method provides the arguments for certutil to create a cert/CSR with extended key usage extension.voidaddExtensions(List<String> cmd, StringWriter sw, org.mozilla.jss.netscape.security.x509.Extensions extensions, Path tmpDir) voidaddKeyUsageExtension(List<String> cmd, org.mozilla.jss.netscape.security.x509.KeyUsageExtension extension) This method provides the arguments for certutil to create a cert/CSR with key usage extension.voidvoidaddOCSPNoCheckExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.extensions.OCSPNoCheckExtension extension, Path tmpDir) This method provides the arguments and the standard input for certutil to create a cert/CSR with OCSP No Check extension.org.mozilla.jss.crypto.X509CertificateaddPEMCertificate(String filename, String trustFlags) voidaddPEMCertificate(String nickname, String filename, String trustFlags) voidaddPEMCertificate(String tokenName, String nickname, String filename, String trustFlags) voidaddSKIDExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.SubjectKeyIdentifierExtension extension) This method provides the arguments and the standard input for certutil to create a cert/CSR with SKID extension.voidcreate()voidvoidcreateCertificate(String tokenName, org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, String serialNumber, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) createCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) createCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, String serialNumber, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) createCRMFRequest(org.mozilla.jss.crypto.CryptoToken token, KeyPair keyPair, org.mozilla.jss.crypto.X509Certificate transportCert, String subjectDN, boolean attributeEncoding, org.mozilla.jss.crypto.SignatureAlgorithm signatureAlgorithm, boolean withPop, org.mozilla.jss.crypto.KeyWrapAlgorithm keyWrapAlgorithm, boolean useOAEP, boolean useSharedSecret) createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, boolean sslECDH) createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, boolean sslECDH, boolean temporary, int sensitive, int extractable) createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, Boolean temporary, Boolean sensitive, Boolean extractable, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) org.mozilla.jss.netscape.security.pkcs.PKCS10createPKCS10Request(KeyPair keyPair, String subject, boolean encodingEnabled, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, boolean keyWrap) createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, Boolean temporary, Boolean sensitive, Boolean extractable, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) voiddebug(Collection<String> command) voiddelete()booleanexists()getPath()loadKeyPair(org.mozilla.jss.crypto.CryptoToken token, byte[] keyID) booleanmoduleExists(String name) voidreadStderr(Process process) voidreadStdout(Process process) voidsetDirectory(File directory) voidsetPasswordStore(PasswordStore passwordStore) voidstatic intvalidityUnitFromString(String validityUnit) static StringvalidityUnitToString(int validityUnit) voidwriteStdin(Process process, String input)
-
Field Details
-
logger
public static org.slf4j.Logger logger
-
-
Constructor Details
-
NSSDatabase
public NSSDatabase() -
NSSDatabase
-
NSSDatabase
-
NSSDatabase
-
-
Method Details
-
getPath
-
setPath
-
getDirectory
-
setDirectory
-
getPasswordStore
-
setPasswordStore
-
exists
public boolean exists() -
create
- Throws:
Exception
-
create
- Throws:
Exception
-
create
- Throws:
Exception
-
moduleExists
- Throws:
Exception
-
addModule
- Throws:
Exception
-
addCertificate
public org.mozilla.jss.crypto.X509Certificate addCertificate(X509Certificate cert, String trustFlags) throws Exception - Throws:
Exception
-
addPEMCertificate
public org.mozilla.jss.crypto.X509Certificate addPEMCertificate(String filename, String trustFlags) throws Exception - Throws:
Exception
-
addCertificate
public void addCertificate(String nickname, org.mozilla.jss.netscape.security.x509.X509CertImpl certImpl, String trustFlags) throws Exception - Throws:
Exception
-
addCertificate
public void addCertificate(String tokenName, String nickname, org.mozilla.jss.netscape.security.x509.X509CertImpl certImpl, String trustFlags) throws Exception - Throws:
Exception
-
addPEMCertificate
- Throws:
Exception
-
addPEMCertificate
public void addPEMCertificate(String tokenName, String nickname, String filename, String trustFlags) throws Exception - Throws:
Exception
-
addBasicConstraintsExtension
public void addBasicConstraintsExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.BasicConstraintsExtension extension) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with basic constraints extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to add- Throws:
Exception
-
addAKIDExtension
public void addAKIDExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.AuthorityKeyIdentifierExtension extension) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with AKID extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to add- Throws:
Exception
-
addSKIDExtension
public void addSKIDExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.SubjectKeyIdentifierExtension extension) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with SKID extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to add- Throws:
Exception
-
addAIAExtension
public void addAIAExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.extensions.AuthInfoAccessExtension extension) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with AIA extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to add- Throws:
Exception
-
addKeyUsageExtension
public void addKeyUsageExtension(List<String> cmd, org.mozilla.jss.netscape.security.x509.KeyUsageExtension extension) throws Exception This method provides the arguments for certutil to create a cert/CSR with key usage extension.- Parameters:
cmd- certutil command and argumentsextension- The extension to add- Throws:
Exception
-
addExtendedKeyUsageExtension
public void addExtendedKeyUsageExtension(List<String> cmd, org.mozilla.jss.netscape.security.extensions.ExtendedKeyUsageExtension extension) throws Exception This method provides the arguments for certutil to create a cert/CSR with extended key usage extension.- Parameters:
cmd- certutil command and argumentsextension- The extension to add- Throws:
Exception
-
addCertificatePoliciesExtension
public void addCertificatePoliciesExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.x509.CertificatePoliciesExtension extension) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with certificate policies extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to add- Throws:
Exception
-
addOCSPNoCheckExtension
public void addOCSPNoCheckExtension(List<String> cmd, PrintWriter stdin, org.mozilla.jss.netscape.security.extensions.OCSPNoCheckExtension extension, Path tmpDir) throws Exception This method provides the arguments and the standard input for certutil to create a cert/CSR with OCSP No Check extension.- Parameters:
cmd- certutil command and argumentsstdin- certutil's standard inputextension- The extension to addtmpDir- Temporary directory to store extension value- Throws:
Exception
-
addExtensions
public void addExtensions(List<String> cmd, StringWriter sw, org.mozilla.jss.netscape.security.x509.Extensions extensions, Path tmpDir) throws Exception - Throws:
Exception
-
loadKeyPair
- Throws:
Exception
-
createRSAKeyPair
public KeyPair createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, Boolean temporary, Boolean sensitive, Boolean extractable, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) throws Exception - Throws:
Exception
-
createRSAKeyPair
public KeyPair createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) throws Exception - Throws:
Exception
-
createRSAKeyPair
public KeyPair createRSAKeyPair(org.mozilla.jss.crypto.CryptoToken token, int keySize, boolean keyWrap) throws Exception - Throws:
Exception
-
createECKeyPair
public KeyPair createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, Boolean temporary, Boolean sensitive, Boolean extractable, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usages, org.mozilla.jss.crypto.KeyPairGeneratorSpi.Usage[] usagesMask) throws Exception - Throws:
Exception
-
createECKeyPair
public KeyPair createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, boolean sslECDH) throws Exception - Throws:
Exception
-
createECKeyPair
public KeyPair createECKeyPair(org.mozilla.jss.crypto.CryptoToken token, String curveName, boolean sslECDH, boolean temporary, int sensitive, int extractable) throws Exception - Throws:
Exception
-
createPKCS10Request
public org.mozilla.jss.netscape.security.pkcs.PKCS10 createPKCS10Request(KeyPair keyPair, String subject, boolean encodingEnabled, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception - Throws:
Exception
-
createCRMFRequest
public String createCRMFRequest(org.mozilla.jss.crypto.CryptoToken token, KeyPair keyPair, org.mozilla.jss.crypto.X509Certificate transportCert, String subjectDN, boolean attributeEncoding, org.mozilla.jss.crypto.SignatureAlgorithm signatureAlgorithm, boolean withPop, org.mozilla.jss.crypto.KeyWrapAlgorithm keyWrapAlgorithm, boolean useOAEP, boolean useSharedSecret) throws Exception - Throws:
Exception
-
validityUnitFromString
- Throws:
Exception
-
validityUnitToString
- Throws:
Exception
-
createCertificate
public X509Certificate createCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception - Throws:
Exception
-
createCertificate
public X509Certificate createCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, String serialNumber, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception - Throws:
Exception
-
createCertificate
public X509Certificate createCertificate(String tokenName, org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, String serialNumber, int validityLength, int validityUnit, String hash, org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception - Throws:
Exception
-
delete
- Throws:
Exception
-
debug
-
readStdout
-
readStderr
-
writeStdin
- Throws:
Exception
-