/** * Getter digest size. * * @return Digest size. */ public int getDigestSize() { return wotsPlus.getParams().getDigestSize(); }
/** * Import keys to WOTS+ instance. * * @param secretKeySeed Secret key seed. * @param publicSeed Public seed. */ void importKeys(byte[] secretKeySeed, byte[] publicSeed) { if (secretKeySeed == null) { throw new NullPointerException("secretKeySeed == null"); } if (secretKeySeed.length != params.getDigestSize()) { throw new IllegalArgumentException("size of secretKeySeed needs to be equal to size of digest"); } if (publicSeed == null) { throw new NullPointerException("publicSeed == null"); } if (publicSeed.length != params.getDigestSize()) { throw new IllegalArgumentException("size of publicSeed needs to be equal to size of digest"); } this.secretKeySeed = secretKeySeed; this.publicSeed = publicSeed; }
/** * Constructs a new WOTS+ one-time signature system based on the given WOTS+ * parameters. * * @param params Parameters for WOTSPlus object. */ protected WOTSPlus(WOTSPlusParameters params) { super(); if (params == null) { throw new NullPointerException("params == null"); } this.params = params; int n = params.getDigestSize(); khf = new KeyedHashFunctions(params.getDigest(), n); secretKeySeed = new byte[n]; publicSeed = new byte[n]; }
protected WOTSPlusPrivateKeyParameters(WOTSPlusParameters params, byte[][] privateKey) { super(); if (params == null) { throw new NullPointerException("params == null"); } if (privateKey == null) { throw new NullPointerException("privateKey == null"); } if (XMSSUtil.hasNullPointer(privateKey)) { throw new NullPointerException("privateKey byte array == null"); } if (privateKey.length != params.getLen()) { throw new IllegalArgumentException("wrong privateKey format"); } for (int i = 0; i < privateKey.length; i++) { if (privateKey[i].length != params.getDigestSize()) { throw new IllegalArgumentException("wrong privateKey format"); } } this.privateKey = XMSSUtil.cloneArray(privateKey); }
protected WOTSPlusPublicKeyParameters(WOTSPlusParameters params, byte[][] publicKey) { super(); if (params == null) { throw new NullPointerException("params == null"); } if (publicKey == null) { throw new NullPointerException("publicKey == null"); } if (XMSSUtil.hasNullPointer(publicKey)) { throw new NullPointerException("publicKey byte array == null"); } if (publicKey.length != params.getLen()) { throw new IllegalArgumentException("wrong publicKey size"); } for (int i = 0; i < publicKey.length; i++) { if (publicKey[i].length != params.getDigestSize()) { throw new IllegalArgumentException("wrong publicKey format"); } } this.publicKey = XMSSUtil.cloneArray(publicKey); }
protected WOTSPlusSignature(WOTSPlusParameters params, byte[][] signature) { super(); if (params == null) { throw new NullPointerException("params == null"); } if (signature == null) { throw new NullPointerException("signature == null"); } if (XMSSUtil.hasNullPointer(signature)) { throw new NullPointerException("signature byte array == null"); } if (signature.length != params.getLen()) { throw new IllegalArgumentException("wrong signature size"); } for (int i = 0; i < signature.length; i++) { if (signature[i].length != params.getDigestSize()) { throw new IllegalArgumentException("wrong signature format"); } } this.signature = XMSSUtil.cloneArray(signature); }
if (messageDigest.length != params.getDigestSize())
if (messageDigest.length != params.getDigestSize())
if (messageDigest.length != params.getDigestSize())
int n = params.getDigestSize(); if (startHash == null)
OTSHashAddress otsHashAddress, int indexLeaf) if (messageDigest.length != wotsPlus.getParams().getDigestSize())
int n = wotsPlus.getParams().getDigestSize(); byte[] tmpMask = new byte[2 * n]; for (int i = 0; i < n; i++)