ECDSASignature.smali
.class public Lorg/web3j/crypto/ECDSASignature;
.super Ljava/lang/Object;
.source "ECDSASignature.java"
# instance fields
.field public final r:Ljava/math/BigInteger;
.field public final s:Ljava/math/BigInteger;
# direct methods
.method public constructor <init>(Ljava/math/BigInteger;Ljava/math/BigInteger;)V
.registers 3
.prologue
.line 12
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 13
iput-object p1, p0, Lorg/web3j/crypto/ECDSASignature;->r:Ljava/math/BigInteger;
.line 14
iput-object p2, p0, Lorg/web3j/crypto/ECDSASignature;->s:Ljava/math/BigInteger;
.line 15
return-void
.end method
# virtual methods
.method public isCanonical()Z
.registers 3
.prologue
.line 24
iget-object v0, p0, Lorg/web3j/crypto/ECDSASignature;->s:Ljava/math/BigInteger;
sget-object v1, Lorg/web3j/crypto/Sign;->HALF_CURVE_ORDER:Ljava/math/BigInteger;
invoke-virtual {v0, v1}, Ljava/math/BigInteger;->compareTo(Ljava/math/BigInteger;)I
move-result v0
if-gtz v0, :cond_c
const/4 v0, 0x1
:goto_b
return v0
:cond_c
const/4 v0, 0x0
goto :goto_b
.end method
.method public toCanonicalised()Lorg/web3j/crypto/ECDSASignature;
.registers 5
.prologue
.line 39
invoke-virtual {p0}, Lorg/web3j/crypto/ECDSASignature;->isCanonical()Z
move-result v0
if-nez v0, :cond_1a
.line 46
new-instance v0, Lorg/web3j/crypto/ECDSASignature;
iget-object v1, p0, Lorg/web3j/crypto/ECDSASignature;->r:Ljava/math/BigInteger;
sget-object v2, Lorg/web3j/crypto/Sign;->CURVE:Lorg/spongycastle/crypto/params/ECDomainParameters;
invoke-virtual {v2}, Lorg/spongycastle/crypto/params/ECDomainParameters;->getN()Ljava/math/BigInteger;
move-result-object v2
iget-object v3, p0, Lorg/web3j/crypto/ECDSASignature;->s:Ljava/math/BigInteger;
invoke-virtual {v2, v3}, Ljava/math/BigInteger;->subtract(Ljava/math/BigInteger;)Ljava/math/BigInteger;
move-result-object v2
invoke-direct {v0, v1, v2}, Lorg/web3j/crypto/ECDSASignature;-><init>(Ljava/math/BigInteger;Ljava/math/BigInteger;)V
move-object p0, v0
.line 48
:cond_1a
return-object p0
.end method