public final class UtilsKeystore extends java.lang.Object implements IUtilsKeystore
Class that manages operations related with the management of keystores.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
JCEKS, JKS, PKCS12| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getCertificateEntry(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String alias,
java.lang.String keystoreType)
Method that obtains a certificate stored inside of a keystore.
|
static java.util.List<java.security.cert.X509Certificate> |
getListCertificates(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String keystoreType)
Method that obtains a list with all the certificates stored inside of a keystore.
|
static java.security.PrivateKey |
getPrivateKeyEntry(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String alias,
java.lang.String keystoreType,
java.lang.String privateKeyDecodedPass)
Method that obtains a private key stored inside of a keystore.
|
static java.security.KeyStore |
loadKeystore(java.lang.String path,
java.lang.String password,
java.lang.String type)
Method that loads a keystore.
|
public static java.security.KeyStore loadKeystore(java.lang.String path,
java.lang.String password,
java.lang.String type)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.io.IOException
path - Parameter that represents the path where is located the keystore.password - Parameter that represents the password of the keystore.type - Parameter that represents the keystore type.java.security.KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the specified type.java.security.NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.java.security.cert.CertificateException - If any of the certificates in the keystore could not be loaded.java.io.IOException - If the file does not exist, is a directory rather than a regular file, or for some other reason cannot be opened for reading, or
if there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password was incorrect.public static byte[] getCertificateEntry(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String alias,
java.lang.String keystoreType)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.io.IOException
keystore - Parameter that represents the keystore.keystoreDecodedPass - Parameter that represents the keystore password.alias - Parameter that represents the alias of the certificate to obtain.keystoreType - Parameter that represents the keystore type.java.security.KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the specified type, or if the keystore has not been
initialized (loaded).java.security.NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.java.security.cert.CertificateException - If any of the certificates in the keystore could not be loaded.java.io.IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password
was incorrect.public static java.util.List<java.security.cert.X509Certificate> getListCertificates(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String keystoreType)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.io.IOException
keystore - Parameter that represents the keystore.keystoreDecodedPass - Parameter that represents the keystore password.keystoreType - Parameter that represents the keystore type.java.security.KeyStoreException - If no Provider supports a KeyStoreSpi implementation for the specified type, or if the keystore has not been
initialized (loaded).java.security.NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found.java.security.cert.CertificateException - If any of the certificates in the keystore could not be loaded.java.io.IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given password
was incorrect.public static java.security.PrivateKey getPrivateKeyEntry(byte[] keystore,
java.lang.String keystoreDecodedPass,
java.lang.String alias,
java.lang.String keystoreType,
java.lang.String privateKeyDecodedPass)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.io.IOException,
java.security.UnrecoverableKeyException
keystore - Parameter that represents the keystore.keystoreDecodedPass - Parameter that represents the keystore password.alias - Parameter that represents the alias of the certificate to obtain.keystoreType - Parameter that represents the keystore type.privateKeyDecodedPass - Parameter that represents the private key password.java.security.KeyStoreException - If if no Provider supports a KeyStoreSpi implementation for the specified type, or if the keystore has not been
initialized (loaded).java.security.NoSuchAlgorithmException - If the algorithm used to check the integrity of the keystore cannot be found, or if the algorithm for recovering
the key cannot be found.java.security.cert.CertificateException - If any of the certificates in the keystore could not be loaded.java.io.IOException - If there is an I/O or format problem with the keystore data, if a password is required but not given, or if the given
password was incorrect.java.security.UnrecoverableKeyException - If the key cannot be recovered (e.g., the given password is wrong).