Wallet.smali

.class public Lorg/web3j/crypto/Wallet;
.super Ljava/lang/Object;
.source "Wallet.java"


# static fields
.field static final AES_128_CTR:Ljava/lang/String; = "pbkdf2"

.field private static final CIPHER:Ljava/lang/String; = "aes-128-ctr"

.field private static final CURRENT_VERSION:I = 0x3

.field private static final DKLEN:I = 0x20

.field private static final N_LIGHT:I = 0x1000

.field private static final N_STANDARD:I = 0x40000

.field private static final P_LIGHT:I = 0x6

.field private static final P_STANDARD:I = 0x1

.field private static final R:I = 0x8

.field static final SCRYPT:Ljava/lang/String; = "scrypt"


# direct methods
.method public constructor <init>()V
    .registers 1

    .prologue
    .line 52
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static create(Ljava/lang/String;Lorg/web3j/crypto/ECKeyPair;II)Lorg/web3j/crypto/WalletFile;
    .registers 13

    .prologue
    const/16 v6, 0x10

    const/16 v5, 0x20

    .line 72
    invoke-static {v5}, Lorg/web3j/crypto/Wallet;->generateRandomBytes(I)[B

    move-result-object v1

    .line 74
    const-string v0, "UTF-8"

    invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;

    move-result-object v0

    invoke-virtual {p0, v0}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B

    move-result-object v0

    const/16 v3, 0x8

    move v2, p2

    move v4, p3

    invoke-static/range {v0 .. v5}, Lorg/web3j/crypto/Wallet;->generateDerivedScryptKey([B[BIIII)[B

    move-result-object v0

    .line 77
    const/4 v2, 0x0

    invoke-static {v0, v2, v6}, Ljava/util/Arrays;->copyOfRange([BII)[B

    move-result-object v2

    .line 78
    invoke-static {v6}, Lorg/web3j/crypto/Wallet;->generateRandomBytes(I)[B

    move-result-object v4

    .line 80
    invoke-virtual {p1}, Lorg/web3j/crypto/ECKeyPair;->getPrivateKey()Ljava/math/BigInteger;

    move-result-object v3

    invoke-static {v3, v5}, Lorg/web3j/utils/Numeric;->toBytesPadded(Ljava/math/BigInteger;I)[B

    move-result-object v3

    .line 83
    const/4 v5, 0x1

    invoke-static {v5, v4, v2, v3}, Lorg/web3j/crypto/Wallet;->performCipherOperation(I[B[B[B)[B

    move-result-object v3

    .line 86
    invoke-static {v0, v3}, Lorg/web3j/crypto/Wallet;->generateMac([B[B)[B

    move-result-object v6

    move-object v2, p1

    move-object v5, v1

    move v7, p2

    move v8, p3

    .line 88
    invoke-static/range {v2 .. v8}, Lorg/web3j/crypto/Wallet;->createWalletFile(Lorg/web3j/crypto/ECKeyPair;[B[B[B[BII)Lorg/web3j/crypto/WalletFile;

    move-result-object v0

    return-object v0
.end method

.method public static createLight(Ljava/lang/String;Lorg/web3j/crypto/ECKeyPair;)Lorg/web3j/crypto/WalletFile;
    .registers 4

    .prologue
    .line 98
    const/16 v0, 0x1000

    const/4 v1, 0x6

    invoke-static {p0, p1, v0, v1}, Lorg/web3j/crypto/Wallet;->create(Ljava/lang/String;Lorg/web3j/crypto/ECKeyPair;II)Lorg/web3j/crypto/WalletFile;

    move-result-object v0

    return-object v0
.end method

.method public static createStandard(Ljava/lang/String;Lorg/web3j/crypto/ECKeyPair;)Lorg/web3j/crypto/WalletFile;
    .registers 4

    .prologue
    .line 93
    const/high16 v0, 0x40000

    const/4 v1, 0x1

    invoke-static {p0, p1, v0, v1}, Lorg/web3j/crypto/Wallet;->create(Ljava/lang/String;Lorg/web3j/crypto/ECKeyPair;II)Lorg/web3j/crypto/WalletFile;

    move-result-object v0

    return-object v0
.end method

.method private static createWalletFile(Lorg/web3j/crypto/ECKeyPair;[B[B[B[BII)Lorg/web3j/crypto/WalletFile;
    .registers 11

    .prologue
    .line 105
    new-instance v0, Lorg/web3j/crypto/WalletFile;

    invoke-direct {v0}, Lorg/web3j/crypto/WalletFile;-><init>()V

    .line 106
    invoke-static {p0}, Lorg/web3j/crypto/Keys;->getAddress(Lorg/web3j/crypto/ECKeyPair;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lorg/web3j/crypto/WalletFile;->setAddress(Ljava/lang/String;)V

    .line 108
    new-instance v1, Lorg/web3j/crypto/WalletFile$Crypto;

    invoke-direct {v1}, Lorg/web3j/crypto/WalletFile$Crypto;-><init>()V

    .line 109
    const-string v2, "aes-128-ctr"

    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setCipher(Ljava/lang/String;)V

    .line 110
    invoke-static {p1}, Lorg/web3j/utils/Numeric;->toHexStringNoPrefix([B)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setCiphertext(Ljava/lang/String;)V

    .line 111
    invoke-virtual {v0, v1}, Lorg/web3j/crypto/WalletFile;->setCrypto(Lorg/web3j/crypto/WalletFile$Crypto;)V

    .line 113
    new-instance v2, Lorg/web3j/crypto/WalletFile$CipherParams;

    invoke-direct {v2}, Lorg/web3j/crypto/WalletFile$CipherParams;-><init>()V

    .line 114
    invoke-static {p2}, Lorg/web3j/utils/Numeric;->toHexStringNoPrefix([B)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Lorg/web3j/crypto/WalletFile$CipherParams;->setIv(Ljava/lang/String;)V

    .line 115
    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setCipherparams(Lorg/web3j/crypto/WalletFile$CipherParams;)V

    .line 117
    const-string v2, "scrypt"

    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setKdf(Ljava/lang/String;)V

    .line 118
    new-instance v2, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;

    invoke-direct {v2}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;-><init>()V

    .line 119
    const/16 v3, 0x20

    invoke-virtual {v2, v3}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->setDklen(I)V

    .line 120
    invoke-virtual {v2, p5}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->setN(I)V

    .line 121
    invoke-virtual {v2, p6}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->setP(I)V

    .line 122
    const/16 v3, 0x8

    invoke-virtual {v2, v3}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->setR(I)V

    .line 123
    invoke-static {p3}, Lorg/web3j/utils/Numeric;->toHexStringNoPrefix([B)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->setSalt(Ljava/lang/String;)V

    .line 124
    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setKdfparams(Lorg/web3j/crypto/WalletFile$KdfParams;)V

    .line 126
    invoke-static {p4}, Lorg/web3j/utils/Numeric;->toHexStringNoPrefix([B)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Lorg/web3j/crypto/WalletFile$Crypto;->setMac(Ljava/lang/String;)V

    .line 127
    invoke-virtual {v0, v1}, Lorg/web3j/crypto/WalletFile;->setCrypto(Lorg/web3j/crypto/WalletFile$Crypto;)V

    .line 128
    invoke-static {}, Ljava/util/UUID;->randomUUID()Ljava/util/UUID;

    move-result-object v1

    invoke-virtual {v1}, Ljava/util/UUID;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lorg/web3j/crypto/WalletFile;->setId(Ljava/lang/String;)V

    .line 129
    const/4 v1, 0x3

    invoke-virtual {v0, v1}, Lorg/web3j/crypto/WalletFile;->setVersion(I)V

    .line 131
    return-object v0
.end method

.method public static decrypt(Ljava/lang/String;Lorg/web3j/crypto/WalletFile;)Lorg/web3j/crypto/ECKeyPair;
    .registers 11

    .prologue
    .line 195
    invoke-static {p1}, Lorg/web3j/crypto/Wallet;->validate(Lorg/web3j/crypto/WalletFile;)V

    .line 197
    invoke-virtual {p1}, Lorg/web3j/crypto/WalletFile;->getCrypto()Lorg/web3j/crypto/WalletFile$Crypto;

    move-result-object v0

    .line 199
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getMac()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lorg/web3j/utils/Numeric;->hexStringToByteArray(Ljava/lang/String;)[B

    move-result-object v6

    .line 200
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getCipherparams()Lorg/web3j/crypto/WalletFile$CipherParams;

    move-result-object v1

    invoke-virtual {v1}, Lorg/web3j/crypto/WalletFile$CipherParams;->getIv()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lorg/web3j/utils/Numeric;->hexStringToByteArray(Ljava/lang/String;)[B

    move-result-object v7

    .line 201
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getCiphertext()Ljava/lang/String;

    move-result-object v1

    invoke-static {v1}, Lorg/web3j/utils/Numeric;->hexStringToByteArray(Ljava/lang/String;)[B

    move-result-object v8

    .line 205
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdfparams()Lorg/web3j/crypto/WalletFile$KdfParams;

    move-result-object v1

    .line 206
    instance-of v2, v1, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;

    if-eqz v2, :cond_69

    .line 207
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdfparams()Lorg/web3j/crypto/WalletFile$KdfParams;

    move-result-object v0

    check-cast v0, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;

    .line 209
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->getDklen()I

    move-result v5

    .line 210
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->getN()I

    move-result v2

    .line 211
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->getP()I

    move-result v4

    .line 212
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->getR()I

    move-result v3

    .line 213
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$ScryptKdfParams;->getSalt()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lorg/web3j/utils/Numeric;->hexStringToByteArray(Ljava/lang/String;)[B

    move-result-object v1

    .line 214
    const-string v0, "UTF-8"

    invoke-static {v0}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;

    move-result-object v0

    invoke-virtual {p0, v0}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B

    move-result-object v0

    invoke-static/range {v0 .. v5}, Lorg/web3j/crypto/Wallet;->generateDerivedScryptKey([B[BIIII)[B

    move-result-object v0

    .line 229
    :goto_57
    invoke-static {v0, v8}, Lorg/web3j/crypto/Wallet;->generateMac([B[B)[B

    move-result-object v1

    .line 231
    invoke-static {v1, v6}, Ljava/util/Arrays;->equals([B[B)Z

    move-result v1

    if-nez v1, :cond_ab

    .line 232
    new-instance v0, Lorg/web3j/crypto/CipherException;

    const-string v1, "Invalid password provided"

    invoke-direct {v0, v1}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 216
    :cond_69
    instance-of v1, v1, Lorg/web3j/crypto/WalletFile$Aes128CtrKdfParams;

    if-eqz v1, :cond_92

    .line 217
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdfparams()Lorg/web3j/crypto/WalletFile$KdfParams;

    move-result-object v0

    check-cast v0, Lorg/web3j/crypto/WalletFile$Aes128CtrKdfParams;

    .line 219
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Aes128CtrKdfParams;->getC()I

    move-result v1

    .line 220
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Aes128CtrKdfParams;->getPrf()Ljava/lang/String;

    move-result-object v2

    .line 221
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Aes128CtrKdfParams;->getSalt()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lorg/web3j/utils/Numeric;->hexStringToByteArray(Ljava/lang/String;)[B

    move-result-object v0

    .line 223
    const-string v3, "UTF-8"

    invoke-static {v3}, Ljava/nio/charset/Charset;->forName(Ljava/lang/String;)Ljava/nio/charset/Charset;

    move-result-object v3

    invoke-virtual {p0, v3}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B

    move-result-object v3

    invoke-static {v3, v0, v1, v2}, Lorg/web3j/crypto/Wallet;->generateAes128CtrDerivedKey([B[BILjava/lang/String;)[B

    move-result-object v0

    goto :goto_57

    .line 226
    :cond_92
    new-instance v1, Lorg/web3j/crypto/CipherException;

    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "Unable to deserialize params: "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdf()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {v1, v0}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v1

    .line 235
    :cond_ab
    const/4 v1, 0x0

    const/16 v2, 0x10

    invoke-static {v0, v1, v2}, Ljava/util/Arrays;->copyOfRange([BII)[B

    move-result-object v0

    .line 236
    const/4 v1, 0x2

    invoke-static {v1, v7, v0, v8}, Lorg/web3j/crypto/Wallet;->performCipherOperation(I[B[B[B)[B

    move-result-object v0

    .line 237
    invoke-static {v0}, Lorg/web3j/crypto/ECKeyPair;->create([B)Lorg/web3j/crypto/ECKeyPair;

    move-result-object v0

    return-object v0
.end method

.method private static generateAes128CtrDerivedKey([B[BILjava/lang/String;)[B
    .registers 7

    .prologue
    .line 142
    const-string v0, "hmac-sha256"

    invoke-virtual {p3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_1d

    .line 143
    new-instance v0, Lorg/web3j/crypto/CipherException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "Unsupported prf:"

    invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 149
    :cond_1d
    new-instance v0, Lorg/spongycastle/crypto/generators/PKCS5S2ParametersGenerator;

    new-instance v1, Lorg/spongycastle/crypto/digests/SHA256Digest;

    invoke-direct {v1}, Lorg/spongycastle/crypto/digests/SHA256Digest;-><init>()V

    invoke-direct {v0, v1}, Lorg/spongycastle/crypto/generators/PKCS5S2ParametersGenerator;-><init>(Lorg/spongycastle/crypto/Digest;)V

    .line 150
    invoke-virtual {v0, p0, p1, p2}, Lorg/spongycastle/crypto/generators/PKCS5S2ParametersGenerator;->init([B[BI)V

    .line 151
    const/16 v1, 0x100

    invoke-virtual {v0, v1}, Lorg/spongycastle/crypto/generators/PKCS5S2ParametersGenerator;->generateDerivedParameters(I)Lorg/spongycastle/crypto/CipherParameters;

    move-result-object v0

    check-cast v0, Lorg/spongycastle/crypto/params/KeyParameter;

    invoke-virtual {v0}, Lorg/spongycastle/crypto/params/KeyParameter;->getKey()[B

    move-result-object v0

    return-object v0
.end method

.method private static generateDerivedScryptKey([B[BIIII)[B
    .registers 7

    .prologue
    .line 136
    invoke-static/range {p0 .. p5}, Lorg/spongycastle/crypto/generators/SCrypt;->generate([B[BIIII)[B

    move-result-object v0

    return-object v0
.end method

.method private static generateMac([B[B)[B
    .registers 6

    .prologue
    const/4 v3, 0x0

    const/16 v2, 0x10

    .line 184
    array-length v0, p1

    add-int/lit8 v0, v0, 0x10

    new-array v0, v0, [B

    .line 186
    invoke-static {p0, v2, v0, v3, v2}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 187
    array-length v1, p1

    invoke-static {p1, v3, v0, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 189
    invoke-static {v0}, Lorg/web3j/crypto/Hash;->sha3([B)[B

    move-result-object v0

    return-object v0
.end method

.method static generateRandomBytes(I)[B
    .registers 3

    .prologue
    .line 257
    new-array v0, p0, [B

    .line 258
    invoke-static {}, Lorg/web3j/crypto/SecureRandomUtils;->secureRandom()Ljava/security/SecureRandom;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/security/SecureRandom;->nextBytes([B)V

    .line 259
    return-object v0
.end method

.method private static performCipherOperation(I[B[B[B)[B
    .registers 8

    .prologue
    .line 158
    :try_start_0
    new-instance v0, Ljavax/crypto/spec/IvParameterSpec;

    invoke-direct {v0, p1}, Ljavax/crypto/spec/IvParameterSpec;-><init>([B)V

    .line 159
    const-string v1, "AES/CTR/NoPadding"

    invoke-static {v1}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;

    move-result-object v1

    .line 161
    new-instance v2, Ljavax/crypto/spec/SecretKeySpec;

    const-string v3, "AES"

    invoke-direct {v2, p2, v3}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V

    .line 162
    invoke-virtual {v1, p0, v2, v0}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;)V

    .line 163
    invoke-virtual {v1, p3}, Ljavax/crypto/Cipher;->doFinal([B)[B
    :try_end_18
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_0 .. :try_end_18} :catch_1a
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_18} :catch_20
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_0 .. :try_end_18} :catch_26
    .catch Ljava/security/InvalidKeyException; {:try_start_0 .. :try_end_18} :catch_2c
    .catch Ljavax/crypto/BadPaddingException; {:try_start_0 .. :try_end_18} :catch_32
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_0 .. :try_end_18} :catch_38

    move-result-object v0

    .line 175
    :goto_19
    return-object v0

    .line 165
    :catch_1a
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19

    .line 167
    :catch_20
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19

    .line 169
    :catch_26
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19

    .line 171
    :catch_2c
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19

    .line 173
    :catch_32
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19

    .line 175
    :catch_38
    move-exception v0

    invoke-static {v0}, Lorg/web3j/crypto/Wallet;->throwCipherException(Ljava/lang/Exception;)[B

    move-result-object v0

    goto :goto_19
.end method

.method private static throwCipherException(Ljava/lang/Exception;)[B
    .registers 3

    .prologue
    .line 180
    new-instance v0, Lorg/web3j/crypto/CipherException;

    const-string v1, "Error performing cipher operation"

    invoke-direct {v0, v1, p0}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v0
.end method

.method static validate(Lorg/web3j/crypto/WalletFile;)V
    .registers 4

    .prologue
    .line 241
    invoke-virtual {p0}, Lorg/web3j/crypto/WalletFile;->getCrypto()Lorg/web3j/crypto/WalletFile$Crypto;

    move-result-object v0

    .line 243
    invoke-virtual {p0}, Lorg/web3j/crypto/WalletFile;->getVersion()I

    move-result v1

    const/4 v2, 0x3

    if-eq v1, v2, :cond_13

    .line 244
    new-instance v0, Lorg/web3j/crypto/CipherException;

    const-string v1, "Wallet version is not supported"

    invoke-direct {v0, v1}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 247
    :cond_13
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getCipher()Ljava/lang/String;

    move-result-object v1

    const-string v2, "aes-128-ctr"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_27

    .line 248
    new-instance v0, Lorg/web3j/crypto/CipherException;

    const-string v1, "Wallet cipher is not supported"

    invoke-direct {v0, v1}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 251
    :cond_27
    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdf()Ljava/lang/String;

    move-result-object v1

    const-string v2, "pbkdf2"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-nez v1, :cond_47

    invoke-virtual {v0}, Lorg/web3j/crypto/WalletFile$Crypto;->getKdf()Ljava/lang/String;

    move-result-object v0

    const-string v1, "scrypt"

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_47

    .line 252
    new-instance v0, Lorg/web3j/crypto/CipherException;

    const-string v1, "KDF type is not supported"

    invoke-direct {v0, v1}, Lorg/web3j/crypto/CipherException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 254
    :cond_47
    return-void
.end method