- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 tripleDes 解密数据。一切看起来都很好,但它的开头有一些无效字符?我究竟做错了什么?对于相同的数据,如果多次调用此函数,前几个字符总是不同的,但其余数据是相同的。
我将 useHashing 传递给 false。
public static byte[] GetTripleDesDecryption(string dataToDecrypt, byte[] key, bool useHashing)
{
byte[] keyArray;
byte[] plainbytes = null;
byte[] cipherbytes;
try
{
if (useHashing)
{
MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider();
keyArray = hashmd5.ComputeHash(key);
hashmd5.Clear();
}
else
keyArray = key;
using (TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider())
{
tdes.Key = keyArray;
tdes.Mode = CipherMode.CBC;
tdes.Padding = PaddingMode.None;
using (ICryptoTransform cTransform = tdes.CreateDecryptor())
{
cipherbytes = Convert.FromBase64String(dataToDecrypt);
plainbytes = cTransform.TransformFinalBlock(cipherbytes, 0, cipherbytes.Length);
}
}
}
catch (Exception e)
{
LogMessage(e.Message + " Attribute Parsing error. DataToDecrypt = " + dataToDecrypt);
throw e;
}
return plainbytes;
}
这是我得到的:
"�{c��]�sertion xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\"><saml:AttributeStatement><saml:Attribute Name=\"userID\"><saml:AttributeValue>456</saml:AttributeValue></saml:Attribute><saml:Attribute Name=\"financialInstitutionNumber\"><saml:AttributeValue>303986258</saml:AttributeValue></saml:Attribute><saml:Attribute Name=\"password\"><saml:AttributeValue>galaxy</saml:AttributeValue></saml:Attribute></saml:AttributeStatement></saml:Assertion> "
最佳答案
我认为 C# 类在未设置的情况下使用随机 IV。尝试将 IV 设置为 8 个字节的字节数组,值为 00h 字节,并尝试用它解密。如果这不起作用,您将不得不以某种方式检索 IV。
PS 正确的方法当然是从 tdes 实例请求 blocksize 而不是放入文字 8
关于c# - 开头带有一些无效数据的 TripleDes 解密,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9231460/
我正在尝试停止使用 CAPICOM,因为我不能再使用它(64 位 Windows 7 机器)。 现有的使用TripleDES的代码是这样的: EncryptedDataClass cryptic =
我有一个使用 Triple DES 加密和解密数据的代码。代码一切正常。 我对 Triple Des 有疑问。Triple DES 在执行加密过程时会改变数据大小。我用谷歌搜索,对得到的答案感到非常困
我有一个 TripleDESCng 的工作实现(针对一些测试向量进行了测试),但是发生了以下情况: 当我加密纯文本时 这是一个示例消息(24 字节,因此它是 3 个 block )(十六进制为 546
我正在尝试使用 tripleDes 解密数据。一切看起来都很好,但它的开头有一些无效字符?我究竟做错了什么?对于相同的数据,如果多次调用此函数,前几个字符总是不同的,但其余数据是相同的。 我将 use
我现在了解到 PasswordDeriveBytes 已被弃用,取而代之的是 Rfc2898DeriveBytes。在 MSDN 上查找 Rfc2898DeriveBytes。有一个使用 Triple
我正在尝试使用 MYSQL 方法使用值为“symmetric_encryption.php”的 key 加密字符串(仅作为示例)。然而,输出是其他密码无法理解的垃圾。我尝试了一切,但无论如何它都会产生
有人可以给我在 C# 中加密和解密大文件的代码或有值(value)的建议吗? 我正在尝试使用 TripleDES 来做到这一点。它应该是安全、快速和可靠的这里应该根据我的 key 完成加密和解密。 最
我正在尝试将一些项目从 .net framework 4.5 迁移到 .net core。尝试迁移旧的crypting/decrypting 方法时会出现问题。该方法是一个 TripleDES,其 k
我有一组来自远程系统的用 TripleDES 编码的加密文档。我需要在 C# 中解码数据,但我无法控制 key 或编码算法。我所拥有的只是 key 和模式 (CBC) 以及文件中的数据。 Triple
根据Wikipedia的说法,TripleDES支持56、112和168位 key 长度,但是System.Cryptography.TripleDESCryptoServiceProvider.Le
我一直在从事我的科学项目,当时我想做一个实验,通过暴力破解来测试 TripleDES 的安全性。 TripleDES 由三个 key 组成,每个 key 56 位(加上 8 个奇偶校验位),其中每个
所以当我说这样的话时: TripleDES tripledes = TripleDES.Create(); Rfc2898DeriveBytes pdb = new Rfc2898DeriveByte
最近出现了一个问题,涉及将 API 与支付处理器连接,该支付处理器请求使用 TripleDES 标准对字符串进行加密以用作 token 。我们的应用程序使用 ColdFusion 运行,它有一个加密标
我正在使用 CryptoJS 库来实现 TripleDES 功能,但解密数据不起作用。我解密的数据不返回原始字符串。 var t = "a"; var d = "john"; var key = Cr
我有一个简单的java Web应用程序,它是由apache wicket构建的。当我在网络应用程序中注册用户时,我使用三元组对他们输入的密码进行加密并将其保存到数据库中。在登录页面,当他们输入相同的密
当使用 crypto js tripleDES 进行加密时,我注意到所有要加密的字符串都很短,例如“01”、“111”、“20”正确加密,但对于长字符串,如“5000021234567890000”,
我正在尝试使用 TripleDES.js 在 JavaScript 中加密和解密。这是我的代码片段: 加密方法: encrypt_string = function (plainData) {
我有一个示例 Java 函数,想为 PHP 做一个类似的函数: public static string Encrypt(string plainText, string key) {
我有一个 C# 应用程序,它使用以下方法在数据库中加密和解密密码: public static string Encrypt(string input, string key) { Tripl
我需要在 Nodejs 中复制 http://tripledes.online-domain-tools.com/ 中 3DS CBC 加密的结果。 这是我的代码: const crypto = re
我是一名优秀的程序员,十分优秀!