what-the-bank/sources/org/bouncycastle/asn1/x509/DigestInfo.java

59 lines
1.9 KiB
Java

package org.bouncycastle.asn1.x509;
import java.util.Enumeration;
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.ASN1TaggedObject;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
/* loaded from: classes6.dex */
public class DigestInfo extends ASN1Object {
private AlgorithmIdentifier algId;
private byte[] digest;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.algId);
aSN1EncodableVector.add(new DEROctetString(this.digest));
return new DERSequence(aSN1EncodableVector);
}
public byte[] getDigest() {
return this.digest;
}
public AlgorithmIdentifier getAlgorithmId() {
return this.algId;
}
public static DigestInfo getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
}
public static DigestInfo getInstance(Object obj) {
if (obj instanceof DigestInfo) {
return (DigestInfo) obj;
}
if (obj != null) {
return new DigestInfo(ASN1Sequence.getInstance(obj));
}
return null;
}
public DigestInfo(AlgorithmIdentifier algorithmIdentifier, byte[] bArr) {
this.digest = bArr;
this.algId = algorithmIdentifier;
}
public DigestInfo(ASN1Sequence aSN1Sequence) {
Enumeration objects = aSN1Sequence.getObjects();
this.algId = AlgorithmIdentifier.getInstance(objects.nextElement());
this.digest = ASN1OctetString.getInstance(objects.nextElement()).getOctets();
}
}