what-the-bank/sources/org/bouncycastle/asn1/esf/SignaturePolicyId.java

73 lines
2.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.esf;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class SignaturePolicyId extends ASN1Object {
private OtherHashAlgAndValue sigPolicyHash;
private ASN1ObjectIdentifier sigPolicyId;
private SigPolicyQualifiers sigPolicyQualifiers;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.sigPolicyId);
aSN1EncodableVector.add(this.sigPolicyHash);
SigPolicyQualifiers sigPolicyQualifiers = this.sigPolicyQualifiers;
if (sigPolicyQualifiers != null) {
aSN1EncodableVector.add(sigPolicyQualifiers);
}
return new DERSequence(aSN1EncodableVector);
}
public SigPolicyQualifiers getSigPolicyQualifiers() {
return this.sigPolicyQualifiers;
}
public ASN1ObjectIdentifier getSigPolicyId() {
return new ASN1ObjectIdentifier(this.sigPolicyId.getId());
}
public OtherHashAlgAndValue getSigPolicyHash() {
return this.sigPolicyHash;
}
public static SignaturePolicyId getInstance(Object obj) {
if (obj instanceof SignaturePolicyId) {
return (SignaturePolicyId) obj;
}
if (obj != null) {
return new SignaturePolicyId(ASN1Sequence.getInstance(obj));
}
return null;
}
private SignaturePolicyId(ASN1Sequence aSN1Sequence) {
if (aSN1Sequence.size() != 2 && aSN1Sequence.size() != 3) {
StringBuilder sb = new StringBuilder("Bad sequence size: ");
sb.append(aSN1Sequence.size());
throw new IllegalArgumentException(sb.toString());
}
this.sigPolicyId = ASN1ObjectIdentifier.getInstance(aSN1Sequence.getObjectAt(0));
this.sigPolicyHash = OtherHashAlgAndValue.getInstance(aSN1Sequence.getObjectAt(1));
if (aSN1Sequence.size() == 3) {
this.sigPolicyQualifiers = SigPolicyQualifiers.getInstance(aSN1Sequence.getObjectAt(2));
}
}
public SignaturePolicyId(ASN1ObjectIdentifier aSN1ObjectIdentifier, OtherHashAlgAndValue otherHashAlgAndValue, SigPolicyQualifiers sigPolicyQualifiers) {
this.sigPolicyId = aSN1ObjectIdentifier;
this.sigPolicyHash = otherHashAlgAndValue;
this.sigPolicyQualifiers = sigPolicyQualifiers;
}
public SignaturePolicyId(ASN1ObjectIdentifier aSN1ObjectIdentifier, OtherHashAlgAndValue otherHashAlgAndValue) {
this(aSN1ObjectIdentifier, otherHashAlgAndValue, null);
}
}