Class KeyPairCache
java.lang.Object
org.globus.gsi.gssapi.KeyPairCache
Simple cache for key pairs. The cache is used to avoid excessive
CPU consumption from key pair generation. In particular for
purposes of delegation, reusing a key pair is safe.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateKeyPairCache(String algorithm, String provider, long lifetime) Creates a KeyPairCache object for the specified algorithm, as supplied from the specified provider. -
Method Summary
Modifier and TypeMethodDescriptiongetKeyPair(int bits) Returns a key pair of sizebits.static KeyPairCachestatic KeyPairCachegetKeyPairCache(String algorithm, String provider, long lifetime)
-
Field Details
-
logger
private static org.apache.commons.logging.Log logger -
DEFAULT_ALGORITHM
- See Also:
-
DEFAULT_PROVIDER
- See Also:
-
algorithm
-
provider
-
lifetime
private final long lifetime -
keyPairCache
-
entries
Hash table of cache entries. The use ofHashtableis significant, since we rely on access to the table being synchronized.
-
-
Constructor Details
-
KeyPairCache
Creates a KeyPairCache object for the specified algorithm, as supplied from the specified provider.- Parameters:
algorithm- the standard string name of the algorithm. See Appendix A in the Java Cryptography Architecture API Specification & Reference for information about standard algorithm names.provider- the string name of the provider.lifetime- the lifetime of the cache in milliseconds.
-
-
Method Details
-
getKeyPairCache
-
getKeyPairCache
-
getKeyPair
Returns a key pair of sizebits. The same key pair may be returned several times within a period of the cache lifetime. If lifetime was set to zero or less than zero, no keys are cached.- Parameters:
bits- the keysize. This is an algorithm-specific metric, such as modulus length, specified in number of bits.- Throws:
NoSuchAlgorithmException- if the algorithm is not available in the environment.NoSuchProviderException- if the provider is not available in the environment.
-