Package org.bouncycastle.jcajce.spec
Class SM9KeyExchangeSpec
- java.lang.Object
-
- org.bouncycastle.jcajce.spec.SM9KeyExchangeSpec
-
- All Implemented Interfaces:
java.security.spec.AlgorithmParameterSpec
public class SM9KeyExchangeSpec extends java.lang.Object implements java.security.spec.AlgorithmParameterSpecParameter spec for the SM9 key exchange protocol (GM/T 0044.3-2016) throughKeyAgreement.SM9: the two things the protocol needs that theKeyAgreementAPI has no slot for - which role this party plays, and the length of the agreed key, which is an input to the GM/T 0044.3 key derivation rather than a truncation of its output.Everything else the exchange needs comes from the key the
KeyAgreementis initialised with (this party's key-exchange user key fromSM9EncMasterPrivateKey.generateExchangeKeyPair(byte[])) or from the peer's key supplied todoPhase: the master public key and the hid ride on the user key, so this party's ephemeral value is generated inside the provider under its own master key and cannot be mis-bound to another.The optional GM/T 0044.3 key-confirmation tags S_A / S_B have no channel in the
KeyAgreementAPI; a caller needing them should use the lightweightSM9KeyExchangedirectly, asKeyAgreement.SM2callers do for SM2's tags.
-
-
Constructor Summary
Constructors Constructor Description SM9KeyExchangeSpec(boolean initiator)Base constructor, with the 128-bit key length of the GM/T 0044.5 worked examples.SM9KeyExchangeSpec(boolean initiator, int keyLengthBits)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetKeyLengthBits()The agreed key length in bits - an input to the GM/T 0044.3 key derivation.booleanisInitiator()
-
-
-
Constructor Detail
-
SM9KeyExchangeSpec
public SM9KeyExchangeSpec(boolean initiator)
Base constructor, with the 128-bit key length of the GM/T 0044.5 worked examples.- Parameters:
initiator- whether this party is the initiator (user A).
-
SM9KeyExchangeSpec
public SM9KeyExchangeSpec(boolean initiator, int keyLengthBits)- Parameters:
initiator- whether this party is the initiator (user A).keyLengthBits- the length of the agreed key in bits.
-
-