APIdia Launch Partner
Top Description Constructors Methods
com.sun.crypto.provider

pack-priv abstract Class SymmetricCipher

extends Object
Class Inheritance
Known Direct Subclasses
com.sun.crypto.provider.AES_Crypt, com.sun.crypto.provider.BlowfishCrypt, com.sun.crypto.provider.DESCrypt, com.sun.crypto.provider.RC2Crypt
Imports
java.security.InvalidKeyException

This abstract class represents the core of all block ciphers. It allows to initialize the cipher and encrypt/decrypt single blocks. Larger quantities are handled by modes, which are subclasses of FeedbackCipher.
Authors
Gigi Ankeny, Jan Luehe
See Also
AES_Crypt, DESCrypt, DESedeCrypt, BlowfishCrypt, FeedbackCipher

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract void
decryptBlock(byte[]
the input buffer with the data to be decrypted
cipher
,
int
the offset in cipher
cipherOffset
,
byte[]
the buffer for the decryption result
plain
,
int
the offset in plain
plainOffset
)

Decrypt one cipher block.

pack-priv abstract void
encryptBlock(byte[]
the input buffer with the data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
byte[]
the buffer for the encryption result
cipher
,
int
the offset in cipher
cipherOffset
)

Encrypt one cipher block.

pack-priv abstract int

Returns:

the block size of this cipher
getBlockSize
()

Retrieves this cipher's block size.

pack-priv abstract void
init(boolean
flag indicating encryption or decryption
decrypting
,
String
the algorithm name
algorithm
,
byte[]
the key
key
)

Initializes the cipher in the specified mode with the given key.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SymmetricCipherback to summary
pack-priv SymmetricCipher()

Method Detail

decryptBlockback to summary
pack-priv abstract void decryptBlock(byte[] cipher, int cipherOffset, byte[] plain, int plainOffset)

Decrypt one cipher block.

The input cipher, starting at cipherOffset and ending at (cipherOffset+blockSize-1), is decrypted. The result is stored in plain, starting at plainOffset.

Parameters
cipher:byte[]

the input buffer with the data to be decrypted

cipherOffset:int

the offset in cipher

plain:byte[]

the buffer for the decryption result

plainOffset:int

the offset in plain

encryptBlockback to summary
pack-priv abstract void encryptBlock(byte[] plain, int plainOffset, byte[] cipher, int cipherOffset)

Encrypt one cipher block.

The input plain, starting at plainOffset and ending at (plainOffset+blockSize-1), is encrypted. The result is stored in cipher, starting at cipherOffset.

Parameters
plain:byte[]

the input buffer with the data to be encrypted

plainOffset:int

the offset in plain

cipher:byte[]

the buffer for the encryption result

cipherOffset:int

the offset in cipher

getBlockSizeback to summary
pack-priv abstract int getBlockSize()

Retrieves this cipher's block size.

Returns:int

the block size of this cipher

initback to summary
pack-priv abstract void init(boolean decrypting, String algorithm, byte[] key) throws InvalidKeyException

Initializes the cipher in the specified mode with the given key.

Parameters
decrypting:boolean

flag indicating encryption or decryption

algorithm:String

the algorithm name

key:byte[]

the key

Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher