ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 September 9th, 2005, 05:06 AM
cfdyn cfdyn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 9 cfdyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 19 sec
Reputation Power: 0
Help with AES Implementation in Coldfusion 5.0

Hi All,
I am trying to implement 128 bit AES encryption in Coldfusion 5.0,
for that I am creating two CFX custom tags , one for encryption and one
for decryption. CFX tags are created using Customtag wizard in VC++.

http://cfhub.com/forum/attachments/cfxwiz_vc50.awx
http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=7&threadid=1040943&highli

ght_key=y&keyword1=encrypt
AES Implementaion C++ : http://www.codeproject.com/cpp/aes.asp
Encryption tag works perfectly, after the encryption ,encrypted value is stored
inside the database.later it is retrieved and passed to the decryption tag.
Encryption tag : <CFX_AES3 encVal="encVal" plaintext="#TestParam#" Key="#MyKey#">
Decryption tag: <CFX_AES_DEC decVal="decVal" eString="#GetImage.IMG#" Key="#MyKey#">

Encryption Program:


try
{
// Retrieve attributes passed to the tag
// Write output back to the user here...
pRequest->Write( "Hello from CFX_AES1!<br>" ) ;
LPCSTR lpszVariable = pRequest->GetAttribute("encVal");
LPCSTR lpszEStr = pRequest->GetAttribute("plaintext");
LPCSTR lpszKey = pRequest->GetAttribute("key");
try
{
CRijndael oRijndael;

pRequest->Write("Input String :<br>");
pRequest->Write(lpszEStr);

pRequest->Write("<br>Key in Encryption:");
pRequest->Write( lpszKey );


oRijndael.MakeKey(lpszKey, CRijndael::sm_chain0, 16, 16);
char szDataIn[49];
strcpy(szDataIn,lpszEStr);

char szDataOut[49];
memset(szDataOut, 0, 49);

oRijndael.Encrypt(szDataIn, szDataOut, 48);
pRequest->SetVariable(lpszVariable,szDataOut);

}

DECRYPTION Program:
try
{
// Retrieve attributes passed to the tag
// Write output back to the user here...
pRequest->Write( "Hello from CFX_AES_DEC!<br>" ) ;
LPCSTR lpszVariable = pRequest->GetAttribute("decVal") ;
LPCSTR lpszEStr = pRequest->GetAttribute( "eString" );
LPCSTR lpszKey = pRequest->GetAttribute("key");
try
{
CRijndael oRijndael;
char szDataIn[49];
char szDataOut[49];

oRijndael.MakeKey(lpszKey, CRijndael::sm_chain0, 16, 16);

pRequest->Write("Input String :<br>");
pRequest->Write(lpszEStr);

pRequest->Write("<br>Key in Decryption:");
pRequest->Write( lpszKey );
memset(szDataIn, 0,49);
memset(szDataOut, 0, 49);

strcpy(szDataIn,lpszEStr);

pRequest->Write("<br>After strcpy() :<br>");
pRequest->Write(szDataIn);
//oRijndael.Decrypt((szDataIn,szDataOut);
oRijndael.Decrypt(lpszEStr,szDataOut,48);
pRequest->SetVariable( lpszVariable,szDataOut );
}



Problem is that Decryption program gives the wrong output.

Thanks in Advance
CFDYN

Reply With Quote
  #2  
Old September 9th, 2005, 08:28 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,651 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 21 m 47 sec
Reputation Power: 53
Never used the tag before so I won't be able to help on this. Best bet would probably be to try and contact the original creator.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old September 12th, 2005, 02:28 AM
cfdyn cfdyn is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 9 cfdyn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 10 m 19 sec
Reputation Power: 0
I have created these CFX custom tags, my problem is more to do with the Decryption , has any one done this before?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > AES Implementation in Coldfusion 5.0


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway