Top Description Fields Constructors Methods
org.bouncycastle.pqc.legacy.crypto.gmss

public Class GMSSKeyPairGenerator

extends Object
implements AsymmetricCipherKeyPairGenerator
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator
Imports
java.security.SecureRandom, java.util.Vector, org.bouncycastle.crypto.AsymmetricCipherKeyPair, .AsymmetricCipherKeyPairGenerator, .Digest, .KeyGenerationParameters, org.bouncycastle.pqc.legacy.crypto.gmss.util.GMSSRandom, .WinternitzOTSVerify, .WinternitzOTSignature

This class implements key pair generation of the generalized Merkle signature scheme (GMSS).
See Also
GMSSSigner

Field Summary

Modifier and TypeField and Description
private byte[][]
currentRootSigs

An array of the RootSignatures

private byte[][]
currentSeeds

An array of the seeds for the PRGN (for main tree, and all current subtrees)

private GMSSDigestProvider
digestProvider

Class of hash function to use

private GMSSKeyGenerationParameters
private GMSSParameters
gmssPS

Instance of GMSSParameterset

private GMSSRandom
gmssRandom

The source of randomness for OTS private key generation

private int[]
heightOfTrees

An array of the heights of the authentication trees of each layer

private boolean
initialized

Flag indicating if the class already has been initialized

private int[]
K

The parameter K needed for the authentication path computation

private int
mdLength

The length of the seed for the PRNG

private Digest
messDigestTree

The hash function used for the construction of the authentication trees

private byte[][]
nextNextSeeds

An array of seeds for the PRGN (for all subtrees after next)

private int
numLayer

the number of Layers

public static final String
OID

The GMSS OID.

private int[]
otsIndex

An array of the Winternitz parameter 'w' of each layer

Constructor Summary

AccessConstructor and Description
public
GMSSKeyPairGenerator(GMSSDigestProvider
provider for digest implementations.
digestProvider
)

The standard constructor tries to generate the GMSS algorithm identifier with the corresponding OID.

Method Summary

Modifier and TypeMethod and Description
private GMSSRootCalc
generateCurrentAuthpathAndRoot(byte[]
stores the root of the lower tree
lowerRoot
,
Vector<E>
stack used for the treehash instance created by this method
currentStack
,
byte[]
starting seeds
seed
,
int
actual layer
h
)

calculates the authpath for tree in layer h which starts with seed[h] additionally computes the rootSignature of underlaying root

public AsymmetricCipherKeyPair
generateKeyPair()

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

return an AsymmetricCipherKeyPair containing the generated keys.
private GMSSRootCalc
generateNextAuthpathAndRoot(Vector<E>
stack used for the treehash instance created by this method
nextStack
,
byte[]
starting seeds
seed
,
int
actual layer
h
)

calculates the authpath and root for tree in layer h which starts with seed[h]

private AsymmetricCipherKeyPair

Returns:

Key pair containing a JDKGMSSPublicKey and a JDKGMSSPrivateKey
genKeyPair
()

Generates the GMSS key pair.

public void
init(KeyGenerationParameters
the parameters the key pair is to be initialised with.
param
)

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

intialise the key pair generator.
public void
initialize(int
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))
keySize
,
SecureRandom
not used by GMSS, the SHA1PRNG of the SUN Provider is always used
secureRandom
)

This method initializes the GMSS KeyPairGenerator using an integer value keySize as input.

public void
initialize(KeyGenerationParameters param)

Initalizes the key pair generator using a parameter set as input

private void
initializeDefault()

This method is called by generateKeyPair() in case that no other initialization method has been called by the user

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentRootSigsback to summary
private byte[][] currentRootSigs

An array of the RootSignatures

currentSeedsback to summary
private byte[][] currentSeeds

An array of the seeds for the PRGN (for main tree, and all current subtrees)

digestProviderback to summary
private GMSSDigestProvider digestProvider

Class of hash function to use

gmssParamsback to summary
private GMSSKeyGenerationParameters gmssParams
gmssPSback to summary
private GMSSParameters gmssPS

Instance of GMSSParameterset

gmssRandomback to summary
private GMSSRandom gmssRandom

The source of randomness for OTS private key generation

heightOfTreesback to summary
private int[] heightOfTrees

An array of the heights of the authentication trees of each layer

initializedback to summary
private boolean initialized

Flag indicating if the class already has been initialized

Kback to summary
private int[] K

The parameter K needed for the authentication path computation

mdLengthback to summary
private int mdLength

The length of the seed for the PRNG

messDigestTreeback to summary
private Digest messDigestTree

The hash function used for the construction of the authentication trees

nextNextSeedsback to summary
private byte[][] nextNextSeeds

An array of seeds for the PRGN (for all subtrees after next)

numLayerback to summary
private int numLayer

the number of Layers

OIDback to summary
public static final String OID

The GMSS OID.

otsIndexback to summary
private int[] otsIndex

An array of the Winternitz parameter 'w' of each layer

Constructor Detail

GMSSKeyPairGeneratorback to summary
public GMSSKeyPairGenerator(GMSSDigestProvider digestProvider)

The standard constructor tries to generate the GMSS algorithm identifier with the corresponding OID.

Parameters
digestProvider:GMSSDigestProvider

provider for digest implementations.

Method Detail

generateCurrentAuthpathAndRootback to summary
private GMSSRootCalc generateCurrentAuthpathAndRoot(byte[] lowerRoot, Vector<E> currentStack, byte[] seed, int h)

calculates the authpath for tree in layer h which starts with seed[h] additionally computes the rootSignature of underlaying root

Parameters
lowerRoot:byte[]

stores the root of the lower tree

currentStack:Vector<E>

stack used for the treehash instance created by this method

seed:byte[]

starting seeds

h:int

actual layer

generateKeyPairback to summary
public AsymmetricCipherKeyPair generateKeyPair()

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

Doc from org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

return an AsymmetricCipherKeyPair containing the generated keys.

Returns:AsymmetricCipherKeyPair

an AsymmetricCipherKeyPair containing the generated keys.

generateNextAuthpathAndRootback to summary
private GMSSRootCalc generateNextAuthpathAndRoot(Vector<E> nextStack, byte[] seed, int h)

calculates the authpath and root for tree in layer h which starts with seed[h]

Parameters
nextStack:Vector<E>

stack used for the treehash instance created by this method

seed:byte[]

starting seeds

h:int

actual layer

genKeyPairback to summary
private AsymmetricCipherKeyPair genKeyPair()

Generates the GMSS key pair. The public key is an instance of JDKGMSSPublicKey, the private key is an instance of JDKGMSSPrivateKey.

Returns:AsymmetricCipherKeyPair

Key pair containing a JDKGMSSPublicKey and a JDKGMSSPrivateKey

initback to summary
public void init(KeyGenerationParameters param)

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

Doc from org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

intialise the key pair generator.

Parameters
param:KeyGenerationParameters

the parameters the key pair is to be initialised with.

initializeback to summary
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.

Parameters
keySize:int

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:SecureRandom

not used by GMSS, the SHA1PRNG of the SUN Provider is always used

initializeback to summary
public void initialize(KeyGenerationParameters param)

Initalizes the key pair generator using a parameter set as input

initializeDefaultback to summary
private void initializeDefault()

This method is called by generateKeyPair() in case that no other initialization method has been called by the user