package org.bouncycastle.pqc.jcajce.spec; import java.security.spec.AlgorithmParameterSpec; import org.bouncycastle.util.Arrays; /* loaded from: classes6.dex */ public class RainbowParameterSpec implements AlgorithmParameterSpec { private static final int[] DEFAULT_VI = {6, 12, 17, 22, 33}; private int[] vi; public int[] getVi() { return Arrays.clone(this.vi); } public int getNumOfLayers() { return this.vi.length - 1; } public int getDocumentLength() { int[] iArr = this.vi; return iArr[iArr.length - 1] - iArr[0]; } private void checkParams() throws Exception { int[] iArr; int i; int[] iArr2 = this.vi; if (iArr2 == null) { throw new IllegalArgumentException("no layers defined."); } if (iArr2.length <= 1) { throw new IllegalArgumentException("Rainbow needs at least 1 layer, such that v1 < v2."); } int i2 = 0; do { iArr = this.vi; if (i2 >= iArr.length - 1) { return; } i = iArr[i2]; i2++; } while (i < iArr[i2]); throw new IllegalArgumentException("v[i] has to be smaller than v[i+1]"); } public RainbowParameterSpec(int[] iArr) { this.vi = iArr; try { checkParams(); } catch (Exception unused) { } } public RainbowParameterSpec() { this.vi = DEFAULT_VI; } }