what-the-bank/sources/org/bouncycastle/asn1/pkcs/PBEParameter.java

57 lines
1.8 KiB
Java

package org.bouncycastle.asn1.pkcs;
import java.math.BigInteger;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class PBEParameter extends ASN1Object {
ASN1Integer iterations;
ASN1OctetString salt;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.salt);
aSN1EncodableVector.add(this.iterations);
return new DERSequence(aSN1EncodableVector);
}
public byte[] getSalt() {
return this.salt.getOctets();
}
public BigInteger getIterationCount() {
return this.iterations.getValue();
}
public static PBEParameter getInstance(Object obj) {
if (obj instanceof PBEParameter) {
return (PBEParameter) obj;
}
if (obj != null) {
return new PBEParameter(ASN1Sequence.getInstance(obj));
}
return null;
}
public PBEParameter(byte[] bArr, int i) {
if (bArr.length != 8) {
throw new IllegalArgumentException("salt length must be 8");
}
this.salt = new DEROctetString(bArr);
this.iterations = new ASN1Integer(i);
}
private PBEParameter(ASN1Sequence aSN1Sequence) {
this.salt = (ASN1OctetString) aSN1Sequence.getObjectAt(0);
this.iterations = (ASN1Integer) aSN1Sequence.getObjectAt(1);
}
}