using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CrossProduct.Core { /// /// Wrapper functions around our CrossProducts Encrypt Functionallity /// public static class Encryption { /// /// Encrypt Text /// /// Text To Encrypt /// Encrypted Text or String.Empty if Error Occured public static string EncryptText(string Text) { try { PerSeCryptography crypto = new PerSeCryptography(); string EncryptedText = crypto.EncryptText(Text); return EncryptedText; } catch (Exception) { /* ignore */ } return string.Empty; } /// /// Encrypt Text for use as a Command-Line Parameter - avoids " /// /// Text To Encrypt public static string EncryptTextParameter(string Text) { string EncryptedText; // Keep calling Encrypt Text until it productes a string without a double quote do { EncryptedText = EncryptText(Text); } while (EncryptedText.IndexOf('\"') != -1); return EncryptedText; } /// /// Decrypt Text /// /// Text To Decrypt /// Decrypted Text or String.Empty if Error Occured public static string DecryptText(string Text) { try { PerSeCryptography crypto = new PerSeCryptography(); string EncryptedText = crypto.DecryptText(Text); return EncryptedText; } catch (Exception) { /* ignore */ } return string.Empty; } } }