Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv Class AESKeyWrapPadded

extends FeedbackCipher
Class Inheritance
Imports
java.util.Arrays, .HexFormat, java.security.*, java.security.spec.*, javax.crypto.*, javax.crypto.spec.*

This class implement the AES KeyWrap With Padding mode of operation as defined in "Recommendation for Block Cipher Modes of Operation: Methods for Key Wrapping" and represents AES cipher in KWP mode.

Field Summary

Modifier and TypeField and Description
pack-priv static final byte[]
private static final byte[]
Inherited from com.sun.crypto.provider.FeedbackCipher:
blockSizeembeddedCipheriv

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv int
decrypt(byte[]
the input buffer with the data to be decrypted
ct
,
int
the offset in cipher
ctOfs
,
int
the length of the input data
ctLen
,
byte[]
the buffer for the decryption result
pt
,
int
the offset in plain
ptOfs
)

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

Performs decryption operation.
pack-priv int

Returns:

the number of bytes placed into ct
decryptFinal
(byte[]
the input buffer with the data to be decrypted
ct
,
int
the offset in ct which is always 0
dummy1
,
int
the length of the input data
ctLen
,
byte[]
the output buffer for the decryption which is always ct
dummy2
,
int
the offset in the output buffer which is always 0
dummy3
)

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

Performs single-part decryption operation.
pack-priv int
encrypt(byte[]
the input buffer with the data to be encrypted
pt
,
int
the offset in plain
ptOfs
,
int
the length of the input data
ptLen
,
byte[]
the buffer for the encryption result
ct
,
int
the offset in cipher
ctOfs
)

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

Performs encryption operation.
pack-priv int

Returns:

the number of bytes placed into pt
encryptFinal
(byte[]
the input buffer with the data to be encrypted
pt
,
int
the offset in pt which is always 0
dummy1
,
int
the length of the input data
ptLen
,
byte[]
the output buffer for the encryption which is always pt
dummy2
,
int
the offset in the output buffer which is always 0
dummy3
)

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

Performs single-part encryption operation.
pack-priv String

Returns:

the string KW
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.
private static void
setIvAndLen(byte[] dest, byte[] iv, int inLen)

private static int
validateIV(byte[] ivAndLen, byte[] iv)

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

Field Detail

ICV2back to summary
pack-priv static final byte[] ICV2
PAD_BLKback to summary
private static final byte[] PAD_BLK

Constructor Detail

AESKeyWrapPaddedback to summary
pack-priv AESKeyWrapPadded()

Method Detail

decryptback to summary
pack-priv int decrypt(byte[] ct, int ctOfs, int ctLen, byte[] pt, int ptOfs)

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

Doc from com.sun.crypto.provider.FeedbackCipher.decrypt.

Performs decryption operation.

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

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
ct:byte[]

the input buffer with the data to be decrypted

ctOfs:int

the offset in cipher

ctLen:int

the length of the input data

pt:byte[]

the buffer for the decryption result

ptOfs:int

the offset in plain

Returns:int

the number of bytes placed into plain

Annotations
@Override
decryptFinalback to summary
pack-priv int decryptFinal(byte[] ct, int dummy1, int ctLen, byte[] dummy2, int dummy3) throws IllegalBlockSizeException

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

Performs single-part decryption operation.

The input ct, starting at 0 and ending at ctLen-1, is decrypted. The result is stored in place into ct, starting at 0.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
ct:byte[]

the input buffer with the data to be decrypted

dummy1:int

the offset in ct which is always 0

ctLen:int

the length of the input data

dummy2:byte[]

the output buffer for the decryption which is always ct

dummy3:int

the offset in the output buffer which is always 0

Returns:int

the number of bytes placed into ct

Annotations
@Override
encryptback to summary
pack-priv int encrypt(byte[] pt, int ptOfs, int ptLen, byte[] ct, int ctOfs)

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

Doc from com.sun.crypto.provider.FeedbackCipher.encrypt.

Performs encryption operation.

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

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
pt:byte[]

the input buffer with the data to be encrypted

ptOfs:int

the offset in plain

ptLen:int

the length of the input data

ct:byte[]

the buffer for the encryption result

ctOfs:int

the offset in cipher

Returns:int

the number of bytes placed into cipher

Annotations
@Override
encryptFinalback to summary
pack-priv int encryptFinal(byte[] pt, int dummy1, int ptLen, byte[] dummy2, int dummy3) throws IllegalBlockSizeException

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

Performs single-part encryption operation.

The input pt, starting at 0 and ending at ptLen-1, is encrypted. The result is stored in place into pt, starting at 0.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
pt:byte[]

the input buffer with the data to be encrypted

dummy1:int

the offset in pt which is always 0

ptLen:int

the length of the input data

dummy2:byte[]

the output buffer for the encryption which is always pt

dummy3:int

the offset in the output buffer which is always 0

Returns:int

the number of bytes placed into pt

Annotations
@Override
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 KW

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

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

Annotations
@Override
Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher
InvalidAlgorithmParameterException:
if the given iv is non-null and not the right length
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).

Annotations
@Override
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.

Annotations
@Override
saveback to summary
pack-priv void save()

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

Save the current content of this cipher.

Annotations
@Override
setIvAndLenback to summary
private static void setIvAndLen(byte[] dest, byte[] iv, int inLen)
validateIVback to summary
private static int validateIV(byte[] ivAndLen, byte[] iv) throws IllegalBlockSizeException