Package ghidra.net
Class ApplicationKeyStore
java.lang.Object
ghidra.net.ApplicationKeyStore
ApplicationKeyStore provides the ability to read X.509 certificates and
keystores in various formats. Certificate files (e.g., cacerts) may be in a standard
X.509 form (*.pem, *.crt, *.cer, *.der) or Java JKS (*.jks) form, while keystores
for client/server may be in a PKCS12 form (*.p12, *.pks, *.pfx) or Java JKS (*.jks) form.-
Method Summary
Modifier and TypeMethodDescriptionstatic StringdetectKeyStoreType(String keystorePath) Attempt to detect PKI KeyStore type ("JKS" or "PKCS12") for the specified file.static KeyStoregetCertificateStoreInstance(String cacertsPath) Load the specified X.509 certificate authority store in a standard X.509 form (*.pem, *.crt, *.cer, *.der) or Java JKS (*.jks) form.static KeyStoregetKeyStoreInstance(String keystorePath, char[] pwd) Attempt to load a client/server keystore in a PKCS12 form (*.p12, *.pks, *.pfx) or Java JKS (*.jks) form.static voidlogCerts(X509Certificate[] x509Certs) Log all X509 certificates contained within array
-
Method Details
-
getCertificateStoreInstance
public static KeyStore getCertificateStoreInstance(String cacertsPath) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException Load the specified X.509 certificate authority store in a standard X.509 form (*.pem, *.crt, *.cer, *.der) or Java JKS (*.jks) form.- Parameters:
cacertsPath- certificate store file path- Returns:
- KeyStore containing ingested certificates
- Throws:
IOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionCertificateException
-
getKeyStoreInstance
public static KeyStore getKeyStoreInstance(String keystorePath, char[] pwd) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException Attempt to load a client/server keystore in a PKCS12 form (*.p12, *.pks, *.pfx) or Java JKS (*.jks) form.- Parameters:
pwd- keystore password- Returns:
- keystore instance
- Throws:
IOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionCertificateException
-
detectKeyStoreType
Attempt to detect PKI KeyStore type ("JKS" or "PKCS12") for the specified file.- Parameters:
keystorePath- key store file path- Returns:
- "JKS", "PKCS12" or null
- Throws:
IOException- if file read error occurs
-
logCerts
Log all X509 certificates contained within array- Parameters:
x509Certs- array of certificates
-