Bouncy Castle Cryptography Library 1.87

org.bouncycastle.jcajce.interfaces
Interface SM9EncUserKeyGenerator

All Known Subinterfaces:
SM9EncMasterPrivateKey

public interface SM9EncUserKeyGenerator

A master private key capable of the KGC user-key extraction for an identity-based encryption-family scheme: deriving a user's key pair from the user's identity and the private-key generation function identifier hid the KGC chose (GM/T 0044.3/0044.4-2016 for SM9, where one encryption master key serves key exchange, KEM and public-key encryption).

The hid is what separates the functions a KGC offers. Usage warning: a key pair generated here should be used for the KEM or for public-key encryption, but not for both; a KGC offering both functions publishes a separate hid for each, as it does for the key exchange.

See Also:
SM9SigUserKeyGenerator

Field Summary
static byte HID
          The encryption private-key generation function identifier hid, 0x03 - the value the GM/T 0044.5-2016 Annex C/D worked examples publish for KEM and public-key encryption. hid is not fixed by the standard: GM/T 0044.3-2016 defines it as the "identifier of the encryption private key generating function, denoted by one byte", chosen and published by the KGC.
static byte HID_EXCHANGE
          The key-exchange private-key generation function identifier hid, 0x02, as published by the Chinese edition of the GM/T 0044.5-2016 Annex B worked example (the official English edition of the same annex chose 0x03 - the KGC's published choice governs).
 
Method Summary
 java.security.KeyPair generateUserKeyPair(byte[] identity, byte hid)
          Generate the key pair of the user identified by under the given hid.
 

Field Detail

HID

public static final byte HID
The encryption private-key generation function identifier hid, 0x03 - the value the GM/T 0044.5-2016 Annex C/D worked examples publish for KEM and public-key encryption. hid is not fixed by the standard: GM/T 0044.3-2016 defines it as the "identifier of the encryption private key generating function, denoted by one byte", chosen and published by the KGC. These are the two values the published GM/T 0044 examples use, and the defaults here.

The same value is declared on SM9EncMasterPublicKey and on the lightweight SM9EncMasterPrivateKeyParameters.HID, which both JCA copies take their value from, so the three cannot drift apart.

See Also:
Constant Field Values

HID_EXCHANGE

public static final byte HID_EXCHANGE
The key-exchange private-key generation function identifier hid, 0x02, as published by the Chinese edition of the GM/T 0044.5-2016 Annex B worked example (the official English edition of the same annex chose 0x03 - the KGC's published choice governs). Taken from SM9EncMasterPrivateKeyParameters.HID_EXCHANGE, as HID is.

See Also:
Constant Field Values
Method Detail

generateUserKeyPair

public java.security.KeyPair generateUserKeyPair(byte[] identity,
                                                 byte hid)
Generate the key pair of the user identified by under the given hid. This derivation is a KGC operation and is deterministic - the same master key, identity and hid always yield the same pair.

Parameters:
identity - the user's identity.
hid - the private-key generation function identifier the KGC chose for the KEM / public-key encryption, in the published examples. It may not be HID_EXCHANGE, which names the key exchange: an exchange key pair comes from . A KGC offering both the KEM and public-key encryption publishes a further value of its own for one of them, so that no identity's key serves both.
Returns:
the user's key pair.

Bouncy Castle Cryptography Library 1.87