Top Description Inners Fields Constructors Methods
org.bouncycastle.crypto.engines

public Class SM2Engine

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.security.SecureRandom, org.bouncycastle.crypto.CipherParameters, .CryptoServicesRegistrar, .DataLengthException, .Digest, .InvalidCipherTextException, org.bouncycastle.crypto.constraints.ConstraintUtils, .DefaultServiceProperties, org.bouncycastle.crypto.digests.SM3Digest, org.bouncycastle.crypto.params.ECDomainParameters, .ECKeyParameters, .ECPrivateKeyParameters, .ECPublicKeyParameters, .ParametersWithRandom, org.bouncycastle.math.ec.ECFieldElement, .ECMultiplier, .ECPoint, .FixedPointCombMultiplier, org.bouncycastle.util.Arrays, .BigIntegers, .Bytes, .Memoable, .Pack

SM2 public key encryption engine - based on https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private int
private final Digest
private ECKeyParameters
private ECDomainParameters
private boolean
private final SM2Engine.Mode
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
public
public
SM2Engine(Digest digest)

public

Method Summary

Modifier and TypeMethod and Description
private void
protected ECMultiplier
private byte[]
decrypt(byte[] in, int inOff, int inLen)

private byte[]
encrypt(byte[] in, int inOff, int inLen)

public int
getOutputSize(int inputLen)

public void
init(boolean forEncryption, CipherParameters param)

private void
kdf(Digest digest, ECPoint c1, byte[] encData)

private BigInteger
private boolean
notEncrypted(byte[] encData, byte[] in, int inOff)

public byte[]
processBlock(byte[] in, int inOff, int inLen)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

curveLengthback to summary
private int curveLength
digestback to summary
private final Digest digest
ecKeyback to summary
private ECKeyParameters ecKey
ecParamsback to summary
private ECDomainParameters ecParams
forEncryptionback to summary
private boolean forEncryption
modeback to summary
private final SM2Engine.Mode mode
randomback to summary
private SecureRandom random

Constructor Detail

SM2Engineback to summary
public SM2Engine()
SM2Engineback to summary
public SM2Engine(SM2Engine.Mode mode)
SM2Engineback to summary
public SM2Engine(Digest digest)
SM2Engineback to summary
public SM2Engine(Digest digest, SM2Engine.Mode mode)

Method Detail

addFieldElementback to summary
private void addFieldElement(Digest digest, ECFieldElement v)
createBasePointMultiplierback to summary
protected ECMultiplier createBasePointMultiplier()
decryptback to summary
private byte[] decrypt(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
encryptback to summary
private byte[] encrypt(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
getOutputSizeback to summary
public int getOutputSize(int inputLen)
initback to summary
public void init(boolean forEncryption, CipherParameters param)
kdfback to summary
private void kdf(Digest digest, ECPoint c1, byte[] encData)
nextKback to summary
private BigInteger nextK()
notEncryptedback to summary
private boolean notEncrypted(byte[] encData, byte[] in, int inOff)
processBlockback to summary
public byte[] processBlock(byte[] in, int inOff, int inLen) throws InvalidCipherTextException
org.bouncycastle.crypto.engines back to summary

public final Enum SM2Engine.Mode

extends Enum<SM2Engine.Mode>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final SM2Engine.Mode
public static final SM2Engine.Mode

Constructor Summary

AccessConstructor and Description
private
Mode()

Method Summary

Modifier and TypeMethod and Description
public static SM2Engine.Mode
public static SM2Engine.Mode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

C1C2C3back to summary
public static final SM2Engine.Mode C1C2C3
C1C3C2back to summary
public static final SM2Engine.Mode C1C3C2

Constructor Detail

Modeback to summary
private Mode()

Method Detail

valueOfback to summary
public static SM2Engine.Mode valueOf(String name)
valuesback to summary
public static SM2Engine.Mode[] values()