Package org.bouncycastle.jcajce.provider.asymmetric.sm9
package org.bouncycastle.jcajce.provider.asymmetric.sm9
JCA/JCE provider classes for the SM9 identity-based cryptographic algorithms (GM/T 0044-2016),
registered in the BouncyCastle provider: the master key-pair generators, the key factory,
Signature.SM9, Cipher.SM9, KeyAgreement.SM9 and the SM9 KEM through
KeyGenerator.SM9-KEM (and KEM.SM9-KEM on Java 21 and later). The public key
interfaces these classes implement are in org.bouncycastle.jcajce.interfaces; the
lightweight implementation they wrap is described in org.bouncycastle.math.ec.sm9.
Serialization. Only the master keys are serializable. Each is written as an
SM9KeyProxy holding its standard encoding, and rebuilt through the key factory by the
proxy's readResolve; the user keys and the key exchange's ephemeral keys refuse to be
written, and no key class accepts a stream that names it directly. A deserialization filter
(java.io.ObjectInputFilter) is also shown the object readResolve returns, so an
allow-list for SM9 master keys has to name the resolved class as well as the proxy and the byte
array it carries, for example:
org.bouncycastle.jcajce.provider.asymmetric.sm9.SM9KeyProxy; org.bouncycastle.jcajce.provider.asymmetric.sm9.BCSM9SigMasterPublicKey; org.bouncycastle.jcajce.provider.asymmetric.sm9.BCSM9SigMasterPrivateKey; org.bouncycastle.jcajce.provider.asymmetric.sm9.BCSM9EncMasterPublicKey; org.bouncycastle.jcajce.provider.asymmetric.sm9.BCSM9EncMasterPrivateKey; [B;!*(as one pattern string, without the line breaks). A filter naming the proxy alone rejects every SM9 key. Serialization carries no integrity protection: a stream yields whatever well-formed master key it encodes, so a stored key that must not be substituted or corrupted needs protecting by the application.
-
ClassesClassDescriptionJCA
Cipherfor SM9 public-key encryption (GM/T 0044.4).JCA adapter for the SM9 key exchange protocol (GM/T 0044.3-2016), registered asKeyAgreement.SM9.KeyFactory for the SM9 master keys (sm9signandsm9encrypt): 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'sgetEncoded()).Generator for SM9 encryption master key pairs (GM/T 0044.4), registered asKeyPairGenerator.SM9-ENC: the KGC's randomly-generated root of the scheme.Generator for the SM9 signature master key pair (GM/T 0044.2), registered asKeyPairGenerator.SM9-SIGN.JCASM9signature (GM/T 0044.2).JCAKeyGeneratorbridge for the SM9 key encapsulation mechanism (GM/T 0044.4-2016).