Classic ASP AESDecrypt for SagePay 3.00

328 views Asked by At

I am using classic asp to upgrade to SagePay 3.00.

When receiving the crypt response back from SagePay, I am successfully decrypting that and displaying the long string on the screen.

What I need to do is separate the pairs so I can use that information, such as VendorTxCode.

I have successfully used rijndael.asp and includes.asp to Encrypt, send the information to SagePay and decrypt.

How can I perform what I think is the final task by listing the values separately from the string?

I have encrypted and decrypted with these two functions :

public function EncryptAndEncode(strIn) 
        '** AES encryption, CBC blocking with PKCS5 padding then HEX encoding - DEFAULT **
        EncryptAndEncode="@" & AESEncrypt(strIn,strEncryptionPassword)

end function

** Wrapper function do decode then decrypt based on header of the encrypted field **

public function DecodeAndDecrypt(strIn)
    DecodeAndDecrypt=AESDecrypt(mid(strIn,2),strEncryptionPassword) 
end function

Thanks.

2

There are 2 answers

0
Stephen S On

Something like this should work:

dim decryptedString, values, value

decryptedString = "value1,value2,value3"

values = Split("decryptedString", ",")

for each value in values
    Response.Write(value & "<br />")
next

Depending on the delimiter a regular expression might be required.

1
Steven On

Thank you for your response and help.

This is what I have now :

transinfo = Request.QueryString("Crypt")

decryptthis = DecodeAndDecrypt(transinfo)

Which successfully receives the string, the decrypts it. I am still unsure how to take the individual values out with your code.

I specifically need to take the VendorTxCode & related value out of the string.

when I output decryptthis to the screen, I see it, but I need to take it out of the string so I can use it.