public class CTR extends StreamModeBaseCipher
counter, ivBLOCKSIZE, inputLenUpdate, inputOffsetUpdate, inputUpdate, isInitialized, len, opmode, padding, rk, sm4| 构造器和说明 |
|---|
CTR() |
| 限定符和类型 | 方法和说明 |
|---|---|
private void |
decrypt(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
decrypt without handling padding
|
private void |
encrypt(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
encrypt with handling padding
|
byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen) |
int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset) |
int |
engineGetOutputSize(int inputLen) |
void |
engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random) |
void |
engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random) |
void |
engineInit(int opmode,
Key key,
SecureRandom random) |
byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen) |
int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset) |
private byte |
increment(int index)
determines whether the binary bit of counter[index] contains zeros
if it contains zero, it changes the rightmost zero to 1 and all binary positions to its right to 0
if it does not contain 0, it throws an exception
|
private void |
incrementCount()
implement counter increment
|
private void |
processCTR(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
encrypt(decrypt) entire blocks of data
|
void |
reset()
reset some parameters after encryption
|
engineGetIV, engineGetParametersengineGetBlockSize, engineSetMode, engineSetPadding, engineUpdateAAD, initengineDoFinal, engineGetKeySize, engineUnwrap, engineUpdate, engineUpdateAAD, engineWrappublic void engineInit(int opmode,
Key key,
SecureRandom random)
throws InvalidKeyException
engineInit 在类中 StreamModeBaseCipherInvalidKeyExceptionpublic void engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
public void engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
public int engineGetOutputSize(int inputLen)
engineGetOutputSize 在类中 SM4BaseCipherpublic byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
engineUpdate 在类中 SM4BaseCipherpublic int engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException
engineUpdate 在类中 SM4BaseCipherShortBufferExceptionpublic byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
throws IllegalBlockSizeException,
BadPaddingException
public int engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException,
IllegalBlockSizeException,
BadPaddingException
private void encrypt(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
input - inputOffset - inputLen - output - outputOffset - private void decrypt(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
input - inputOffset - inputLen - output - outputOffset - private void incrementCount()
private byte increment(int index)
throws Exception
index - Exceptionprivate void processCTR(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
input - inputOffset - inputLen - output - outputOffset - public void reset()
SM4BaseCipherreset 在类中 StreamModeBaseCipherCopyright © 2024. All rights reserved.