93 lines
3.5 KiB
Java
93 lines
3.5 KiB
Java
package org.bouncycastle.asn1.cms;
|
|
|
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
|
import org.bouncycastle.asn1.ASN1GeneralizedTime;
|
|
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 RecipientKeyIdentifier extends ASN1Object {
|
|
private ASN1GeneralizedTime date;
|
|
private OtherKeyAttribute other;
|
|
private ASN1OctetString subjectKeyIdentifier;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(this.subjectKeyIdentifier);
|
|
ASN1GeneralizedTime aSN1GeneralizedTime = this.date;
|
|
if (aSN1GeneralizedTime != null) {
|
|
aSN1EncodableVector.add(aSN1GeneralizedTime);
|
|
}
|
|
OtherKeyAttribute otherKeyAttribute = this.other;
|
|
if (otherKeyAttribute != null) {
|
|
aSN1EncodableVector.add(otherKeyAttribute);
|
|
}
|
|
return new DERSequence(aSN1EncodableVector);
|
|
}
|
|
|
|
public ASN1OctetString getSubjectKeyIdentifier() {
|
|
return this.subjectKeyIdentifier;
|
|
}
|
|
|
|
public OtherKeyAttribute getOtherKeyAttribute() {
|
|
return this.other;
|
|
}
|
|
|
|
public ASN1GeneralizedTime getDate() {
|
|
return this.date;
|
|
}
|
|
|
|
public static RecipientKeyIdentifier getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
|
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
|
}
|
|
|
|
public static RecipientKeyIdentifier getInstance(Object obj) {
|
|
if (obj instanceof RecipientKeyIdentifier) {
|
|
return (RecipientKeyIdentifier) obj;
|
|
}
|
|
if (obj != null) {
|
|
return new RecipientKeyIdentifier(ASN1Sequence.getInstance(obj));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public RecipientKeyIdentifier(byte[] bArr, ASN1GeneralizedTime aSN1GeneralizedTime, OtherKeyAttribute otherKeyAttribute) {
|
|
this.subjectKeyIdentifier = new DEROctetString(bArr);
|
|
this.date = aSN1GeneralizedTime;
|
|
this.other = otherKeyAttribute;
|
|
}
|
|
|
|
public RecipientKeyIdentifier(byte[] bArr) {
|
|
this(bArr, (ASN1GeneralizedTime) null, (OtherKeyAttribute) null);
|
|
}
|
|
|
|
public RecipientKeyIdentifier(ASN1Sequence aSN1Sequence) {
|
|
this.subjectKeyIdentifier = ASN1OctetString.getInstance(aSN1Sequence.getObjectAt(0));
|
|
int size = aSN1Sequence.size();
|
|
if (size != 1) {
|
|
if (size != 2) {
|
|
if (size != 3) {
|
|
throw new IllegalArgumentException("Invalid RecipientKeyIdentifier");
|
|
}
|
|
this.date = ASN1GeneralizedTime.getInstance(aSN1Sequence.getObjectAt(1));
|
|
} else if (aSN1Sequence.getObjectAt(1) instanceof ASN1GeneralizedTime) {
|
|
this.date = ASN1GeneralizedTime.getInstance(aSN1Sequence.getObjectAt(1));
|
|
return;
|
|
}
|
|
this.other = OtherKeyAttribute.getInstance(aSN1Sequence.getObjectAt(2));
|
|
}
|
|
}
|
|
|
|
public RecipientKeyIdentifier(ASN1OctetString aSN1OctetString, ASN1GeneralizedTime aSN1GeneralizedTime, OtherKeyAttribute otherKeyAttribute) {
|
|
this.subjectKeyIdentifier = aSN1OctetString;
|
|
this.date = aSN1GeneralizedTime;
|
|
this.other = otherKeyAttribute;
|
|
}
|
|
}
|