ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 17th, 2012, 03:10 AM
friendlylier friendlylier is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 2 friendlylier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 sec
Reputation Power: 0
PHP AES Encryption to Coldfusion

Hi, i have an AES Encrypted String from PHP
Code:
$data='sickstring';
$key = base64_decode('LP+Rc9e1q5ajWPD9djDkLQ==');
echo base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $maus, MCRYPT_MODE_ECB));


The Result is

E4Q6oR7XEyYtZAPSYjdXoQ== --> (sickstring)

I can decrypt this in php with

Code:
$key = base64_decode('LP+Rc9e1q5ajWPD9djDkLQ==');
$data = base64_decode('E4Q6oR7XEyYtZAPSYjdXoQ==');

echo mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_ECB);


But i want to decrypt this Sring with Coldfusion.

Code:
<cfdump var="#decrypt("E4Q6oR7XEyYtZAPSYjdXoQ==", "LP+Rc9e1q5ajWPD9djDkLQ==", "AES", "Base64")#">>


But i got an error:
Code:
Given final block not properly padded


any help?

Reply With Quote
  #2  
Old July 17th, 2012, 10:03 AM
kiteless kiteless is offline
Moderator
Dev Shed God (5000 - 5499 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 5,091 kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level)kiteless User rank is General (90000 - 100000 Reputation Level) 
Time spent in forums: 2 Weeks 5 Days 2 h 53 m 27 sec
Reputation Power: 966
Seems like it's a mismatch between the encryption and decryption algorithm. About the only thing I can offer is to have a look at this and see if it covers your situation: http://stackoverflow.com/questions/...d-string-in-php

Or maybe this: http://stackoverflow.com/questions/...fferent-results.

I'd say the best way to test would be to create the CFML code that will create the same encrypted value, then you know you're on the right track and decrypting it should be straightforward.

Last edited by kiteless : July 17th, 2012 at 10:05 AM.

Reply With Quote
  #3  
Old July 18th, 2012, 02:19 AM
friendlylier friendlylier is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2012
Posts: 2 friendlylier User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 30 sec
Reputation Power: 0
many thankz.

....../questions/3196846/un-encrypting-re-encrypting-a-coldfusion-encrypted-string-in-php

will work

PHP Code:
 $pad 16 - (StrLen($data) % 16);
if (
$pad 0) {
     
$data .= Str_repeat(Chr($pad), $pad);



gotcha

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > PHP AES Encryption to Coldfusion

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap