private void validate() { if (authenticationPath == null) { throw new IllegalStateException("authenticationPath == null"); } if (retain == null) { throw new IllegalStateException("retain == null"); } if (stack == null) { throw new IllegalStateException("stack == null"); } if (treeHashInstances == null) { throw new IllegalStateException("treeHashInstances == null"); } if (keep == null) { throw new IllegalStateException("keep == null"); } if (!XMSSUtil.isIndexValid(treeHeight, index)) { throw new IllegalStateException("index in BDS state out of bounds"); } }
if (!XMSSUtil.isIndexValid(totalHeight, index)) int totalHeight = params.getHeight(); if (XMSSUtil.isIndexValid(totalHeight, globalIndex) && tmpPublicSeed != null && tmpSecretKeySeed != null)
if (!XMSSUtil.isIndexValid(params.getHeight(), index))
if (!XMSSUtil.isIndexValid(height, index))
private static XMSSPrivateKey xmssCreateKeyStructure(XMSSPrivateKeyParameters keyParams) { byte[] keyData = keyParams.toByteArray(); int n = keyParams.getParameters().getDigestSize(); int totalHeight = keyParams.getParameters().getHeight(); int indexSize = 4; int secretKeySize = n; int secretKeyPRFSize = n; int publicSeedSize = n; int rootSize = n; int position = 0; int index = (int)XMSSUtil.bytesToXBigEndian(keyData, position, indexSize); if (!XMSSUtil.isIndexValid(totalHeight, index)) { throw new IllegalArgumentException("index out of bounds"); } position += indexSize; byte[] secretKeySeed = XMSSUtil.extractBytesAtOffset(keyData, position, secretKeySize); position += secretKeySize; byte[] secretKeyPRF = XMSSUtil.extractBytesAtOffset(keyData, position, secretKeyPRFSize); position += secretKeyPRFSize; byte[] publicSeed = XMSSUtil.extractBytesAtOffset(keyData, position, publicSeedSize); position += publicSeedSize; byte[] root = XMSSUtil.extractBytesAtOffset(keyData, position, rootSize); position += rootSize; /* import BDS state */ byte[] bdsStateBinary = XMSSUtil.extractBytesAtOffset(keyData, position, keyData.length - position); return new XMSSPrivateKey(index, secretKeySeed, secretKeyPRF, publicSeed, root, bdsStateBinary); }
if (!XMSSUtil.isIndexValid(totalHeight, index))
if (!XMSSUtil.isIndexValid(params.getHeight(), index))
final int totalHeight = params.getHeight(); final int xmssHeight = xmssParams.getHeight(); if (!XMSSUtil.isIndexValid(totalHeight, globalIndex))