de.flexiprovider.pqc.ots.merkle
Class MerkleOTSKeyPairGenerator

java.lang.Object
  |
  +--java.security.KeyPairGeneratorSpi
        |
        +--de.flexiprovider.api.keys.KeyPairGenerator
              |
              +--de.flexiprovider.pqc.ots.merkle.MerkleOTSKeyPairGenerator
Direct Known Subclasses:
MerkleOTSKeyPairGenerator.SHA1andSHA1PRNG, MerkleOTSKeyPairGenerator.SHA256andSHA1PRNG, MerkleOTSKeyPairGenerator.SHA384andSHA1PRNG, MerkleOTSKeyPairGenerator.SHA512andSHA1PRNG

public class MerkleOTSKeyPairGenerator
extends KeyPairGenerator

This class generates a private and public key for the MerkleOTS (One Time Signature). The private key is a 2-dimensional byte array of random values that are generated with a secure random generator. The secure random generator is initiated before with a seed that can be set with the integer value startValue. The public key is a 2-dimensional byte array with the hash values of the private key. A key pair consists of a MerkleOTSPublicKey and a MerkleOTSPrivateKey.

A MerkleOTS key pair can be generated as follows:

 // obtain an instance of the key pair generator 
 KeyPairGenerator kpg = KeyPairGenerator.getInstance(
 	"MerkleOTSwithSHA256andSHA1PRNG", "FlexiPQC");
 // set the seed size
 kpg.initialize(256);
 // generate the key pair 
 KeyPair keyPair = kpg.generateKeyPair();
 

Author:
Klintsevich Elena
See Also:
MerkleOTSPrivateKey, MerkleOTSPublicKey

Inner Class Summary
static class MerkleOTSKeyPairGenerator.SHA1andSHA1PRNG
          Merkle OTS key pair generator with SHA1 and SHA1PRNG
static class MerkleOTSKeyPairGenerator.SHA256andSHA1PRNG
          Merkle OTS key pair generator with SHA256 and SHA1PRNG
static class MerkleOTSKeyPairGenerator.SHA384andSHA1PRNG
          Merkle OTS key pair generator with SHA384 and SHA1PRNG
static class MerkleOTSKeyPairGenerator.SHA512andSHA1PRNG
          Merkle OTS key pair generator with SHA512 and SHA1PRNG
 
Constructor Summary
protected MerkleOTSKeyPairGenerator(java.lang.String oid, MessageDigest md, java.lang.String prngName)
          Constructor.
 
Method Summary
 KeyPair genKeyPair()
          Generate a MerkleOTS key pair, consisting of a MerkleOTSPublicKey and a MerkleOTSPrivateKey.
 void initialize(AlgorithmParameterSpec params, SecureRandom random)
          Initialize the key pair generator.
 void initialize(int seedSize, SecureRandom random)
          Initialize the key pair generator with the given seed size and source of randomness.
 
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

MerkleOTSKeyPairGenerator

protected MerkleOTSKeyPairGenerator(java.lang.String oid,
                                    MessageDigest md,
                                    java.lang.String prngName)
Constructor.
Parameters:
oid - the OID of the algorithm
md - the message digest
prngName - the name of the PRNG
Method Detail

initialize

public void initialize(AlgorithmParameterSpec params,
                       SecureRandom random)
                throws InvalidAlgorithmParameterException
Initialize the key pair generator.
Overrides:
initialize in class KeyPairGenerator
Parameters:
params - the parameters
random - the source of randomness
Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of MerkleOTSKeyGenParameterSpec.

initialize

public void initialize(int seedSize,
                       SecureRandom random)
Initialize the key pair generator with the given seed size and source of randomness.
Overrides:
initialize in class KeyPairGenerator
Parameters:
seedSize - the seed size in bits (>= hash length)
random - the source of randomness

genKeyPair

public KeyPair genKeyPair()
Generate a MerkleOTS key pair, consisting of a MerkleOTSPublicKey and a MerkleOTSPrivateKey.
Overrides:
genKeyPair in class KeyPairGenerator
Returns:
the generated key pair