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

71 lines
2.5 KiB
Java

package org.bouncycastle.asn1.cms;
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.BERTaggedObject;
/* loaded from: classes6.dex */
public class EncryptedData extends ASN1Object {
private EncryptedContentInfo encryptedContentInfo;
private ASN1Set unprotectedAttrs;
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.encryptedContentInfo);
ASN1Set aSN1Set = this.unprotectedAttrs;
if (aSN1Set != null) {
aSN1EncodableVector.add(new BERTaggedObject(false, 1, aSN1Set));
}
return new BERSequence(aSN1EncodableVector);
}
public ASN1Integer getVersion() {
return this.version;
}
public ASN1Set getUnprotectedAttrs() {
return this.unprotectedAttrs;
}
public EncryptedContentInfo getEncryptedContentInfo() {
return this.encryptedContentInfo;
}
public static EncryptedData getInstance(Object obj) {
if (obj instanceof EncryptedData) {
return (EncryptedData) obj;
}
if (obj != null) {
return new EncryptedData(ASN1Sequence.getInstance(obj));
}
return null;
}
public EncryptedData(EncryptedContentInfo encryptedContentInfo, ASN1Set aSN1Set) {
this.version = new ASN1Integer(aSN1Set == null ? 0L : 2L);
this.encryptedContentInfo = encryptedContentInfo;
this.unprotectedAttrs = aSN1Set;
}
public EncryptedData(EncryptedContentInfo encryptedContentInfo) {
this(encryptedContentInfo, null);
}
private EncryptedData(ASN1Sequence aSN1Sequence) {
this.version = ASN1Integer.getInstance(aSN1Sequence.getObjectAt(0));
this.encryptedContentInfo = EncryptedContentInfo.getInstance(aSN1Sequence.getObjectAt(1));
if (aSN1Sequence.size() == 3) {
this.unprotectedAttrs = ASN1Set.getInstance((ASN1TaggedObject) aSN1Sequence.getObjectAt(2), false);
}
}
}