Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2004-12-23 16:50:47 +0300
committerSebastien Pouliot <sebastien@ximian.com>2004-12-23 16:50:47 +0300
commitbbc7ffba3919fd54a6262ff1ef960ba4ad65789b (patch)
tree447b86750a17bc34fa98e3e6ea67ea147d348ba6 /mcs/class/System.Security/System.Security.Cryptography
parent3e5e30a790b1b9182175d71d91b01f09aad4a979 (diff)
parent183e72bc2b8284dbaba7db6579da8df0f29395c2 (diff)
2004-12-23 Sebastien Pouliot <sebastien@ximian.com>
* System.Security.dll.sources: Added System.Security.Cryptography/ ProtectedData.cs, ProtectedMemory.cs, DataProtectionScope.cs and MemoryProtectionScope.cs as they been moved from mscorlib to here. * System.Security_test.dll.sources : Added Test/System.Security. Cryptography/ProtectedDataTest.cs and ProtectedMemoryTest.cs for the same reason. svn path=/trunk/mcs/; revision=38060
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography')
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs45
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography/MemoryProtectionScope.cs46
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs71
-rwxr-xr-xmcs/class/System.Security/System.Security.Cryptography/ProtectedMemory.cs72
4 files changed, 234 insertions, 0 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs b/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs
new file mode 100755
index 00000000000..0e592b198a4
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography/DataProtectionScope.cs
@@ -0,0 +1,45 @@
+//
+// DataProtectionScope.cs: Scope for ProtectData
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ public enum DataProtectionScope {
+ CurrentUser,
+ LocalMachine
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography/MemoryProtectionScope.cs b/mcs/class/System.Security/System.Security.Cryptography/MemoryProtectionScope.cs
new file mode 100755
index 00000000000..ac36dd779e9
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography/MemoryProtectionScope.cs
@@ -0,0 +1,46 @@
+//
+// MemoryProtectionScope.cs: Scope for ProtectMemory
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ public enum MemoryProtectionScope {
+ SameProcess,
+ CrossProcess,
+ SameLogon
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs b/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs
new file mode 100755
index 00000000000..fcc07f0b420
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography/ProtectedData.cs
@@ -0,0 +1,71 @@
+//
+// ProtectedData.cs: Protect (encrypt) data without (user involved) key management
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ // References:
+ // a. Windows Data Protection
+ // http://msdn.microsoft.com/library/en-us/dnsecure/html/windataprotection-dpapi.asp?frame=true
+
+ public sealed class ProtectedData {
+
+ private ProtectedData ()
+ {
+ }
+
+ // FIXME: interop could be important under windows - if one application protect some data using
+ // mono and another one unprotects it using ms.net
+
+ [MonoTODO ("interop with MS implementation ?")]
+ public static byte[] Protect (byte[] userData, byte[] optionalEntropy, DataProtectionScope scope)
+ {
+ if (userData == null)
+ throw new ArgumentNullException ("userData");
+
+ // on Windows this is supported only under 2000 and later OS
+ throw new PlatformNotSupportedException ();
+ }
+
+ [MonoTODO ("interop with MS implementation ?")]
+ public static byte[] Unprotect (byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)
+ {
+ if (encryptedData == null)
+ throw new ArgumentNullException ("encryptedData");
+
+ // on Windows this is supported only under 2000 and later OS
+ throw new PlatformNotSupportedException ();
+ }
+ }
+}
+
+#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/ProtectedMemory.cs b/mcs/class/System.Security/System.Security.Cryptography/ProtectedMemory.cs
new file mode 100755
index 00000000000..2b1dfab08ec
--- /dev/null
+++ b/mcs/class/System.Security/System.Security.Cryptography/ProtectedMemory.cs
@@ -0,0 +1,72 @@
+//
+// ProtectedMemory.cs: Protect (encrypt) memory without (user involved) key management
+//
+// Author:
+// Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_2_0
+
+using System;
+
+namespace System.Security.Cryptography {
+
+ // References:
+ // a. Windows Data Protection
+ // http://msdn.microsoft.com/library/en-us/dnsecure/html/windataprotection-dpapi.asp?frame=true
+
+ public sealed class ProtectedMemory {
+
+ private ProtectedMemory ()
+ {
+ }
+
+ [MonoTODO]
+ public static void Protect (byte[] userData, MemoryProtectionScope scope)
+ {
+ if (userData == null)
+ throw new ArgumentNullException ("userData");
+ if (userData.Length % 16 != 0)
+ throw new CryptographicException ("not a multiple of 16 bytes");
+
+ // on Windows this is supported only under XP and later OS
+ throw new PlatformNotSupportedException ();
+ }
+
+ [MonoTODO]
+ public static void Unprotect (byte[] encryptedData, MemoryProtectionScope scope)
+ {
+ if (encryptedData == null)
+ throw new ArgumentNullException ("encryptedData");
+ if (encryptedData.Length % 16 != 0)
+ throw new CryptographicException ("not a multiple of 16 bytes");
+
+ // on Windows this is supported only under XP and later OS
+ throw new PlatformNotSupportedException ();
+ }
+ }
+}
+
+#endif