GMSSLeaf nextLeaf() { GMSSLeaf nextLeaf = new GMSSLeaf(this); nextLeaf.updateLeafCalc(); return nextLeaf; }
public GMSSLeaf(Digest digest, int w, int numLeafs, byte[] seed0) { this.w = w; messDigestOTS = digest; gmssRandom = new GMSSRandom(messDigestOTS); // calulate keysize for private key and the help array mdsize = messDigestOTS.getDigestSize(); int mdsizeBit = mdsize << 3; int messagesize = (int)Math.ceil((double)(mdsizeBit) / (double)w); int checksumsize = getLog((messagesize << w) + 1); this.keysize = messagesize + (int)Math.ceil((double)checksumsize / (double)w); this.two_power_w = 1 << w; // calculate steps // ((2^w)-1)*keysize + keysize + 1 / (2^h -1) this.steps = (int)Math .ceil((double)(((1 << w) - 1) * keysize + 1 + keysize) / (double)(numLeafs)); // initialize arrays this.seed = new byte[mdsize]; this.leaf = new byte[mdsize]; this.privateKeyOTS = new byte[mdsize]; this.concHashs = new byte[mdsize * keysize]; initLeafCalc(seed0); }
out = out + this.getStatInt()[i] + " "; byte[][] temp = this.getStatByte(); for (int i = 0; i < 4; i++)
nextNextLeaf[layer - 1 - 1] = nextNextLeaf[layer - 1 - 1].nextLeaf(); upperLeaf[layer - 1] = upperLeaf[layer - 1].nextLeaf(); byte[] leaf = this.upperTreehashLeaf[layer - 1].getLeaf(); this.upperTreehashLeaf[layer - 1] = new GMSSLeaf( this.digestProvider.get(), this.otsIndex[layer - 1], t, seed); this.upperTreehashLeaf[layer - 1] = this.upperTreehashLeaf[layer - 1].nextLeaf(); this.upperTreehashLeaf[layer - 1] = this.upperTreehashLeaf[layer - 1].nextLeaf();
/** * Updates the authentication path and root calculation for the tree after * next (AUTH++, ROOT++) in layer <code>layer</code> * * @param layer */ private void updateNextNextAuthRoot(int layer) { byte[] OTSseed = new byte[mdLength]; OTSseed = gmssRandom.nextSeed(nextNextSeeds[layer - 1]); // get the necessary leaf if (layer == numLayer - 1) { // lowest layer computes the necessary // leaf completely at this time WinternitzOTSignature ots = new WinternitzOTSignature(OTSseed, digestProvider.get(), otsIndex[layer]); this.nextNextRoot[layer - 1].update(nextNextSeeds[layer - 1], ots .getPublicKey()); } else { // other layers use the precomputed leafs in nextNextLeaf this.nextNextRoot[layer - 1].update(nextNextSeeds[layer - 1], nextNextLeaf[layer - 1].getLeaf()); this.nextNextLeaf[layer - 1].initLeafCalc(nextNextSeeds[layer - 1]); } }
int mdsizeBit = mdsize << 3; int messagesize = (int)Math.ceil((double)(mdsizeBit) / (double)w); int checksumsize = getLog((messagesize << w) + 1); this.keysize = messagesize + (int)Math.ceil((double)checksumsize / (double)w);
for (int i = 0; i < numLayer - 2; i++) this.nextNextLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i + 1], numLeafs[i + 2], this.nextNextSeeds[i]); for (int i = 0; i < numLayer - 1; i++) this.upperLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i], numLeafs[i + 1], this.currentSeeds[i]); for (int i = 0; i < numLayer - 1; i++) this.upperTreehashLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i], numLeafs[i + 1]);
nextNextLeaf[layer - 1 - 1] = nextNextLeaf[layer - 1 - 1].nextLeaf(); upperLeaf[layer - 1] = upperLeaf[layer - 1].nextLeaf(); byte[] leaf = this.upperTreehashLeaf[layer - 1].getLeaf(); this.upperTreehashLeaf[layer - 1] = new GMSSLeaf( this.digestProvider.get(), this.otsIndex[layer - 1], t, seed); this.upperTreehashLeaf[layer - 1] = this.upperTreehashLeaf[layer - 1].nextLeaf(); this.upperTreehashLeaf[layer - 1] = this.upperTreehashLeaf[layer - 1].nextLeaf();
/** * Updates the authentication path and root calculation for the tree after * next (AUTH++, ROOT++) in layer <code>layer</code> * * @param layer */ private void updateNextNextAuthRoot(int layer) { byte[] OTSseed = new byte[mdLength]; OTSseed = gmssRandom.nextSeed(nextNextSeeds[layer - 1]); // get the necessary leaf if (layer == numLayer - 1) { // lowest layer computes the necessary // leaf completely at this time WinternitzOTSignature ots = new WinternitzOTSignature(OTSseed, digestProvider.get(), otsIndex[layer]); this.nextNextRoot[layer - 1].update(nextNextSeeds[layer - 1], ots .getPublicKey()); } else { // other layers use the precomputed leafs in nextNextLeaf this.nextNextRoot[layer - 1].update(nextNextSeeds[layer - 1], nextNextLeaf[layer - 1].getLeaf()); this.nextNextLeaf[layer - 1].initLeafCalc(nextNextSeeds[layer - 1]); } }
int mdsizeBit = mdsize << 3; int messagesize = (int)Math.ceil((double)(mdsizeBit) / (double)w); int checksumsize = getLog((messagesize << w) + 1); this.keysize = messagesize + (int)Math.ceil((double)checksumsize / (double)w);
for (int i = 0; i < numLayer - 2; i++) this.nextNextLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i + 1], numLeafs[i + 2], this.nextNextSeeds[i]); for (int i = 0; i < numLayer - 1; i++) this.upperLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i], numLeafs[i + 1], this.currentSeeds[i]); for (int i = 0; i < numLayer - 1; i++) this.upperTreehashLeaf[i] = new GMSSLeaf(digestProvider.get(), otsIndex[i], numLeafs[i + 1]);
System.arraycopy(currentSeeds[layer], 0, dummy, 0, mdLength); gmssRandom.nextSeed(dummy); help = upperLeaf[layer].getLeaf(); this.upperLeaf[layer].initLeafCalc(dummy);
out = out + this.getStatInt()[i] + " "; byte[][] temp = this.getStatByte(); for (int i = 0; i < 4; i++)
GMSSLeaf nextLeaf() { GMSSLeaf nextLeaf = new GMSSLeaf(this); nextLeaf.updateLeafCalc(); return nextLeaf; }
public GMSSLeaf(Digest digest, int w, int numLeafs, byte[] seed0) { this.w = w; messDigestOTS = digest; gmssRandom = new GMSSRandom(messDigestOTS); // calulate keysize for private key and the help array mdsize = messDigestOTS.getDigestSize(); int mdsizeBit = mdsize << 3; int messagesize = (int)Math.ceil((double)(mdsizeBit) / (double)w); int checksumsize = getLog((messagesize << w) + 1); this.keysize = messagesize + (int)Math.ceil((double)checksumsize / (double)w); this.two_power_w = 1 << w; // calculate steps // ((2^w)-1)*keysize + keysize + 1 / (2^h -1) this.steps = (int)Math .ceil((double)(((1 << w) - 1) * keysize + 1 + keysize) / (double)(numLeafs)); // initialize arrays this.seed = new byte[mdsize]; this.leaf = new byte[mdsize]; this.privateKeyOTS = new byte[mdsize]; this.concHashs = new byte[mdsize * keysize]; initLeafCalc(seed0); }
int mdsizeBit = mdsize << 3; int messagesize = (int)Math.ceil((double)(mdsizeBit) / (double)w); int checksumsize = getLog((messagesize << w) + 1); this.keysize = messagesize + (int)Math.ceil((double)checksumsize / (double)w);
System.arraycopy(currentSeeds[layer], 0, dummy, 0, mdLength); gmssRandom.nextSeed(dummy); help = upperLeaf[layer].getLeaf(); this.upperLeaf[layer].initLeafCalc(dummy);
byte[][] tempByte = nextNextLeaf[i].getStatByte(); seqOfByte.add(new DEROctetString(tempByte[0])); seqOfByte.add(new DEROctetString(tempByte[1])); seqOfByte = new ASN1EncodableVector(); int[] tempInt = nextNextLeaf[i].getStatInt(); seqOfInt.add(new ASN1Integer(tempInt[0])); seqOfInt.add(new ASN1Integer(tempInt[1])); byte[][] tempByte = upperLeaf[i].getStatByte(); seqOfByte.add(new DEROctetString(tempByte[0])); seqOfByte.add(new DEROctetString(tempByte[1])); seqOfByte = new ASN1EncodableVector(); int[] tempInt = upperLeaf[i].getStatInt(); seqOfInt.add(new ASN1Integer(tempInt[0])); seqOfInt.add(new ASN1Integer(tempInt[1])); byte[][] tempByte = upperTreehashLeaf[i].getStatByte(); seqOfByte.add(new DEROctetString(tempByte[0])); seqOfByte.add(new DEROctetString(tempByte[1])); int[] tempInt = upperTreehashLeaf[i].getStatInt(); seqOfInt.add(new ASN1Integer(tempInt[0])); seqOfInt.add(new ASN1Integer(tempInt[1]));