what-the-bank/sources/org/bouncycastle/asn1/x9/X9ECPoint.java

64 lines
1.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.asn1.x9;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.math.ec.ECPoint;
import org.bouncycastle.util.Arrays;
/* loaded from: classes6.dex */
public class X9ECPoint extends ASN1Object {
private ECCurve c;
private final ASN1OctetString encoding;
private ECPoint p;
@Override // org.bouncycastle.asn1.ASN1Object, org.bouncycastle.asn1.ASN1Encodable
public ASN1Primitive toASN1Primitive() {
return this.encoding;
}
public boolean isPointCompressed() {
byte[] octets = this.encoding.getOctets();
if (octets == null || octets.length <= 0) {
return false;
}
byte b = octets[0];
return b == 2 || b == 3;
}
public byte[] getPointEncoding() {
return Arrays.clone(this.encoding.getOctets());
}
public ECPoint getPoint() {
ECPoint eCPoint;
synchronized (this) {
if (this.p == null) {
this.p = this.c.decodePoint(this.encoding.getOctets()).normalize();
}
eCPoint = this.p;
}
return eCPoint;
}
public X9ECPoint(ECPoint eCPoint, boolean z) {
this.p = eCPoint.normalize();
this.encoding = new DEROctetString(eCPoint.getEncoded(z));
}
public X9ECPoint(ECPoint eCPoint) {
this(eCPoint, false);
}
public X9ECPoint(ECCurve eCCurve, byte[] bArr) {
this.c = eCCurve;
this.encoding = new DEROctetString(Arrays.clone(bArr));
}
public X9ECPoint(ECCurve eCCurve, ASN1OctetString aSN1OctetString) {
this(eCCurve, aSN1OctetString.getOctets());
}
}