Class GMCipherSpi
java.lang.Object
javax.crypto.CipherSpi
org.bouncycastle.jcajce.provider.asymmetric.util.BaseCipherSpi
org.bouncycastle.jcajce.provider.asymmetric.ec.GMCipherSpi
- Direct Known Subclasses:
GMCipherSpi.SM2, GMCipherSpi.SM2withBlake2b, GMCipherSpi.SM2withBlake2s, GMCipherSpi.SM2withMD5, GMCipherSpi.SM2withRMD, GMCipherSpi.SM2withSha1, GMCipherSpi.SM2withSha224, GMCipherSpi.SM2withSha256, GMCipherSpi.SM2withSha384, GMCipherSpi.SM2withSha512, GMCipherSpi.SM2withWhirlpool
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classA ByteArrayOutputStream whose contents can be zeroed: reset() only rewinds the count and leaves what was written in the backing array, and a growth, left to ByteArrayOutputStream, drops the array it replaces as it stands.static classClasses that inherit from usstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields inherited from class BaseCipherSpi
engineParams, wrapEngine -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]engineDoFinal(byte[] input, int inputOffset, int inputLen) intengineDoFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) intbyte[]intengineGetKeySize(Key key) The field size of the key's curve, for any EC key init accepts - not just a BC one - so the key is converted the same way init converts it.intengineGetOutputSize(int inputLen) The size of the next doFinal's output, which takes the input update() has buffered as well as inputLen more.voidengineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) voidengineInit(int opmode, Key key, SecureRandom random) voidengineInit(int opmode, Key key, AlgorithmParameterSpec engineSpec, SecureRandom random) voidengineSetMode(String mode) voidengineSetPadding(String padding) byte[]engineUpdate(byte[] input, int inputOffset, int inputLen) intengineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) Methods inherited from class BaseCipherSpi
createParametersInstance, engineUnwrap, engineWrapMethods inherited from class CipherSpi
engineDoFinal, engineUpdate, engineUpdateAAD, engineUpdateAAD
-
Constructor Details
-
GMCipherSpi
-
-
Method Details
-
engineGetBlockSize
public int engineGetBlockSize()- Overrides:
engineGetBlockSizein classBaseCipherSpi
-
engineGetKeySize
The field size of the key's curve, for any EC key init accepts - not just a BC one - so the key is converted the same way init converts it. Cipher asks for the size before init sees the key, so a key that is not an EC key is answered as BaseCipherSpi answers it, and left for init to refuse with the InvalidKeyException it declares.- Overrides:
engineGetKeySizein classBaseCipherSpi
-
engineGetIV
public byte[] engineGetIV()- Overrides:
engineGetIVin classBaseCipherSpi
-
engineGetParameters
- Overrides:
engineGetParametersin classBaseCipherSpi
-
engineSetMode
- Overrides:
engineSetModein classBaseCipherSpi- Throws:
NoSuchAlgorithmException
-
engineGetOutputSize
public int engineGetOutputSize(int inputLen) The size of the next doFinal's output, which takes the input update() has buffered as well as inputLen more. C2 is as long as the message and C1 and C3 are of fixed size, so the answer is exact: encryption adds that overhead and decryption removes it. The sum is taken in long and capped at the largest array.- Overrides:
engineGetOutputSizein classBaseCipherSpi
-
engineSetPadding
- Overrides:
engineSetPaddingin classBaseCipherSpi- Throws:
NoSuchPaddingException
-
engineInit
public void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInitin classCipherSpi- Throws:
InvalidKeyExceptionInvalidAlgorithmParameterException
-
engineInit
public void engineInit(int opmode, Key key, AlgorithmParameterSpec engineSpec, SecureRandom random) throws InvalidAlgorithmParameterException, InvalidKeyException - Specified by:
engineInitin classCipherSpi- Throws:
InvalidAlgorithmParameterExceptionInvalidKeyException
-
engineInit
- Specified by:
engineInitin classCipherSpi- Throws:
InvalidKeyException
-
engineUpdate
public byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) - Specified by:
engineUpdatein classCipherSpi
-
engineUpdate
public int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) - Specified by:
engineUpdatein classCipherSpi
-
engineDoFinal
public byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException - Specified by:
engineDoFinalin classCipherSpi- Throws:
IllegalBlockSizeExceptionBadPaddingException
-
engineDoFinal
public int engineDoFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException - Specified by:
engineDoFinalin classCipherSpi- Throws:
ShortBufferExceptionIllegalBlockSizeExceptionBadPaddingException
-