97 lines
3.7 KiB
Java
97 lines
3.7 KiB
Java
|
package org.bouncycastle.asn1.pkcs;
|
||
|
|
||
|
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.DERSequence;
|
||
|
import org.bouncycastle.asn1.DERTaggedObject;
|
||
|
import org.bouncycastle.asn1.x500.X500Name;
|
||
|
import org.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
|
||
|
import org.bouncycastle.asn1.x509.X509Name;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class CertificationRequestInfo extends ASN1Object {
|
||
|
ASN1Set attributes;
|
||
|
X500Name subject;
|
||
|
SubjectPublicKeyInfo subjectPKInfo;
|
||
|
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.subject);
|
||
|
aSN1EncodableVector.add(this.subjectPKInfo);
|
||
|
if (this.attributes != null) {
|
||
|
aSN1EncodableVector.add(new DERTaggedObject(false, 0, this.attributes));
|
||
|
}
|
||
|
return new DERSequence(aSN1EncodableVector);
|
||
|
}
|
||
|
|
||
|
public ASN1Integer getVersion() {
|
||
|
return this.version;
|
||
|
}
|
||
|
|
||
|
public SubjectPublicKeyInfo getSubjectPublicKeyInfo() {
|
||
|
return this.subjectPKInfo;
|
||
|
}
|
||
|
|
||
|
public X500Name getSubject() {
|
||
|
return this.subject;
|
||
|
}
|
||
|
|
||
|
public ASN1Set getAttributes() {
|
||
|
return this.attributes;
|
||
|
}
|
||
|
|
||
|
public static CertificationRequestInfo getInstance(Object obj) {
|
||
|
if (obj instanceof CertificationRequestInfo) {
|
||
|
return (CertificationRequestInfo) obj;
|
||
|
}
|
||
|
if (obj != null) {
|
||
|
return new CertificationRequestInfo(ASN1Sequence.getInstance(obj));
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
public CertificationRequestInfo(X509Name x509Name, SubjectPublicKeyInfo subjectPublicKeyInfo, ASN1Set aSN1Set) {
|
||
|
this.version = new ASN1Integer(0L);
|
||
|
this.attributes = null;
|
||
|
if (x509Name == null || subjectPublicKeyInfo == null) {
|
||
|
throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
|
||
|
}
|
||
|
this.subject = X500Name.getInstance(x509Name.toASN1Primitive());
|
||
|
this.subjectPKInfo = subjectPublicKeyInfo;
|
||
|
this.attributes = aSN1Set;
|
||
|
}
|
||
|
|
||
|
public CertificationRequestInfo(X500Name x500Name, SubjectPublicKeyInfo subjectPublicKeyInfo, ASN1Set aSN1Set) {
|
||
|
this.version = new ASN1Integer(0L);
|
||
|
this.attributes = null;
|
||
|
if (x500Name == null || subjectPublicKeyInfo == null) {
|
||
|
throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
|
||
|
}
|
||
|
this.subject = x500Name;
|
||
|
this.subjectPKInfo = subjectPublicKeyInfo;
|
||
|
this.attributes = aSN1Set;
|
||
|
}
|
||
|
|
||
|
public CertificationRequestInfo(ASN1Sequence aSN1Sequence) {
|
||
|
this.version = new ASN1Integer(0L);
|
||
|
this.attributes = null;
|
||
|
this.version = (ASN1Integer) aSN1Sequence.getObjectAt(0);
|
||
|
this.subject = X500Name.getInstance(aSN1Sequence.getObjectAt(1));
|
||
|
this.subjectPKInfo = SubjectPublicKeyInfo.getInstance(aSN1Sequence.getObjectAt(2));
|
||
|
if (aSN1Sequence.size() > 3) {
|
||
|
this.attributes = ASN1Set.getInstance((ASN1TaggedObject) aSN1Sequence.getObjectAt(3), false);
|
||
|
}
|
||
|
if (this.subject == null || this.version == null || this.subjectPKInfo == null) {
|
||
|
throw new IllegalArgumentException("Not all mandatory fields set in CertificationRequestInfo generator.");
|
||
|
}
|
||
|
}
|
||
|
}
|