protected void setPublicSeed(byte[] publicSeed) { privateKey = new XMSSPrivateKeyParameters.Builder(params) .withSecretKeySeed(privateKey.getSecretKeySeed()).withSecretKeyPRF(privateKey.getSecretKeyPRF()) .withPublicSeed(publicSeed).withRoot(getRoot()).withBDSState(privateKey.getBDSState()).build(); publicKey = new XMSSPublicKeyParameters.Builder(params).withRoot(getRoot()).withPublicSeed(publicSeed) .build(); wotsPlus.importKeys(new byte[params.getDigestSize()], publicSeed); }
protected void setIndex(int index) { privateKey = new XMSSPrivateKeyParameters.Builder(params) .withSecretKeySeed(privateKey.getSecretKeySeed()).withSecretKeyPRF(privateKey.getSecretKeyPRF()) .withPublicSeed(privateKey.getPublicSeed()).withRoot(privateKey.getRoot()) .withBDSState(privateKey.getBDSState()).build(); }
private void importState(XMSSMTPrivateKeyParameters privateKey, XMSSMTPublicKeyParameters publicKey) { /* import to xmss */ xmssParams.getWOTSPlus().importKeys(new byte[params.getDigestSize()], this.privateKey.getPublicSeed()); this.privateKey = privateKey; this.publicKey = publicKey; }
protected void setRoot(byte[] root) { privateKey = new XMSSPrivateKeyParameters.Builder(params) .withSecretKeySeed(privateKey.getSecretKeySeed()).withSecretKeyPRF(privateKey.getSecretKeyPRF()) .withPublicSeed(getPublicSeed()).withRoot(root).withBDSState(privateKey.getBDSState()).build(); publicKey = new XMSSPublicKeyParameters.Builder(params).withRoot(root).withPublicSeed(getPublicSeed()) .build(); }
public XMSSMTPrivateKeyParameters getNextKey() { BDSStateMap newState = new BDSStateMap(bdsState, params, this.getIndex(), publicSeed, secretKeySeed); return new XMSSMTPrivateKeyParameters.Builder(params).withIndex(index + 1) .withSecretKeySeed(secretKeySeed).withSecretKeyPRF(secretKeyPRF) .withPublicSeed(publicSeed).withRoot(root) .withBDSState(newState).build(); } }
/** * Generate a new XMSS private key / public key pair. */ public void generateKeys() { XMSSKeyPairGenerator kpGen = new XMSSKeyPairGenerator(); kpGen.init(new XMSSKeyGenerationParameters(getParams(), prng)); AsymmetricCipherKeyPair kp = kpGen.generateKeyPair(); privateKey = (XMSSPrivateKeyParameters)kp.getPrivate(); publicKey = (XMSSPublicKeyParameters)kp.getPublic(); wotsPlus.importKeys(new byte[params.getDigestSize()], this.privateKey.getPublicSeed()); }
/** * Set up constructor. * * @param params tree parameters * @param publicSeed public seed for tree * @param secretKeySeed secret seed for tree * @param otsHashAddress hash address */ BDS(XMSSParameters params, byte[] publicSeed, byte[] secretKeySeed, OTSHashAddress otsHashAddress) { this(params.getWOTSPlus(), params.getHeight(), params.getK()); this.initialize(publicSeed, secretKeySeed, otsHashAddress); }
protected int getLen() { return xmssParams.getWOTSPlus().getParams().getLen(); } }
public long getUsagesRemaining() { return (1L << this.getParameters().getHeight()) - this.getIndex(); }
public void init( KeyGenerationParameters param) { XMSSMTKeyGenerationParameters parameters = (XMSSMTKeyGenerationParameters)param; prng = parameters.getRandom(); this.params = parameters.getParameters(); this.xmssParams = params.getXMSSParameters(); }
/** * Getter digest size. * * @return Digest size. */ public int getDigestSize() { return wotsPlus.getParams().getDigestSize(); }
public int getHeight() { return keyParams.getParameters().getHeight(); }
public int getHeight() { return keyParams.getParameters().getHeight(); }
/** * Getter Winternitz parameter. * * @return Winternitz parameter. */ public int getWinternitzParameter() { return wotsPlus.getParams().getWinternitzParameter(); }
public Builder withPublicSeed(byte[] val) { publicSeed = XMSSUtil.cloneArray(val); return this; }
public XMSSMTPublicKeyParameters build() { return new XMSSMTPublicKeyParameters(this); } }
public XMSSReducedSignature build() { return new XMSSReducedSignature(this); } }
public Builder withRandom(byte[] val) { random = XMSSUtil.cloneArray(val); return this; }