public abstract class SecurityEngine
extends java.lang.Object
To operate in FIPS mode the cryptographic module must be authenticated, and every cryptographic algorithm must be tested. This means that every JAR file that contains classes which belong to the cryptographic module must present. The JAR files which contain classes belonging to the cryptographic module are listed below, all must be present in order for the module authentication to succeed:
Or:
For people who wish to use the Toolkit in non-FIPS mode, no additional calls need to be made; by default the Toolkit operates in non-FIPS mode. For people who with to use the Toolkit in FIPS mode, the following call must be made at the start of their program:
SecurityEngine.initialize( true );
Once this call has been made, the Toolkit will operate in compliance with FIPS 140-2 level 1. For more information on FIPS, please refer to NIST
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_BYTE_ARRAY
Data returned when in FIPS ERROR state.
|
static int |
ERROR
Constant to indicate the ERROR state as required by FIPS 140-2.
|
static java.lang.String |
FIPS_VERSION
Contains the version of the FIPS boundary
|
static int |
OPERATIONAL
Constant to indicate that the Security Engine is in the non-FIPS
operational state.
|
static int |
OPERATIONAL_FIPS
Constant to indicate that the Security Engine is in the FIPS operational
state whereby FIPS requirements are enforced.
|
static int |
SELF_TESTING
Constant to indicate that the Security Engine is in the SELF_TESTING
state.
|
| Constructor and Description |
|---|
SecurityEngine() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertCryptoOperationsAllowed()
Checks if the Toolkit is allowed to perform cryptographic operations; if
not, a
SecurityException is thrown indicating this. |
static void |
doSelfTests()
Authenticates the cryptographic module and runs all algorithm self-tests
on the cryptographic module.
|
static int |
getState()
Return the state of the FIPS Security Engine.
|
static void |
initialize(boolean fipsMode)
Initializes the Toolkit in FIPS or non-FIPS mode.
|
static boolean |
isCryptoOperationsAllowed()
Returns
true if the Toolkit is allowed to perform
cryptographic operations; otherwise false is returned. |
static boolean |
isInFIPSMode()
Returns
true if the Security Engine is in FIPS mode;
otherwise false is returned. |
static void |
setErrorState(java.lang.String errorMessage)
Forces the FIPS Security Engine into the FIPS ERROR state.
|
public static final int OPERATIONAL
public static final int SELF_TESTING
public static final int OPERATIONAL_FIPS
public static final int ERROR
public static final byte[] EMPTY_BYTE_ARRAY
public static final java.lang.String FIPS_VERSION
public static void initialize(boolean fipsMode)
throws java.lang.SecurityException
To initialize in non-FIPS mode, call this function with fipsMode set to false. When calling this function with fipsMode set to true, it will attempt to initialize in FIPS mode. If the initialization was unsuccessful, the FIPS ERROR state results.
fipsMode - [FIPS 140-2 control input] true for initializing
in FIPS mode; false otherwisejava.lang.SecurityException - [FIPS 140-2 status output] thrown if FIPS power up
self-tests failpublic static void doSelfTests()
throws java.lang.SecurityException
If the tests are all successful, a state transition to OPERATIONAL_FIPS occurs; if the tests fail, a state transition to ERROR occurs.
java.lang.SecurityException - [FIPS 140-2 status output] thrown if any of the self-tests
failpublic static int getState()
public static void setErrorState(java.lang.String errorMessage)
Users should never call this function as it will restrict cryptographic functionality. Its purpose is to allow power-up test failure and conditional test failure to result in the FIPS ERROR state.
errorMessage - [FIPS 140-2 control input] message indicating why the FIPS
Security Engine is being put in the FIPS ERROR statejava.lang.SecurityException - [FIPS 140-2 status output] always thrown; contains the
provided error messagepublic static boolean isInFIPSMode()
true if the Security Engine is in FIPS mode;
otherwise false is returned.
When in FIPS mode, the FIPS Security Engine enforces FIPS requirements.
true if the Security
Engine is in FIPS mode; false otherwisepublic static boolean isCryptoOperationsAllowed()
true if the Toolkit is allowed to perform
cryptographic operations; otherwise false is returned.
Cryptographic operation are not permitted when in the FIPS ERROR state.
true if the Toolkit is
allowed to perform cryptographic operations; false
otherwisepublic static void assertCryptoOperationsAllowed()
throws Fips140ErrorStateException
SecurityException is thrown indicating this.
Cryptographic operations are not permitted when in the FIPS ERROR state.
Fips140ErrorStateException - [FIPS 140-2 status output] thrown if the Toolkit is not
allowed to perform cryptographic operations