de.flexiprovider.pqc.hbc.gmss
Class GMSSKeyPairGenerator

java.lang.Object
  |
  +--java.security.KeyPairGeneratorSpi
        |
        +--de.flexiprovider.api.keys.KeyPairGenerator
              |
              +--de.flexiprovider.pqc.hbc.gmss.GMSSKeyPairGenerator
Direct Known Subclasses:
GMSSKeyPairGenerator.GMSSwithSHA1, GMSSKeyPairGenerator.GMSSwithSHA224, GMSSKeyPairGenerator.GMSSwithSHA256, GMSSKeyPairGenerator.GMSSwithSHA384, GMSSKeyPairGenerator.GMSSwithSHA512

public class GMSSKeyPairGenerator
extends KeyPairGenerator

This class implements key pair generation of the generalized Merkle signature scheme (GMSS). The class extends the KeyPairGeneratorSpi class.

The GMSSKeyPairGenerator can be used as follows:

1. get instance of GMSS key pair generator:
KeyPairGenerator kpg = KeyPairGenerator.getInstance("GMSSwithSHA1", "FlexiPQC");
2. initialize the KPG with the desired Parameterset
kpg.initialize(parameterset);
3. create GMSS key pair:
KeyPair keyPair = kpg.generateKeyPair();
4. get the encoded private and public keys from the key pair:
encodedPublicKey = keyPair.getPublic().getEncoded();
encodedPrivateKey = keyPair.getPrivate().getEncoded();

The key pair generator can be initialized with an integer value as well. For this purpose call kpg.initialize(keySize);. The integer keySize determindes the number of signatures that can be created. A value less than 10 creates 2^10 signatures, between 11 and 20 creates 2^20 and a keySize greater than 20 creates 2^40 signatures.

To generate an own parameterSpec for the use with GMSS use the following:

1. define int arrays of the desired parameters (defh for the height of the single layers of the GMSS tree, w for the Winternitz parameters for each layer, K for the parameter for the AuthPath computation)
int[] defh = {10, 10, 10, 10};
int[] defw = {9, 9, 9, 3};
int[] defk = {2, 2, 2, 2};
2. create a parameterspec
gps = new GMSSParameterSpec(defh.length, defh, defw, defk);
3. initialize the KPG with the desired Parameterset
kpg.initialize(parameterset);

Author:
Michael Schneider, Sebastian Blume
See Also:
GMSSSignature, GMSSPrivateKey, GMSSPublicKey

Inner Class Summary
static class GMSSKeyPairGenerator.GMSSwithSHA1
          GMSSKeyPairGenerator with SHA1
static class GMSSKeyPairGenerator.GMSSwithSHA224
          GMSSKeyPairGenerator with SHA224
static class GMSSKeyPairGenerator.GMSSwithSHA256
          GMSSKeyPairGenerator with SHA256
static class GMSSKeyPairGenerator.GMSSwithSHA384
          GMSSKeyPairGenerator with SHA384
static class GMSSKeyPairGenerator.GMSSwithSHA512
          GMSSKeyPairGenerator with SHA512
 
Constructor Summary
GMSSKeyPairGenerator(java.lang.String oidStr, java.lang.String mdName, java.lang.String mdProvName)
          The standard constructor tries to generate the GMSS algorithm identifier with the corresponding OID.
 
Method Summary
 KeyPair genKeyPair()
          Generates the GMSS key pair.
 void initialize(AlgorithmParameterSpec algParamSpec)
          Initalizes the key pair generator using a parameter set as input
 void initialize(AlgorithmParameterSpec algParamSpec, SecureRandom secureRandom)
          Initalizes the key pair generator using a parameter set as input
 void initialize(int keySize, SecureRandom secureRandom)
          This method initializes the GMSS KeyPairGenerator using an integer value keySize as input.
 
Methods inherited from class de.flexiprovider.api.keys.KeyPairGenerator
generateKeyPair, initialize, initialize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMSSKeyPairGenerator

public GMSSKeyPairGenerator(java.lang.String oidStr,
                            java.lang.String mdName,
                            java.lang.String mdProvName)
The standard constructor tries to generate the GMSS algorithm identifier with the corresponding OID.

Parameters:
oidStr - string with the oid of the algorithm
mdName - name of the message digest for the construction of the authentication trees
mdProvName - provider name of the message digest for the construction of the the authentication trees and for the OTS
Method Detail

genKeyPair

public KeyPair genKeyPair()
Generates the GMSS key pair. The public key is an instance of GMSSPublicKey, the private key is an instance of GMSSPrivateKey.
Overrides:
genKeyPair in class KeyPairGenerator
Returns:
Key pair containing a GMSSPublicKey and a GMSSPrivateKey
See Also:
GMSSPrivateKey, GMSSPublicKey

initialize

public void initialize(int keySize,
                       SecureRandom secureRandom)
This method initializes the GMSS KeyPairGenerator using an integer value keySize as input. It provides a simple use of the GMSS for testing demands.

A given keysize of less than 10 creates an amount 2^10 signatures. A keySize between 10 and 20 creates 2^20 signatures. Given an integer greater than 20 the key pair generator creates 2^40 signatures.

Overrides:
initialize in class KeyPairGenerator
Parameters:
keySize - Assigns the parameters used for the GMSS signatures. There are 3 choices:
1. keysize <= 10: creates 2^10 signatures using the parameterset
P = (2, (5, 5), (3, 3), (3, 3))
2. keysize > 10 and <= 20: creates 2^20 signatures using the parameterset
P = (2, (10, 10), (5, 4), (2, 2))
3. keysize > 20: creates 2^40 signatures using the parameterset
P = (2, (10, 10, 10, 10), (9, 9, 9, 3), (2, 2, 2, 2))
secureRandom - not used by GMSS, the SHA1PRNG of the SUN Provider is always used

initialize

public void initialize(AlgorithmParameterSpec algParamSpec,
                       SecureRandom secureRandom)
                throws InvalidAlgorithmParameterException
Initalizes the key pair generator using a parameter set as input
Overrides:
initialize in class KeyPairGenerator
Parameters:
algParamSpec - an instance of GMSSParameterSpec
secureRandom - not used in GMSS
See Also:
GMSSParameterSpec

initialize

public void initialize(AlgorithmParameterSpec algParamSpec)
                throws InvalidAlgorithmParameterException
Initalizes the key pair generator using a parameter set as input
Parameters:
algParamSpec - an instance of GMSSParameterSpec
See Also:
GMSSParameterSpec