Asi lo estaba convirtiendo. Salen algunos errores..
A ver si me hechas una mano..
Código PHP:
public static string Encrypt(string strText,string strEncrKey)
{
byte byKey;
byte[] IV={&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF};
//des=new ds
try
{
//byKey = System.Text.Encoding.UTF8.GetBytes(Left(strEncrKey, 8));
byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,8));
DESCryptoServiceProvider des= new DESCryptoServiceProvider();
//Dim des As New DESCryptoServiceProvider()
byte inputByteArray=Encoding.UTF8.GetBytes(strText);
//Dim inputByteArray() As Byte = Encoding.UTF8.GetBytes(strText)
//ms=new Memo
MemoryStream ms=new MemoryStream();
//Dim ms As New MemoryStream()
CryptoStream cs=new CryptoStream(ms,des.CreateDecryptor(byKey,IV),
CryptoStreamMode.Write);
//cs.
//Dim cs As New CryptoStream(ms, des.CreateEncryptor(byKey, IV),_
cs.Write(inputByteArray,0,inputByteArray.ToString().Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
catch(Exception ex)
{
return ex.Message.ToString();
}
}
public static string Decrypt(string strText,string sDecrKey)
{
byte byKey;
byte[] IV={&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF};
byte inputByteArray;
inputByteArray(strText.Length);
try
{
byKey=System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
DESCryptoServiceProvider des=new DESCryptoServiceProvider();
inputByteArray=Convert.FromBase64String(strText);
//Dim ms As New MemoryStream()
MemoryStream ms=new MemoryStream();
CryptoStream cs=new CryptoStream(ms,des.CreateDecryptor(byKey,IV),
CryptoStreamMode.Write);
//Dim cs As New CryptoStream(ms, des.CreateDecryptor(byKey,_
//IV), CryptoStreamMode.Write)
//cs.Write(inputByteArray, 0, inputByteArray.Length)
cs.Write(inputByteArray,0,inputByteArray.ToString().Length);
cs.FlushFinalBlock();
//cs.FlushFinalBlock()
System.Text.Encoding encoding=new System.Text.UTF8Encoding();
//Dim encoding As System.Text.Encoding = System.Text.Encoding.UTF8
//Return encoding.GetString(ms.ToArray())
return encoding.GetString(ms.ToArray());
}
catch(Exception ex)
{
return ex.Message.ToString();
}
}