Decrypting “SunJCE” AES encrypted data on Android

前端 未结 3 1389
迷失自我
迷失自我 2021-02-11 05:07

We need to write some Android code to decrypt some data sent from our server. Our server team gave us some sample decryption code which uses the \"SunJCE\" provider, which unfo

3条回答
  •  长发绾君心
    2021-02-11 05:27

    If you run this code on Android, you'll see what Ciphers are supported:

    TreeSet ciphers = new TreeSet<>();
    for (Provider provider : Security.getProviders())
        for (Service service : provider.getServices())
            if (service.getType().equals("Cipher"))
                ciphers.add(service.getAlgorithm());
    for (String cipher : ciphers)
        System.out.println(cipher);
    

    On Windows 7 with JDK 1.8.0_51, I get:

    AES
    AESWrap
    AESWrap_128
    AESWrap_192
    AESWrap_256
    AES_128/CBC/NoPadding
    AES_128/CFB/NoPadding
    AES_128/ECB/NoPadding
    AES_128/GCM/NoPadding
    AES_128/OFB/NoPadding
    AES_192/CBC/NoPadding
    AES_192/CFB/NoPadding
    AES_192/ECB/NoPadding
    AES_192/GCM/NoPadding
    AES_192/OFB/NoPadding
    AES_256/CBC/NoPadding
    AES_256/CFB/NoPadding
    AES_256/ECB/NoPadding
    AES_256/GCM/NoPadding
    AES_256/OFB/NoPadding
    ARCFOUR
    Blowfish
    DES
    DESede
    DESedeWrap
    PBEWithHmacSHA1AndAES_128
    PBEWithHmacSHA1AndAES_256
    PBEWithHmacSHA224AndAES_128
    PBEWithHmacSHA224AndAES_256
    PBEWithHmacSHA256AndAES_128
    PBEWithHmacSHA256AndAES_256
    PBEWithHmacSHA384AndAES_128
    PBEWithHmacSHA384AndAES_256
    PBEWithHmacSHA512AndAES_128
    PBEWithHmacSHA512AndAES_256
    PBEWithMD5AndDES
    PBEWithMD5AndTripleDES
    PBEWithSHA1AndDESede
    PBEWithSHA1AndRC2_128
    PBEWithSHA1AndRC2_40
    PBEWithSHA1AndRC4_128
    PBEWithSHA1AndRC4_40
    RC2
    RSA
    RSA/ECB/PKCS1Padding
    

提交回复
热议问题