c.smali

.class public abstract Lcom/baidu/techain/v/c;
.super Ljava/lang/Object;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/baidu/techain/v/c$a;
    }
.end annotation


# direct methods
.method public static a(Ljava/lang/String;)Landroid/util/Pair;
    .registers 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/lang/String;",
            ")",
            "Landroid/util/Pair",
            "<[B",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    const/4 v1, 0x0

    const/16 v2, 0x20

    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_f

    invoke-virtual {p0}, Ljava/lang/String;->length()I

    move-result v0

    if-ge v0, v2, :cond_17

    :cond_f
    new-instance v0, Landroid/util/Pair;

    new-array v1, v1, [B

    invoke-direct {v0, v1, p0}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    :goto_16
    return-object v0

    :cond_17
    invoke-virtual {p0, v1, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v2}, Ljava/lang/String;->substring(I)Ljava/lang/String;

    move-result-object v2

    new-instance v0, Landroid/util/Pair;

    invoke-static {v1}, Lcom/baidu/techain/v/f;->a(Ljava/lang/String;)[B

    move-result-object v1

    invoke-direct {v0, v1, v2}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    goto :goto_16
.end method

.method public static a()Ljava/lang/String;
    .registers 2

    new-instance v0, Ljava/security/SecureRandom;

    invoke-direct {v0}, Ljava/security/SecureRandom;-><init>()V

    const/16 v1, 0x10

    new-array v1, v1, [B

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

    invoke-static {v1}, Lcom/baidu/techain/v/f;->a([B)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static a(Ljava/lang/String;[BLjava/lang/String;)Ljava/lang/String;
    .registers 5

    if-eqz p2, :cond_d

    invoke-static {p0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_d

    if-eqz p1, :cond_d

    array-length v0, p1

    if-nez v0, :cond_10

    :cond_d
    const-string v0, ""

    :goto_f
    return-object v0

    :cond_10
    :try_start_10
    const-string v0, "UTF-8"

    invoke-virtual {p2, v0}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v0

    invoke-static {p0, p1, v0}, Lcom/baidu/techain/v/c;->a(Ljava/lang/String;[B[B)[B

    move-result-object v0

    invoke-static {v0}, Lcom/baidu/techain/v/f;->a([B)Ljava/lang/String;
    :try_end_1d
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_10 .. :try_end_1d} :catch_1f

    move-result-object v0

    goto :goto_f

    :catch_1f
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): UnsupportedEncodingException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    const-string v0, ""

    goto :goto_f
.end method

.method public static a([BLjava/lang/String;)Ljava/lang/String;
    .registers 3

    if-eqz p0, :cond_5

    array-length v0, p0

    if-nez v0, :cond_6

    :cond_5
    :goto_5
    return-object p1

    :cond_6
    if-nez p1, :cond_a

    const-string p1, ""

    :cond_a
    invoke-static {p0}, Lcom/baidu/techain/v/f;->a([B)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    goto :goto_5
.end method

.method public static a(Ljava/lang/String;[B[B)[B
    .registers 8

    const/4 v4, 0x0

    if-eqz p0, :cond_8

    if-eqz p1, :cond_8

    array-length v0, p1

    if-nez v0, :cond_b

    :cond_8
    new-array v0, v4, [B

    :goto_a
    return-object v0

    :cond_b
    :try_start_b
    const-string v0, "AES/CBC/PKCS5Padding"

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

    move-result-object v0

    invoke-static {p0}, Lcom/baidu/techain/v/f;->a(Ljava/lang/String;)[B

    move-result-object v1

    new-instance v2, Ljavax/crypto/spec/SecretKeySpec;

    const-string v3, "AES"

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

    new-instance v1, Ljavax/crypto/spec/IvParameterSpec;

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

    const/4 v3, 0x1

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

    invoke-virtual {v0, p2}, Ljavax/crypto/Cipher;->doFinal([B)[B
    :try_end_28
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_b .. :try_end_28} :catch_2a
    .catch Ljava/security/InvalidKeyException; {:try_start_b .. :try_end_28} :catch_35
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_b .. :try_end_28} :catch_40
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_b .. :try_end_28} :catch_4b
    .catch Ljavax/crypto/BadPaddingException; {:try_start_b .. :try_end_28} :catch_56
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_b .. :try_end_28} :catch_61

    move-result-object v0

    goto :goto_a

    :catch_2a
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): NoSuchAlgorithmException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a

    :catch_35
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): InvalidKeyException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a

    :catch_40
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): InvalidAlgorithmParameterException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a

    :catch_4b
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): NoSuchPaddingException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a

    :catch_56
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): BadPaddingException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a

    :catch_61
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesEncrypt(): IllegalBlockSizeException: fail to encrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-array v0, v4, [B

    goto :goto_a
.end method

.method private static a([B)[B
    .registers 5

    .prologue
    .line 0
    :try_start_0
    const-string v0, "24907259431961377209480304447420314675278854956424737688244507998454379688588314890162679979323703303509240796245532111474023047392580178709435281576624542294613207523485034492914828565153172773053351891188090398210811384185501117117991603774176386409127476628856566065613009756131651597266262540467980974946876675842468600552312158771248419700603327630677244315755445967726919102965015263135288381740211593751262078285738436597133664401598420056690274760726854877181978220226448211936820860496708860964018593025172845041095854180953040116559241637133730839837036910305932797451786785855051024967644159284784940216337"

    const-string v1, "65537"

    .line 1000
    new-instance v2, Ljava/math/BigInteger;

    invoke-direct {v2, v0}, Ljava/math/BigInteger;-><init>(Ljava/lang/String;)V

    new-instance v0, Ljava/math/BigInteger;

    invoke-direct {v0, v1}, Ljava/math/BigInteger;-><init>(Ljava/lang/String;)V

    const-string v1, "RSA"

    invoke-static {v1}, Ljava/security/KeyFactory;->getInstance(Ljava/lang/String;)Ljava/security/KeyFactory;

    move-result-object v1

    new-instance v3, Ljava/security/spec/RSAPublicKeySpec;

    invoke-direct {v3, v2, v0}, Ljava/security/spec/RSAPublicKeySpec;-><init>(Ljava/math/BigInteger;Ljava/math/BigInteger;)V

    invoke-virtual {v1, v3}, Ljava/security/KeyFactory;->generatePublic(Ljava/security/spec/KeySpec;)Ljava/security/PublicKey;

    move-result-object v0

    check-cast v0, Ljava/security/interfaces/RSAPublicKey;

    .line 0
    if-nez v0, :cond_35

    new-instance v0, Ljava/io/UnsupportedEncodingException;

    invoke-direct {v0}, Ljava/io/UnsupportedEncodingException;-><init>()V

    throw v0
    :try_end_27
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_27} :catch_27
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_27} :catch_44
    .catch Ljava/security/InvalidKeyException; {:try_start_0 .. :try_end_27} :catch_52
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_0 .. :try_end_27} :catch_60
    .catch Ljavax/crypto/BadPaddingException; {:try_start_0 .. :try_end_27} :catch_6e
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_0 .. :try_end_27} :catch_7c
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_0 .. :try_end_27} :catch_8a

    :catch_27
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): UnsupportedEncodingException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :cond_35
    :try_start_35
    const-string v1, "RSA/ECB/OAEPWITHSHA-1ANDMGF1PADDING"

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

    move-result-object v1

    const/4 v2, 0x1

    invoke-virtual {v1, v2, v0}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;)V

    invoke-virtual {v1, p0}, Ljavax/crypto/Cipher;->doFinal([B)[B
    :try_end_42
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_35 .. :try_end_42} :catch_27
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_35 .. :try_end_42} :catch_44
    .catch Ljava/security/InvalidKeyException; {:try_start_35 .. :try_end_42} :catch_52
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_35 .. :try_end_42} :catch_60
    .catch Ljavax/crypto/BadPaddingException; {:try_start_35 .. :try_end_42} :catch_6e
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_35 .. :try_end_42} :catch_7c
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_35 .. :try_end_42} :catch_8a

    move-result-object v0

    return-object v0

    :catch_44
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): NoSuchAlgorithmException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :catch_52
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): InvalidKeyException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :catch_60
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): NoSuchPaddingException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :catch_6e
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): BadPaddingException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :catch_7c
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): InvalidKeySpecException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0

    :catch_8a
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): IllegalBlockSizeException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0
.end method

.method public static b()Ljava/lang/String;
    .registers 2

    new-instance v0, Ljava/security/SecureRandom;

    invoke-direct {v0}, Ljava/security/SecureRandom;-><init>()V

    const/16 v1, 0x80

    new-array v1, v1, [B

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

    invoke-static {v1}, Lcom/baidu/techain/v/f;->a([B)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public static b(Ljava/lang/String;)Ljava/lang/String;
    .registers 4

    const-string v0, ""

    :try_start_2
    invoke-static {p0}, Lcom/baidu/techain/v/c;->c(Ljava/lang/String;)Ljava/lang/String;
    :try_end_5
    .catch Lcom/baidu/techain/v/c$a; {:try_start_2 .. :try_end_5} :catch_7

    move-result-object v0

    :goto_6
    return-object v0

    :catch_7
    move-exception v1

    const-string v1, "Crypter"

    const-string v2, "rasEncryptKey(): RSAEncryptionException"

    invoke-static {v1, v2}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_6
.end method

.method public static b(Ljava/lang/String;[BLjava/lang/String;)Ljava/lang/String;
    .registers 7

    if-eqz p0, :cond_9

    if-eqz p1, :cond_9

    array-length v0, p1

    if-eqz v0, :cond_9

    if-nez p2, :cond_c

    :cond_9
    const-string v0, ""

    :goto_b
    return-object v0

    :cond_c
    :try_start_c
    const-string v0, "AES/CBC/PKCS5Padding"

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

    move-result-object v0

    invoke-static {p0}, Lcom/baidu/techain/v/f;->a(Ljava/lang/String;)[B

    move-result-object v1

    new-instance v2, Ljavax/crypto/spec/SecretKeySpec;

    const-string v3, "AES"

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

    new-instance v1, Ljavax/crypto/spec/IvParameterSpec;

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

    const/4 v3, 0x2

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

    invoke-static {p2}, Lcom/baidu/techain/v/f;->a(Ljava/lang/String;)[B

    move-result-object v1

    invoke-virtual {v0, v1}, Ljavax/crypto/Cipher;->doFinal([B)[B

    move-result-object v1

    new-instance v0, Ljava/lang/String;

    const-string v2, "UTF-8"

    invoke-direct {v0, v1, v2}, Ljava/lang/String;-><init>([BLjava/lang/String;)V
    :try_end_35
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_c .. :try_end_35} :catch_36
    .catch Ljava/security/InvalidKeyException; {:try_start_c .. :try_end_35} :catch_41
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_c .. :try_end_35} :catch_4a
    .catch Ljavax/crypto/NoSuchPaddingException; {:try_start_c .. :try_end_35} :catch_53
    .catch Ljavax/crypto/BadPaddingException; {:try_start_c .. :try_end_35} :catch_5c
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_c .. :try_end_35} :catch_65
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_c .. :try_end_35} :catch_6e

    goto :goto_b

    :catch_36
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): NoSuchAlgorithmException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    :goto_3e
    const-string v0, ""

    goto :goto_b

    :catch_41
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): InvalidKeyException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e

    :catch_4a
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): InvalidAlgorithmParameterException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e

    :catch_53
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): NoSuchPaddingException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e

    :catch_5c
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): BadPaddingException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e

    :catch_65
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): UnsupportedEncodingException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e

    :catch_6e
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "aesDecrypt(): IllegalBlockSizeException: fail to decrypt"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_3e
.end method

.method private static c(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    :try_start_0
    const-string v0, "UTF-8"

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

    move-result-object v0

    invoke-static {v0}, Lcom/baidu/techain/v/c;->a([B)[B

    move-result-object v0

    invoke-static {v0}, Lcom/baidu/techain/v/f;->a([B)Ljava/lang/String;
    :try_end_d
    .catch Ljava/io/UnsupportedEncodingException; {:try_start_0 .. :try_end_d} :catch_f

    move-result-object v0

    return-object v0

    :catch_f
    move-exception v0

    const-string v0, "Crypter"

    const-string v1, "rsaEncrypt(): UnsupportedEncodingException"

    invoke-static {v0, v1}, Lcom/baidu/techain/s/b;->c(Ljava/lang/String;Ljava/lang/String;)V

    new-instance v0, Lcom/baidu/techain/v/c$a;

    invoke-direct {v0}, Lcom/baidu/techain/v/c$a;-><init>()V

    throw v0
.end method

.method public static c()[B
    .registers 2

    new-instance v0, Ljava/security/SecureRandom;

    invoke-direct {v0}, Ljava/security/SecureRandom;-><init>()V

    const/16 v1, 0x10

    new-array v1, v1, [B

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

    return-object v1
.end method