相关疑难解决方法(0)

DESede和TripleDES之间的差异cipher.getInstance()

我试图让TripleDES加密工作在Java中.从维基百科的文章Keying Options,我想用选项1,其中All three keys are independent.

Cipher文档中可以看到这里参考指南,但我仍然不清楚.

我正在努力运行示例,并在不同的项目中使用这两行:

Cipher c = Cipher.getInstance("DESede");

Cipher cipher = Cipher.getInstance("TripleDES/ECB/PKCS5Padding");
Run Code Online (Sandbox Code Playgroud)

编译都很好,那有什么区别?我应该使用其中一个吗?这两个都可以使用三个独立的键吗?

java encryption cryptography tripledes

18
推荐指数
1
解决办法
3万
查看次数

使用 ChaCha20 加密和解密字符串

我想使用chacha20解密和加密字符串

BouncyCastleProvider 正在使用 chacha20 技术。所以我把它包括在罐子里。并尝试了代码但无法工作。

测试版

public class PBE extends AppCompatActivity {

    private static final String salt = "A long, but constant phrase that will be used each time as the salt.";
    private static final int iterations = 2000;
    private static final int keyLength = 256;
    private static final SecureRandom random = new SecureRandom();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pbe);

        try {
            Security.insertProviderAt(new BouncyCastleProvider(), 1);
            //Security.addProvider(new BouncyCastleProvider());

            String passphrase = "The quick brown fox jumped …
Run Code Online (Sandbox Code Playgroud)

encryption android bouncycastle

0
推荐指数
1
解决办法
7147
查看次数