108 lines
3.8 KiB
Java
108 lines
3.8 KiB
Java
package org.bouncycastle.asn1.pkcs;
|
|
|
|
import java.util.Enumeration;
|
|
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.ASN1Set;
|
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
|
import org.bouncycastle.asn1.BERSequence;
|
|
import org.bouncycastle.asn1.DERTaggedObject;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class SignedData extends ASN1Object implements PKCSObjectIdentifiers {
|
|
private ASN1Set certificates;
|
|
private ContentInfo contentInfo;
|
|
private ASN1Set crls;
|
|
private ASN1Set digestAlgorithms;
|
|
private ASN1Set signerInfos;
|
|
private ASN1Integer version;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(this.version);
|
|
aSN1EncodableVector.add(this.digestAlgorithms);
|
|
aSN1EncodableVector.add(this.contentInfo);
|
|
if (this.certificates != null) {
|
|
aSN1EncodableVector.add(new DERTaggedObject(false, 0, this.certificates));
|
|
}
|
|
if (this.crls != null) {
|
|
aSN1EncodableVector.add(new DERTaggedObject(false, 1, this.crls));
|
|
}
|
|
aSN1EncodableVector.add(this.signerInfos);
|
|
return new BERSequence(aSN1EncodableVector);
|
|
}
|
|
|
|
public ASN1Integer getVersion() {
|
|
return this.version;
|
|
}
|
|
|
|
public ASN1Set getSignerInfos() {
|
|
return this.signerInfos;
|
|
}
|
|
|
|
public ASN1Set getDigestAlgorithms() {
|
|
return this.digestAlgorithms;
|
|
}
|
|
|
|
public ContentInfo getContentInfo() {
|
|
return this.contentInfo;
|
|
}
|
|
|
|
public ASN1Set getCertificates() {
|
|
return this.certificates;
|
|
}
|
|
|
|
public ASN1Set getCRLs() {
|
|
return this.crls;
|
|
}
|
|
|
|
public static SignedData getInstance(Object obj) {
|
|
if (obj instanceof SignedData) {
|
|
return (SignedData) obj;
|
|
}
|
|
if (obj != null) {
|
|
return new SignedData(ASN1Sequence.getInstance(obj));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public SignedData(ASN1Sequence aSN1Sequence) {
|
|
Enumeration objects = aSN1Sequence.getObjects();
|
|
this.version = (ASN1Integer) objects.nextElement();
|
|
this.digestAlgorithms = (ASN1Set) objects.nextElement();
|
|
this.contentInfo = ContentInfo.getInstance(objects.nextElement());
|
|
while (objects.hasMoreElements()) {
|
|
ASN1Primitive aSN1Primitive = (ASN1Primitive) objects.nextElement();
|
|
if (aSN1Primitive instanceof ASN1TaggedObject) {
|
|
ASN1TaggedObject aSN1TaggedObject = (ASN1TaggedObject) aSN1Primitive;
|
|
int tagNo = aSN1TaggedObject.getTagNo();
|
|
if (tagNo == 0) {
|
|
this.certificates = ASN1Set.getInstance(aSN1TaggedObject, false);
|
|
} else {
|
|
if (tagNo != 1) {
|
|
StringBuilder sb = new StringBuilder("unknown tag value ");
|
|
sb.append(aSN1TaggedObject.getTagNo());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
this.crls = ASN1Set.getInstance(aSN1TaggedObject, false);
|
|
}
|
|
} else {
|
|
this.signerInfos = (ASN1Set) aSN1Primitive;
|
|
}
|
|
}
|
|
}
|
|
|
|
public SignedData(ASN1Integer aSN1Integer, ASN1Set aSN1Set, ContentInfo contentInfo, ASN1Set aSN1Set2, ASN1Set aSN1Set3, ASN1Set aSN1Set4) {
|
|
this.version = aSN1Integer;
|
|
this.digestAlgorithms = aSN1Set;
|
|
this.contentInfo = contentInfo;
|
|
this.certificates = aSN1Set2;
|
|
this.crls = aSN1Set3;
|
|
this.signerInfos = aSN1Set4;
|
|
}
|
|
}
|