DES (Data Encryption Standard)
Frasti
Member Posts: 11
Hello everybody!
I have to apply the DES (Data Encryption Standard) algorithm (exactly the Triple-DES algorithm) on some data. Now i'm looking for a piece of navision-code or an executable that i can run by the shell-command to encrypt/decrypt my data with the DES.
Is someone experienced with this problem or can sombody help me?
I have to apply the DES (Data Encryption Standard) algorithm (exactly the Triple-DES algorithm) on some data. Now i'm looking for a piece of navision-code or an executable that i can run by the shell-command to encrypt/decrypt my data with the DES.
Is someone experienced with this problem or can sombody help me?
0
Comments
-
Compile this class in visual studio and you will have a console application that encrypts in 3DES
namespace ConsoleApplication { class EncryptData { private static string EncryptText(string data, byte[] tdesKey, byte[] tdesIV) { TripleDESCryptoServiceProvider cryto = new TripleDESCryptoServiceProvider(); MemoryStream ms = new MemoryStream(); CryptoStream cs = new CryptoStream(ms, cryto.CreateEncryptor(tdesKey, tdesIV), CryptoStreamMode.Write); StreamWriter sw = new StreamWriter(cs); sw.Write(data); sw.Flush(); cs.FlushFinalBlock(); ms.Flush(); return Convert.ToBase64String(ms.GetBuffer(), 0, (int) ms.Length); } private static string DecryptText(string data, byte[] tdesKey, byte[] tdesIV) { TripleDESCryptoServiceProvider cryto = new TripleDESCryptoServiceProvider(); byte[] buffer = Convert.FromBase64String(data); MemoryStream ms = new MemoryStream(buffer); CryptoStream cs = new CryptoStream(ms, cryto.CreateDecryptor(tdesKey, tdesIV), CryptoStreamMode.Read); StreamReader sr = new StreamReader(cs); return sr.ReadToEnd(); } [STAThread] static void Main(string[] args) { byte[] KEY_192 = {42, 16, 93, 156, 78, 4, 218, 32, 15, 167, 44, 80, 26, 250, 155, 112, 2, 94, 11, 204, 119, 35, 184, 197}; byte[] IV_192 = {55, 103, 246, 79, 36, 99, 167, 3, 42, 5, 62, 83, 184, 7, 209, 13, 145, 23, 200, 58, 173, 10, 121, 222}; string data = "hello world"; Console.WriteLine("Clean:" + data); string encrypted = EncryptText(data, KEY_192, IV_192); Console.WriteLine("Encrypted:" + encrypted); Console.WriteLine("Decrypted:" + DecryptText(encrypted, KEY_192, IV_192)); } } }0 -
great thx! i made some changes: i used a BinaryWriter to write my data as bytes and it works...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 323 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions