All ciphers in GNU Crypto implement the IBlockCipher
interface,
and support all the methods listed in this section.
A property name in the attributes map that is passed to the
init
method, representing the cipher's desired block size. The mapped value should be ajava.lang.Integer
of the cipher's block size, in bytes. If this attribute is omitted, the cipher's default block size is used.
A property name in the attributes map that is passed to the
init
method, representing the bytes that are to compose the cipher's key. The mapped value must be a byte array, and its length must be one of the cipher's supported key sizes.
Initializes the cipher for transforming data. The attributes parameter must be a
java.util.Map
that has, at least, a mapping between theKEY_MATERIAL
property name to a byte array containing the key. Ciphers may define other property names. If the supplied byte array is not an acceptable key, this method throws ajava.security.InvalidKeyException
. If this instance has already been initialized, this method throws ajava.lang.IllegalStateException
.
Returns a
java.util.Iterator
of the cipher's supported block sizes. Each element of the iterator is ajava.lang.Integer
.
Returns a
java.util.Iterator
of the cipher's supported key sizes. Each element of the iterator is ajava.lang.Integer
.
Returns a clone of this cipher. The cloned instance must be initialized, as this method will not clone the cipher's internal key.
Returns the cipher's current block size, in bytes, or will throw a
java.lang.IllegalStateException
if this instance has not been initialized.
Encrypts a block of bytes from plaintext starting at inOffset, storing the encrypted bytes in ciphertext, starting at outOffset. It is up to the programmer to ensure that there is at least one full block in plaintext from inOffset and space for one full block in ciphertext from outOffset. A
java.lang.IllegalStateException
will be thrown if the cipher has not been initialized.
Decrypts a block of bytes from ciphertext starting at inOffset, storing the encrypted bytes in plaintext, starting at outOffset. It is up to the programmer to ensure that there is at least one full block in ciphertext from inOffset and space for one full block in plaintext from outOffset. A
java.lang.IllegalStateException
will be thrown if the cipher has not been initialized.