From 9e4b34a4b1baebf611b615ead6018c15c4536820 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 7 May 2014 14:38:50 -0400 Subject: add basic open subtitle configuration --- .../Security/EncryptionManager.cs | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 MediaBrowser.Server.Implementations/Security/EncryptionManager.cs (limited to 'MediaBrowser.Server.Implementations/Security/EncryptionManager.cs') diff --git a/MediaBrowser.Server.Implementations/Security/EncryptionManager.cs b/MediaBrowser.Server.Implementations/Security/EncryptionManager.cs new file mode 100644 index 000000000..73a4e3004 --- /dev/null +++ b/MediaBrowser.Server.Implementations/Security/EncryptionManager.cs @@ -0,0 +1,36 @@ +using MediaBrowser.Controller.Security; +using System; +using System.Security.Cryptography; +using System.Text; + +namespace MediaBrowser.Server.Implementations.Security +{ + public class EncryptionManager : IEncryptionManager + { + /// + /// Encrypts the string. + /// + /// The value. + /// System.String. + /// value + public string EncryptString(string value) + { + if (value == null) throw new ArgumentNullException("value"); + + return Encoding.Default.GetString(ProtectedData.Protect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine)); + } + + /// + /// Decrypts the string. + /// + /// The value. + /// System.String. + /// value + public string DecryptString(string value) + { + if (value == null) throw new ArgumentNullException("value"); + + return Encoding.Default.GetString(ProtectedData.Unprotect(Encoding.Default.GetBytes(value), null, DataProtectionScope.LocalMachine)); + } + } +} -- cgit v1.2.3