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.Logger
logger
-
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 void
addAIAExtension(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.void
addAKIDExtension(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.void
addBasicConstraintsExtension(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.void
addCertificate(java.lang.String nickname, java.security.cert.X509Certificate cert, java.lang.String trustAttributes)
org.mozilla.jss.crypto.X509Certificate
addCertificate(java.security.cert.X509Certificate cert, java.lang.String trustAttributes)
void
addCertificatePoliciesExtension(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.void
addExtendedKeyUsageExtension(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.void
addExtensions(java.util.List<java.lang.String> cmd, java.io.StringWriter sw, org.mozilla.jss.netscape.security.x509.CertificateExtensions extensions)
void
addKeyUsageExtension(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.void
addModule(java.lang.String name, java.lang.String library)
org.mozilla.jss.crypto.X509Certificate
addPEMCertificate(java.lang.String filename, java.lang.String trustAttributes)
void
addPEMCertificate(java.lang.String nickname, java.lang.String filename, java.lang.String trustAttributes)
void
addSKIDExtension(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.void
create()
void
create(java.lang.String password)
void
create(java.lang.String password, boolean enableTrustPolicy)
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)
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)
void
debug(java.util.Collection<java.lang.String> command)
void
delete()
boolean
exists()
java.io.File
getDirectory()
IPasswordStore
getPasswordStore()
java.nio.file.Path
getPath()
boolean
moduleExists(java.lang.String name)
void
readStderr(java.lang.Process process)
void
readStdout(java.lang.Process process)
void
setDirectory(java.io.File directory)
void
setPasswordStore(IPasswordStore passwordStore)
void
setPath(java.nio.file.Path path)
void
writeStdin(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.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:
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.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:
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.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:
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.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:
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.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:
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.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:
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.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:
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
-
-