小编Kar*_*rel的帖子

Java BouncyCastle AES 解密的 C# 等效项是什么?

我有以下需要转换为 c# 的 Java 代码:

public static byte[] encryptAES(byte[] toEncrypt, byte[] key,
                                boolean encrypte) throws Exception {

    Security.addProvider(new BouncyCastleProvider());

    byte[] iv = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                  (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                  (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
                  (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };

    IvParameterSpec salt = new IvParameterSpec(iv);
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC");

    if (encrypte == false)
        cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"),  salt);
    else
        cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"), …
Run Code Online (Sandbox Code Playgroud)

c# java encryption cryptography bouncycastle

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

堆栈溢出在.Net世界中实际意味着什么?

堆栈溢出在.Net垃圾收集世界中实际意味着什么?

.net stack-overflow

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