Top Description Fields Constructors Methods
org.bouncycastle.crypto.agreement

public Class SM2KeyExchange

extends Object
Class Inheritance
Imports
java.math.BigInteger, org.bouncycastle.crypto.CipherParameters, .CryptoServicesRegistrar, .Digest, org.bouncycastle.crypto.digests.SM3Digest, org.bouncycastle.crypto.params.ECDomainParameters, .ECPrivateKeyParameters, .ParametersWithID, .SM2KeyExchangePrivateParameters, .SM2KeyExchangePublicParameters, org.bouncycastle.math.ec.ECAlgorithms, .ECFieldElement, .ECPoint, org.bouncycastle.util.Arrays, .Memoable, .Pack

SM2 Key Exchange protocol - based on https://tools.ietf.org/html/draft-shen-sm2-ecdsa-02

Field Summary

Modifier and TypeField and Description
private final Digest
private ECDomainParameters
private ECPrivateKeyParameters
private ECPoint
private boolean
private ECPrivateKeyParameters
private ECPoint
private byte[]
private int
w

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
addUserID(Digest digest, byte[] userID)

private byte[]
calculateInnerHash(Digest digest, ECPoint u, byte[] za, byte[] zb, ECPoint p1, ECPoint p2)

public byte[]
calculateKey(int kLen, CipherParameters pubParam)

public byte[][]
calculateKeyWithConfirmation(int kLen, byte[] confirmationTag, CipherParameters pubParam)

private ECPoint
private byte[]
private byte[]
getZ(Digest digest, byte[] userID, ECPoint pubPoint)

public void
private byte[]
kdf(ECPoint u, byte[] za, byte[] zb, int klen)

private BigInteger
private byte[]
S1(Digest digest, ECPoint u, byte[] inner)

private byte[]
S2(Digest digest, ECPoint u, byte[] inner)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

digestback to summary
private final Digest digest
ecParamsback to summary
private ECDomainParameters ecParams
ephemeralKeyback to summary
private ECPrivateKeyParameters ephemeralKey
ephemeralPubPointback to summary
private ECPoint ephemeralPubPoint
initiatorback to summary
private boolean initiator
staticKeyback to summary
private ECPrivateKeyParameters staticKey
staticPubPointback to summary
private ECPoint staticPubPoint
userIDback to summary
private byte[] userID
wback to summary
private int w

Constructor Detail

SM2KeyExchangeback to summary
public SM2KeyExchange()
SM2KeyExchangeback to summary
public SM2KeyExchange(Digest digest)

Method Detail

addFieldElementback to summary
private void addFieldElement(Digest digest, ECFieldElement v)
addUserIDback to summary
private void addUserID(Digest digest, byte[] userID)
calculateInnerHashback to summary
private byte[] calculateInnerHash(Digest digest, ECPoint u, byte[] za, byte[] zb, ECPoint p1, ECPoint p2)
calculateKeyback to summary
public byte[] calculateKey(int kLen, CipherParameters pubParam)
calculateKeyWithConfirmationback to summary
public byte[][] calculateKeyWithConfirmation(int kLen, byte[] confirmationTag, CipherParameters pubParam)
calculateUback to summary
private ECPoint calculateU(SM2KeyExchangePublicParameters otherPub)
digestDoFinalback to summary
private byte[] digestDoFinal()
getZback to summary
private byte[] getZ(Digest digest, byte[] userID, ECPoint pubPoint)
initback to summary
public void init(CipherParameters privParam)
kdfback to summary
private byte[] kdf(ECPoint u, byte[] za, byte[] zb, int klen)
reduceback to summary
private BigInteger reduce(BigInteger x)
S1back to summary
private byte[] S1(Digest digest, ECPoint u, byte[] inner)
S2back to summary
private byte[] S2(Digest digest, ECPoint u, byte[] inner)