what-the-bank/sources/org/bouncycastle/jcajce/spec/KTSParameterSpec.java

79 lines
2.7 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.jcajce.spec;
import java.security.spec.AlgorithmParameterSpec;
import org.bouncycastle.asn1.nist.NISTObjectIdentifiers;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.bouncycastle.asn1.x9.X9ObjectIdentifiers;
import org.bouncycastle.util.Arrays;
/* loaded from: classes6.dex */
public class KTSParameterSpec implements AlgorithmParameterSpec {
private final AlgorithmIdentifier kdfAlgorithm;
private final int keySizeInBits;
private byte[] otherInfo;
private final AlgorithmParameterSpec parameterSpec;
private final String wrappingKeyAlgorithm;
public AlgorithmParameterSpec getParameterSpec() {
return this.parameterSpec;
}
/* loaded from: classes6.dex */
public static final class Builder {
private final String algorithmName;
private AlgorithmIdentifier kdfAlgorithm;
private final int keySizeInBits;
private byte[] otherInfo;
private AlgorithmParameterSpec parameterSpec;
public final Builder withParameterSpec(AlgorithmParameterSpec algorithmParameterSpec) {
this.parameterSpec = algorithmParameterSpec;
return this;
}
public final Builder withKdfAlgorithm(AlgorithmIdentifier algorithmIdentifier) {
this.kdfAlgorithm = algorithmIdentifier;
return this;
}
public final KTSParameterSpec build() {
return new KTSParameterSpec(this.algorithmName, this.keySizeInBits, this.parameterSpec, this.kdfAlgorithm, this.otherInfo);
}
public Builder(String str, int i, byte[] bArr) {
this.algorithmName = str;
this.keySizeInBits = i;
this.kdfAlgorithm = new AlgorithmIdentifier(X9ObjectIdentifiers.id_kdf_kdf3, new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256));
this.otherInfo = bArr == null ? new byte[0] : Arrays.clone(bArr);
}
public Builder(String str, int i) {
this(str, i, null);
}
}
public byte[] getOtherInfo() {
return Arrays.clone(this.otherInfo);
}
public int getKeySize() {
return this.keySizeInBits;
}
public String getKeyAlgorithmName() {
return this.wrappingKeyAlgorithm;
}
public AlgorithmIdentifier getKdfAlgorithm() {
return this.kdfAlgorithm;
}
private KTSParameterSpec(String str, int i, AlgorithmParameterSpec algorithmParameterSpec, AlgorithmIdentifier algorithmIdentifier, byte[] bArr) {
this.wrappingKeyAlgorithm = str;
this.keySizeInBits = i;
this.parameterSpec = algorithmParameterSpec;
this.kdfAlgorithm = algorithmIdentifier;
this.otherInfo = bArr;
}
}