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

87 lines
2.9 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.cms;
import org.bouncycastle.asn1.ASN1Boolean;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DERIA5String;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.DERUTF8String;
/* loaded from: classes6.dex */
public class MetaData extends ASN1Object {
private DERUTF8String fileName;
private ASN1Boolean hashProtected;
private DERIA5String mediaType;
private Attributes otherMetaData;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
aSN1EncodableVector.add(this.hashProtected);
DERUTF8String dERUTF8String = this.fileName;
if (dERUTF8String != null) {
aSN1EncodableVector.add(dERUTF8String);
}
DERIA5String dERIA5String = this.mediaType;
if (dERIA5String != null) {
aSN1EncodableVector.add(dERIA5String);
}
Attributes attributes = this.otherMetaData;
if (attributes != null) {
aSN1EncodableVector.add(attributes);
}
return new DERSequence(aSN1EncodableVector);
}
public boolean isHashProtected() {
return this.hashProtected.isTrue();
}
public Attributes getOtherMetaData() {
return this.otherMetaData;
}
public DERIA5String getMediaType() {
return this.mediaType;
}
public DERUTF8String getFileName() {
return this.fileName;
}
public static MetaData getInstance(Object obj) {
if (obj instanceof MetaData) {
return (MetaData) obj;
}
if (obj != null) {
return new MetaData(ASN1Sequence.getInstance(obj));
}
return null;
}
private MetaData(ASN1Sequence aSN1Sequence) {
this.hashProtected = ASN1Boolean.getInstance(aSN1Sequence.getObjectAt(0));
int i = 1;
if (1 < aSN1Sequence.size() && (aSN1Sequence.getObjectAt(1) instanceof DERUTF8String)) {
this.fileName = DERUTF8String.getInstance(aSN1Sequence.getObjectAt(1));
i = 2;
}
if (i < aSN1Sequence.size() && (aSN1Sequence.getObjectAt(i) instanceof DERIA5String)) {
this.mediaType = DERIA5String.getInstance(aSN1Sequence.getObjectAt(i));
i++;
}
if (i < aSN1Sequence.size()) {
this.otherMetaData = Attributes.getInstance(aSN1Sequence.getObjectAt(i));
}
}
public MetaData(ASN1Boolean aSN1Boolean, DERUTF8String dERUTF8String, DERIA5String dERIA5String, Attributes attributes) {
this.hashProtected = aSN1Boolean;
this.fileName = dERUTF8String;
this.mediaType = dERIA5String;
this.otherMetaData = attributes;
}
}