Package org.bouncycastle.crypto.params
Class SM9SigMasterPrivateKeyParameters
- java.lang.Object
-
- org.bouncycastle.crypto.params.AsymmetricKeyParameter
-
- org.bouncycastle.crypto.params.SM9SigMasterPrivateKeyParameters
-
- All Implemented Interfaces:
javax.security.auth.Destroyable,CipherParameters,SM9SigUserKeyParametersGenerator
public class SM9SigMasterPrivateKeyParameters extends AsymmetricKeyParameter implements javax.security.auth.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
Fields Modifier and Type Field Description static byteHIDThe signature private-key generation function identifier hid, fixed to 0x01 for the SM9 signature algorithm (GM/T 0044.2-2016, Annex A).
-
Constructor Summary
Constructors Constructor Description SM9SigMasterPrivateKeyParameters(java.math.BigInteger ks)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy this object, dropping its reference to the master secret ks.static SM9SigMasterPrivateKeyParametersfromEncoded(byte[] enc)SM9SigPrivateKeyParametersgenerateUserKey(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[]getEncoded()The master private key ks as a 32-byte big-endian scalar.SM9SigMasterPublicKeyParametersgetPublicKeyParameters()booleanisDestroyed()-
Methods inherited from class org.bouncycastle.crypto.params.AsymmetricKeyParameter
isPrivate
-
-
-
-
Field Detail
-
HID
public static final byte HID
The signature private-key generation function identifier hid, fixed to 0x01 for the SM9 signature algorithm (GM/T 0044.2-2016, Annex A).- See Also:
- Constant Field Values
-
-
Method Detail
-
getPublicKeyParameters
public SM9SigMasterPublicKeyParameters getPublicKeyParameters()
-
getEncoded
public byte[] getEncoded()
The master private key ks as a 32-byte big-endian scalar.
-
fromEncoded
public static SM9SigMasterPrivateKeyParameters fromEncoded(byte[] enc)
-
generateUserKey
public SM9SigPrivateKeyParameters 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.- 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 interfacejavax.security.auth.Destroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyedin interfacejavax.security.auth.Destroyable
-
-