52 lines
1.6 KiB
Java
52 lines
1.6 KiB
Java
|
package org.bouncycastle.asn1.x9;
|
||
|
|
||
|
import java.math.BigInteger;
|
||
|
import org.bouncycastle.asn1.ASN1Integer;
|
||
|
import org.bouncycastle.asn1.ASN1Object;
|
||
|
import org.bouncycastle.asn1.ASN1Primitive;
|
||
|
import org.bouncycastle.asn1.ASN1TaggedObject;
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
public class DHPublicKey extends ASN1Object {
|
||
|
private ASN1Integer y;
|
||
|
|
||
|
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
|
||
|
public ASN1Primitive toASN1Primitive() {
|
||
|
return this.y;
|
||
|
}
|
||
|
|
||
|
public BigInteger getY() {
|
||
|
return this.y.getPositiveValue();
|
||
|
}
|
||
|
|
||
|
public static DHPublicKey getInstance(ASN1TaggedObject aSN1TaggedObject, boolean z) {
|
||
|
return getInstance(ASN1Integer.getInstance(aSN1TaggedObject, z));
|
||
|
}
|
||
|
|
||
|
public static DHPublicKey getInstance(Object obj) {
|
||
|
if (obj == null || (obj instanceof DHPublicKey)) {
|
||
|
return (DHPublicKey) obj;
|
||
|
}
|
||
|
if (obj instanceof ASN1Integer) {
|
||
|
return new DHPublicKey((ASN1Integer) obj);
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("Invalid DHPublicKey: ");
|
||
|
sb.append(obj.getClass().getName());
|
||
|
throw new IllegalArgumentException(sb.toString());
|
||
|
}
|
||
|
|
||
|
private DHPublicKey(ASN1Integer aSN1Integer) {
|
||
|
if (aSN1Integer == null) {
|
||
|
throw new IllegalArgumentException("'y' cannot be null");
|
||
|
}
|
||
|
this.y = aSN1Integer;
|
||
|
}
|
||
|
|
||
|
public DHPublicKey(BigInteger bigInteger) {
|
||
|
if (bigInteger == null) {
|
||
|
throw new IllegalArgumentException("'y' cannot be null");
|
||
|
}
|
||
|
this.y = new ASN1Integer(bigInteger);
|
||
|
}
|
||
|
}
|