55 lines
1.7 KiB
Java
55 lines
1.7 KiB
Java
|
package org.bouncycastle.crypto.params;
|
||
|
|
||
|
import org.bouncycastle.crypto.DerivationParameters;
|
||
|
import org.bouncycastle.util.Arrays;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class KDFDoublePipelineIterationParameters implements DerivationParameters {
|
||
|
private static final int UNUSED_R = 32;
|
||
|
private final byte[] fixedInputData;
|
||
|
private final byte[] ki;
|
||
|
private final int r;
|
||
|
private final boolean useCounter;
|
||
|
|
||
|
public final boolean useCounter() {
|
||
|
return this.useCounter;
|
||
|
}
|
||
|
|
||
|
public final int getR() {
|
||
|
return this.r;
|
||
|
}
|
||
|
|
||
|
public final byte[] getKI() {
|
||
|
return this.ki;
|
||
|
}
|
||
|
|
||
|
public final byte[] getFixedInputData() {
|
||
|
return Arrays.clone(this.fixedInputData);
|
||
|
}
|
||
|
|
||
|
public static KDFDoublePipelineIterationParameters createWithoutCounter(byte[] bArr, byte[] bArr2) {
|
||
|
return new KDFDoublePipelineIterationParameters(bArr, bArr2, 32, false);
|
||
|
}
|
||
|
|
||
|
public static KDFDoublePipelineIterationParameters createWithCounter(byte[] bArr, byte[] bArr2, int i) {
|
||
|
return new KDFDoublePipelineIterationParameters(bArr, bArr2, i, true);
|
||
|
}
|
||
|
|
||
|
private KDFDoublePipelineIterationParameters(byte[] bArr, byte[] bArr2, int i, boolean z) {
|
||
|
if (bArr == null) {
|
||
|
throw new IllegalArgumentException("A KDF requires Ki (a seed) as input");
|
||
|
}
|
||
|
this.ki = Arrays.clone(bArr);
|
||
|
if (bArr2 == null) {
|
||
|
this.fixedInputData = new byte[0];
|
||
|
} else {
|
||
|
this.fixedInputData = Arrays.clone(bArr2);
|
||
|
}
|
||
|
if (i != 8 && i != 16 && i != 24 && i != 32) {
|
||
|
throw new IllegalArgumentException("Length of counter should be 8, 16, 24 or 32");
|
||
|
}
|
||
|
this.r = i;
|
||
|
this.useCounter = z;
|
||
|
}
|
||
|
}
|