Class KeyFactorySpi
java.lang.Object
java.security.KeyFactorySpi
org.bouncycastle.jcajce.provider.asymmetric.sm9.KeyFactorySpi
KeyFactory for the SM9 master keys (
sm9sign and sm9encrypt): the master
public and private keys round-trip through their JCA X.509 / PKCS#8 encodings (the GM/T 0080-2020 key
material under the GM algorithm OID; the bare GM/T 0080-2020 form is the lightweight
key-parameter class's getEncoded()).
A user's identity-based key is not decodable in isolation - it additionally needs
the master public key and the identity, and for an encryption key the hid and the usage
(KEM / decryption or key exchange) too - so it does not decode from a plain PKCS#8 spec. Rebuild a stored user key from its encoding plus that
context with an SM9SigUserPrivateKeySpec /
SM9EncUserPrivateKeySpec (also handed back by
getKeySpec), or derive it afresh from the master private key via the master
key's generateUserKeyPair method.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PrivateKeyengineGeneratePrivate(KeySpec keySpec) protected PublicKeyengineGeneratePublic(KeySpec keySpec) protected KeySpecengineGetKeySpec(Key key, Class keySpec) protected KeyengineTranslateKey(Key key)
-
Constructor Details
-
KeyFactorySpi
public KeyFactorySpi()
-
-
Method Details
-
engineGeneratePublic
- Specified by:
engineGeneratePublicin classKeyFactorySpi- Throws:
InvalidKeySpecException
-
engineGeneratePrivate
- Specified by:
engineGeneratePrivatein classKeyFactorySpi- Throws:
InvalidKeySpecException
-
engineGetKeySpec
- Specified by:
engineGetKeySpecin classKeyFactorySpi- Throws:
InvalidKeySpecException
-
engineTranslateKey
- Specified by:
engineTranslateKeyin classKeyFactorySpi- Throws:
InvalidKeyException
-