public class TrustStoreController
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.security.KeyStore |
trustStore |
Constructor and Description |
---|
TrustStoreController(java.awt.Window ownerDialog)
generates a blank controller, which still needs to initialize the trustStore
|
TrustStoreController(java.awt.Window ownerWindow,
java.io.File trustStoreFile,
java.lang.String trustStorePassword,
boolean edit)
This Initializes the TrustStoreController.
|
Modifier and Type | Method and Description |
---|---|
void |
addCertificate(java.security.cert.X509Certificate certificate,
java.lang.String alias)
Adds a certificate to the truststore
|
void |
addCertificateToTrustStore(java.lang.String certificateToAdd,
java.lang.String certificateAlias)
Loads a certificate from a file, adds it to the truststore and saves the truststore
|
void |
addTableModelRow(CertificateProperties certificateProperties)
Adds row to the TableModel
|
void |
changeAlias(java.lang.String oldAlias,
java.lang.String newAlias)
Change a certificate alias.
|
void |
changeTrustStorePassword(java.lang.String newTrustStorePassword)
This method allows the user to change the password of a TrustStore.
|
void |
clearTableModel()
Clears the table model.
|
void |
createTrustStore(java.io.File trustStoreFile,
java.lang.String trustStorePassword)
This method allows the user to create a TrustStore and protect its
integrity with a password.
|
void |
deleteCertificateFromTrustStore(java.lang.String certificateAliasToDelete)
This method allows the user to delete certificate from TrustStore.
|
java.security.cert.X509Certificate |
getCertificate(java.lang.String alias)
Gets the certificate with the specified alias.
|
CertificateProperties |
getCertificateProperties(java.lang.String alias)
Gets the certificate properties.
|
CertificateProperties |
getFirstCertificateProperties()
Gets the first certificate properties.
|
java.security.KeyStore |
getKeyStore()
returns the key store object for direct interaction
|
javax.swing.table.DefaultTableModel |
getTableModel()
Gets the tableModel.
|
java.util.Enumeration<java.lang.String> |
getTrustedCertificatesList()
Get TrustedCertificates list .
|
java.lang.String |
getTrustStorePassword()
Gets the trust store password.
|
void |
init(java.io.File trustStoreFile,
java.lang.String trustStorePassword)
Initializes the truststore controller.
|
boolean |
isInitialized()
Checks if is initialized.
|
boolean |
openTrustStore(java.io.File trustStoreFile,
java.lang.String trustStorePassword)
This method open a TrustStore.
|
boolean |
openTrustStoreFromStream(java.io.InputStream trustStoreInputStream,
java.lang.String trustStorePassword)
This method opens a TrustStore directly from stream.
|
void |
saveTrustStore()
Save the trust store.
|
void |
saveTrustStore(java.lang.String trustStorePassword)
Save the trust store.
|
void |
setOwnerWindow(java.awt.Window ownerWindow)
Sets the owner window.
|
void |
setTrustStorePassword(java.lang.String trustStorePassword)
Sets the trust store password.
|
public TrustStoreController(java.awt.Window ownerDialog)
public TrustStoreController(java.awt.Window ownerWindow, java.io.File trustStoreFile, java.lang.String trustStorePassword, boolean edit)
public void setOwnerWindow(java.awt.Window ownerWindow)
ownerWindow
- the new owner windowpublic java.security.KeyStore getKeyStore()
public java.lang.String getTrustStorePassword()
public void setTrustStorePassword(java.lang.String trustStorePassword)
trustStorePassword
- the new trust store passwordpublic void createTrustStore(java.io.File trustStoreFile, java.lang.String trustStorePassword)
trustStoreFile
- the TrustStore filetrustStorePassword
- the TrustStore passwordpublic void init(java.io.File trustStoreFile, java.lang.String trustStorePassword)
trustStoreFile
- the trust store filetrustStorePassword
- the trust store passwordpublic boolean openTrustStore(java.io.File trustStoreFile, java.lang.String trustStorePassword)
trustStoreFile
- the TrustStore nametrustStorePassword
- the TrustStore passwordpublic boolean openTrustStoreFromStream(java.io.InputStream trustStoreInputStream, java.lang.String trustStorePassword)
trustStoreInputStream
- the TrustStore nametrustStorePassword
- the TrustStore passwordpublic void saveTrustStore()
public void saveTrustStore(java.lang.String trustStorePassword)
trustStorePassword
- the trust store passwordpublic void changeTrustStorePassword(java.lang.String newTrustStorePassword)
newTrustStorePassword
- the new TrustStore passwordpublic void changeAlias(java.lang.String oldAlias, java.lang.String newAlias)
oldAlias
- the old aliasnewAlias
- the new aliaspublic void addCertificate(java.security.cert.X509Certificate certificate, java.lang.String alias) throws java.security.KeyStoreException
certificate
- The certificatealias
- The certificate aliasjava.security.KeyStoreException
- Error adding the certificatepublic void addCertificateToTrustStore(java.lang.String certificateToAdd, java.lang.String certificateAlias)
certificateToAdd
- The path to the certificate filecertificateAlias
- the certificate alias The certificate aliaspublic void deleteCertificateFromTrustStore(java.lang.String certificateAliasToDelete)
certificateAliasToDelete
- the certificate alias to deletepublic javax.swing.table.DefaultTableModel getTableModel()
public void addTableModelRow(CertificateProperties certificateProperties)
certificateProperties
- the CertificatePropertiespublic void clearTableModel()
public java.util.Enumeration<java.lang.String> getTrustedCertificatesList()
public CertificateProperties getFirstCertificateProperties()
public CertificateProperties getCertificateProperties(java.lang.String alias)
alias
- the certificate aliaspublic java.security.cert.X509Certificate getCertificate(java.lang.String alias)
alias
- the aliaspublic boolean isInitialized()