Created
February 9, 2012 18:30
-
-
Save smathy/1781848 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string encriptaRijndael(string ccNum) | |
{ | |
IniFile ini = new IniFile("C:\\Adquira/config/Rijndael.properties"); | |
byte[] keyArray = UTF8Encoding.Default.GetBytes(ini.IniReadValue("Info", "KEY")); | |
byte[] resultArray = new byte[0]; | |
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(ccNum); | |
try | |
{ | |
if (keyArray.Length > 0) | |
{ | |
RijndaelManaged rDel = new RijndaelManaged(); | |
rDel.Key = keyArray; | |
rDel.Mode = CipherMode.ECB; | |
rDel.Padding = PaddingMode.Zeros; | |
ICryptoTransform cTransform = rDel.CreateEncryptor(); | |
resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); | |
} | |
} | |
catch (Exception) | |
{ | |
//("ERROR EN EL CIFRADO (Rijndael)."); | |
} | |
return Convert.ToBase64String(resultArray, 0, resultArray.Length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment