78 lines
2.7 KiB
Java
78 lines
2.7 KiB
Java
|
package org.bouncycastle.asn1.x9;
|
||
|
|
||
|
import java.math.BigInteger;
|
||
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
||
|
import org.bouncycastle.asn1.ASN1Integer;
|
||
|
import org.bouncycastle.asn1.ASN1Object;
|
||
|
import org.bouncycastle.asn1.ASN1Primitive;
|
||
|
import org.bouncycastle.asn1.ASN1Sequence;
|
||
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||
|
import org.bouncycastle.asn1.DERBitString;
|
||
|
import org.bouncycastle.asn1.DERSequence;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class ValidationParams extends ASN1Object {
|
||
|
private ASN1Integer pgenCounter;
|
||
|
private DERBitString seed;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
||
|
aSN1EncodableVector.add(this.seed);
|
||
|
aSN1EncodableVector.add(this.pgenCounter);
|
||
|
return new DERSequence(aSN1EncodableVector);
|
||
|
}
|
||
|
|
||
|
public byte[] getSeed() {
|
||
|
return this.seed.getBytes();
|
||
|
}
|
||
|
|
||
|
public BigInteger getPgenCounter() {
|
||
|
return this.pgenCounter.getPositiveValue();
|
||
|
}
|
||
|
|
||
|
public static ValidationParams getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
||
|
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
||
|
}
|
||
|
|
||
|
public static ValidationParams getInstance(Object obj) {
|
||
|
if (obj instanceof ValidationParams) {
|
||
|
return (ValidationParams) obj;
|
||
|
}
|
||
|
if (obj != null) {
|
||
|
return new ValidationParams(ASN1Sequence.getInstance(obj));
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public ValidationParams(byte[] bArr, int i) {
|
||
|
if (bArr == null) {
|
||
|
throw new IllegalArgumentException("'seed' cannot be null");
|
||
|
}
|
||
|
this.seed = new DERBitString(bArr);
|
||
|
this.pgenCounter = new ASN1Integer(i);
|
||
|
}
|
||
|
|
||
|
public ValidationParams(DERBitString dERBitString, ASN1Integer aSN1Integer) {
|
||
|
if (dERBitString == null) {
|
||
|
throw new IllegalArgumentException("'seed' cannot be null");
|
||
|
}
|
||
|
if (aSN1Integer == null) {
|
||
|
throw new IllegalArgumentException("'pgenCounter' cannot be null");
|
||
|
}
|
||
|
this.seed = dERBitString;
|
||
|
this.pgenCounter = aSN1Integer;
|
||
|
}
|
||
|
|
||
|
private ValidationParams(ASN1Sequence aSN1Sequence) {
|
||
|
if (aSN1Sequence.size() == 2) {
|
||
|
this.seed = DERBitString.getInstance(aSN1Sequence.getObjectAt(0));
|
||
|
this.pgenCounter = ASN1Integer.getInstance(aSN1Sequence.getObjectAt(1));
|
||
|
} else {
|
||
|
StringBuilder sb = new StringBuilder("Bad sequence size: ");
|
||
|
sb.append(aSN1Sequence.size());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
}
|
||
|
}
|