SignatureSpi.smali
.class public Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;
.super Ljava/security/SignatureSpi;
.source "SignatureSpi.java"
# interfaces
.implements Lorg/spongycastle/asn1/pkcs/PKCSObjectIdentifiers;
.implements Lorg/spongycastle/asn1/x509/X509ObjectIdentifiers;
# instance fields
.field private digest:Lorg/spongycastle/crypto/Digest;
.field private signer:Lorg/spongycastle/crypto/DSA;
# direct methods
.method public constructor <init>()V
.registers 2
.prologue
.line 34
invoke-direct {p0}, Ljava/security/SignatureSpi;-><init>()V
.line 35
new-instance v0, Lorg/spongycastle/crypto/digests/GOST3411Digest;
invoke-direct {v0}, Lorg/spongycastle/crypto/digests/GOST3411Digest;-><init>()V
iput-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
.line 36
new-instance v0, Lorg/spongycastle/crypto/signers/ECGOST3410Signer;
invoke-direct {v0}, Lorg/spongycastle/crypto/signers/ECGOST3410Signer;-><init>()V
iput-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
.line 37
return-void
.end method
# virtual methods
.method protected engineGetParameter(Ljava/lang/String;)Ljava/lang/Object;
.registers 4
.prologue
.line 209
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "engineSetParameter unsupported"
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method protected engineInitSign(Ljava/security/PrivateKey;)V
.registers 7
.prologue
const/4 v4, 0x1
.line 79
instance-of v0, p1, Lorg/spongycastle/jce/interfaces/ECKey;
if-eqz v0, :cond_1f
.line 81
invoke-static {p1}, Lorg/spongycastle/jcajce/provider/asymmetric/util/ECUtil;->generatePrivateKeyParameter(Ljava/security/PrivateKey;)Lorg/spongycastle/crypto/params/AsymmetricKeyParameter;
move-result-object v0
.line 88
:goto_9
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v1}, Lorg/spongycastle/crypto/Digest;->reset()V
.line 90
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->appRandom:Ljava/security/SecureRandom;
if-eqz v1, :cond_24
.line 92
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
new-instance v2, Lorg/spongycastle/crypto/params/ParametersWithRandom;
iget-object v3, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->appRandom:Ljava/security/SecureRandom;
invoke-direct {v2, v0, v3}, Lorg/spongycastle/crypto/params/ParametersWithRandom;-><init>(Lorg/spongycastle/crypto/CipherParameters;Ljava/security/SecureRandom;)V
invoke-interface {v1, v4, v2}, Lorg/spongycastle/crypto/DSA;->init(ZLorg/spongycastle/crypto/CipherParameters;)V
.line 98
:goto_1e
return-void
.line 85
:cond_1f
invoke-static {p1}, Lorg/spongycastle/jcajce/provider/asymmetric/util/GOST3410Util;->generatePrivateKeyParameter(Ljava/security/PrivateKey;)Lorg/spongycastle/crypto/params/AsymmetricKeyParameter;
move-result-object v0
goto :goto_9
.line 96
:cond_24
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
invoke-interface {v1, v4, v0}, Lorg/spongycastle/crypto/DSA;->init(ZLorg/spongycastle/crypto/CipherParameters;)V
goto :goto_1e
.end method
.method protected engineInitVerify(Ljava/security/PublicKey;)V
.registers 5
.prologue
.line 45
instance-of v0, p1, Lorg/spongycastle/jce/interfaces/ECPublicKey;
if-eqz v0, :cond_14
.line 47
invoke-static {p1}, Lorg/spongycastle/jcajce/provider/asymmetric/util/ECUtil;->generatePublicKeyParameter(Ljava/security/PublicKey;)Lorg/spongycastle/crypto/params/AsymmetricKeyParameter;
move-result-object v0
.line 69
:goto_8
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v1}, Lorg/spongycastle/crypto/Digest;->reset()V
.line 70
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
const/4 v2, 0x0
invoke-interface {v1, v2, v0}, Lorg/spongycastle/crypto/DSA;->init(ZLorg/spongycastle/crypto/CipherParameters;)V
.line 71
return-void
.line 49
:cond_14
instance-of v0, p1, Lorg/spongycastle/jce/interfaces/GOST3410Key;
if-eqz v0, :cond_1d
.line 51
invoke-static {p1}, Lorg/spongycastle/jcajce/provider/asymmetric/util/GOST3410Util;->generatePublicKeyParameter(Ljava/security/PublicKey;)Lorg/spongycastle/crypto/params/AsymmetricKeyParameter;
move-result-object v0
goto :goto_8
.line 57
:cond_1d
:try_start_1d
invoke-interface {p1}, Ljava/security/PublicKey;->getEncoded()[B
move-result-object v0
.line 59
invoke-static {v0}, Lorg/spongycastle/asn1/x509/SubjectPublicKeyInfo;->getInstance(Ljava/lang/Object;)Lorg/spongycastle/asn1/x509/SubjectPublicKeyInfo;
move-result-object v0
invoke-static {v0}, Lorg/spongycastle/jce/provider/BouncyCastleProvider;->getPublicKey(Lorg/spongycastle/asn1/x509/SubjectPublicKeyInfo;)Ljava/security/PublicKey;
move-result-object v0
.line 61
invoke-static {v0}, Lorg/spongycastle/jcajce/provider/asymmetric/util/ECUtil;->generatePublicKeyParameter(Ljava/security/PublicKey;)Lorg/spongycastle/crypto/params/AsymmetricKeyParameter;
:try_end_2c
.catch Ljava/lang/Exception; {:try_start_1d .. :try_end_2c} :catch_2e
move-result-object v0
goto :goto_8
.line 65
:catch_2e
move-exception v0
new-instance v0, Ljava/security/InvalidKeyException;
const-string v1, "can\'t recognise key type in DSA based signer"
invoke-direct {v0, v1}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method protected engineSetParameter(Ljava/lang/String;Ljava/lang/Object;)V
.registers 5
.prologue
.line 200
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "engineSetParameter unsupported"
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method protected engineSetParameter(Ljava/security/spec/AlgorithmParameterSpec;)V
.registers 4
.prologue
.line 190
new-instance v0, Ljava/lang/UnsupportedOperationException;
const-string v1, "engineSetParameter unsupported"
invoke-direct {v0, v1}, Ljava/lang/UnsupportedOperationException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method protected engineSign()[B
.registers 7
.prologue
const/4 v2, 0x0
.line 119
iget-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v0}, Lorg/spongycastle/crypto/Digest;->getDigestSize()I
move-result v0
new-array v0, v0, [B
.line 121
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v1, v0, v2}, Lorg/spongycastle/crypto/Digest;->doFinal([BI)I
.line 125
const/16 v1, 0x40
:try_start_10
new-array v1, v1, [B
.line 126
iget-object v2, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
invoke-interface {v2, v0}, Lorg/spongycastle/crypto/DSA;->generateSignature([B)[Ljava/math/BigInteger;
move-result-object v0
.line 127
const/4 v2, 0x0
aget-object v2, v0, v2
invoke-virtual {v2}, Ljava/math/BigInteger;->toByteArray()[B
move-result-object v2
.line 128
const/4 v3, 0x1
aget-object v0, v0, v3
invoke-virtual {v0}, Ljava/math/BigInteger;->toByteArray()[B
move-result-object v0
.line 130
const/4 v3, 0x0
aget-byte v3, v0, v3
if-eqz v3, :cond_41
.line 132
const/4 v3, 0x0
array-length v4, v0
rsub-int/lit8 v4, v4, 0x20
array-length v5, v0
invoke-static {v0, v3, v1, v4, v5}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 139
:goto_33
const/4 v0, 0x0
aget-byte v0, v2, v0
if-eqz v0, :cond_59
.line 141
const/4 v0, 0x0
array-length v3, v2
rsub-int/lit8 v3, v3, 0x40
array-length v4, v2
invoke-static {v2, v0, v1, v3, v4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 148
:goto_40
return-object v1
.line 136
:cond_41
const/4 v3, 0x1
array-length v4, v0
add-int/lit8 v4, v4, -0x1
rsub-int/lit8 v4, v4, 0x20
array-length v5, v0
add-int/lit8 v5, v5, -0x1
invoke-static {v0, v3, v1, v4, v5}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
:try_end_4d
.catch Ljava/lang/Exception; {:try_start_10 .. :try_end_4d} :catch_4e
goto :goto_33
.line 150
:catch_4e
move-exception v0
.line 152
new-instance v1, Ljava/security/SignatureException;
invoke-virtual {v0}, Ljava/lang/Exception;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {v1, v0}, Ljava/security/SignatureException;-><init>(Ljava/lang/String;)V
throw v1
.line 145
:cond_59
const/4 v0, 0x1
:try_start_5a
array-length v3, v2
add-int/lit8 v3, v3, -0x1
rsub-int/lit8 v3, v3, 0x40
array-length v4, v2
add-int/lit8 v4, v4, -0x1
invoke-static {v2, v0, v1, v3, v4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
:try_end_65
.catch Ljava/lang/Exception; {:try_start_5a .. :try_end_65} :catch_4e
goto :goto_40
.end method
.method protected engineUpdate(B)V
.registers 3
.prologue
.line 104
iget-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v0, p1}, Lorg/spongycastle/crypto/Digest;->update(B)V
.line 105
return-void
.end method
.method protected engineUpdate([BII)V
.registers 5
.prologue
.line 113
iget-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v0, p1, p2, p3}, Lorg/spongycastle/crypto/Digest;->update([BII)V
.line 114
return-void
.end method
.method protected engineVerify([B)Z
.registers 11
.prologue
const/4 v8, 0x1
const/4 v7, 0x0
.line 160
iget-object v0, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v0}, Lorg/spongycastle/crypto/Digest;->getDigestSize()I
move-result v0
new-array v0, v0, [B
.line 162
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->digest:Lorg/spongycastle/crypto/Digest;
invoke-interface {v1, v0, v7}, Lorg/spongycastle/crypto/Digest;->doFinal([BI)I
.line 168
const/16 v1, 0x20
:try_start_11
new-array v1, v1, [B
.line 169
const/16 v2, 0x20
new-array v2, v2, [B
.line 171
const/4 v3, 0x0
const/4 v4, 0x0
const/16 v5, 0x20
invoke-static {p1, v3, v2, v4, v5}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 173
const/16 v3, 0x20
const/4 v4, 0x0
const/16 v5, 0x20
invoke-static {p1, v3, v1, v4, v5}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
.line 175
const/4 v3, 0x2
new-array v3, v3, [Ljava/math/BigInteger;
.line 176
const/4 v4, 0x0
new-instance v5, Ljava/math/BigInteger;
const/4 v6, 0x1
invoke-direct {v5, v6, v1}, Ljava/math/BigInteger;-><init>(I[B)V
aput-object v5, v3, v4
.line 177
const/4 v1, 0x1
new-instance v4, Ljava/math/BigInteger;
const/4 v5, 0x1
invoke-direct {v4, v5, v2}, Ljava/math/BigInteger;-><init>(I[B)V
aput-object v4, v3, v1
:try_end_3b
.catch Ljava/lang/Exception; {:try_start_11 .. :try_end_3b} :catch_46
.line 184
iget-object v1, p0, Lorg/spongycastle/jcajce/provider/asymmetric/ecgost/SignatureSpi;->signer:Lorg/spongycastle/crypto/DSA;
aget-object v2, v3, v7
aget-object v3, v3, v8
invoke-interface {v1, v0, v2, v3}, Lorg/spongycastle/crypto/DSA;->verifySignature([BLjava/math/BigInteger;Ljava/math/BigInteger;)Z
move-result v0
return v0
.line 181
:catch_46
move-exception v0
new-instance v0, Ljava/security/SignatureException;
const-string v1, "error decoding signature bytes."
invoke-direct {v0, v1}, Ljava/security/SignatureException;-><init>(Ljava/lang/String;)V
throw v0
.end method