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

pack-priv final Class CipherFeedback

extends FeedbackCipher
Class Inheritance
Imports
java.security.InvalidKeyException, .ProviderException, sun.security.util.ArrayUtil

This class represents ciphers in cipher-feedback (CFB) mode.

This mode is implemented independently of a particular cipher. Ciphers to which this mode should apply (e.g., DES) must be plugged-in using the constructor.

Note

This class does not deal with buffering or padding.

Author
Gigi Ankeny

Field Summary

Modifier and TypeField and Description
private final byte[]
k

private final int
private final byte[]
private byte[]
Inherited from com.sun.crypto.provider.FeedbackCipher:
blockSizeembeddedCipheriv

Constructor Summary

AccessConstructor and Description
pack-priv
CipherFeedback(SymmetricCipher embeddedCipher, int numBytes)

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

the length of the decrypted data
decrypt
(byte[]
the buffer with the input data to be decrypted
cipher
,
int
the offset in cipherOffset
cipherOffset
,
int
the length of the input data
cipherLen
,
byte[]
the buffer for the result
plain
,
int
the offset in plain
plainOffset
)

Implements abstract com.sun.crypto.provider.FeedbackCipher.decrypt.

Performs decryption operation.

pack-priv int

Returns:

the length of the decrypted data
decryptFinal
(byte[]
the buffer with the input data to be decrypted
cipher
,
int
the offset in cipherOffset
cipherOffset
,
int
the length of the input data
cipherLen
,
byte[]
the buffer for the result
plain
,
int
the offset in plain
plainOffset
)

Overrides com.sun.crypto.provider.FeedbackCipher.decryptFinal.

Performs the last decryption operation.

pack-priv int

Returns:

the length of the encrypted data
encrypt
(byte[]
the buffer with the input data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
int
the length of the input data
plainLen
,
byte[]
the buffer for the result
cipher
,
int
the offset in cipher
cipherOffset
)

Implements abstract com.sun.crypto.provider.FeedbackCipher.encrypt.

Performs encryption operation.

pack-priv int

Returns:

the number of bytes placed into cipher
encryptFinal
(byte[]
the buffer with the input data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
int
the length of the input data
plainLen
,
byte[]
the buffer for the result
cipher
,
int
the offset in cipher
cipherOffset
)

Overrides com.sun.crypto.provider.FeedbackCipher.encryptFinal.

Performs the last encryption operation.

pack-priv String

Returns:

the string CFB
getFeedback
()

Implements abstract com.sun.crypto.provider.FeedbackCipher.getFeedback.

Gets the name of this feedback mode.

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

Implements abstract com.sun.crypto.provider.FeedbackCipher.init.

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

pack-priv void
reset()

Implements abstract com.sun.crypto.provider.FeedbackCipher.reset.

Resets the iv to its original value.

pack-priv void
restore()

Implements abstract com.sun.crypto.provider.FeedbackCipher.restore.

Restores the content of this cipher to the previous saved one.

pack-priv void
save()

Implements abstract com.sun.crypto.provider.FeedbackCipher.save.

Save the current content of this cipher.

Inherited from com.sun.crypto.provider.FeedbackCipher:
getBlockSizegetEmbeddedCiphergetIV

Field Detail

kback to summary
private final byte[] k
numBytesback to summary
private final int numBytes
registerback to summary
private final byte[] register
registerSaveback to summary
private byte[] registerSave

Constructor Detail

CipherFeedbackback to summary
pack-priv CipherFeedback(SymmetricCipher embeddedCipher, int numBytes)

Method Detail

decryptback to summary
pack-priv int decrypt(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset)

Implements abstract com.sun.crypto.provider.FeedbackCipher.decrypt.

Performs decryption operation.

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

Parameters
cipher:byte[]

the buffer with the input data to be decrypted

cipherOffset:int

the offset in cipherOffset

cipherLen:int

the length of the input data

plain:byte[]

the buffer for the result

plainOffset:int

the offset in plain

Returns:int

the length of the decrypted data

Exceptions
ProviderException:
if cipherLen is not a multiple of the numBytes
decryptFinalback to summary
pack-priv int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset)

Overrides com.sun.crypto.provider.FeedbackCipher.decryptFinal.

Performs the last decryption operation.

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

Parameters
cipher:byte[]

the buffer with the input data to be decrypted

cipherOffset:int

the offset in cipherOffset

cipherLen:int

the length of the input data

plain:byte[]

the buffer for the result

plainOffset:int

the offset in plain

Returns:int

the length of the decrypted data

encryptback to summary
pack-priv int encrypt(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset)

Implements abstract com.sun.crypto.provider.FeedbackCipher.encrypt.

Performs encryption operation.

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

Parameters
plain:byte[]

the buffer with the input data to be encrypted

plainOffset:int

the offset in plain

plainLen:int

the length of the input data

cipher:byte[]

the buffer for the result

cipherOffset:int

the offset in cipher

Returns:int

the length of the encrypted data

Exceptions
ProviderException:
if plainLen is not a multiple of the numBytes
encryptFinalback to summary
pack-priv int encryptFinal(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset)

Overrides com.sun.crypto.provider.FeedbackCipher.encryptFinal.

Performs the last encryption operation.

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

Parameters
plain:byte[]

the buffer with the input data to be encrypted

plainOffset:int

the offset in plain

plainLen:int

the length of the input data

cipher:byte[]

the buffer for the result

cipherOffset:int

the offset in cipher

Returns:int

the number of bytes placed into cipher

getFeedbackback to summary
pack-priv String getFeedback()

Implements abstract com.sun.crypto.provider.FeedbackCipher.getFeedback.

Gets the name of this feedback mode.

Returns:String

the string CFB

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

Implements abstract com.sun.crypto.provider.FeedbackCipher.init.

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

Parameters
decrypting:boolean

flag indicating encryption or decryption

algorithm:String

the algorithm name

key:byte[]

the key

iv:byte[]

the iv

Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
resetback to summary
pack-priv void reset()

Implements abstract com.sun.crypto.provider.FeedbackCipher.reset.

Resets the iv to its original value. This is used when doFinal is called in the Cipher class, so that the cipher can be reused (with its original iv).

restoreback to summary
pack-priv void restore()

Implements abstract com.sun.crypto.provider.FeedbackCipher.restore.

Restores the content of this cipher to the previous saved one.

saveback to summary
pack-priv void save()

Implements abstract com.sun.crypto.provider.FeedbackCipher.save.

Save the current content of this cipher.