Bouncy Castle Cryptography Library 1.87

org.bouncycastle.crypto.kems
Class SM9KEMGenerator

java.lang.Object
  extended byorg.bouncycastle.crypto.kems.SM9KEMGenerator
All Implemented Interfaces:
EncapsulatedSecretGenerator

public class SM9KEMGenerator
extends java.lang.Object
implements EncapsulatedSecretGenerator

SM9 key encapsulation mechanism - encapsulation side (GM/T 0044.4-2016, clause 6). Given a recipient identity and the encryption master public key, produces a shared key K and its encapsulation C = [r]Q_B (a G1 point, encoded x||y).

Usage warning: an identity's encryption key should be used for this mechanism or for public-key encryption (SM9Engine), but not for both. A deployment needing both has its KGC publish a separate hid for each function, as it already does for the key exchange, so that the two keys are distinct.


Field Summary
static int ENCAPSULATION_LENGTH
          The length in bytes of an SM9 KEM encapsulation: C = [r]Q_B, a G1 point written as x || y.
 
Constructor Summary
SM9KEMGenerator(int keyLenBits, java.security.SecureRandom random)
           
 
Method Summary
 SecretWithEncapsulation generateEncapsulated(AsymmetricKeyParameter recipientKey)
          Generate secret/encapsulation based on the recipient public key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCAPSULATION_LENGTH

public static final int ENCAPSULATION_LENGTH
The length in bytes of an SM9 KEM encapsulation: C = [r]Q_B, a G1 point written as x || y. The one value both the generator's and the extractor's sides report, so the two cannot drift.

See Also:
Constant Field Values
Constructor Detail

SM9KEMGenerator

public SM9KEMGenerator(int keyLenBits,
                       java.security.SecureRandom random)
Method Detail

generateEncapsulated

public SecretWithEncapsulation generateEncapsulated(AsymmetricKeyParameter recipientKey)
Description copied from interface: EncapsulatedSecretGenerator
Generate secret/encapsulation based on the recipient public key.

Specified by:
generateEncapsulated in interface EncapsulatedSecretGenerator
Returns:
An SecretWithEncapsulation derived from the recipient public key.

Bouncy Castle Cryptography Library 1.87