what-the-bank/sources/org/bouncycastle/asn1/ess/ESSCertID.java

67 lines
2.2 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.ess;
import org.bouncycastle.asn1.ASN1EncodableVector;
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;
import org.bouncycastle.asn1.x509.IssuerSerial;
/* loaded from: classes6.dex */
public class ESSCertID extends ASN1Object {
private ASN1OctetString certHash;
private IssuerSerial issuerSerial;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.certHash);
IssuerSerial issuerSerial = this.issuerSerial;
if (issuerSerial != null) {
aSN1EncodableVector.add(issuerSerial);
}
return new DERSequence(aSN1EncodableVector);
}
public IssuerSerial getIssuerSerial() {
return this.issuerSerial;
}
public byte[] getCertHash() {
return this.certHash.getOctets();
}
public static ESSCertID getInstance(Object obj) {
if (obj instanceof ESSCertID) {
return (ESSCertID) obj;
}
if (obj != null) {
return new ESSCertID(ASN1Sequence.getInstance(obj));
}
return null;
}
public ESSCertID(byte[] bArr, IssuerSerial issuerSerial) {
this.certHash = new DEROctetString(bArr);
this.issuerSerial = issuerSerial;
}
public ESSCertID(byte[] bArr) {
this.certHash = new DEROctetString(bArr);
}
private ESSCertID(ASN1Sequence aSN1Sequence) {
if (aSN1Sequence.size() <= 0 || aSN1Sequence.size() > 2) {
StringBuilder sb = new StringBuilder("Bad sequence size: ");
sb.append(aSN1Sequence.size());
throw new IllegalArgumentException(sb.toString());
}
this.certHash = ASN1OctetString.getInstance(aSN1Sequence.getObjectAt(0));
if (aSN1Sequence.size() > 1) {
this.issuerSerial = IssuerSerial.getInstance(aSN1Sequence.getObjectAt(1));
}
}
}