Class SM9KEMKeyGeneratorSpi
java.lang.Object
javax.crypto.KeyGeneratorSpi
org.bouncycastle.jcajce.provider.asymmetric.sm9.SM9KEMKeyGeneratorSpi
JCA
KeyGenerator bridge for the SM9 key encapsulation mechanism
(GM/T 0044.4-2016). Registered as KeyGenerator.SM9-KEM; initialise with:
- a
KEMGenerateSpecto encapsulate - itsPublicKeymust be aBCSM9EncPublicKey(the recipient's master public key + identity); or - a
KEMExtractSpecto decapsulate - itsPrivateKeymust be aBCSM9EncPrivateKey(the recipient's extracted decryption key).
keySizeInBits) drives SM9's own
GM/T 0044.4 KDF, which produces the shared key directly; the spec's generic KDF
fields are therefore not applied (an external KDF on top would break interoperability
with other GM/T 0044.4 implementations - callers who want one anyway can layer it via
the javax.crypto.KEM API, KEM.SM9-KEM, with a KTSParameterSpec KDF).
engineGenerateKey returns a SecretKeyWithEncapsulation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SecretKeyprotected voidengineInit(int keySize, SecureRandom random) protected voidengineInit(SecureRandom random) protected voidengineInit(AlgorithmParameterSpec spec, SecureRandom random)
-
Constructor Details
-
SM9KEMKeyGeneratorSpi
public SM9KEMKeyGeneratorSpi()
-
-
Method Details
-
engineInit
- Specified by:
engineInitin classKeyGeneratorSpi
-
engineInit
- Specified by:
engineInitin classKeyGeneratorSpi
-
engineInit
protected void engineInit(AlgorithmParameterSpec spec, SecureRandom random) throws InvalidAlgorithmParameterException - Specified by:
engineInitin classKeyGeneratorSpi- Throws:
InvalidAlgorithmParameterException
-
engineGenerateKey
- Specified by:
engineGenerateKeyin classKeyGeneratorSpi
-