Encrypting The string
-
Hi to all, Actually I am working on a e-commerce portal. We are using sage pay (payment gateway) for the transaction.While sending data to sage for transaction, the data should be encrypted. For this data should be encrypted using Simple XOR algorithm and then should be Base64 encoded. Can anyone have any idea about this. I am trying like this:
public void gencrypt() { string mycrypt = ""; key = "EnNj72dXmScJUX45"; string mystring = strPost; string temp = ""; SimpleXor(mystring, key); Base64Encode(temp); } public void SimpleXor(string strIn, string strkey) { int iInIndex; int iKeyIndex; string strReturn; if (strIn.Length == 0 || strkey.Length == 0) { return; } iInIndex = 1; iKeyIndex = 1; strReturn = ""; for (int i = 0; i <= strIn.Length; i++) { for (int j = 0; j <= strkey.Length;j++ ) { strReturn = strReturn + (strIn\[i\] ^ strkey\[j\]); iInIndex = iInIndex + 1; if (iKeyIndex == strIn.Length) { iKeyIndex = 0; iKeyIndex = iKeyIndex + 1; } } } } public void Base64Encode(string strplain) { }
Please assist me..
cheers, sneha
-
Hi to all, Actually I am working on a e-commerce portal. We are using sage pay (payment gateway) for the transaction.While sending data to sage for transaction, the data should be encrypted. For this data should be encrypted using Simple XOR algorithm and then should be Base64 encoded. Can anyone have any idea about this. I am trying like this:
public void gencrypt() { string mycrypt = ""; key = "EnNj72dXmScJUX45"; string mystring = strPost; string temp = ""; SimpleXor(mystring, key); Base64Encode(temp); } public void SimpleXor(string strIn, string strkey) { int iInIndex; int iKeyIndex; string strReturn; if (strIn.Length == 0 || strkey.Length == 0) { return; } iInIndex = 1; iKeyIndex = 1; strReturn = ""; for (int i = 0; i <= strIn.Length; i++) { for (int j = 0; j <= strkey.Length;j++ ) { strReturn = strReturn + (strIn\[i\] ^ strkey\[j\]); iInIndex = iInIndex + 1; if (iKeyIndex == strIn.Length) { iKeyIndex = 0; iKeyIndex = iKeyIndex + 1; } } } } public void Base64Encode(string strplain) { }
Please assist me..
cheers, sneha
I dont understand what your issue is - a little search prduces many ways of doing it, including this Implementing XOR cipher encryption / decryption in C#[^] but in reality Im not sure I'd be sending payment info to Sage or anyone else using simple xor encryption - if thats what they recommend I certainly wouldnt be dealing with them 'g'
modified on Sunday, January 24, 2010 4:02 AM