Package org.dogtagpki.nss
Class NSSDatabase
- java.lang.Object
-
- org.dogtagpki.nss.NSSDatabase
-
public class NSSDatabase extends java.lang.Object- Author:
- Endi S. Dewata
-
-
Field Summary
Fields Modifier and Type Field Description static org.slf4j.Loggerlogger
-
Constructor Summary
Constructors Constructor Description NSSDatabase(java.io.File directory)NSSDatabase(java.lang.String directory)NSSDatabase(java.nio.file.Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAIAExtension(java.util.List<java.lang.String> cmd, java.io.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(java.util.List<java.lang.String> cmd, java.io.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(java.util.List<java.lang.String> cmd, java.io.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(java.lang.String nickname, java.security.cert.X509Certificate cert, java.lang.String trustAttributes)org.mozilla.jss.crypto.X509CertificateaddCertificate(java.security.cert.X509Certificate cert, java.lang.String trustAttributes)voidaddCertificatePoliciesExtension(java.util.List<java.lang.String> cmd, java.io.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(java.util.List<java.lang.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(java.util.List<java.lang.String> cmd, java.io.StringWriter sw, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions)voidaddKeyUsageExtension(java.util.List<java.lang.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.voidaddModule(java.lang.String name, java.lang.String library)org.mozilla.jss.crypto.X509CertificateaddPEMCertificate(java.lang.String filename, java.lang.String trustAttributes)voidaddPEMCertificate(java.lang.String nickname, java.lang.String filename, java.lang.String trustAttributes)voidaddSKIDExtension(java.util.List<java.lang.String> cmd, java.io.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()voidcreate(java.lang.String password)voidcreate(java.lang.String password, boolean enableTrustPolicy)java.security.cert.X509CertificatecreateCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, java.lang.Integer monthsValid, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions)org.mozilla.jss.netscape.security.pkcs.PKCS10createRequest(java.lang.String subject, java.lang.String keyID, java.lang.String keyType, java.lang.String keySize, java.lang.String curve, java.lang.String hash, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions)voiddebug(java.util.Collection<java.lang.String> command)voiddelete()booleanexists()java.io.FilegetDirectory()IPasswordStoregetPasswordStore()java.nio.file.PathgetPath()booleanmoduleExists(java.lang.String name)voidreadStderr(java.lang.Process process)voidreadStdout(java.lang.Process process)voidsetDirectory(java.io.File directory)voidsetPasswordStore(IPasswordStore passwordStore)voidsetPath(java.nio.file.Path path)voidwriteStdin(java.lang.Process process, java.lang.String input)
-
-
-
Method Detail
-
getPath
public java.nio.file.Path getPath()
-
setPath
public void setPath(java.nio.file.Path path)
-
getDirectory
public java.io.File getDirectory()
-
setDirectory
public void setDirectory(java.io.File directory)
-
getPasswordStore
public IPasswordStore getPasswordStore()
-
setPasswordStore
public void setPasswordStore(IPasswordStore passwordStore)
-
exists
public boolean exists()
-
create
public void create() throws java.lang.Exception- Throws:
java.lang.Exception
-
create
public void create(java.lang.String password) throws java.lang.Exception- Throws:
java.lang.Exception
-
create
public void create(java.lang.String password, boolean enableTrustPolicy) throws java.lang.Exception- Throws:
java.lang.Exception
-
moduleExists
public boolean moduleExists(java.lang.String name) throws java.lang.Exception- Throws:
java.lang.Exception
-
addModule
public void addModule(java.lang.String name, java.lang.String library) throws java.lang.Exception- Throws:
java.lang.Exception
-
addCertificate
public org.mozilla.jss.crypto.X509Certificate addCertificate(java.security.cert.X509Certificate cert, java.lang.String trustAttributes) throws java.lang.Exception- Throws:
java.lang.Exception
-
addPEMCertificate
public org.mozilla.jss.crypto.X509Certificate addPEMCertificate(java.lang.String filename, java.lang.String trustAttributes) throws java.lang.Exception- Throws:
java.lang.Exception
-
addCertificate
public void addCertificate(java.lang.String nickname, java.security.cert.X509Certificate cert, java.lang.String trustAttributes) throws java.lang.Exception- Throws:
java.lang.Exception
-
addPEMCertificate
public void addPEMCertificate(java.lang.String nickname, java.lang.String filename, java.lang.String trustAttributes) throws java.lang.Exception- Throws:
java.lang.Exception
-
addBasicConstraintsExtension
public void addBasicConstraintsExtension(java.util.List<java.lang.String> cmd, java.io.PrintWriter stdin, org.mozilla.jss.netscape.security.x509.BasicConstraintsExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addAKIDExtension
public void addAKIDExtension(java.util.List<java.lang.String> cmd, java.io.PrintWriter stdin, org.mozilla.jss.netscape.security.x509.AuthorityKeyIdentifierExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addSKIDExtension
public void addSKIDExtension(java.util.List<java.lang.String> cmd, java.io.PrintWriter stdin, org.mozilla.jss.netscape.security.x509.SubjectKeyIdentifierExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addAIAExtension
public void addAIAExtension(java.util.List<java.lang.String> cmd, java.io.PrintWriter stdin, org.mozilla.jss.netscape.security.extensions.AuthInfoAccessExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addKeyUsageExtension
public void addKeyUsageExtension(java.util.List<java.lang.String> cmd, org.mozilla.jss.netscape.security.x509.KeyUsageExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addExtendedKeyUsageExtension
public void addExtendedKeyUsageExtension(java.util.List<java.lang.String> cmd, org.mozilla.jss.netscape.security.extensions.ExtendedKeyUsageExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addCertificatePoliciesExtension
public void addCertificatePoliciesExtension(java.util.List<java.lang.String> cmd, java.io.PrintWriter stdin, org.mozilla.jss.netscape.security.x509.CertificatePoliciesExtension extension) throws java.lang.ExceptionThis 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:
java.lang.Exception
-
addExtensions
public void addExtensions(java.util.List<java.lang.String> cmd, java.io.StringWriter sw, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions) throws java.lang.Exception- Throws:
java.lang.Exception
-
createRequest
public org.mozilla.jss.netscape.security.pkcs.PKCS10 createRequest(java.lang.String subject, java.lang.String keyID, java.lang.String keyType, java.lang.String keySize, java.lang.String curve, java.lang.String hash, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions) throws java.lang.Exception- Throws:
java.lang.Exception
-
createCertificate
public java.security.cert.X509Certificate createCertificate(org.mozilla.jss.crypto.X509Certificate issuer, org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10, java.lang.Integer monthsValid, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions) throws java.lang.Exception- Throws:
java.lang.Exception
-
delete
public void delete() throws java.lang.Exception- Throws:
java.lang.Exception
-
debug
public void debug(java.util.Collection<java.lang.String> command)
-
readStdout
public void readStdout(java.lang.Process process)
-
readStderr
public void readStderr(java.lang.Process process)
-
writeStdin
public void writeStdin(java.lang.Process process, java.lang.String input) throws java.lang.Exception- Throws:
java.lang.Exception
-
-