プロバイダーがなかったりしてうまく動作しないことがある。
とりあえず使えるプロバイダの確認
java.security.Security.getProviders()
で一覧を取得できる。
以下エミュレータで取得した結果
for(Provider each : java.security.Security.getProviders()){
android.util.Log.d(tag, each.getName());
}
エミュレータ
- AndroidOpenSSL
- DRLCertFactory
- BC
- Crypto
- HarmonyJSSE
手元にある 001HT
- DRLCertFactory
- Crypto
- HarmonyJSSE
- BC
機種に依存したくないならProviderをアプリに含めるしかなさそうだ。
ついでにエミュレータで各プロバイダのアルゴリズムを出力してみた。
ProviderName : AndroidOpenSSL
- Service algorithm : SSL
- Service algorithm : MD5
- Service algorithm : SSLv3
- Service algorithm : SHA-512
- Service algorithm : Default
- Service algorithm : SHA-256
- Service algorithm : SHA-1
- Service algorithm : TLS
- Service algorithm : TLSv1
- Service algorithm : SHA-384
ProviderName : DRLCertFactory
- Service algorithm : X509
ProviderName : BC
- Service algorithm : PBEWITHSHA256AND128BITAES-CBC-BC
- Service algorithm : SHA-1
- Service algorithm : SHA-512
- Service algorithm : SHA-384
- Service algorithm : DESEDEWRAP
- Service algorithm : PBEWITHMD5AND256BITAES-CBC-OPENSSL
- Service algorithm : RSA
- Service algorithm : PBEWITHHMACSHA1
- Service algorithm : PBEWITHMD5AND192BITAES-CBC-OPENSSL
- Service algorithm : PBEWITHSHA1ANDDES
- Service algorithm : PBEWITHMD5ANDDES
- Service algorithm : DH
- Service algorithm : ARC4
- Service algorithm : PBEWITHSHAAND192BITAES-CBC-BC
- Service algorithm : PKCS12PBE
- Service algorithm : AES
- Service algorithm : SHA-256
- Service algorithm : PBEWITHHMACSHA1
- Service algorithm : DH
- Service algorithm : DSA
- Service algorithm : BouncyCastle
- Service algorithm : DESEDE
- Service algorithm : DESEDE
- Service algorithm : Collection
- Service algorithm : HMACSHA512
- Service algorithm : PBEWITHSHAAND2-KEYTRIPLEDES-CBC
- Service algorithm : PKIX
- Service algorithm : HMACSHA256
- Service algorithm : AESWRAP
- Service algorithm : PBEWITHMD5ANDRC2
- Service algorithm : PKCS12
- Service algorithm : HMACSHA384
- Service algorithm : PBEWITHSHAAND40BITRC2-CBC
- Service algorithm : NONEWITHDSA
- Service algorithm : DES
- Service algorithm : SHA1withDSA
- Service algorithm : RC4
- Service algorithm : PBEWITHSHAAND256BITAES-CBC-BC
- Service algorithm : RSA
- Service algorithm : PBEWITHSHAAND128BITRC4
- Service algorithm : DH
- Service algorithm : HMACSHA384
- Service algorithm : PBEWITHSHAAND192BITAES-CBC-BC
- Service algorithm : PBEWITHSHA1ANDRC2
- Service algorithm : DSA
- Service algorithm : PBEWITHSHA256AND192BITAES-CBC-BC
- Service algorithm : DH
- Service algorithm : PBEWITHSHAAND128BITRC2-CBC
- Service algorithm : PBEWITHSHAAND3-KEYTRIPLEDES-CBC
- Service algorithm : DESEDE
- Service algorithm : PBEWITHMD5ANDRC2
- Service algorithm : SHA256WithRSAEncryption
- Service algorithm : PBEWITHMD5AND256BITAES-CBC-OPENSSL
- Service algorithm : DSA
- Service algorithm : BLOWFISH
- Service algorithm : PBKDF2WithHmacSHA1
- Service algorithm : SHA512WithRSAEncryption
- Service algorithm : PBEWITHMD5AND128BITAES-CBC-OPENSSL
- Service algorithm : SHA384WithRSAEncryption
- Service algorithm : PBEWITHHMACSHA
- Service algorithm : AES
- Service algorithm : PKIX
- Service algorithm : PBEWITHSHAAND40BITRC4
- Service algorithm : PBEWITHSHAAND128BITAES-CBC-BC
- Service algorithm : DES
- Service algorithm : PBEWITHSHAANDTWOFISH-CBC
- Service algorithm : HMACSHA512
- Service algorithm : PBEWITHSHAAND40BITRC4
- Service algorithm : HMACMD5
- Service algorithm : HMACSHA1
- Service algorithm : PBEWITHSHA256AND192BITAES-CBC-BC
- Service algorithm : PBEWITHSHAAND3-KEYTRIPLEDES-CBC
- Service algorithm : HMACSHA1
- Service algorithm : PBEWITHMD5ANDDES
- Service algorithm : DSA
- Service algorithm : PBEWITHSHAANDTWOFISH-CBC
- Service algorithm : DES
- Service algorithm : PBEWITHSHAAND128BITRC2-CBC
- Service algorithm : AES
- Service algorithm : PBEWITHSHAAND40BITRC2-CBC
- Service algorithm : PBEWITHSHA1ANDDES
- Service algorithm : HMACMD5
- Service algorithm : PBEWITHMD5AND128BITAES-CBC-OPENSSL
- Service algorithm : PBEWITHSHA256AND128BITAES-CBC-BC
- Service algorithm : X.509
- Service algorithm : PBEWITHSHAAND256BITAES-CBC-BC
- Service algorithm : DES
- Service algorithm : DESEDE
- Service algorithm : BLOWFISH
- Service algorithm : MD5WithRSAEncryption
- Service algorithm : HMACSHA256
- Service algorithm : OAEP
- Service algorithm : BKS
- Service algorithm : PBEWITHSHAAND128BITRC4
- Service algorithm : MD5
- Service algorithm : PBEWITHSHAAND128BITAES-CBC-BC
- Service algorithm : PBEWITHSHA256AND256BITAES-CBC-BC
- Service algorithm : PBEWITHSHA1ANDRC2
- Service algorithm : PBEWITHMD5AND192BITAES-CBC-OPENSSL
- Service algorithm : RSA
- Service algorithm : BLOWFISH
- Service algorithm : PBEWITHSHAAND2-KEYTRIPLEDES-CBC
- Service algorithm : SHA1WithRSAEncryption
- Service algorithm : PBEWITHSHA256AND256BITAES-CBC-BC
- Service algorithm : DH
ProviderName : Crypto
- Service algorithm : SHA1withDSA
- Service algorithm : DSA
- Service algorithm : SHA-1
- Service algorithm : SHA1PRNG
ProviderName : HarmonyJSSE
- Service algorithm : TLS
- Service algorithm : TLSv1
- Service algorithm : SSLv3
- Service algorithm : X509
- Service algorithm : X509
- Service algorithm : SSL
実機の方は割愛するが試したかったBlowfishがなかった。