Tutorial :.netCART Credit Card Decryption - IIS 7 App Pool and Decryption issue



Question:

I've got a site using .netCART. It's running fine in production with Windows Server 2003 and .NET 2.0. On the new server (Windows Server 2008) everything is working except for credit card decryption in the store admin. No errors are being sent, no exceptions thrown, just the encrypted string being output to the screen instead of a decrypted credit card number.

Dim strCCEncrypt As String  strCCEncrypt = Trim(DataRow.Item("CreditCard"))  strCCEncrypt = tools.Decrypt(strCCEncrypt) 'tools is a .netCART utility  

Has anyone had experience with .netCART, or seen this issue before?

EDIT: After much investigating yesterday, it seems as though the problem is tied to the App Pool (which is running in classic pipeline mode on .NET 2.0), and Decryption. Can anyone tell me what the processes or services are that are tied to the default app pool which help handle decryption?


Solution:1

Don't know where your specific problem is, but that code snippet is equivalent to this:

Dim CCEncrypt As String = tools.Decrypt(DataRow("CreditCard").ToString().Trim())  

To explain the changes:

  • You can skip the .Item part because it's an indexer for DataRow
  • But you should call .ToString(), in case of other types or DbNulls
  • Then use the string type's .Trim() method rather than the VB Trim() function. Trim() and other old string functions exist solely for backwards compatibility. You're better off becoming accustom to the methods attached to the string type.
  • In .Net, it's no big deal to declare a variable and assign to it on the same line
  • And in .Net, Microsoft's style guidelines specifically recommend against any hungarian-notation type warts on variable names.


Solution:2

The end result of this problem was that I used Reflector to get the method out, provide the key manually to perform the decryption, since the decrypt method shown above just provided a call to a method that took the key.


Solution:3

Check the machinekey element in your web.config. Is it possible the credit cards were encrypted with a different key than you are trying to decrypt them with?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »