加密字符串从德尔福C# [英] Encrypted string From Delphi to C#

查看:100
本文介绍了加密字符串从德尔福C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解密德尔福加密纲要德尔福加密与Cipher1 3.0,第一部分C#的一根弦。
我用TCipher_Rijndael。

i am trying to decrypt one string in c# encrypted in Delphi with Cipher1 3.0, Part I from Delphi Encryption Compendium. I use TCipher_Rijndael.

字符串,我加密就是:这 - 是 - 一 - 测试 - 例如

string that i encrypt is : this-is-a-test-example

密码:通过

加密值是:iKBC8kX4ZEk4A1pCj6jwEegqjpxhqw ==

encrypted values is : iKBC8kX4ZEk4A1pCj6jwEegqjpxhqw==

当我尝试在C#解密此我recive错误:的长度数据解密是无效的。

When i try to decrypt this in c# i recive error: Length of the data to decrypt is invalid.

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

Did anyone have the same problem, and what is a solution?

下面是在c#解密方法:

Here is a decrypt method in 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;
    }

和这里是加密代码德尔福:

and here is encrypt code in Delphi:

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



感谢。

Thanks.

推荐答案

您需要确定所有这些价值是如何加密的详细信息:

You need to determine all of the details of how that value was encrypted:


  1. 什么的使用//en.wikipedia.org/wiki/Block_cipher_modes_of_operation操作的分组密码模式?欧洲央行往往是一个默认值。

  2. 填充方案使用?你的情况也许没有填充。

  3. 是如何在键导出从密码?也许 PBKDF2 或只是一个的 MD5哈希

  4. 什么是的初始化向量?请注意,只有一些密码模式要求之一。

  5. 如何被输出的编码?这似乎是的Base64编码你。

  1. What block cipher mode of operation was used? ECB tends to be a default.
  2. What padding scheme was used? Perhaps no padding in your case.
  3. How was the key derived from the password? Perhaps with PBKDF2 or simply a MD5 hash.
  4. What was the initialization vector? Note that only some cipher modes require one.
  5. How was the output encoded? It appears to be Base64 encoding for you.

只有当你知道它究竟是如何加密,可以逆转这一过程正确地解密。你可能想尝试张贴更多的代码或细节它是如何被加密。这时,有人也许能够确定你需要如何去解密它。我见过此方案与之前未知的,我设法猜测的细节,以找到答案。我试着用你的加密串了几个常见的方式,但我不能轻易解密没有更多的细节。

Only once you know exactly how it was encrypted can you reverse the process to properly decrypt it. You might want to try posting more code or details about how it was encrypted. Then someone might be able to determine how you need to go about decrypting it. I've seen this scenario with unknowns before and I managed to guess the details to find the answer. I tried a few common ways with your encrypted string, but I can't easily decrypt it without more details.

这篇关于加密字符串从德尔福C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆