APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.ssl

pack-priv final Class TrustStoreManager

extends Object
Class Inheritance
Imports
java.io.*, java.lang.ref.WeakReference, java.security.KeyStore, java.security.cert.*, java.util.*, java.util.concurrent.locks.ReentrantLock, sun.security.util.FilePaths, sun.security.validator.TrustStoreUtil

Collection of static utility methods to manage the default trusted KeyStores effectively.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
TrustStoreManager.TrustAnchorManager

The trust anchors manager used to expedite the performance.

private static class
TrustStoreManager.TrustStoreDescriptor

A descriptor of the default trusted KeyStore.

Field Summary

Modifier and TypeField and Description
private static final TrustStoreManager.TrustAnchorManager

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Set<X509Certificate>
getTrustedCerts()

Return an unmodifiable set of all trusted X509Certificates contained in the default trusted KeyStore.

public static KeyStore
getTrustedKeyStore()

Return an instance of the default trusted KeyStore.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

tamback to summary
private static final TrustStoreManager.TrustAnchorManager tam

Constructor Detail

TrustStoreManagerback to summary
private TrustStoreManager()

Method Detail

getTrustedCertsback to summary
public static Set<X509Certificate> getTrustedCerts() throws Exception

Return an unmodifiable set of all trusted X509Certificates contained in the default trusted KeyStore.

getTrustedKeyStoreback to summary
public static KeyStore getTrustedKeyStore() throws Exception

Return an instance of the default trusted KeyStore.

sun.security.ssl back to summary

private final Class TrustStoreManager.TrustAnchorManager

extends Object
Class Inheritance

The trust anchors manager used to expedite the performance. This class can be used to provide singleton services to access default trust KeyStore more effectively.

Field Summary

Modifier and TypeField and Description
private WeakReference<Set<X509Certificate>>
private TrustStoreManager.TrustStoreDescriptor
private WeakReference<KeyStore>
private final ReentrantLock

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv KeyStore

Returns:

null if the underlying KeyStore is not available.
getKeyStore
(TrustStoreManager.TrustStoreDescriptor descriptor)

Get the default trusted KeyStore with the specified descriptor.

pack-priv Set<X509Certificate>

Returns:

empty collection if the underlying KeyStore is not available.
getTrustedCerts
(TrustStoreManager.TrustStoreDescriptor descriptor)

Get trusted certificates in the default trusted KeyStore with the specified descriptor.

private static KeyStore
loadKeyStore(TrustStoreManager.TrustStoreDescriptor descriptor)

Load the KeyStore as described in the specified descriptor.

private static Set<X509Certificate>
loadTrustedCerts(KeyStore ks)

Load trusted certificates from the specified KeyStore.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

csRefback to summary
private WeakReference<Set<X509Certificate>> csRef
descriptorback to summary
private TrustStoreManager.TrustStoreDescriptor descriptor
ksRefback to summary
private WeakReference<KeyStore> ksRef
tamLockback to summary
private final ReentrantLock tamLock

Constructor Detail

TrustAnchorManagerback to summary
private TrustAnchorManager()

Method Detail

getKeyStoreback to summary
pack-priv KeyStore getKeyStore(TrustStoreManager.TrustStoreDescriptor descriptor) throws Exception

Get the default trusted KeyStore with the specified descriptor.

Returns:KeyStore

null if the underlying KeyStore is not available.

getTrustedCertsback to summary
pack-priv Set<X509Certificate> getTrustedCerts(TrustStoreManager.TrustStoreDescriptor descriptor) throws Exception

Get trusted certificates in the default trusted KeyStore with the specified descriptor.

Returns:Set<X509Certificate>

empty collection if the underlying KeyStore is not available.

loadKeyStoreback to summary
private static KeyStore loadKeyStore(TrustStoreManager.TrustStoreDescriptor descriptor) throws Exception

Load the KeyStore as described in the specified descriptor.

loadTrustedCertsback to summary
private static Set<X509Certificate> loadTrustedCerts(KeyStore ks)

Load trusted certificates from the specified KeyStore.

sun.security.ssl back to summary

private final Class TrustStoreManager.TrustStoreDescriptor

extends Object
Class Inheritance

A descriptor of the default trusted KeyStore. The preference of the default trusted KeyStore is: javax.net.ssl.trustStore jssecacerts cacerts

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final String
private static final String
private final long
private final File
private final String
private final String
private final String
private final String

Constructor Summary

AccessConstructor and Description
private
TrustStoreDescriptor(String storeName, String storeType, String storeProvider, String storePassword, File storeFile, long lastModified)

Method Summary

Modifier and TypeMethod and Description
pack-priv static TrustStoreManager.TrustStoreDescriptor
createInstance()

Create an instance of TrustStoreDescriptor for the default trusted KeyStore.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultStoreback to summary
private static final String defaultStore
defaultStorePathback to summary
private static final String defaultStorePath
fileSepback to summary
private static final String fileSep
jsseDefaultStoreback to summary
private static final String jsseDefaultStore
lastModifiedback to summary
private final long lastModified
storeFileback to summary
private final File storeFile
storeNameback to summary
private final String storeName
storePasswordback to summary
private final String storePassword
storeProviderback to summary
private final String storeProvider
storeTypeback to summary
private final String storeType

Constructor Detail

TrustStoreDescriptorback to summary
private TrustStoreDescriptor(String storeName, String storeType, String storeProvider, String storePassword, File storeFile, long lastModified)

Method Detail

createInstanceback to summary
pack-priv static TrustStoreManager.TrustStoreDescriptor createInstance()

Create an instance of TrustStoreDescriptor for the default trusted KeyStore.

Annotations
@SuppressWarnings:Convert2Lambda
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override