public final class SPEED extends Cipher implements SymmetricCipher
These parameters are set as follows:
initEncrypt
or initDecrypt
. It can be
any even number of bytes from 6 to 32 (6, 8, 10, ... 32).
These are recommended settings for 'adequate' security:
+--------------------------------------------------+ | block size | key length | rounds | |==================================================| | 8 | >= 8 | >= 64 | |--------------------------------------------------| | 16 | >= 8 | >= 48 | |--------------------------------------------------| | 32 | >= 8 | >= 48 | +--------------------------------------------------+
SPEED was designed by Yuliang Zheng, and is in the public domain.
References:
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.6 $
DECRYPT, ENCRYPT, UNINITIALIZED
Constructor and Description |
---|
SPEED()
Constructs a SPEED cipher object, in the UNINITIALIZED state.
|
Modifier and Type | Method and Description |
---|---|
protected void |
blockDecrypt(byte[] in,
int in_offset,
byte[] out,
int out_offset)
Decrypts a block.
|
protected void |
blockEncrypt(byte[] in,
int in_offset,
byte[] out,
int out_offset)
Encrypts a block.
|
java.lang.Object |
clone()
Always throws a CloneNotSupportedException (cloning of ciphers is not
supported for security reasons).
|
(package private) void |
dump() |
protected int |
engineBlockSize()
SPI: Return the data block length of this cipher.
|
protected java.lang.Object |
engineGetParameter(java.lang.String param)
SPI: Gets the value of the specified algorithm parameter.
|
void |
engineInitDecrypt(java.security.Key key)
SPI: Initializes this cipher for decryption, using the
specified key.
|
void |
engineInitEncrypt(java.security.Key key)
SPI: Initializes this cipher for encryption, using the
specified key.
|
protected void |
engineSetParameter(java.lang.String param,
java.lang.Object value)
SPI: Sets the specified algorithm parameter to the specified
value.
|
protected int |
engineUpdate(byte[] in,
int inOffset,
int inLen,
byte[] out,
int outOffset)
SPI: This is the main engine method for updating data.
|
protected void |
finalize()
Cleans up resources used by this instance, if necessary.
|
static LinkStatus |
getLinkStatus()
Gets an object representing the native linking status of this class.
|
int |
getRounds()
Returns the currently set number of rounds for this instance.
|
static void |
main(java.lang.String[] argv)
Entry point for self_test.
|
static void |
self_test(java.io.PrintWriter out,
java.lang.String[] argv)
Runs algorithm through test data, including certification data
provided in paper.
|
void |
setBlockSize(int blocksize)
Sets the block size in bytes for this cipher.
|
void |
setRounds(int rounds)
Sets the number of rounds for this cipher.
|
blockSize, crypt, crypt, crypt, doFinal, doFinal, doFinal, doFinal, engineCiphertextBlockSize, engineCrypt, engineInBufferSize, engineOutBufferSize, enginePlaintextBlockSize, engineSetPaddingScheme, getAlgorithm, getAlgorithms, getAlgorithms, getCiphertextBlockSize, getInputBlockSize, getInstance, getInstance, getInstance, getMode, getOutputBlockSize, getPadding, getPaddingScheme, getParameter, getPlaintextBlockSize, getProvider, getState, inBufferSize, inBufferSizeFinal, initDecrypt, initEncrypt, isPaddingBlockCipher, outBufferSize, outBufferSizeFinal, setParameter, toString, update, update, update, update
public SPEED()
public static LinkStatus getLinkStatus()
protected final void finalize()
finalize
in class java.lang.Object
public final java.lang.Object clone() throws java.lang.CloneNotSupportedException
protected int engineBlockSize()
engineBlockSize
in class Cipher
public void engineInitEncrypt(java.security.Key key) throws java.security.InvalidKeyException
engineInitEncrypt
in class Cipher
key
- the key to use for encryption.java.security.InvalidKeyException
- if one of the following occurs: public void engineInitDecrypt(java.security.Key key) throws java.security.InvalidKeyException, CryptixException
engineInitDecrypt
in class Cipher
key
- the key to use for decryption.java.security.InvalidKeyException
- if one of the following occurs: CryptixException
protected int engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset)
in and out may be the same array, and the input and output regions may overlap.
engineUpdate
in class Cipher
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.CryptixException
- if the native library is being used, and it
reports an error.protected void engineSetParameter(java.lang.String param, java.lang.Object value) throws NoSuchParameterException, java.security.InvalidParameterException, InvalidParameterTypeException
SPEED has two parameters:
engineSetParameter
in class Cipher
param
- the string name of the parameter.value
- the parameter value.java.security.InvalidParameterException
- if param is an invalid
parameter for this cipher implementation, the
parameter is already set and cannot be set again, a
security exception occurs, and so on.InvalidParameterTypeException
- if value is of the wrong
type.NoSuchParameterException
- if there is no parameter with name
param for this cipher implementation.protected java.lang.Object engineGetParameter(java.lang.String param) throws NoSuchParameterException, java.security.InvalidParameterException
SPEED has two parameters:
engineGetParameter
in class Cipher
param
- the string name of the parameter.NoSuchParameterException
- if there is no parameter with name
param for this cipher implementation.java.security.InvalidParameterException
- if the parameter exists but cannot
be read.public void setRounds(int rounds)
If the specified number is invalid, an IllegalArgumentException is thrown.
rounds
- the desired number of rounds: >= 32, multiple of 4java.lang.IllegalStateException
- if this cipher is not uninitialised.java.security.InvalidParameterException
- if the given number of rounds is
not supported.public int getRounds()
public void setBlockSize(int blocksize)
If the specified number is invalid, an IllegalArgumentException is thrown.
blocksize
- the desired block size in bytes: 8, 16 or 32java.lang.IllegalStateException
- if this cipher is not uninitialised.java.lang.IllegalArgumentException
- if the given number of rounds is
not supported.void dump()
protected void blockEncrypt(byte[] in, int in_offset, byte[] out, int out_offset)
in
- The data to be encrypted.in_offset
- The start of data within the in buffer.out
- The encrypted data.out_offset
- The start of data within the out buffer.protected void blockDecrypt(byte[] in, int in_offset, byte[] out, int out_offset)
in
- The data to be decrypted.in_offset
- The start of data within the in buffer.out
- The decrypted data.out_offset
- The start of data within the out buffer.public static final void main(java.lang.String[] argv)
public static void self_test(java.io.PrintWriter out, java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception