Class KeyStores
java.lang.Object
net.sourceforge.jnlp.security.KeyStores
The
KeyStores class allows easily accessing the various KeyStores
used.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static KeyStorecreateKeyStoreFromFile(File file, boolean createIfNotFound) Reads the file (using the password) and uses it to create a newKeyStore.Returns an array of KeyStore that contain trusted CA certificates.Returns an array of KeyStore that contain certificates that are trusted.Returns KeyStores containing trusted client certificatesstatic KeyStores.KeyStoreWithPathgetKeyStore(KeyStores.Level level, KeyStores.Type type) Returns a KeyStore corresponding to the appropriate level level (user or system) and type.static InfrastructureFileDescriptorgetKeyStoreLocation(KeyStores.Level level, KeyStores.Type type) Returns the location of a KeyStore corresponding to the given level and type.static Stringstatic StringtoDisplayableString(KeyStores.Level level, KeyStores.Type type) Returns a human readable name for this KeyStorestatic StringtoTranslatableString(KeyStores.Level level, KeyStores.Type type) Returns a String that can be used as a translation key to create a user-visible representation of this KeyStore.
-
Field Details
-
LOG
-
keystoresPaths
-
KEYSTORE_TYPE
- See Also:
-
-
Constructor Details
-
KeyStores
public KeyStores()
-
-
Method Details
-
getKeyStore
Returns a KeyStore corresponding to the appropriate level level (user or system) and type.- Parameters:
level- whether the KeyStore desired is a user-level or system-level KeyStoretype- the type of KeyStore desired- Returns:
- a KeyStore containing certificates from the appropriate
-
getPathToKeystore
-
getCertKeyStores
-
getCAKeyStores
-
getClientKeyStores
-
getKeyStoreLocation
public static InfrastructureFileDescriptor getKeyStoreLocation(KeyStores.Level level, KeyStores.Type type) Returns the location of a KeyStore corresponding to the given level and type.- Parameters:
level- the specified level of the key store to be returned.type- the specified type of the key store to be returned.- Returns:
- the location of the key store.
-
toTranslatableString
Returns a String that can be used as a translation key to create a user-visible representation of this KeyStore. Creates a string by concatenating a level and type, converting everything to Title Case and removing the _'s. (USER,CA_CERTS) becomes UserCaCerts.- Parameters:
level- the level of the key store.type- the type of the key store.- Returns:
- the translation key.
-
toDisplayableString
Returns a human readable name for this KeyStore- Parameters:
level- the level of the KeyStoretype- the type of KeyStore- Returns:
- a localized name for this KeyStore
-
createKeyStoreFromFile
private static KeyStore createKeyStoreFromFile(File file, boolean createIfNotFound) throws IOException, KeyStoreException, NoSuchAlgorithmException, CertificateException Reads the file (using the password) and uses it to create a newKeyStore. If the file does not exist and should not be created, it returns an empty but initialized KeyStore- Parameters:
file- the file to load information from- Returns:
- a KeyStore containing data from the file
- Throws:
IOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionCertificateException
-