2 // ProtectedMemory.cs: Protect (encrypt) memory without (user involved) key management
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
14 namespace System.Security.Cryptography {
17 // a. Windows Data Protection
18 // http://msdn.microsoft.com/library/en-us/dnsecure/html/windataprotection-dpapi.asp?frame=true
20 public sealed class ProtectedMemory {
23 public static void Protect (byte[] userData, MemoryProtectionScope scope)
26 throw new ArgumentNullException ("userData");
27 if (userData.Length % 16 != 0)
28 throw new CryptographicException ("not a multiple of 16 bytes");
30 // on Windows this is supported only under XP and later OS
31 throw new PlatformNotSupportedException ();
35 public static void Unprotect (byte[] encryptedData, MemoryProtectionScope scope)
37 if (encryptedData == null)
38 throw new ArgumentNullException ("encryptedData");
39 if (encryptedData.Length % 16 != 0)
40 throw new CryptographicException ("not a multiple of 16 bytes");
42 // on Windows this is supported only under XP and later OS
43 throw new PlatformNotSupportedException ();