Bouncy Castle Cryptography Library 1.87

org.bouncycastle.jcajce.spec
Class SM9KeyExchangeSpec

java.lang.Object
  extended byorg.bouncycastle.jcajce.spec.SM9KeyExchangeSpec
All Implemented Interfaces:
java.security.spec.AlgorithmParameterSpec

public class SM9KeyExchangeSpec
extends java.lang.Object
implements java.security.spec.AlgorithmParameterSpec

Parameter spec for the SM9 key exchange protocol (GM/T 0044.3-2016) through : the two things the protocol needs that the API 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 is initialised with (this party's key-exchange user key from SM9EncMasterPrivateKey.generateExchangeKeyPair(byte[])) or from the peer's key supplied to : 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 API; a caller needing them should use the lightweight SM9KeyExchange directly, as callers do for SM2's tags.


Constructor Summary
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
 int getKeyLengthBits()
          The agreed key length in bits - an input to the GM/T 0044.3 key derivation.
 boolean isInitiator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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, a positive whole number of bytes - the key is handed back as bytes, and KEM.SM9-KEM takes the same rule, so the two services no longer round a fractional-byte request in opposite directions.
Method Detail

isInitiator

public boolean isInitiator()

getKeyLengthBits

public int getKeyLengthBits()
The agreed key length in bits - an input to the GM/T 0044.3 key derivation.


Bouncy Castle Cryptography Library 1.87