org.bouncycastle.jcajce.provider.asymmetric.ec
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
- public class GMCipherSpi
- extends BaseCipherSpi
|
Method Summary |
byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
|
int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
|
int |
engineGetBlockSize()
|
byte[] |
engineGetIV()
|
int |
engineGetKeySize(java.security.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. |
int |
engineGetOutputSize(int inputLen)
The size of the next doFinal's output, which takes the input update() has buffered as well as
inputLen more. |
java.security.AlgorithmParameters |
engineGetParameters()
|
void |
engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec engineSpec,
java.security.SecureRandom random)
|
void |
engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters params,
java.security.SecureRandom random)
|
void |
engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
|
void |
engineSetMode(java.lang.String mode)
|
void |
engineSetPadding(java.lang.String padding)
|
byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen)
|
int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GMCipherSpi
public GMCipherSpi(Digest digest)
engineGetBlockSize
public int engineGetBlockSize()
- Overrides:
engineGetBlockSize in class BaseCipherSpi
engineGetKeySize
public int engineGetKeySize(java.security.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. 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:
engineGetKeySize in class BaseCipherSpi
engineGetIV
public byte[] engineGetIV()
- Overrides:
engineGetIV in class BaseCipherSpi
engineGetParameters
public java.security.AlgorithmParameters engineGetParameters()
- Overrides:
engineGetParameters in class BaseCipherSpi
engineSetMode
public void engineSetMode(java.lang.String mode)
throws java.security.NoSuchAlgorithmException
- Overrides:
engineSetMode in class BaseCipherSpi
- Throws:
java.security.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:
engineGetOutputSize in class BaseCipherSpi
engineSetPadding
public void engineSetPadding(java.lang.String padding)
throws javax.crypto.NoSuchPaddingException
- Overrides:
engineSetPadding in class BaseCipherSpi
- Throws:
javax.crypto.NoSuchPaddingException
engineInit
public void engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters params,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
engineInit
public void engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec engineSpec,
java.security.SecureRandom random)
throws java.security.InvalidAlgorithmParameterException,
java.security.InvalidKeyException
- Throws:
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException
engineInit
public void engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
throws java.security.InvalidKeyException
- Throws:
java.security.InvalidKeyException
engineUpdate
public byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
engineUpdate
public int engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
engineDoFinal
public byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
throws javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
- Throws:
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
engineDoFinal
public int engineDoFinal(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws javax.crypto.ShortBufferException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
- Throws:
javax.crypto.ShortBufferException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException