aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Security/EncryptionManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-05-07 14:38:50 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-05-07 14:38:50 -0400
commit9e4b34a4b1baebf611b615ead6018c15c4536820 (patch)
tree7de3528eaad24dce030d3a383a91a2a612b7fed0 /MediaBrowser.Server.Implementations/Security/EncryptionManager.cs
parent0d025f7fb620bf2a24ca9aa4e5994f132e02e7c0 (diff)
add basic open subtitle configuration
Diffstat (limited to 'MediaBrowser.Server.Implementations/Security/EncryptionManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Security/EncryptionManager.cs36
1 files changed, 36 insertions, 0 deletions
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
+ {
+ /// <summary>
+ /// Encrypts the string.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns>System.String.</returns>
+ /// <exception cref="System.ArgumentNullException">value</exception>
+ 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));
+ }
+
+ /// <summary>
+ /// Decrypts the string.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns>System.String.</returns>
+ /// <exception cref="System.ArgumentNullException">value</exception>
+ 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));
+ }
+ }
+}