64 lines
2.2 KiB
Java
64 lines
2.2 KiB
Java
package org.bouncycastle.asn1.pkcs;
|
|
|
|
import java.math.BigInteger;
|
|
import java.util.Enumeration;
|
|
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.ASN1TaggedObject;
|
|
import org.bouncycastle.asn1.DERSequence;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class RSAPublicKey extends ASN1Object {
|
|
private BigInteger modulus;
|
|
private BigInteger publicExponent;
|
|
|
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
|
public ASN1Primitive toASN1Primitive() {
|
|
ASN1EncodableVector aSN1EncodableVector = new ASN1EncodableVector();
|
|
aSN1EncodableVector.add(new ASN1Integer(getModulus()));
|
|
aSN1EncodableVector.add(new ASN1Integer(getPublicExponent()));
|
|
return new DERSequence(aSN1EncodableVector);
|
|
}
|
|
|
|
public BigInteger getPublicExponent() {
|
|
return this.publicExponent;
|
|
}
|
|
|
|
public BigInteger getModulus() {
|
|
return this.modulus;
|
|
}
|
|
|
|
public static RSAPublicKey getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
|
return getInstance(ASN1Sequence.getInstance(aSN1TaggedObject, z));
|
|
}
|
|
|
|
public static RSAPublicKey getInstance(Object obj) {
|
|
if (obj instanceof RSAPublicKey) {
|
|
return (RSAPublicKey) obj;
|
|
}
|
|
if (obj != null) {
|
|
return new RSAPublicKey(ASN1Sequence.getInstance(obj));
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private RSAPublicKey(ASN1Sequence aSN1Sequence) {
|
|
if (aSN1Sequence.size() != 2) {
|
|
StringBuilder sb = new StringBuilder("Bad sequence size: ");
|
|
sb.append(aSN1Sequence.size());
|
|
throw new IllegalArgumentException(sb.toString());
|
|
}
|
|
Enumeration objects = aSN1Sequence.getObjects();
|
|
this.modulus = ASN1Integer.getInstance(objects.nextElement()).getPositiveValue();
|
|
this.publicExponent = ASN1Integer.getInstance(objects.nextElement()).getPositiveValue();
|
|
}
|
|
|
|
public RSAPublicKey(BigInteger bigInteger, BigInteger bigInteger2) {
|
|
this.modulus = bigInteger;
|
|
this.publicExponent = bigInteger2;
|
|
}
|
|
}
|