jjzjj

tripledes

全部标签

c# - 三重 DES : Specified key is a known weak key for 'TripleDES' and cannot be used

我正在使用.NET3.0类System.Security.Cryptography.MACTripleDES类来生成MAC值。不幸的是,我正在使用使用“1111111111111111”(十六进制)作为单一长度DESkey的硬件设备。System.Security.Cryptography库会对key进行完整性检查,如果您尝试使用加密强度较弱的key,则会返回异常。例如:byte[]key=newbyte[24];for(inti=0;i抛出异常System.Security.Cryptography.CryptographicException:Specifiedkeyisaknow

c# - C# 和 PHP 中的 TripleDES 加密结果不一样(PKCS7、ECB)?

我已经花了几个小时试图解决这个问题,但就是无法让它发挥作用。我有一个需要在php中匹配的C#加密例程。我无法更改C#版本,这不是一个选项(第3方对此很坚定)。这是C#代码://InC#//Console.WriteLine(ApiEncode("testing","56dsfkj3kj23asdf83kseegflkj43458afdl"));//Resultsin://XvHbR/CsLTo=publicstaticstringApiEncode(stringdata,stringsecret){byte[]clear;varencoding=newUTF8Encoding();va

php - 使用 PHP 的 TRIPLE DES 加密/解密

我在PHP中有这个三重DES加密代码$encryption_key="CE51E06875F7D964";$data='tokenNo=test&securityCode=111';echo$desEncryptedData=encryptText_3des($data,$encryption_key);//outputs3desencrypteddatafunctionencryptText_3des($plainText,$key){$key=hash("md5",$key,TRUE);for($x=0;$x我能够将数据加密为xcFEvIdLXc2fjhG1i4iPOQu5L6ah

c# - 在 C# 中使用 TripleDES 加密的字符串,需要在 PHP 中解密

C#代码看起来像那样(不能更改它,因为它在客户的系统中)。namespaceCommon{publicstaticclassEncryptionHelper{privateconststringcryptoKey="password";//TheInitializationVectorfortheDESencryptionroutineprivatestaticreadonlybyte[]IV=newbyte[8]{240,3,45,29,0,76,173,59};//////Encryptsprovidedstringparameter///publicstaticstringEnc

使用 TripleDes、PKCS7 和 ECB 进行 PHP 加密/解密

我的加密函数可以正常工作,但是我不知道如何让解密函数提供正确的输出。这是我的加密函数:functionEncrypt($data,$secret){//Generateakeyfromahash$key=md5(utf8_encode($secret),true);//Takefirst8bytesof$keyandappendthemtotheendof$key.$key.=substr($key,0,8);//PadforPKCS7$blockSize=mcrypt_get_block_size('tripledes','ecb');$len=strlen($data);$pad=

ios - '不安全指针<UInt8 >' is not convertible to ' 不安全指针<_>'

我正在做tripleDES加密和解密。收到此错误:UnsafePointer'isnotconvertibleto'UnsafePointer我收到错误的代码是:letkeyString="25d1d4cb0a08403e2acbcbe0"letkeyData=keyString.data(using:.utf8)!letmessage=passletdata=message.data(using:.utf8)!letcryptData=NSMutableData(length:Int(data.count)+kCCBlockSize3DES)!letkeyLength=size_t(

带有 ECB 的 iOS 3DES 返回一半正确的数据

使用3DES+ECB算法加密密码时遇到问题。这是我使用的代码:classfuncencryptPassword(pass:String)->String{letkeyString="123456789012345678901234"letkeyData:NSData!=(keyStringasNSString).dataUsingEncoding(NSUTF8StringEncoding)asNSData!letkeyBytes=UnsafePointer(keyData.bytes)letdata:NSData!=(passasNSString).dataUsingEncoding(

java - cipher.getInstance() 的 DESede 和 TripleDES 之间的区别

我正尝试在Java中使用TripleDES加密。来自Wikipediaarticle在KeyingOptions下,我想使用选项1,其中所有三个键都是独立的。来自Cipherdocs它说去referenceguidehere,但我仍然不清楚。我正在努力运行示例,并在不同的项目中使用这两行:Cipherc=Cipher.getInstance("DESede");Ciphercipher=Cipher.getInstance("TripleDES/ECB/PKCS5Padding");两者都可以编译,那有什么区别呢?我应该使用一个吗?这两个都适用于使用三个单独的key吗?

encryption - 三重 DES 解密返回错误的前 16 个字节再次解密时

当我尝试再次解密同一个byteslice时,我遇到了解密问题。澄清代码示例:packagemainimport("fmt""crypto/cipher""crypto/des")const(//tripleKeyisTripleDESkeystring(3x8bytes)tripleKey="12345678asdfghjkzxcvbnmq")var(encryptercipher.BlockModedecryptercipher.BlockMode)funcinit(){//tripleDESChiperischiperblockbasedontripleKeyusedforencr

encryption - 三重 DES 解密返回错误的前 16 个字节再次解密时

当我尝试再次解密同一个byteslice时,我遇到了解密问题。澄清代码示例:packagemainimport("fmt""crypto/cipher""crypto/des")const(//tripleKeyisTripleDESkeystring(3x8bytes)tripleKey="12345678asdfghjkzxcvbnmq")var(encryptercipher.BlockModedecryptercipher.BlockMode)funcinit(){//tripleDESChiperischiperblockbasedontripleKeyusedforencr
12