69 lines
2.5 KiB
Java
69 lines
2.5 KiB
Java
|
package org.bouncycastle.asn1.x509;
|
||
|
|
||
|
import org.bouncycastle.asn1.ASN1Encodable;
|
||
|
import org.bouncycastle.asn1.ASN1EncodableVector;
|
||
|
import org.bouncycastle.asn1.ASN1Object;
|
||
|
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
|
||
|
import org.bouncycastle.asn1.ASN1Primitive;
|
||
|
import org.bouncycastle.asn1.ASN1Sequence;
|
||
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||
|
import org.bouncycastle.asn1.DERSequence;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class AlgorithmIdentifier extends ASN1Object {
|
||
|
private ASN1ObjectIdentifier algorithm;
|
||
|
private ASN1Encodable parameters;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
||
|
aSN1EncodableVector.add(this.algorithm);
|
||
|
ASN1Encodable aSN1Encodable = this.parameters;
|
||
|
if (aSN1Encodable != null) {
|
||
|
aSN1EncodableVector.add(aSN1Encodable);
|
||
|
}
|
||
|
return new DERSequence(aSN1EncodableVector);
|
||
|
}
|
||
|
|
||
|
public ASN1Encodable getParameters() {
|
||
|
return this.parameters;
|
||
|
}
|
||
|
|
||
|
public ASN1ObjectIdentifier getAlgorithm() {
|
||
|
return this.algorithm;
|
||
|
}
|
||
|
|
||
|
public static AlgorithmIdentifier getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
||
|
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
||
|
}
|
||
|
|
||
|
public static AlgorithmIdentifier getInstance(Object obj) {
|
||
|
if (obj instanceof AlgorithmIdentifier) {
|
||
|
return (AlgorithmIdentifier) obj;
|
||
|
}
|
||
|
if (obj != null) {
|
||
|
return new AlgorithmIdentifier(ASN1Sequence.getInstance(obj));
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
private AlgorithmIdentifier(ASN1Sequence aSN1Sequence) {
|
||
|
if (aSN1Sequence.size() <= 0 || aSN1Sequence.size() > 2) {
|
||
|
StringBuilder sb = new StringBuilder("Bad sequence size: ");
|
||
|
sb.append(aSN1Sequence.size());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
this.algorithm = ASN1ObjectIdentifier.getInstance(aSN1Sequence.getObjectAt(0));
|
||
|
this.parameters = aSN1Sequence.size() == 2 ? aSN1Sequence.getObjectAt(1) : null;
|
||
|
}
|
||
|
|
||
|
public AlgorithmIdentifier(ASN1ObjectIdentifier aSN1ObjectIdentifier, ASN1Encodable aSN1Encodable) {
|
||
|
this.algorithm = aSN1ObjectIdentifier;
|
||
|
this.parameters = aSN1Encodable;
|
||
|
}
|
||
|
|
||
|
public AlgorithmIdentifier(ASN1ObjectIdentifier aSN1ObjectIdentifier) {
|
||
|
this.algorithm = aSN1ObjectIdentifier;
|
||
|
}
|
||
|
}
|