小编bud*_*uda的帖子

加密字符串从Delphi到C#

我试图用Delphi Encryption Compendium中的Cipher1 3.0,第一部分解密用Delphi加密的c#中的一个字符串.我使用TCipher_Rijndael.

我加密的字符串是:this-is-a-test-example

密码:通过

加密值为:iKBC8kX4ZEk4A1pCj6jwEegqjpxhqw ==

当我尝试在c#中解密时,我发现错误:要解密的数据长度无效.

有没有人有同样的问题,什么是解决方案?

这是c#中的解密方法:

public static byte[] Decrypt(byte[] cipherData,
                                byte[] Key, byte[] IV)
    {

        MemoryStream ms = new MemoryStream();  
        Rijndael alg = Rijndael.Create();      
        alg.Key = Key;
        alg.IV = IV;
        CryptoStream cs = new CryptoStream(ms,
            alg.CreateDecryptor(), CryptoStreamMode.Write);           
        cs.Write(cipherData, 0, cipherData.Length);    
        cs.Close();
        byte[] decryptedData = ms.ToArray();
        return decryptedData;
    }
Run Code Online (Sandbox Code Playgroud)

这里是Delphi中的加密代码:

with TCipher_Rijndael.Create('pass',  nil) do
      begin
        memo2.lines.add ( CodeString( 'this-is-a-test-example' , paEncode, fmtDEFAULT));
        Free;
      end;
Run Code Online (Sandbox Code Playgroud)

谢谢.

c# delphi encryption aes

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

时间戳响应

我正在使用 Bouncy Castle 从 .NET 中的时间戳服务器读取响应。现在我想向客户端显示时间戳服务器证书,如何从响应中读取时间戳服务器证书?

提前致谢。

.net c# bouncycastle trusted-timestamp rfc3161

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

标签 统计

c# ×2

.net ×1

aes ×1

bouncycastle ×1

delphi ×1

encryption ×1

rfc3161 ×1

trusted-timestamp ×1