what-the-bank/sources/org/bouncycastle/crypto/params/KDFCounterParameters.java

58 lines
1.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.params;
import org.bouncycastle.crypto.DerivationParameters;
import org.bouncycastle.util.Arrays;
/* loaded from: classes6.dex */
public final class KDFCounterParameters implements DerivationParameters {
private byte[] fixedInputDataCounterPrefix;
private byte[] fixedInputDataCounterSuffix;
private byte[] ki;
private int r;
public final int getR() {
return this.r;
}
public final byte[] getKI() {
return this.ki;
}
public final byte[] getFixedInputDataCounterSuffix() {
return Arrays.clone(this.fixedInputDataCounterSuffix);
}
public final byte[] getFixedInputDataCounterPrefix() {
return Arrays.clone(this.fixedInputDataCounterPrefix);
}
public final byte[] getFixedInputData() {
return Arrays.clone(this.fixedInputDataCounterSuffix);
}
public KDFCounterParameters(byte[] bArr, byte[] bArr2, byte[] bArr3, int i) {
if (bArr == null) {
throw new IllegalArgumentException("A KDF requires Ki (a seed) as input");
}
this.ki = Arrays.clone(bArr);
if (bArr2 == null) {
this.fixedInputDataCounterPrefix = new byte[0];
} else {
this.fixedInputDataCounterPrefix = Arrays.clone(bArr2);
}
if (bArr3 == null) {
this.fixedInputDataCounterSuffix = new byte[0];
} else {
this.fixedInputDataCounterSuffix = Arrays.clone(bArr3);
}
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;
}
public KDFCounterParameters(byte[] bArr, byte[] bArr2, int i) {
this(bArr, null, bArr2, i);
}
}