Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
xjava.security.IJCE_Traceable
xjava.security.Cipher
cryptix.provider.cipher.SAFER
Richard De Moliner (demoliner@isi.ee.ethz.ch)Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
Signal and Information Processing Laboratory
Swiss Federal Institute of Technology
CH-8092 Zürich, Switzerland.
Field Summary | |
static int | |
static int | |
static int | |
static int |
Fields inherited from class xjava.security.Cipher | |
DECRYPT , ENCRYPT , UNINITIALIZED |
Fields inherited from class xjava.security.IJCE_Traceable | |
tracing |
Constructor Summary | |
|
Method Summary | |
Object |
|
int |
|
protected Object |
|
void |
|
void |
|
protected void |
|
protected int |
|
protected void |
|
static LinkStatus |
|
int |
|
String |
|
void |
|
void |
|
Methods inherited from class xjava.security.IJCE_Traceable | |
disableTracing , enableTracing , traceMethod , traceResult , traceResult , traceVoidMethod |
public static final int K128_VARIANT
- Field Value:
- 2
public static final int K64_VARIANT
- Field Value:
- 3
public static final int SK128_VARIANT
- Field Value:
- 0
public static final int SK64_VARIANT
- Field Value:
- 1
public SAFER()
Calls the Cipher constructor withimplBuffering
false,implPadding
false and the provider set to "Cryptix". Sets the variant of this cipher based on the currently set "variant" property in the provider properties file. The current JCE syntax for the SAFER algorithm variant property is:Alg.variant.SAFER = ...Valid alternatives for variant are:Once the variant is set, a default value for the number of rounds to use is also set as follows:
- SK-128, SK128, sk-128 and sk128: Strengthened key schedule of length 128 bits.
- SK-64, SK64, sk-64 and sk64: Strengthened key schedule of length 64 bits.
- K-128, K128, k-128 and k128: Non-strengthened key schedule of length 128 bits.
- K-64, K64, k-64 and k64: Non-strengthened key schedule of length 64 bits.
Variant Number of rounds = current value ------- -------------------------------- SK-128 SK128_DEFAULT_NOF_ROUNDS = 10 SK-64 SK64_DEFAULT_NOF_ROUNDS = 8 K-128 K128_DEFAULT_NOF_ROUNDS = 10 K-64 K64_DEFAULT_NOF_ROUNDS = 6If no variant property is found in the provider's properties file a strengthened key schedule of 128 bits is used with 10 rounds. This constructor also attempts to set the desired number of rounds for this cipher object from a "rounds" property in the provider's properties file. Acceptable values are non-zero integers between 1 and the MAX_NOF_ROUNDS constant; i.e. 13. If no such property is found, or is found but deemed invalid, then the already set value (depending on the variant property as determined above) remains unaltered.
public final Object clone() throws CloneNotSupportedException
Always throws a CloneNotSupportedException (cloning of ciphers is not supported for security reasons).
- Overrides:
- clone in interface Cipher
public int engineBlockSize()
SPI: Returns the length of an input block, in bytes.
- Overrides:
- engineBlockSize in interface Cipher
- Returns:
- the length in bytes of an input block for this cipher.
protected Object engineGetParameter(String param) throws NoSuchParameterException, InvalidParameterException
- Overrides:
- engineGetParameter in interface Cipher
public void engineInitDecrypt(Key key) throws KeyException
SPI: Initializes this cipher for decryption, using the specified key.
- Overrides:
- engineInitDecrypt in interface Cipher
- Parameters:
key
- the key to use for decryption.
public void engineInitEncrypt(Key key) throws KeyException
SPI: Initializes this cipher for encryption, using the specified key.
- Overrides:
- engineInitEncrypt in interface Cipher
- Parameters:
key
- the key to use for encryption.
protected void engineSetParameter(String param, Object value) throws NoSuchParameterException, InvalidParameterException, InvalidParameterTypeException
- Overrides:
- engineSetParameter in interface Cipher
protected int engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset)
SPI: This is the main engine method for updating data. in and out may be the same array, and the input and output regions may overlap.
- Overrides:
- engineUpdate in interface Cipher
- Parameters:
in
- the input data.inOffset
- the offset into in specifying where the data starts.inLen
- the length of the subarray.out
- the output array.outOffset
- the offset indicating where to start writing into the out array.
- Returns:
- the number of bytes written.
protected final void finalize()
Cleans up resources used by this instance, if necessary.
public static LinkStatus getLinkStatus()
Gets an object representing the native linking status of this class.
public int getRounds()
Gets the number of rounds for this cipher.
public String getVariant()
Gets the variant for this cipher ("SK-128", "SK-64", "K-128", or "K-64").
public void setRounds(int rounds)
Sets the number of rounds for this cipher. Allowed only when this cipher is in the UNINITIALIZED state; otherwise an exception is thrown. If the specified number is invalid, the current one remains unchanged.
- Parameters:
rounds
- the desired number of rounds for this cipher.
public void setVariant(String ps)
Sets the variant for this cipher. Allowed only when this cipher is in the UNINITIALIZED state; otherwise an exception is thrown.
- Parameters:
ps
- The desired new variant identifier for this cipher.