rijndael

Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)

天大地大妈咪最大 提交于 2019-12-01 05:28:52
So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong conversions or using the functions improperly, but I'll let you guys look at it. C++ /* 256bit key */ string key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ="; string decodedKey; StringSource(key, true, new Base64Decoder(new StringSink(decodedKey))); const byte* keyByte = (const byte*) decodedKey.data(); /* Generate IV */ /* AutoSeededRandomPool prng; byte

Crypto++ pbkdf2 output is different than Rfc2898DeriveBytes (C#) and crypto.pbkdf2 (JavaScript)

≯℡__Kan透↙ 提交于 2019-12-01 02:23:49
问题 So I'm trying to use PBKDF2 to derive a key given a base64 string of 256bits. I am able to use C#'s Rfc2898DeriveBytes and node-crypto's pbkdf2 to derive the same key, however, I can't say the same for C++. I'm not sure if I'm doing wrong conversions or using the functions improperly, but I'll let you guys look at it. C++ /* 256bit key */ string key = "Y1Mjycd0+O+AendY5pB58JMlmS0EmBWgjdj2r2KW6qQ="; string decodedKey; StringSource(key, true, new Base64Decoder(new StringSink(decodedKey)));

PHP encryption code converted to ColdFusion

荒凉一梦 提交于 2019-12-01 01:57:38
I have this bit of PHP that I'd like to do the equivalent of in ColdFusion. function & _encryptMessage( $message ) { $td = mcrypt_module_open( MCRYPT_RIJNDAEL_256, '', MCRYPT_MODE_CBC, ''); mcrypt_generic_init( $td, $this->key, $this->iv ); $encrypted_data = mcrypt_generic( $td, $message ); mcrypt_generic_deinit($td); mcrypt_module_close($td); return base64_encode( $encrypted_data ); } I think it is just encrypt(message,"","AES","Base64") But I have no real way of knowing for sure and it doesn't feel quite right, so I wondered if someone out there would be good enough to point me in the right

Php Decrypt a String from C# .NET RIJNDAEL 256

岁酱吖の 提交于 2019-11-30 20:03:53
Fixed it. $data = base64_decode(str_replace(' ', '+', $_GET['data'])); for whatever reason, Php was converting the +'s from the GET variablesinto spaces -- I am trying to decrypt a string that is being decrypted in C#.NET. The results of the code vary, There were several occasions where the final string had some parts decrypted, and the rest of it was random characters. Most of the time the "decrypted" string is just all random characters, I also tried some Php functions to remove PKCS7 padding but none of them fixed the problem. I've looked at several similar questions on the site but none of

Python equivalent of PHP's MCRYPT_RIJNDAEL_256 CBC

邮差的信 提交于 2019-11-30 17:58:10
问题 I need a Python implementation of this function - I want to use it on appengine. I am not so good in Python so please help. function encrypt($data) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256 ,'oqufXQ(?bc=6_hR2I3sMZChDpb6dDlw4', $data , MCRYPT_MODE_CBC, utf8_encode('fOaiIOkD8*9Xeu_s4_bb87Ox_UG+D9GA'))); } 回答1: Have you tried this one (also included below)? It implements the Rijndael block cipher for 16, 24 or 32 bytes. You are using the 256 bit (32 byte) version of the block

Decrypting the .ASPXAUTH Cookie WITH protection=validation

本小妞迷上赌 提交于 2019-11-30 17:50:48
For quite sometime I've been trying to decipher the ASP .ASPXAUTH cookie and decrypt it using PHP. My reasons are huge and I need to do this, there is no alternative. In PHP so far I have successfully managed to read the data from this cookie, but I cannot seem to do it while it is encrypted. Anyway, here it goes... First you need to alter your servers Web.config file (protection needs to be set to Validation): <authentication mode="None"> <forms name=".ASPXAUTH" protection="Validation" cookieless="UseCookies" timeout="10080" enableCrossAppRedirects="true"/> </authentication> Then in a PHP

Decrypt C# RIJNDAEL encoded text

半腔热情 提交于 2019-11-30 10:35:55
I'm implementing in Java the communication to a third party application. As part of the login process, the third party application is sending an encrypted string that I have to decode and send back. I have spent nearly 2 days googeling and reading posts but I can't find the right way to implement this. I have a test case where the encrypted string is "c1W2YO1vYQzu6czteEidrG0U4g5gT4h57vAlP7tdjcY=" that decrypted with the password "GAT" must return "101714994". The documentation I have states this: Authorization string was encrypted with the following settings: Padding of input data: PKCS*7

Rewrite Rijndael 256 C# Encryption Code in PHP

大兔子大兔子 提交于 2019-11-30 08:20:50
问题 I have an encryption/decryption algorithm written in C# - I need to be able to produce the same encryption in PHP so I can send the encrypted text over HTTP to be decrypted on the C# side. Here is the C# code for the encryption. this.m_plainText = string.Empty; this.m_passPhrase = "passpharse"; this.m_saltValue = "saltvalue"; this.m_hashAlgorithm = "SHA1"; this.m_passwordIterations = 2; this.m_initVector = "1a2b3c4d5e6f7g8h"; this.m_keySize = 256; public string Encrypt() { string plainText =

PHP to Delphi and back Encryption-Decryption using Rijndael

随声附和 提交于 2019-11-30 07:52:12
问题 I have problems with decrypting strings sent from PHP to Delphi using the rijndael cipher. I'm using mcrypt on the PHP side and DCP_rijndael on the Delphi side. At the moment I have the below code. PHP: function encRJ($key, $iv, $data) { $r = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_CBC, $iv); $r = base64_encode($r); return $r; } And in Delphi: function decRJ(Data: string; Key: string; IV: string): string; var ciph: TDCP_rijndael; begin Data := Base64DecodeStr(Data); ciph:

Php Decrypt a String from C# .NET RIJNDAEL 256

本秂侑毒 提交于 2019-11-30 04:37:17
问题 Fixed it. $data = base64_decode(str_replace(' ', '+', $_GET['data'])); for whatever reason, Php was converting the +'s from the GET variablesinto spaces -- I am trying to decrypt a string that is being decrypted in C#.NET. The results of the code vary, There were several occasions where the final string had some parts decrypted, and the rest of it was random characters. Most of the time the "decrypted" string is just all random characters, I also tried some Php functions to remove PKCS7