IAIK PKCS#11 Provider API Documentation
version 1.6

iaik.pkcs.pkcs11.provider.random
Class PKCS11RandomSpi

java.lang.Object
  extended by java.security.SecureRandomSpi
      extended by iaik.pkcs.pkcs11.provider.random.PKCS11RandomSpi
All Implemented Interfaces:
PKCS11EngineClass, java.io.Serializable
Direct Known Subclasses:
PKCS11RandomNoSetSeedSpi, PKCS11SeededRandomSpi

public class PKCS11RandomSpi
extends java.security.SecureRandomSpi
implements PKCS11EngineClass

An implementation of the SecureRandomSpi that uses a PKCS#11 token to gereate random data and seeds. If this object is created using the default constructor, and this is always the case when instantiated through the JCA mechanism, this implementation always links to the first instance of IAIKPkcs11. The only way to link to a different instance is to instantiate the PKCS11Random class directly and to specify the provider. This implementation gets all random data directly from the token - seed bytes and random bytes. If there is no token present at creation time of this object, or if the present token does not support random number generation, this implementation uses a software delegate to process all requests. Per default, the SHA1PRNG algorithm is used for the software delegate.

Author:
Karl Scheibelhofer
See Also:
Serialized Form

Constructor Summary
PKCS11RandomSpi()
          This default constructor always links this random class to the first provider instance, because there are no means in the JCE to find out our provider instance.
PKCS11RandomSpi(TokenManager tokenManager)
          This constructor links this random class to the given token manager.
 
Method Summary
 boolean isSupportedBy(TokenManager tokenManager)
          Check, if the current token of the given token manager supports the required features for this engine class.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PKCS11RandomSpi

public PKCS11RandomSpi()
                throws IAIKPkcs11Exception
This default constructor always links this random class to the first provider instance, because there are no means in the JCE to find out our provider instance.

Throws:
IAIKPkcs11Exception - If there is no IAIKPkcs11 instance available.

PKCS11RandomSpi

public PKCS11RandomSpi(TokenManager tokenManager)
                throws IAIKPkcs11Exception
This constructor links this random class to the given token manager. It uses this token manager to access the token.

Parameters:
tokenManager - The manager of the token we use for random generation.
Throws:
IAIKPkcs11Exception - If there is no IAIKPkcs11 instance available.
Method Detail

isSupportedBy

public boolean isSupportedBy(TokenManager tokenManager)
Check, if the current token of the given token manager supports the required features for this engine class.

Specified by:
isSupportedBy in interface PKCS11EngineClass
Parameters:
tokenManager - The token manager. Used to get information about the current token.
Returns:
True, if this engine class can be used with the currently present token of the given token manager.
Preconditions
(tokenManager <> null)

IAIK PKCS#11 Provider API Documentation
version 1.6

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/

IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.6