what-the-bank/sources/org/bouncycastle/asn1/cms/AuthenticatedDataParser.java

129 lines
4.7 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.cms;
import java.io.IOException;
import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1SequenceParser;
import org.bouncycastle.asn1.ASN1SetParser;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.ASN1TaggedObjectParser;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
/* loaded from: classes6.dex */
public class AuthenticatedDataParser {
private ASN1Encodable nextObject;
private boolean originatorInfoCalled;
private ASN1SequenceParser seq;
private ASN1Integer version;
public ASN1Integer getVersion() {
return this.version;
}
public ASN1SetParser getUnauthAttrs() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (aSN1Encodable == null) {
return null;
}
this.nextObject = null;
return (ASN1SetParser) ((ASN1TaggedObjectParser) aSN1Encodable).getObjectParser(17, false);
}
public ASN1SetParser getRecipientInfos() throws IOException {
if (!this.originatorInfoCalled) {
getOriginatorInfo();
}
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1SetParser aSN1SetParser = (ASN1SetParser) this.nextObject;
this.nextObject = null;
return aSN1SetParser;
}
public OriginatorInfo getOriginatorInfo() throws IOException {
this.originatorInfoCalled = true;
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (!(aSN1Encodable instanceof ASN1TaggedObjectParser) || ((ASN1TaggedObjectParser) aSN1Encodable).getTagNo() != 0) {
return null;
}
ASN1SequenceParser aSN1SequenceParser = (ASN1SequenceParser) ((ASN1TaggedObjectParser) this.nextObject).getObjectParser(16, false);
this.nextObject = null;
return OriginatorInfo.getInstance(aSN1SequenceParser.toASN1Primitive());
}
public AlgorithmIdentifier getMacAlgorithm() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (aSN1Encodable == null) {
return null;
}
this.nextObject = null;
return AlgorithmIdentifier.getInstance(((ASN1SequenceParser) aSN1Encodable).toASN1Primitive());
}
public ASN1OctetString getMac() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
this.nextObject = null;
return ASN1OctetString.getInstance(aSN1Encodable.toASN1Primitive());
}
public ContentInfoParser getEncapsulatedContentInfo() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (aSN1Encodable == null) {
return null;
}
this.nextObject = null;
return new ContentInfoParser((ASN1SequenceParser) aSN1Encodable);
}
public ContentInfoParser getEnapsulatedContentInfo() throws IOException {
return getEncapsulatedContentInfo();
}
public AlgorithmIdentifier getDigestAlgorithm() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (!(aSN1Encodable instanceof ASN1TaggedObjectParser)) {
return null;
}
AlgorithmIdentifier algorithmIdentifier = AlgorithmIdentifier.getInstance((ASN1TaggedObject) aSN1Encodable.toASN1Primitive(), false);
this.nextObject = null;
return algorithmIdentifier;
}
public ASN1SetParser getAuthAttrs() throws IOException {
if (this.nextObject == null) {
this.nextObject = this.seq.readObject();
}
ASN1Encodable aSN1Encodable = this.nextObject;
if (!(aSN1Encodable instanceof ASN1TaggedObjectParser)) {
return null;
}
this.nextObject = null;
return (ASN1SetParser) ((ASN1TaggedObjectParser) aSN1Encodable).getObjectParser(17, false);
}
public AuthenticatedDataParser(ASN1SequenceParser aSN1SequenceParser) throws IOException {
this.seq = aSN1SequenceParser;
this.version = ASN1Integer.getInstance(aSN1SequenceParser.readObject());
}
}