RSA BSAFE CRYPTO-J

Cryptographic Components for Java

JSAFE Javadoc JCE Javadoc Search

CryptoJ Class Reference

This is the Crypto-J "master class".

It keeps the version number and enables FIPS-related self-testing on a FIPS-validated version of the toolkit.

CryptoJ has methods to allow the user run the FIPS-required power-up self-tests on demand and get their status, methods to set and query the user role, and methods to get and set the library to fips or non-fips mode. These methods are not available on a non-fips library.

The FIPS version of CryptoJ executes power-up self-tests automatically upon startup and conditional tests at runtime. Upon startup failure, the the toolkit enters a FAILED state preventing further operation.

See Overview of Crypto-J for background and reference material on using and understanding Crypto-J.

Copyright © RSA Security Inc., 1997-2005. All rights reserved.

List of all members.

Static Public Methods

CryptoJ CryptoJ:: getInstance ()
 A factory method that gets a CryptoJ instance.

SecureRandom CryptoJ:: getSeeder ()
 Returns the global seed generator. More...

final boolean CryptoJ:: isFIPS140Compliant ()
 Indicates whether this toolkit is FIPS 140-2 compliant. More...

int CryptoJ:: getState ()
 Queries the toolkit execution state on a FIPS-validated toolkit. More...

int CryptoJ:: getMode ()
 Returns the mode, either FIPS or NON-FIPS. More...

void CryptoJ:: setMode (int newMode) throws JSAFE_InvalidUseException
 Sets the FIPS mode to newMode. More...

int CryptoJ:: getRole ()
 Returns the user role. More...

void CryptoJ:: setRole (int newRole) throws JSAFE_InvalidUseException
 Sets the user mode to newRole. More...

boolean CryptoJ:: selfTestPassed ()
 Retrieves the results of last execution of the power-up self-tests. More...

synchronized boolean CryptoJ:: runSelfTests () throws JSAFE_InvalidUseException
 Runs the FIPS 140 required power-up self-tests on demand. More...

void CryptoJ:: fips186RandomClearQ (SecureRandom random)
 Resets the prime Q to its default value. More...

void CryptoJ:: fips186RandomSetQ (SecureRandom random, byte[] qBytes)
 Sets the prime Q to the given value. More...

void CryptoJ:: fips186RandomClearXKEY (SecureRandom random)
 Clears the the interal state of the random. More...

void CryptoJ:: fips186RandomSetXKEY (SecureRandom random, byte[] XKEYBytes)
 Sets the internal seed of the random to the given value. More...

void CryptoJ:: main (String[] args)
 This method prints the version number on a non-FIPS toolkit and runs run any or all of the known answer tests used in power-up self-testing on a FIPS validated toolkit.


Static Public Attributes

final String CryptoJ:: CRYPTO_J_VERSION
 The current version of Crypto-J.

final int CryptoJ:: NOT_INITIALIZED
 Indicates that the toolkit has not been verified.

final int CryptoJ:: UNDER_SELF_TEST
 Indicates that the toolkit is under self test.

final int CryptoJ:: OPERATIONAL
 Indicates that the toolkit passed verification.

final int CryptoJ:: FAILED
 Indicates that the toolkit failed verification; a powerup or a conditional self test has failed.

final int CryptoJ:: FIPS_MODE
 Indicates that the toolkit is running in FIPS mode.

final int CryptoJ:: NON_FIPS_MODE
 Indicates that the toolkit is running in non-FIPS mode.

final int CryptoJ:: FIPS_TESTING_MODE
 Indicates that the toolkit is running in FIPS testing mode.

final int CryptoJ:: CRYPTO_OFFICER_ROLE
 Denotes the Crypto Officer role.

final int CryptoJ:: USER_ROLE
 Denotes the normal user role.

byte [] CryptoJ:: savedQBytes
 saved Q bytes for testing a fips 186 random and acts as a flag.

byte [] CryptoJ:: savedXKEYBytes
 saved XKEY bytes for testing a fips 186 random and acts as a flag.


Member Function Documentation

void CryptoJ::fips186RandomClearQ SecureRandom    random [inline, static];
 

Resets the prime Q to its default value.

This method is for use in CRYPTO_OFFICER_ROLE when running the FIPS RNG validation suite.

Parameters:
random a FIPS 186 random to test

void CryptoJ::fips186RandomClearXKEY SecureRandom    random [inline, static];
 

Clears the the interal state of the random.

This method is for use in the CRYPTO_OFFICER_ROLE when running the FIPS RNG validation suite.

Parameters:
random a FIPS 186 random to test

void CryptoJ::fips186RandomSetQ SecureRandom    random,
byte    qBytes[]
[inline, static];
 

Sets the prime Q to the given value.

This method is for use in CRYPTO_OFFICER_ROLE when running the FIPS RNG validation suite.

Parameters:
random a FIPS 186 random to test
qBytes the value for Q

void CryptoJ::fips186RandomSetXKEY SecureRandom    random,
byte    XKEYBytes[]
[inline, static];
 

Sets the internal seed of the random to the given value.

This method is for use in CRYPTO_OFFICER_ROLE when running the FIPS RNG validation suite. Neither the JCE nor the JSAFE API provide a method to seed the internal seed of the random. This method provides allows a NIST RNG validation test to set tthe initial test of the random in a uniforma fashion acrorss teh JSAFE and JCE API.

Parameters:
random a FIPS 186 random to test
qBytes the value for Q

int CryptoJ::getMode   [inline, static];
 

Returns the mode, either FIPS or NON-FIPS. The FIPS mode is meaningful only in a FIPS-validated library.

See also:
isFIPS140Compliant , setMode
Returns:
The mode: FIPS_MODE or NON_FIPS_MODE.

int CryptoJ::getRole   [inline, static];
 

Returns the user role. The user role is meaninful only on a FIPS-validated library.

See also:
isFIPS140Compliant , setRole
Returns:
The user role: USER_ROLE or CRYPTO_OFFICER_ROLE.

SecureRandom CryptoJ::getSeeder   [inline, static];
 

Returns the global seed generator.

This method is a convenience for users that may need to rely on autoseeding. It allows access to the library's shared seed generation object. Crypto-J keeps a globaly shared SecureRandom of the default provider from which it extracts seed bytes in order to seed other random number generators. These bytes are computed using the seed generation algorithm that this class of the default provider uses to seed itself. The caller may add entropy to this object or trigger autoseeding at a time convenient to the application.

Returns:
the Crypto-J global seed generator

int CryptoJ::getState   [inline, static];
 

Queries the toolkit execution state on a FIPS-validated toolkit.

See also:
isFIPS140Compliant
Returns:
The execution state: NOT_INITIALIZED, UNDER_SELF_TEST, OPERATIONAL, or FAILED.

final boolean CryptoJ::isFIPS140Compliant   [inline, static];
 

Indicates whether this toolkit is FIPS 140-2 compliant. If it is compliant, then methods to query and set the FIPS mode, the user role, and run the power-up tests are available; otherwise, these methods are not available.

There is no enforcement of algorithm selection in FIPS_MODE. The caller is responsible for choosing the proper algorithms.

See also:
getState , getMode , setMode , getRole , setRole , selfTestPassed , runSelfTests
Returns:
true if this is a FIPS 140-2 compliant library; false otherwise.

synchronized boolean CryptoJ::runSelfTests   throws JSAFE_InvalidUseException [inline, static];
 

Runs the FIPS 140 required power-up self-tests on demand. For use by the Crypto Officer with a FIPS-validated toolkit.

These tests consist of the algorithm known answer tests plus pairwise consisency checks on DSA and RSA key pair generation.

See also:
isFIPS140Compliant , selfTestPassed
Returns:
true if all the self-tests passed, false otherwise.

boolean CryptoJ::selfTestPassed   [inline, static];
 

Retrieves the results of last execution of the power-up self-tests. This method should be called on a FIPS-compliant library only.

See also:
isFIPS140Compliant
Returns:
true if all the self-tests passed, false otherwise.

void CryptoJ::setMode int    newMode throws JSAFE_InvalidUseException [inline, static];
 

Sets the FIPS mode to newMode. The paramater newMode must be one of FIPS_MODE or NON_FIPS_MODE and the library must be a FIPS validated library. There is no enforcement of algorithm selection on FIPS_MODE, the caller is resposible for choosing the proper algorithms.

See also:
isFIPS140Compliant , getMode
Parameters:
newMode The desired mode, FIPS_MODE or NON_FIPS_MODE
Exceptions:
JSAFE_InvalidUseException If newMode is not an allowed value or the library is not a FIPS-compliant library.

void CryptoJ::setRole int    newRole throws JSAFE_InvalidUseException [inline, static];
 

Sets the user mode to newRole. For use with a FIPS-validated toolkit.

See also:
isFIPS140Compliant , getRole
Parameters:
newRole The desired role: USER_ROLE or CRYPTO_OFFICER_ROLE.
Exceptions:
JSAFE_InvalidUseException If newRole is not an allowed value or the library is not FIPS-compliant.


Copyright (c) 1999-2005 RSA Security Inc. All rights reserved. 038-001001-3500-001-000 - 3.5