Class SM9SigMasterPrivateKeyParameters
java.lang.Object
org.bouncycastle.crypto.params.AsymmetricKeyParameter
org.bouncycastle.crypto.params.SM9SigMasterPrivateKeyParameters
- All Implemented Interfaces:
Destroyable, CipherParameters, SM9SigUserKeyParametersGenerator
public class SM9SigMasterPrivateKeyParameters
extends AsymmetricKeyParameter
implements Destroyable, SM9SigUserKeyParametersGenerator
SM9 signature master private key ks (GM/T 0044.2-2016). Held by the Key
Generation Center (KGC); derives the master public key P_pub-s = [ks]P2 and
users' signature private keys from their identities.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteThe signature private-key generation function identifier hid, fixed to 0x01 for the SM9 signature algorithm by GM/T 0080-2020 8.1 and GB/T 41389-2022 6.3.1; GM/T 0044.2-2016 leaves it to the KGC and assigns no value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Destroy this object, dropping its reference to the master secret ks.fromEncoded(byte[] enc) fromEncoded(byte[] enc, SM9SigMasterPublicKeyParameters publicKey) Rebuild a signature master key and check it against the master public key its KGC published.generateUserKey(byte[] identity) Derive the signature private key for the user identified byidentity(GM/T 0044.2-2016, 5.3): t1 = H1(identity||hid, N) + ks; if t1 = 0 the master key must be regenerated; otherwise t2 = ks*t1^-1 and ds = [t2]P1.byte[]The master private key ks as a 32-byte big-endian scalar.booleanMethods inherited from class AsymmetricKeyParameter
isPrivate
-
Field Details
-
HID
public static final byte HIDThe signature private-key generation function identifier hid, fixed to 0x01 for the SM9 signature algorithm by GM/T 0080-2020 8.1 and GB/T 41389-2022 6.3.1; GM/T 0044.2-2016 leaves it to the KGC and assigns no value.- See Also:
-
-
Constructor Details
-
SM9SigMasterPrivateKeyParameters
-
-
Method Details
-
getPublicKeyParameters
-
getEncoded
public byte[] getEncoded()The master private key ks as a 32-byte big-endian scalar. -
fromEncoded
-
fromEncoded
public static SM9SigMasterPrivateKeyParameters fromEncoded(byte[] enc, SM9SigMasterPublicKeyParameters publicKey) Rebuild a signature master key and check it against the master public key its KGC published. A key decoded from its scalar alone always agrees with the public key it derives from that scalar, so a stale or substituted scalar - still 32 bytes, still in [1, N-1] - imports as a well-formed key pair that is simply not the KGC's, and every user key it then issues is a key of that wrong public key, whose signatures verify under it and under no other; comparing against the published one catches the substitution when the master key is decoded, rather than when a verifier holding the published key rejects a signature. -
generateUserKey
Derive the signature private key for the user identified byidentity(GM/T 0044.2-2016, 5.3): t1 = H1(identity||hid, N) + ks; if t1 = 0 the master key must be regenerated; otherwise t2 = ks*t1^-1 and ds = [t2]P1.- Specified by:
generateUserKeyin interfaceSM9SigUserKeyParametersGenerator- Parameters:
identity- the user's identity.- Returns:
- the user's signature private key.
-
destroy
public void destroy()Destroy this object, dropping its reference to the master secret ks.As
BigIntegeris immutable the secret value cannot be zeroized in place; destruction drops the reference and marks the key destroyed, after whichgetEncoded()andgenerateUserKey(byte[])throwIllegalStateException. The public key parameters remain available.- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceDestroyable
-