|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
I have created these CFX custom tags, my problem is more to do with the Decryption , has any one done this before?
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > AES Implementation in Coldfusion 5.0 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|