在Android的Blowfish加密Android、Blowfish

2023-09-08 10:24:04 作者:ε麼

cipher = Cipher.getInstance("Blowfish");

这将引发异常java.security.NoSuchAlgorithmException:找不到密码河豚实施

This throws an exception java.security.NoSuchAlgorithmException: Cipher Blowfish implementation not found.

我检查都local_policy.jar和的US_export_policy.jar存在,他们并没有从Java安装的瞬间变化。什么会导致这个问题?

I checked both local_policy.jar and US_export_policy.jar exist and they weren't changed from the moment of java installation. What can cause this problem?

编辑:

Object[] o = Security.getAlgorithms("Cipher").toArray();
    for (int i=0; i<o.length; i++) {
        System.out.println((String)o[i]);
    }

当我运行这个code我得到的名单没有河豚,但算法的名称,如DES或RSA当中也有一些不知名的名字,如1.2.840.113549.1.1.7和这样的。为什么有没有河豚有抑或是隐藏在这些数字?

When I run this code I get list without "Blowfish" but among algorithm names such as DES or RSA there are some unknown names such as "1.2.840.113549.1.1.7" and like that. Why there's no Blowfish there or is it hidden in those numbers?

推荐答案

叶氏,我无法找到解决办法,只是使用的GNU密码库。它工作正常。

Yeap, I couldn't find the solution and just used the GNU crypto library. It works fine.