Browse Source

In Test/System.Security.Cryptography:
2005-09-26 Sebastien Pouliot <[email protected]>

* Asn*.cs, Oid*.cs: Moved to System.dll

In Test/System.Security.Permissions:
2005-09-26 Sebastien Pouliot <[email protected]>

* StorePermissionAttributeTest.cs: Moved in System.dll

In Test/System.Security.Cryptography.X509Certificates:
2005-09-26 Sebastien Pouliot <[email protected]>
* All tests moved to System.dll assembly.
In System.Security.Cryptography:
2005-09-26 Sebastien Pouliot <[email protected]>
* Asn*.cs, Oid*.cs: Moved to System.dll
In System.Security.Permissions:
2005-09-26 Sebastien Pouliot <[email protected]>

* Store*.cs: Moved in System.dll

In .:
2005-09-26 Sebastien Pouliot <[email protected]>

* System.Security.dll.sources: Remove all X509 related classes.
* System.Security_test.dll.sources: Remove all X509 related tests.
* System.Security.Cryptography.X509Certificates/*.cs: moved to
System.dll assembly.
* Test/System.Security.Cryptography.X509Certificates/*.cs: moved to
System.dll assembly.

In System.Security.Cryptography.X509Certificates:
2005-09-26 Sebastien Pouliot <[email protected]>
* All classes moved in System.dll

svn path=/trunk/mcs/; revision=50770

Sebastien Pouliot 20 years ago
parent
commit
6a080fe2bd
64 changed files with 27 additions and 7569 deletions
  1. 9 0
      mcs/class/System.Security/ChangeLog
  2. 2 150
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
  3. 0 47
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/OpenFlags.cs
  4. 0 90
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/PublicKey.cs
  5. 0 43
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/StoreLocation.cs
  6. 0 49
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/StoreName.cs
  7. 0 85
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs
  8. 0 49
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs
  9. 0 231
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
  10. 0 348
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
  11. 0 206
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
  12. 0 69
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs
  13. 0 105
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Chain.cs
  14. 0 62
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElement.cs
  15. 0 94
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs
  16. 0 73
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs
  17. 0 107
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs
  18. 0 58
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs
  19. 0 65
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs
  20. 0 190
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
  21. 0 115
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
  22. 0 112
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs
  23. 0 73
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs
  24. 0 56
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509FindType.cs
  25. 0 45
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509IncludeOption.cs
  26. 0 254
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
  27. 0 49
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
  28. 0 43
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs
  29. 0 42
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs
  30. 0 44
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509RevocationMode.cs
  31. 0 43
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs
  32. 0 201
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs
  33. 0 242
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
  34. 0 41
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs
  35. 0 60
      mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs
  36. 0 319
      mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs
  37. 0 102
      mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs
  38. 0 88
      mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs
  39. 2 33
      mcs/class/System.Security/System.Security.Cryptography/ChangeLog
  40. 0 184
      mcs/class/System.Security/System.Security.Cryptography/Oid.cs
  41. 0 124
      mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs
  42. 0 91
      mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs
  43. 4 17
      mcs/class/System.Security/System.Security.Permissions/ChangeLog
  44. 0 155
      mcs/class/System.Security/System.Security.Permissions/StorePermission.cs
  45. 0 159
      mcs/class/System.Security/System.Security.Permissions/StorePermissionAttribute.cs
  46. 0 51
      mcs/class/System.Security/System.Security.Permissions/StorePermissionFlags.cs
  47. 0 42
      mcs/class/System.Security/System.Security.dll.sources
  48. 0 13
      mcs/class/System.Security/System.Security_test.dll.sources
  49. 2 25
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/ChangeLog
  50. 0 285
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtensionTest.cs
  51. 0 169
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ChainPolicyTest.cs
  52. 0 64
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ChainTest.cs
  53. 0 224
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtensionTest.cs
  54. 0 189
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ExtensionTest.cs
  55. 0 251
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509KeyUsageExtensionTest.cs
  56. 0 259
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509StoreTest.cs
  57. 0 292
      mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtensionTest.cs
  58. 0 280
      mcs/class/System.Security/Test/System.Security.Cryptography/AsnEncodedDataTest.cs
  59. 4 22
      mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog
  60. 0 75
      mcs/class/System.Security/Test/System.Security.Cryptography/OidCollectionTest.cs
  61. 0 82
      mcs/class/System.Security/Test/System.Security.Cryptography/OidEnumeratorTest.cs
  62. 0 184
      mcs/class/System.Security/Test/System.Security.Cryptography/OidTest.cs
  63. 4 0
      mcs/class/System.Security/Test/System.Security.Permissions/ChangeLog
  64. 0 249
      mcs/class/System.Security/Test/System.Security.Permissions/StorePermissionAttributeTest.cs

+ 9 - 0
mcs/class/System.Security/ChangeLog

@@ -1,3 +1,12 @@
+2005-09-26  Sebastien Pouliot  <[email protected]>
+
+	* System.Security.dll.sources: Remove all X509 related classes.
+	* System.Security_test.dll.sources: Remove all X509 related tests.
+	* System.Security.Cryptography.X509Certificates/*.cs: moved to 
+	System.dll assembly.
+	* Test/System.Security.Cryptography.X509Certificates/*.cs: moved to
+	System.dll assembly.
+
 2005-05-18  Sebastien Pouliot  <[email protected]>
 
 	* System.Security_test.dll.sources: Added unit tests for System.

+ 2 - 150
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog

@@ -1,151 +1,3 @@
-2005-04-27  Sebastien Pouliot  <[email protected]>
+2005-09-26  Sebastien Pouliot  <[email protected]>
 
-	* X509BasicConstraintsExtension.cs: Now throw ArgumentNullException in 
-	CopyFrom (fixed in beta2).
-	* X509CertificateEx.cs: Throw a CryptographicException in the RawData
-	property if no certificate is loaded in the instance.
-	* X509EnhancedKeyUsageExtension.cs: Now throw ArgumentNullException in 
-	CopyFrom (fixed in beta2).
-	* X509Extension.cs: Now throw ArgumentNullException in CopyFrom (fixed
-	in beta2).
-	* X509KeyUsageExtension.cs: Now throw ArgumentNullException in 
-	CopyFrom (fixed in beta2).
-	* X509Store.cs: Re-added certificate creation to get the exception.
-	* X509SubjectKeyIdentifierExtension.cs: Throw ArgumentNullException in
-	CopyFrom (fixed in beta2). Fix SubjectKeyIdentifier to return an empty
-	string (not null) after (unsucessful) decoding.
-
-2005-04-26  Sebastien Pouliot  <[email protected]>
-
-	* X509CertificateEx.cs: Used new features from Mono.Security.dll to 
-	load certificates and private keys from PKCS#12.
-
-2005-04-24  Sebastien Pouliot  <[email protected]>
-
-	* X509CertificateEx.cs: Added new constructors and Import methods that
-	accept SecureString for passwords. Added new property HasPrivateKey and
-	Verify method.
-	* X509CertificateExCollection.cs: Added new constructor that accept a
-	single X509Certificate2.
-	* X509EnhancedKeyUsageExtension.cs: Fixed compiler warnings.
-	* X509KeyUsageExtension.cs: Fixed new enum name for CrlSign. 
-	* X509KeyUsageFlags.cs: Fixed values and removed [Serializable].
-	* X509NameType.cs: Fixed values and removed [Serializable].
-	* X509Store.cs: Added new constructor that accept an IntPtr and the 
-	StoreHandle property. Fixed compiler warnings.
-
-2005-04-23  Sebastien Pouliot  <[email protected]>
-
-	* X509CertificateEx.cs, X509CertificateExCollection.cs, 
-	X509CertificateExEnumerator.cs, X509Chain.cs, X509ChainElement.cs,
-	X509ChainPolicy.cs, X509Store.cs: Changed all references of
-	X509CertificateEx to X509Certificate2 to match beta2.
-
-2005-01-17  Sebastien Pouliot  <[email protected]>
-
-	* X509BasicConstraintsExtension.cs: Completed implementation.
-	* X509Chain.cs: Updated to Dec CTP definitions.
-	* X509ChainPolicy.cs: Updated to Dec CTP definitions.
-	* X500DistinguishedNameFlags.cs: Added new ForceUTF8Encoding.
-	* X509EnhancedKeyUsageExtension.cs: New. Complete implementation.
-	* X509Extension.cs: Completed implementation.
-	* X509ExtensionCollection.cs: Updated to Dec CTP definitions.
-	* X509KeyUsageExtension.cs: Completed implementation.
-	* X509RevocationFlag.cs: Minus 1 on each member.
-	* X509SubjectKeyIdentifierExtension.cs: Completed implementation 
-	except for the new constructor accepting a public key.
-	* X509SubjectKeyIdentifierHashAlgorithm.cs: New enum.
-
-2004-09-03  Tim Coleman <[email protected]>
-	* X509KeyUsageExtension.cs: New stub class
-	* X509SubjectKeyIdentifierExtension.cs: New stub class
-	* PublicKey.cs X509BasicConstraintsExtension.cs X509CertificateEx.cs
-	* X509CertificateExCollection.cs X509Extension.cs
-	* X509ExtensionCollection.cs:
-		Bring these more in line with 2.0
-
-2004-07-08  Sebastien Pouliot  <[email protected]>
-
-	* OpenFlags.cs: Fixed flags values. Added missing attributes.
-	* StoreLocation.cs: Fixed enum values. Added missing [Serializable].
-	* StoreName.cs: Fixed enum values. Added missing [Serializable].
-	* X500DistinguishedName.cs: New. X.501 DN.
-	* X500DistinguishedNameFlags.cs: New. X.501 DN flags.
-	* X509CertificateEx.cs: Updated to Fx 2.0 beta 1. Added MonoTODO.
-	* X509Chain.cs: Added missing Reset method.
-	* X509ChainStatusFlags.cs: Fixed flags values. Added missing attrs.
-	* X509Extension.cs: Fixed API.
-	* X509ExtensionCollection.cs: Fixed API and implemented.
-	* X509FindType.cs: Fixed enum values. Added missing [Serializable].
-	* X509IncludeOption.cs: Added missing [Serializable].
-	* X509KeyUsageFlags.cs: : Fixed flags values. Added missing attrs.
-	* X509NameType.cs: Fixed enum values. Added missing [Serializable].
-	* X509RevocationFlag.cs: Fixed enum values. Added missing [Serializable].
-	* X509RevocationMode.cs: Added missing [Serializable].
-	* X509SelectionFlag.cs: Added missing [Serializable].
-	* X509VerificationFlags.cs: Fixed flags values. Added missing attrs.
-
-2004-07-07  Sebastien Pouliot  <[email protected]>
-
-	* X509Store.cs: Removed old store code (as it has changed a lot in 
-	Mono.Security).
-
-2003-12-07  Sebastien Pouliot  <[email protected]>
-
-	* PublicKey.cs: New (1.2). Class that encapsulate an ASN.1 encoded 
-	public key. 
-	* X509BasicConstraintsExtension.cs: New (1.2). X.509 certification 
-	extension for BasicConstraints.
-	* X509CertificateEx.cs: New (1.2). Augmented class to use X.509 
-	certificates.
-	* X509CertificateExCollection.cs: New (1.2). Collection class for 
-	X509CertificateEx.
-	* X509CertificateExEnumerator.cs: New (1.2). Enumerator class for 
-	X509CertificateEx.
-	* X509ChainElement.cs: New (1.2). Information (certificate, status, 
-	informations) for a member of a certificate chain.
-	* X509ChainElementCollection.cs: New (1.2). Collection class for 
-	X509ChainElement.
-	* X509ChainElementEnumerator.cs: New (1.2). Enumerator class for 
-	X509ChainElement.
-	* X509ChainStatus.cs: New (1.2). Chain status (many can apply to a 
-	single X509ChainElement).
-	* X509Extension.cs: New (1.2). Base class for all certificate 
-	extensions.
-	* X509ExtensionCollection.cs: New (1.2). Collection class for 
-	X509Extension.
-	* X509ExtensionEnumerator.cs: New (1.2). Enumerator class for 
-	X509Extension.
-
-2003-11-08  Sebastien Pouliot  <[email protected]>
-
-	* OpenFlags.cs: New (1.2). Enumeration for certificate stores.
-	* StoreLocation.cs: New (1.2). Enumeration for certificate stores.
-	* StoreName.cs: New (1.2). Enumeration for certificate stores.
-	* X509Chain.cs: New (1.2). Class to build a certificate chain up to a 
-	trusted anchor.
-	* X509ChainElement.cs: New (1.2). Element from the chain (certificate,
-	status and information) - only stubbed for now.
-	* X509ChainElementCollection.cs: New (1.2). Collection class for 
-	X509ChainElement.
-	* X509ChainElementEnumerator.cs: New (1.2). Enumerator class for 
-	X509ChainElement.
-	* X509ChainPolicy.cs: New (1.2). Policy to build a certificate chain.
-	* X509ChainStatusFlags.cs: New (1.2). Enumeration for chain status.
-	* X509FindType.cs: New (1.2). Enumeration for how to find X.509 
-	certificates in stores.
-	* X509IncludeOption.cs: New (1.2). Enumeration for options about which
-	certificate(s) to store within a (pkcs7) structure.
-	* X509KeyUsageFlags.cs: New (1.2). Enumeration for specifying valid 
-	usage for a keypair.
-	* X509NameType.cs: New (1.2). Enumeration for different types of name
-	that can be present inside a certificate.
-	* X509RevocationFlag.cs: New (1.2). Enumeration for specifying which
-	certificates should be verified for revocation in a chain.
-	* X509RevocationMode.cs: New (1.2). Enumeration for specifying how the
-	revocation process should find it's informations.
-	* X509SelectionFlag.cs: New (1.2). Enumeration about how to select 
-	certificates (ui-related).
-	* X509Store.cs: New (1.2). X.509 certificate store access - not complete.
-	* X509VerificationFlags.cs: New (1.2). Enumeration for parameters 
-	affecting the verification of a certificate chain.
+	* All classes moved in System.dll

+ 0 - 47
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/OpenFlags.cs

@@ -1,47 +0,0 @@
-//
-// OpenFlags.cs - System.Security.Cryptography.X509Certificates.OpenFlags
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Flags]
-	[Serializable]
-	public enum OpenFlags {
-		ReadOnly,
-		ReadWrite, 
-		MaxAllowed,
-		OpenExistingOnly = 4,
-		IncludeArchived = 8
-	}
-}
-
-#endif

+ 0 - 90
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/PublicKey.cs

@@ -1,90 +0,0 @@
-//
-// PublicKey.cs - System.Security.Cryptography.PublicKey
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//	Tim Coleman ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-//
-
-//
-// 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.X509Certificates {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public sealed class PublicKey {
-
-		private AsymmetricAlgorithm _key;
-		private AsnEncodedData _keyValue;
-		private AsnEncodedData _params;
-		private Oid _oid;
-
-		[MonoTODO]
-		public PublicKey (Oid oid, AsnEncodedData parameters, AsnEncodedData keyValue)
-		{
-			_oid = oid;
-			_params = parameters;
-			_keyValue = keyValue;
-		}
-
-		internal PublicKey (Mono.Security.X509.X509Certificate certificate)
-		{
-			if (certificate.KeyAlgorithm == "1.2.840.113549.1.1.1") {
-				_key = certificate.RSA;
-			}
-			else {
-				_key = certificate.DSA;
-			}
-
-			_oid = new Oid (certificate.KeyAlgorithm);
-			_keyValue = new AsnEncodedData (_oid, certificate.PublicKey);
-			_params = new AsnEncodedData (_oid, certificate.KeyAlgorithmParameters);
-		}
-
-		// properties
-
-		public AsnEncodedData EncodedKeyValue {
-			get { return _keyValue; }
-		}
-
-		public AsnEncodedData EncodedParameters {
-			get { return _params; }
-		}
-
-		public AsymmetricAlgorithm Key {
-			get { return _key; }
-		}
-
-		public Oid Oid {
-			get { return _oid; }
-		}
-	}
-}
-
-#endif

+ 0 - 43
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/StoreLocation.cs

@@ -1,43 +0,0 @@
-//
-// StoreLocation.cs - System.Security.Cryptography.X509Certificates.StoreLocation
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum StoreLocation {
-		CurrentUser = 1,
-		LocalMachine = 2
-	}
-}
-
-#endif

+ 0 - 49
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/StoreName.cs

@@ -1,49 +0,0 @@
-//
-// StoreName.cs - System.Security.Cryptography.X509Certificates.StoreName
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum StoreName {
-		AddressBook = 1,
-		AuthRoot = 2,
-		CertificateAuthority = 3,
-		Disallowed = 4,
-		My = 5,
-		Root = 6,
-		TrustedPeople = 7,
-		TrustedPublisher = 8 
-	}
-}
-
-#endif

+ 0 - 85
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs

@@ -1,85 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X500DistinguishedName
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// 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;
-using System.Text;
-
-using MX = Mono.Security.X509;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X500DistinguishedName : AsnEncodedData {
-
-		[MonoTODO]
-		public X500DistinguishedName (AsnEncodedData encodedDistinguishedName)
-		{
-		}
-
-		[MonoTODO]
-		public X500DistinguishedName (byte[] encodedDistinguishedName)
-		{
-		}
-
-		[MonoTODO]
-		public X500DistinguishedName (string distinguishedName)
-		{
-		}
-
-		[MonoTODO]
-		public X500DistinguishedName (string distinguishedName, X500DistinguishedNameFlags flag)
-		{
-		}
-
-		[MonoTODO]
-		public X500DistinguishedName (X500DistinguishedName distinguishedName)
-		{
-		}
-
-		[MonoTODO]
-		public string Name {
-			get { return null; }
-		}
-
-		[MonoTODO]
-		public string Decode (X500DistinguishedNameFlags flag)
-		{
-			return null;
-		}
-
-		[MonoTODO]
-		public override string Format (bool multiLine)
-		{
-			return null;
-		}
-
-	}
-}
-
-#endif

+ 0 - 49
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs

@@ -1,49 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2004-2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	[Flags]
-	[Serializable]
-	public enum X500DistinguishedNameFlags {
-		None = 0,
-		Reversed = 1,
-		UseSemicolons = 16,
-		DoNotUsePlusSign = 32,
-		DoNotUseQuotes = 64,
-		UseCommas = 128,
-		UseNewLines = 256,
-		UseUTF8Encoding = 4096,
-		UseT61Encoding = 8192,
-		ForceUTF8Encoding = 16384
-	}
-}
-
-#endif

+ 0 - 231
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs

@@ -1,231 +0,0 @@
-//
-// System.Security.Cryptography.X509BasicConstraintsExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//	Tim Coleman ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2005 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.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509BasicConstraintsExtension : X509Extension {
-
-		internal const string oid = "2.5.29.19";
-		internal const string friendlyName = "Basic Constraints";
-
-		private bool _certificateAuthority;
-		private bool _hasPathLengthConstraint;
-		private int _pathLengthConstraint;
-		private AsnDecodeStatus _status;
-
-		// constructors
-
-		public X509BasicConstraintsExtension ()
-		{
-			_oid = new Oid (oid, friendlyName);
-		}
-
-		public X509BasicConstraintsExtension (AsnEncodedData encodedBasicConstraints, bool critical)
-		{
-			// ignore the Oid provided by encodedKeyUsage (our rules!)
-			_oid = new Oid (oid, friendlyName);
-			_raw = encodedBasicConstraints.RawData;
-			base.Critical = critical;
-			_status = Decode (this.RawData);
-		}
-
-		public X509BasicConstraintsExtension (bool certificateAuthority, bool hasPathLengthConstraint, int pathLengthConstraint, bool critical)
-		{
-			if (hasPathLengthConstraint) {
-				if (pathLengthConstraint < 0)
-					throw new ArgumentOutOfRangeException ("pathLengthConstraint");
-				_pathLengthConstraint = pathLengthConstraint;
-			}
-			_hasPathLengthConstraint = hasPathLengthConstraint;
-			_certificateAuthority = certificateAuthority;
-			_oid = new Oid (oid, friendlyName);
-			base.Critical = critical;
-			RawData = Encode ();
-		}
-
-		// properties
-
-		public bool CertificateAuthority {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					return _certificateAuthority;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		public bool HasPathLengthConstraint {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					return _hasPathLengthConstraint;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		public int PathLengthConstraint {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					return _pathLengthConstraint;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData) 
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("asnEncodedData");
-
-			X509Extension ex = (asnEncodedData as X509Extension);
-			if (ex == null)
-				throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
-
-			if (ex._oid == null)
-				_oid = new Oid (oid, friendlyName);
-			else 
-				_oid = new Oid (ex._oid);
-
-			RawData = ex.RawData;
-			base.Critical = ex.Critical;
-			// and we deal with the rest later
-			_status = Decode (this.RawData);
-		}
-
-		// internal
-
-		internal AsnDecodeStatus Decode (byte[] extension)
-		{
-			if ((extension == null) || (extension.Length == 0))
-				return AsnDecodeStatus.BadAsn;
-			if (extension [0] != 0x30)
-				return AsnDecodeStatus.BadTag;
-			if (extension.Length < 3) {
-				if (!((extension.Length == 2) && (extension [1] == 0x00)))
-					return AsnDecodeStatus.BadLength;
-			}
-
-			try {
-				ASN1 sequence = new ASN1 (extension);
-				int n = 0;
-				ASN1 a = sequence [n++];
-				if ((a != null) && (a.Tag == 0x01)) {
-					_certificateAuthority = (a.Value [0] == 0xFF);
-					a = sequence [n++];
-				}
-				if ((a != null) && (a.Tag == 0x02)) {
-					_hasPathLengthConstraint = true;
-					_pathLengthConstraint = ASN1Convert.ToInt32 (a);
-				}
-			}
-			catch {
-				return AsnDecodeStatus.BadAsn;
-			}
-
-			return AsnDecodeStatus.Ok;
-		}
-
-		internal byte[] Encode ()
-		{
-			ASN1 ex = new ASN1 (0x30);
-
-			if (_certificateAuthority)
-				ex.Add (new ASN1 (0x01, new byte[] { 0xFF }));
-			if (_hasPathLengthConstraint) {
-				// MS encodes the 0 (pathLengthConstraint is OPTIONAL)
-				// and in a long form (02 00 versus 02 01 00)
-				if (_pathLengthConstraint == 0)
-					ex.Add (new ASN1 (0x02, new byte[] { 0x00 }));
-				else
-					ex.Add (ASN1Convert.FromInt32 (_pathLengthConstraint));
-			}
-
-			return ex.GetBytes ();
-		}
-
-		internal override string ToString (bool multiLine)
-		{
-			switch (_status) {
-			case AsnDecodeStatus.BadAsn:
-				return String.Empty;
-			case AsnDecodeStatus.BadTag:
-			case AsnDecodeStatus.BadLength:
-				return FormatUnkownData (_raw);
-			case AsnDecodeStatus.InformationNotAvailable:
-				return "Information Not Available";
-			}
-
-			if (_oid.Value != oid)
-				return String.Format ("Unknown Key Usage ({0})", _oid.Value);
-
-			StringBuilder sb = new StringBuilder ();
-
-			sb.Append ("Subject Type=");
-			if (_certificateAuthority)
-				sb.Append ("CA");
-			else
-				sb.Append ("End Entity");
-			if (multiLine)
-				sb.Append (Environment.NewLine);
-			else
-				sb.Append (", ");
-
-			sb.Append ("Path Length Constraint=");
-			if (_hasPathLengthConstraint) 
-				sb.Append (_pathLengthConstraint);
-			else
-				sb.Append ("None");
-			if (multiLine)
-				sb.Append (Environment.NewLine);
-
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 348
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs

@@ -1,348 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificate2 class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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;
-using System.IO;
-using System.Text;
-
-using MX = Mono.Security.X509;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public class X509Certificate2 : X509Certificate {
-
-		private bool _archived;
-		private X509ExtensionCollection _extensions;
-		private string _name;
-		private string _serial;
-		private PublicKey _publicKey;
-
-		private MX.X509Certificate _cert;
-
-		// constructors
-
-		public X509Certificate2 () : base () 
-		{
-			_cert = null;
-		}
-
-		public X509Certificate2 (byte[] rawData) : base (rawData) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (byte[] rawData, string password) : base (rawData, password) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (byte[] rawData, SecureString password) : base (rawData, password) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
-			: base (rawData, password, keyStorageFlags) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
-			: base (rawData, password, keyStorageFlags) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (string fileName) : base (fileName) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (string fileName, string password) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (string fileName, SecureString password) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
-			: base (fileName, password, keyStorageFlags) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags)
-			: base (fileName, password, keyStorageFlags) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (IntPtr handle) : base (handle) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		public X509Certificate2 (X509Certificate certificate) 
-		{
-			_cert = new MX.X509Certificate (base.GetRawCertData ());
-		}
-
-		// properties
-
-		public bool Archived {
-			get { return _archived; }
-			set { _archived = value; }
-		}
-
-		public X509ExtensionCollection Extensions {
-			get { return _extensions; }
-		}
-
-		public string FriendlyName {
-			get { return _name; }
-			set { _name = value; }
-		}
-
-		[MonoTODO]
-		public bool HasPrivateKey {
-			get { return false; }
-		}
-
-		[MonoTODO]
-		public X500DistinguishedName IssuerName {
-			get { return null; }
-		} 
-
-		public DateTime NotAfter {
-			get { return _cert.ValidUntil; }
-		}
-
-		public DateTime NotBefore {
-			get { return _cert.ValidFrom; }
-		}
-
-		public AsymmetricAlgorithm PrivateKey {
-			get {
-				if (_cert.RSA != null)
-					return _cert.RSA; 
-				else if (_cert.DSA != null)
-					return _cert.DSA;
-				return null;
-			}
-			set {
-				if (value is RSA)
-					_cert.RSA = (RSA) value;
-				else if (value is DSA)
-					_cert.DSA = (DSA) value;
-				else
-					throw new NotSupportedException ();
-			}
-		} 
-
-		public PublicKey PublicKey {
-			get { 
-				if (_publicKey == null) {
-					_publicKey = new PublicKey (_cert);
-				}
-				return _publicKey;
-			}
-		} 
-
-		public byte[] RawData {
-			get {
-				if (_cert == null) {
-					throw new CryptographicException (Locale.GetText ("No certificate data."));
-				}
-				return base.GetRawCertData ();
-			}
-		} 
-
-		public string SerialNumber {
-			get { 
-				if (_serial == null) {
-					StringBuilder sb = new StringBuilder ();
-					byte[] serial = _cert.SerialNumber;
-					for (int i=serial.Length - 1; i >= 0; i--)
-						sb.Append (serial [i].ToString ("X2"));
-					_serial = sb.ToString ();
-				}
-				return _serial; 
-			}
-		} 
-
-		public Oid SignatureAlgorithm {
-			get { return null; }
-		} 
-
-		[MonoTODO]
-		public X500DistinguishedName SubjectName {
-			get { return null; }
-		} 
-
-		public string Thumbprint {
-			get { return base.GetCertHashString (); }
-		} 
-
-		public int Version {
-			get { return _cert.Version; }
-		}
-
-		// methods
-
-		[MonoTODO]
-		public void Display ()
-		{
-		}
-
-		[MonoTODO]
-		public void Display (IntPtr hwndParent) 
-		{
-		}
-
-		[MonoTODO]
-		public string GetNameInfo (X509NameType nameType, bool forIssuer) 
-		{
-			return null;
-		}
-
-		public override void Import (byte[] rawData) 
-		{
-			Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
-		}
-
-		[MonoTODO ("missing KeyStorageFlags support")]
-		public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
-		{
-			base.Import (rawData, password, keyStorageFlags);
-			if (password == null) {
-				_cert = new Mono.Security.X509.X509Certificate (rawData);
-				// TODO - PKCS12 without password
-			} else {
-				// try PKCS#12
-				MX.PKCS12 pfx = new MX.PKCS12 (rawData, password);
-				if (pfx.Certificates.Count > 0) {
-					_cert = pfx.Certificates [0];
-				} else {
-					_cert = null;
-				}
-				if (pfx.Keys.Count > 0) {
-					_cert.RSA = (pfx.Keys [0] as RSA);
-					_cert.DSA = (pfx.Keys [0] as DSA);
-				}
-			}
-		}
-
-		[MonoTODO ("SecureString is incomplete")]
-		public override void Import (byte[] rawData, SecureString password, X509KeyStorageFlags keyStorageFlags)
-		{
-			Import (rawData, (string) null, keyStorageFlags);
-		}
-
-		public override void Import (string fileName) 
-		{
-			byte[] rawData = Load (fileName);
-			Import (rawData, (string)null, X509KeyStorageFlags.DefaultKeySet);
-		}
-
-		[MonoTODO ("missing KeyStorageFlags support")]
-		public override void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) 
-		{
-			byte[] rawData = Load (fileName);
-			Import (rawData, password, keyStorageFlags);
-		}
-
-		[MonoTODO ("SecureString is incomplete")]
-		public override void Import (string fileName, SecureString password, X509KeyStorageFlags keyStorageFlags) 
-		{
-			byte[] rawData = Load (fileName);
-			Import (rawData, (string)null, keyStorageFlags);
-		}
-
-		private byte[] Load (string fileName)
-		{
-			byte[] data = null;
-			using (FileStream fs = new FileStream (fileName, FileMode.Open)) {
-				data = new byte [fs.Length];
-				fs.Read (data, 0, data.Length);
-				fs.Close ();
-			}
-			return data;
-		}
-
-		public override void Reset () 
-		{
-			_serial = null;
-			_publicKey = null;
-			base.Reset ();
-		}
-
-		[MonoTODO]
-		public override string ToString ()
-		{
-			return null;
-		}
-
-		[MonoTODO]
-		public override string ToString (bool verbose)
-		{
-			return null;
-		}
-
-		[MonoTODO]
-		public bool Verify ()
-		{
-			X509Chain chain = new X509Chain ();
-			if (!chain.Build (this))
-				return false;
-			// TODO - check chain and other stuff ???
-			return true;
-		}
-
-		// static methods
-
-		[MonoTODO]
-		public static X509ContentType GetCertContentType (byte[] rawData)
-		{
-			return X509ContentType.Unknown;
-		}
-
-		[MonoTODO]
-		public static X509ContentType GetCertContentType (string fileName)
-		{
-			return X509ContentType.Unknown;
-		}
-	}
-}
-
-#endif

+ 0 - 206
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs

@@ -1,206 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509Certificate2Collection class
-//
-// Authors:
-//	Sebastien Pouliot  <[email protected]>
-//	Tim Coleman ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2005 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.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509Certificate2Collection : X509CertificateCollection {
-
-		// constructors
-
-		public X509Certificate2Collection ()
-		{
-		}
-
-		public X509Certificate2Collection (X509Certificate2Collection certificates)
-		{
-			AddRange (certificates);
-		}
-
-		public X509Certificate2Collection (X509Certificate2 certificate) 
-		{
-			Add (certificate);
-		}
-
-		public X509Certificate2Collection (X509Certificate2[] certificates) 
-		{
-			AddRange (certificates);
-		}
-
-		// properties
-
-		public new X509Certificate2 this [int index] {
-			get {
-				if (index < 0)
-					throw new ArgumentOutOfRangeException ("negative index");
-				if (index >= InnerList.Count)
-					throw new ArgumentOutOfRangeException ("index >= Count");
-				return (X509Certificate2) InnerList [index];
-			}
-			set { InnerList [index] = value; }
-		}
-
-		// methods
-
-		public int Add (X509Certificate2 certificate)
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-
-			return InnerList.Add (certificate);
-		}
-
-		// note: transactional
-		public void AddRange (X509Certificate2[] certificates) 
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificates");
-
-			for (int i=0; i < certificates.Length; i++)
-				InnerList.Add (certificates [i]);
-		}
-
-		// note: transactional
-		public void AddRange (X509Certificate2Collection certificates) 
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificates");
-
-			InnerList.AddRange (certificates);
-		}
-
-		public bool Contains (X509Certificate2 certificate) 
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-
-			foreach (X509Certificate2 c in InnerList) {
-				if (certificate.Equals (c))
-					return true;
-			}
-			return false;
-		}
-
-		public byte[] Export (X509ContentType contentType) 
-		{
-			return null;
-		}
-
-		public byte[] Export (X509ContentType contentType, string password) 
-		{
-			return null;
-		}
-
-		public X509Certificate2Collection Find (X509FindType findType, object findValue, bool validOnly) 
-		{
-			return null;
-		}
-
-		public new X509Certificate2Enumerator GetEnumerator () 
-		{
-			return null;
-		}
-
-		public void Import (byte[] rawData) 
-		{
-		}
-
-		public void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
-		{
-		}
-
-		public void Import (string fileName) 
-		{
-		}
-
-		public void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) 
-		{
-		}
-
-		public void Insert (int index, X509Certificate2 certificate) 
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-			if (index < 0)
-				throw new ArgumentOutOfRangeException ("negative index");
-			if (index >= InnerList.Count)
-				throw new ArgumentOutOfRangeException ("index >= Count");
-
-			InnerList.Insert (index, certificate);
-		}
-
-		public void Remove (X509Certificate2 certificate) 
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-
-			for (int i=0; i < InnerList.Count; i++) {
-				X509Certificate2 c = (X509Certificate2) InnerList [i];
-				if (certificate.Equals (c)) {
-					InnerList.RemoveAt (i);
-					// only first instance is removed
-					return;
-				}
-			}
-		}
-
-		// note: transactional
-		public void RemoveRange (X509Certificate2[] certificates)
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificate");
-		}
-
-		// note: transactional
-		public void RemoveRange (X509Certificate2Collection certificates) 
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificate");
-		}
-
-		// note: UI
-		public X509Certificate2Collection Select (string title, string message, X509SelectionFlag selectionFlag)
-		{
-			return null;
-		}
-
-		// note: UI
-		public X509Certificate2Collection Select (string title, string message, X509SelectionFlag selectionFlag, IntPtr hwndParent) 
-		{
-			return null;
-		}
-	}
-}
-
-#endif

+ 0 - 69
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs

@@ -1,69 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509Certificate2Enumerator class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 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.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509Certificate2Enumerator : IEnumerator {
-
-		private IEnumerator enumerator;
-
-		internal X509Certificate2Enumerator (X509Certificate2Collection collection) 
-		{
-			enumerator = ((IEnumerable) collection).GetEnumerator ();
-		}
-
-		// properties
-
-		public X509Certificate2 Current {
-			get { return (X509Certificate2) enumerator.Current; }
-		}
-
-		object IEnumerator.Current {
-			get { return enumerator.Current; }
-		}
-
-		// methods
-
-		public bool MoveNext () 
-		{
-			return enumerator.MoveNext ();
-		}
-
-		public void Reset ()
-		{
-			enumerator.Reset ();
-		}
-	}
-}
-
-#endif

+ 0 - 105
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Chain.cs

@@ -1,105 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509Chain
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public class X509Chain {
-
-		private bool _machineContext;
-		private X509ChainElementCollection _elements;
-		private X509ChainPolicy _policy;
-		private X509ChainStatus[] _status;
-
-		// constructors
-
-		public X509Chain () : this (false)
-		{
-		}
-
-		public X509Chain (bool useMachineContext) 
-		{
-			_machineContext = useMachineContext;
-			_elements = new X509ChainElementCollection ();
-			_policy = new X509ChainPolicy ();
-		}
-
-		public X509Chain (IntPtr chainContext)
-		{
-			// CryptoAPI compatibility (unmanaged handle)
-			throw new NotSupportedException ();
-		}
-
-		// properties
-
-		public IntPtr ChainContext {
-			get { return IntPtr.Zero; }
-		}
-
-		public X509ChainElementCollection ChainElements {
-			get { return _elements; }
-		}
-
-		public X509ChainPolicy ChainPolicy {
-			get { return _policy; }
-			set { _policy = value; }
-		}
-
-		public X509ChainStatus[] ChainStatus {
-			get { 
-				if (_status == null)
-					_status = new X509ChainStatus [0]; 
-				return _status;
-			}
-		} 
-
-		// methods
-
-		[MonoTODO]
-		public bool Build (X509Certificate2 certificate)
-		{
-			return false;
-		}
-
-		[MonoTODO]
-		public void Reset () 
-		{
-		}
-
-		// static methods
-
-		public static X509Chain Create ()
-		{
-			return new X509Chain ();
-		}
-	}
-}
-
-#endif

+ 0 - 62
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElement.cs

@@ -1,62 +0,0 @@
-//
-// X509ChainElement.cs - System.Security.Cryptography.X509Certificates.X509ChainElement
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public class X509ChainElement {
-
-		// constructors
-
-		// only accessible from X509Chain.ChainElements
-		internal X509ChainElement ()
-		{
-		}
-
-		// properties
-
-		[MonoTODO]
-		public X509Certificate2 Certificate {
-			get { return null; }
-		}
-
-		[MonoTODO]
-		public X509ChainStatus[] ChainElementStatus {
-			get { return null; }
-		}
-
-		[MonoTODO]
-		public string Information {
-			get { return null; }
-		}
-	}
-}
-
-#endif

+ 0 - 94
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs

@@ -1,94 +0,0 @@
-//
-// X509ChainElementCollection.cs - System.Security.Cryptography.X509Certificates.X509ChainElementCollection
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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;
-using System.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public sealed class X509ChainElementCollection : ICollection, IEnumerable {
-
-		private ArrayList _list;
-
-		// constructors
-
-		// only accessible from X509Chain
-		internal X509ChainElementCollection () 
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return _list.IsSynchronized; }
-		}
-
-		public X509ChainElement this [int index] {
-			get { return (X509ChainElement) _list [index]; }
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		// methods
-
-		public void CopyTo (X509ChainElement[] array, int index) 
-		{
-			_list.CopyTo ((Array)array, index);
-		}
-
-		void ICollection.CopyTo (Array array, int index) 
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public X509ChainElementEnumerator GetEnumerator ()
-		{
-			return new X509ChainElementEnumerator (_list);
-		}
-
-		IEnumerator IEnumerable.GetEnumerator ()
-		{
-			return new X509ChainElementEnumerator (_list);
-		}
-	}
-}
-
-#endif

+ 0 - 73
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs

@@ -1,73 +0,0 @@
-//
-// X509ChainElementEnumerator.cs - System.Security.Cryptography.X509Certificates.X509ChainElementEnumerator
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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;
-using System.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public sealed class X509ChainElementEnumerator : IEnumerator {
-
-		private IEnumerator enumerator;
-
-		internal X509ChainElementEnumerator (IEnumerable enumerable) 
-		{
-			enumerator = enumerable.GetEnumerator ();
-		}
-
-		// properties
-
-		public X509ChainElement Current {
-			get { return (X509ChainElement) enumerator.Current; }
-		}
-
-		object IEnumerator.Current {
-			get { return enumerator.Current; }
-		}
-
-		// methods
-
-		public bool MoveNext ()
-		{
-			return enumerator.MoveNext ();
-		}
-
-		public void Reset() 
-		{
-			enumerator.Reset ();
-		}
-	}
-}
-
-#endif

+ 0 - 107
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs

@@ -1,107 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509ChainPolicy class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509ChainPolicy {
-
-		private OidCollection _apps;
-		private OidCollection _cert;
-		private X509Certificate2Collection _store;
-		private X509RevocationFlag _rflag;
-		private X509RevocationMode _mode;
-		private TimeSpan _timeout;
-		private X509VerificationFlags _vflags;
-		private DateTime _vtime;
-
-		// constructors
-
-		public X509ChainPolicy () 
-		{
-			Reset ();
-		}
-
-		// properties
-
-		public OidCollection ApplicationPolicy {
-			get { return _apps; }
-		}
-
-		public OidCollection CertificatePolicy {
-			get { return _cert; }
-		}
-
-		public X509Certificate2Collection ExtraStore {
-			get { return _store; }
-		}
-
-		public X509RevocationFlag RevocationFlag {
-			get { return _rflag; }
-			set { _rflag = value; }
-		}
-
-		public X509RevocationMode RevocationMode {
-			get { return _mode; }
-			set { _mode = value; }
-		}
-
-		public TimeSpan UrlRetrievalTimeout {
-			get { return _timeout; }
-			set { _timeout = value; }
-		}
-
-		public X509VerificationFlags VerificationFlags {
-			get { return _vflags; }
-			set { _vflags = value; }
-		}
-
-		public DateTime VerificationTime {
-			get { return _vtime; }
-			set { _vtime = value; }
-		}
-
-		// methods
-
-		public void Reset ()
-		{
-			_apps = new OidCollection ();
-			_cert = new OidCollection ();
-			_store = new X509Certificate2Collection ();
-			_rflag = X509RevocationFlag.ExcludeRoot;
-			_mode = X509RevocationMode.Online;
-			_timeout = new TimeSpan (0);
-			_vflags = X509VerificationFlags.NoFlag;
-			_vtime = DateTime.Now;
-		}
-	}
-}
-
-#endif

+ 0 - 58
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs

@@ -1,58 +0,0 @@
-//
-// X509ChainStatus.cs - System.Security.Cryptography.X509Certificates.X509ChainStatus
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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.X509Certificates {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public struct X509ChainStatus {
-
-		private X509ChainStatusFlags _status;
-		private string _info;
-
-		// properties
-
-		public X509ChainStatusFlags Status {
-			get { return _status; }
-			set { _status = value; }
-		}
-
-		public string StatusInformation {
-			get { return _info; }
-			set { _info = value; }
-		}
-	}
-}
-
-#endif

+ 0 - 65
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs

@@ -1,65 +0,0 @@
-//
-// X509ChainStatusFlags.cs - System.Security.Cryptography.X509Certificates.X509ChainStatusFlags
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Flags]
-	[Serializable]
-	public enum X509ChainStatusFlags {
-		NoError = 0,
-		NotTimeValid = 1,
-		NotTimeNested = 2,
-		Revoked = 4,
-		NotSignatureValid = 8,
-		NotValidForUsage = 16,
-		UntrustedRoot = 32,
-		RevocationStatusUnknown = 64,
-		Cyclic = 128,
-		InvalidExtension = 256,
-		InvalidPolicyConstraints = 512,
-		InvalidBasicConstraints = 1024,
-		InvalidNameConstraints = 2048,
-		HasNotSupportedNameConstraint = 4096,
-		HasNotDefinedNameConstraint = 8192,
-		HasNotPermittedNameConstraint = 16384,
-		HasExcludedNameConstraint = 32768,
-		PartialChain = 65536,
-		CtlNotTimeValid = 131072,
-		CtlNotSignatureValid = 262144,
-		CtlNotValidForUsage = 524288,
-		OfflineRevocation = 16777216,
-		NoIssuanceChainPolicy = 33554432
-	}
-}
-
-#endif

+ 0 - 190
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs

@@ -1,190 +0,0 @@
-//
-// System.Security.Cryptography.X509EnhancedKeyUsageExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509EnhancedKeyUsageExtension : X509Extension {
-
-		internal const string oid = "2.5.29.37";
-		internal const string friendlyName = "Enhanced Key Usage";
-
-		private OidCollection _enhKeyUsage;
-		private AsnDecodeStatus _status;
-
-		// constructors
-
-		public X509EnhancedKeyUsageExtension ()
-		{
-			_oid = new Oid (oid, friendlyName);
-		}
-
-		public X509EnhancedKeyUsageExtension (AsnEncodedData encodedEnhancedKeyUsages, bool critical)
-		{
-			// ignore the Oid provided by encodedKeyUsage (our rules!)
-			_oid = new Oid (oid, friendlyName);
-			_raw = encodedEnhancedKeyUsages.RawData;
-			base.Critical = critical;
-			_status = Decode (this.RawData);
-		}
-
-		public X509EnhancedKeyUsageExtension (OidCollection enhancedKeyUsages, bool critical)
-		{
-			if (enhancedKeyUsages == null)
-				throw new ArgumentNullException ("enhancedKeyUsages");
-
-			_oid = new Oid (oid, friendlyName);
-			base.Critical = critical;
-			_enhKeyUsage = enhancedKeyUsages.ReadOnlyCopy ();
-			RawData = Encode ();
-		}
-
-		// properties
-
-		public OidCollection EnhancedKeyUsages {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					if (_enhKeyUsage == null)
-						_enhKeyUsage = new OidCollection ();
-					_enhKeyUsage.ReadOnly = true;
-					return _enhKeyUsage;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData) 
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("encodedData");
-
-			X509Extension ex = (asnEncodedData as X509Extension);
-			if (ex == null)
-				throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
-
-			if (ex._oid == null)
-				_oid = new Oid (oid, friendlyName);
-			else 
-				_oid = new Oid (ex._oid);
-
-			RawData = ex.RawData;
-			base.Critical = ex.Critical;
-			// and we deal with the rest later
-			_status = Decode (this.RawData);
-		}
-
-		// internal
-
-		internal AsnDecodeStatus Decode (byte[] extension)
-		{
-			if ((extension == null) || (extension.Length == 0))
-				return AsnDecodeStatus.BadAsn;
-			if (extension [0] != 0x30)
-				return AsnDecodeStatus.BadTag;
-
-			if (_enhKeyUsage == null)
-				_enhKeyUsage = new OidCollection ();
-
-			try {
-				ASN1 ex = new ASN1 (extension);
-				if (ex.Tag != 0x30)
-					throw new CryptographicException (Locale.GetText ("Invalid ASN.1 Tag"));
-				for (int i=0; i < ex.Count; i++) {
-					_enhKeyUsage.Add (new Oid (ASN1Convert.ToOid (ex [i])));
-				}
-			}
-			catch {
-				return AsnDecodeStatus.BadAsn;
-			}
-
-			return AsnDecodeStatus.Ok;
-		}
-
-		internal byte[] Encode ()
-		{
-			ASN1 ex = new ASN1 (0x30);
-			foreach (Oid oid in _enhKeyUsage) {
-				ex.Add (ASN1Convert.FromOid (oid.Value));
-			}
-			return ex.GetBytes ();
-		}
-
-		internal override string ToString (bool multiLine)
-		{
-			switch (_status) {
-			case AsnDecodeStatus.BadAsn:
-				return String.Empty;
-			case AsnDecodeStatus.BadTag:
-			case AsnDecodeStatus.BadLength:
-				return FormatUnkownData (_raw);
-			case AsnDecodeStatus.InformationNotAvailable:
-				return "Information Not Available";
-			}
-
-			if (_oid.Value != oid)
-				return String.Format ("Unknown Key Usage ({0})", _oid.Value);
-			if (_enhKeyUsage.Count == 0)
-				return "Information Not Available";
-
-			StringBuilder sb = new StringBuilder ();
-
-			for (int i=0; i < _enhKeyUsage.Count; i++) {
-				Oid o = _enhKeyUsage [i];
-				switch (o.Value) {
-				case "1.3.6.1.5.5.7.3.1":
-					sb.Append ("Server Authentication (");
-					break;
-				default:
-					sb.Append ("Unknown Key Usage (");
-					break;
-				}
-				sb.Append (o.Value);
-				sb.Append (")");
-
-				if (multiLine)
-					sb.Append (Environment.NewLine);
-				else if (i != (_enhKeyUsage.Count - 1))
-					sb.Append (", ");
-			}
-
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 115
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs

@@ -1,115 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509Extension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//	Tim Coleman ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Text;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public class X509Extension : AsnEncodedData {
-
-		private bool _critical;
-
-		// constructors
-
-		protected X509Extension () 
-		{
-		}
-
-		public X509Extension (AsnEncodedData encodedExtension, bool critical)
-		{
-// Match MS		if (encodedExtension == null)
-//				throw new ArgumentNullException ("encodedExtension");
-			if (encodedExtension.Oid == null)
-				throw new ArgumentNullException ("encodedExtension.Oid");
-
-			Oid = encodedExtension.Oid;
-			RawData = encodedExtension.RawData;
-			_critical = critical;
-		}
-
-		public X509Extension (Oid oid, byte[] rawData, bool critical)
-		{
-			if (oid == null)
-				throw new ArgumentNullException ("oid");
-			Oid = oid;
-			RawData = rawData;
-			_critical = critical;
-		}
-
-		public X509Extension (string oid, byte[] rawData, bool critical)
-			: base (oid, rawData)
-		{
-			_critical = critical;
-		}
-
-		// properties
-
-		public bool Critical {
-			get { return _critical; }
-			set { _critical = value; }
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData) 
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("encodedData");
-
-			X509Extension ex = (asnEncodedData as X509Extension);
-			if (ex == null)
-				throw new ArgumentException (Locale.GetText ("Expected a X509Extension instance."));
-
-			base.CopyFrom (asnEncodedData);
-			// and we deal with critical
-			_critical = ex.Critical;
-		}
-
-		// internal stuff
-
-		// this version doesn't includes spaces between bytes and use uppercase hexadecimal values
-		internal string FormatUnkownData (byte[] data)
-		{
-			if ((data == null) || (data.Length == 0))
-				return String.Empty;
-
-			StringBuilder sb = new StringBuilder ();
-			for (int i=0; i < data.Length; i++) {
-				sb.Append (data [i].ToString ("X2"));
-			}
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 112
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs

@@ -1,112 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509ExtensionCollection
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//	Tim Coleman ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509ExtensionCollection : ICollection, IEnumerable {
-
-		private ArrayList _list;
-
-		// constructors
-
-		public X509ExtensionCollection ()
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return _list.IsSynchronized; }
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		public X509Extension this [int index] {
-			get { return (X509Extension) _list [index]; }
-		}
-
-		public X509Extension this [string oid] {
-			get { 
-				foreach (X509Extension extension in this) {
-					if (extension.Oid.Value.Equals (oid))
-						return extension;
-				}
-				return null;
-			}
-		}
-
-		// methods
-
-		public int Add (X509Extension extension) 
-		{
-			return _list.Add (extension);
-		}
-
-		[MonoTODO]
-		public void CopyTo (X509Extension[] array, int index) 
-		{
-			if (array == null)
-				throw new ArgumentNullException ("array");
-			if (index < 0)
-				throw new ArgumentException ("negative index");
-			if (index > array.Length)
-				throw new ArgumentOutOfRangeException ("index > array.Length");
-		}
-
-		void ICollection.CopyTo (Array array, int index)
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public X509ExtensionEnumerator GetEnumerator () 
-		{
-			return new X509ExtensionEnumerator (this);
-		}
-
-		IEnumerator IEnumerable.GetEnumerator () 
-		{
-			return new X509ExtensionEnumerator (this);
-		}
-	}
-}
-
-#endif

+ 0 - 73
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs

@@ -1,73 +0,0 @@
-//
-// X509ExtensionEnumerator.cs - System.Security.Cryptography.X509ExtensionEnumerator
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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;
-using System.Collections;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public sealed class X509ExtensionEnumerator : IEnumerator {
-
-		private IEnumerator enumerator;
-
-		internal X509ExtensionEnumerator (X509ExtensionCollection collection)
-		{
-			enumerator = ((IEnumerable) collection).GetEnumerator ();
-		}
-
-		// properties
-
-		public X509Extension Current {
-			get { return (X509Extension) enumerator.Current; }
-		}
-
-		object IEnumerator.Current {
-			get { return enumerator.Current; }
-		}
-
-		// methods
-
-		public bool MoveNext () 
-		{
-			return enumerator.MoveNext ();
-		}
-
-		public void Reset ()
-		{
-			enumerator.Reset ();
-		}
-	}
-}
-
-#endif

+ 0 - 56
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509FindType.cs

@@ -1,56 +0,0 @@
-//
-// X509FindType.cs - System.Security.Cryptography.X509Certificates.X509FindType
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum X509FindType {
-		FindByThumbprint,
-		FindBySubjectName,
-		FindBySubjectDistinguishedName,
-		FindByIssuerName,
-		FindByIssuerDistinguishedName,
-		FindBySerialNumber,
-		FindByTimeValid,
-		FindByTimeNotYetValid,
-		FindByTimeExpired,
-		FindByTemplateName,
-		FindByApplicationPolicy,
-		FindByCertificatePolicy,
-		FindByExtension,
-		FindByKeyUsage,
-		FindBySubjectKeyIdentifier,
-	}
-}
-
-#endif

+ 0 - 45
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509IncludeOption.cs

@@ -1,45 +0,0 @@
-//
-// X509IncludeOption.cs - System.Security.Cryptography.X509IncludeOption
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum X509IncludeOption {
-		None,
-		ExcludeRoot,
-		EndCertOnly,
-		WholeChain
-	}
-}
-
-#endif

+ 0 - 254
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs

@@ -1,254 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509KeyUsageExtension
-//
-// Authors:
-//	Tim Coleman ([email protected])
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509KeyUsageExtension : X509Extension {
-
-		internal const string oid = "2.5.29.15";
-		internal const string friendlyName = "Key Usage";
-
-		internal const X509KeyUsageFlags all = X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.CrlSign | 
-			X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.KeyAgreement | X509KeyUsageFlags.DataEncipherment |
-			X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.NonRepudiation | 
-			X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.DecipherOnly;
-
-		private X509KeyUsageFlags _keyUsages;
-		private AsnDecodeStatus _status;
-
-		// constructors
-
-		public X509KeyUsageExtension ()
-		{
-			_oid = new Oid (oid, friendlyName);
-		}
-
-		public X509KeyUsageExtension (AsnEncodedData encodedKeyUsage, bool critical)
-		{
-			// ignore the Oid provided by encodedKeyUsage (our rules!)
-			_oid = new Oid (oid, friendlyName);
-			_raw = encodedKeyUsage.RawData;
-			base.Critical = critical;
-			_status = Decode (this.RawData);
-		}
-
-		public X509KeyUsageExtension (X509KeyUsageFlags keyUsages, bool critical)
-		{
-			_oid = new Oid (oid, friendlyName);
-			base.Critical = critical;
-			_keyUsages = GetValidFlags (keyUsages);
-			RawData = Encode ();
-		}
-
-		// properties
-
-		public X509KeyUsageFlags KeyUsages {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					return _keyUsages;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData encodedData)
-		{
-			if (encodedData == null)
-				throw new ArgumentNullException ("encodedData");
-
-			X509Extension ex = (encodedData as X509Extension);
-			if (ex == null)
-				throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
-
-			if (ex._oid == null)
-				_oid = new Oid (oid, friendlyName);
-			else 
-				_oid = new Oid (ex._oid);
-
-			RawData = ex.RawData;
-			base.Critical = ex.Critical;
-			// and we deal with the rest later
-			_status = Decode (this.RawData);
-		}
-
-		// internal
-
-		internal X509KeyUsageFlags GetValidFlags (X509KeyUsageFlags flags)
-		{
-			if ((flags & all) != flags)
-				return (X509KeyUsageFlags) 0;
-			return flags;
-		}
-
-		internal AsnDecodeStatus Decode (byte[] extension)
-		{
-			if ((extension == null) || (extension.Length == 0))
-				return AsnDecodeStatus.BadAsn;
-			if (extension [0] != 0x03)
-				return AsnDecodeStatus.BadTag;
-			if (extension.Length < 3)
-				return AsnDecodeStatus.BadLength;
-			if (extension.Length < 4)
-				return AsnDecodeStatus.InformationNotAvailable;
-
-			try {
-				ASN1 ex = new ASN1 (extension);
-				int kubits = 0;
-				int i = 1; // byte zero has the number of unused bits (ASN1's BITSTRING)
-				while (i < ex.Value.Length)
-					kubits = (kubits << 8) + ex.Value [i++];
-
-				_keyUsages = GetValidFlags ((X509KeyUsageFlags)kubits);
-			}
-			catch {
-				return AsnDecodeStatus.BadAsn;
-			}
-
-			return AsnDecodeStatus.Ok;
-		}
-
-		internal byte[] Encode ()
-		{
-			ASN1 ex = null;
-			int kubits = (int)_keyUsages;
-			byte empty = 0;
-
-			if (kubits == 0) {
-				ex = new ASN1 (0x03, new byte[] { empty });
-			} else {
-				// count empty bits (applicable to first byte only)
-				int ku = ((kubits < Byte.MaxValue) ? kubits : (kubits >> 8));
-				while (((ku & 0x01) == 0x00) && (empty < 8)) {
-					empty++;
-					ku >>= 1;
-				}
-
-				if (kubits <= Byte.MaxValue) {
-					ex = new ASN1 (0x03, new byte[] { empty, (byte)kubits });
-				} else {
-					ex = new ASN1 (0x03, new byte[] { empty, (byte)kubits, (byte)(kubits >> 8) });
-				}
-			}
-
-			return ex.GetBytes ();
-		}
-
-		internal override string ToString (bool multiLine)
-		{
-			switch (_status) {
-			case AsnDecodeStatus.BadAsn:
-				return String.Empty;
-			case AsnDecodeStatus.BadTag:
-			case AsnDecodeStatus.BadLength:
-				return FormatUnkownData (_raw);
-			case AsnDecodeStatus.InformationNotAvailable:
-				return "Information Not Available";
-			}
-
-			if (_oid.Value != oid)
-				return String.Format ("Unknown Key Usage ({0})", _oid.Value);
-			if (_keyUsages == 0)
-				return "Information Not Available";
-
-			StringBuilder sb = new StringBuilder ();
-
-			if ((_keyUsages & X509KeyUsageFlags.DigitalSignature) != 0) {
-				sb.Append ("Digital Signature");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.NonRepudiation) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Non-Repudiation");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.KeyEncipherment) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Key Encipherment");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.DataEncipherment) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Data Encipherment");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.KeyAgreement) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Key Agreement");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.KeyCertSign) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Certificate Signing");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.CrlSign) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Off-line CRL Signing, CRL Signing");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.EncipherOnly) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Encipher Only");
-			}
-			if ((_keyUsages & X509KeyUsageFlags.DecipherOnly) != 0) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Decipher Only");
-			}
-
-			int ku = (int)_keyUsages;
-			sb.Append (" (");
-			sb.Append (((byte)ku).ToString ("x2"));
-			if (ku > Byte.MaxValue) {
-				sb.Append (" ");
-				sb.Append (((byte)(ku >> 8)).ToString ("x2"));
-			}
-			sb.Append (")");
-
-			if (multiLine)
-				sb.Append (Environment.NewLine);
-
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 49
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs

@@ -1,49 +0,0 @@
-//
-// X509KeyUsageFlags.cs - System.Security.Cryptography.X509Certificates.X509KeyUsageFlags
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	[Flags]
-	public enum X509KeyUsageFlags {
-		None = 0,
-		EncipherOnly = 1,
-		CrlSign = 2,
-		KeyCertSign = 4,
-		KeyAgreement = 8,
-		DataEncipherment = 16,
-		KeyEncipherment = 32,
-		NonRepudiation = 64,
-		DigitalSignature = 128,
-		DecipherOnly = 32768
-	}
-}
-
-#endif

+ 0 - 43
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509NameType.cs

@@ -1,43 +0,0 @@
-//
-// X509NameType.cs - System.Security.Cryptography.X509NameType
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public enum X509NameType {
-		SimpleName,
-		EmailName,
-		UpnName,
-		DnsName,
-		UrlName
-	}
-}
-
-#endif

+ 0 - 42
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs

@@ -1,42 +0,0 @@
-//
-// X509RevocationFlag.cs - System.Security.Cryptography.X509Certificates.X509RevocationFlag
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	[Serializable]
-	public enum X509RevocationFlag {
-		EndCertificateOnly = 0,
-		EntireChain = 1,
-		ExcludeRoot = 2
-	}
-}
-
-#endif

+ 0 - 44
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509RevocationMode.cs

@@ -1,44 +0,0 @@
-//
-// X509RevocationMode.cs - System.Security.Cryptography.X509Certificates.X509RevocationMode
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum X509RevocationMode {
-		NoCheck,
-		Online,
-		Offline
-	}
-}
-
-#endif

+ 0 - 43
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs

@@ -1,43 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509SelectionFlag
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Serializable]
-	public enum X509SelectionFlag {
-		SingleSelection,
-		MultiSelection
-	}
-}
-
-#endif

+ 0 - 201
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Store.cs

@@ -1,201 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509Store class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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 Mono.Security.X509;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509Store {
-
-		private string _name;
-		private StoreLocation _location;
-		private X509Certificate2Collection _certs;
-		private OpenFlags _flags;
-
-		// constructors
-
-		// BUG: MY when using this constructor - My when using StoreName.My
-		public X509Store () 
-			: this ("MY", StoreLocation.CurrentUser) 
-		{
-		}
-
-		public X509Store (string storeName) 
-			: this (storeName, StoreLocation.CurrentUser) 
-		{
-		}
-
-		public X509Store (StoreName storeName) 
-			: this (StoreNameToString (storeName), StoreLocation.CurrentUser)
-		{
-		}
-
-		public X509Store (StoreLocation storeLocation) 
-			: this ("MY", storeLocation)
-		{
-		}
-
-		public X509Store (StoreName storeName, StoreLocation storeLocation)
-			: this (StoreNameToString (storeName), StoreLocation.CurrentUser)
-		{
-		}
-
-		public X509Store (IntPtr storeHandle)
-		{
-			// CryptoAPI compatibility (unmanaged handle)
-			throw new NotSupportedException ();
-		}
-
-		[MonoTODO ("call Mono.Security.X509.X509Store*")]
-		public X509Store (string storeName, StoreLocation storeLocation)
-		{
-			if (storeName == null)
-				throw new ArgumentNullException ("storeName");
-
-			_name = storeName;
-			_location = storeLocation;
-		}
-
-		// properties
-
-		public X509Certificate2Collection Certificates {
-			get { 
-				if (_certs == null)
-					_certs = new X509Certificate2Collection ();
-				return _certs; 
-			}
-		} 
-
-		public StoreLocation Location {
-			get { return _location; }
-		}
-
-		public string Name {
-			get { return _name; }
-		}
-
-		private bool ReadOnly {
-			get { return ((_flags & OpenFlags.ReadOnly) != OpenFlags.ReadOnly); }
-		}
-
-		public IntPtr StoreHandle {
-			get { return IntPtr.Zero; }
-		}
-
-		// methods
-
-		private static string StoreNameToString (StoreName sn) 
-		{
-			switch (sn) {
-				case StoreName.CertificateAuthority:
-					return "CA";
-				default:
-					return sn.ToString ();
-			}
-		}
-
-		[MonoTODO ("call Mono.Security.X509.X509Store*")]
-		public void Add (X509Certificate2 certificate)
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-
-			if (!ReadOnly) {
-				try {
-					new Mono.Security.X509.X509Certificate (certificate.RawData);
-					// Mono.Security.X509.X509Certificate x = new Mono.Security.X509.X509Certificate (certificate.RawData);
-					// TODO
-				}
-				catch {
-					throw new CryptographicException ("couldn't add certificate");
-				}
-			}
-		}
-
-		public void AddRange (X509Certificate2Collection certificates)
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificates");
-
-			if (!ReadOnly) {
-				foreach (X509Certificate2 certificate in certificates) {
-					Add (certificate);
-				}
-			}
-		}
-
-		[MonoTODO ("call Mono.Security.X509.X509Store*")]
-		public void Close () 
-		{
-		}
-
-		[MonoTODO ("call Mono.Security.X509.X509Store*")]
-		public void Open (OpenFlags flags)
-		{
-			_flags = flags;
-			/*bool readOnly = ((flags & OpenFlags.ReadOnly) == OpenFlags.ReadOnly);
-			bool create = !((flags & OpenFlags.OpenExistingOnly) == OpenFlags.OpenExistingOnly);
-			bool archive = ((flags & OpenFlags.IncludeArchived) == OpenFlags.IncludeArchived);*/
-			// TODO
-		}
-
-		[MonoTODO ("call Mono.Security.X509.X509Store*")]
-		public void Remove (X509Certificate2 certificate) 
-		{
-			if (certificate == null)
-				throw new ArgumentNullException ("certificate");
-
-			if (!ReadOnly) {
-				try {
-					//Mono.Security.X509.X509Certificate x = new Mono.Security.X509.X509Certificate (certificate.RawData);
-					// TODO
-				}
-				catch {
-					throw new CryptographicException ("couldn't remove certificate");
-				}
-			}
-		}
-
-		public void RemoveRange (X509Certificate2Collection certificates) 
-		{
-			if (certificates == null)
-				throw new ArgumentNullException ("certificates");
-
-			if (!this.ReadOnly) {
-				foreach (X509Certificate2 certificate in certificates) {
-					Remove (certificate);
-				}
-			}
-		}
-	}
-}
-
-#endif

+ 0 - 242
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs

@@ -1,242 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension
-//
-// Authors:
-//	Tim Coleman ([email protected])
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 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.Text;
-
-using Mono.Security;
-using Mono.Security.Cryptography;
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	public sealed class X509SubjectKeyIdentifierExtension : X509Extension {
-
-		internal const string oid = "2.5.29.14";
-		internal const string friendlyName = "Subject Key Identifier";
-
-		private byte[] _subjectKeyIdentifier;
-		private string _ski;
-		private AsnDecodeStatus _status;
-
-		// constructors
-
-		public X509SubjectKeyIdentifierExtension ()
-		{
-			_oid = new Oid (oid, friendlyName);
-		}
-
-		public X509SubjectKeyIdentifierExtension (AsnEncodedData encodedSubjectKeyIdentifier, bool critical)
-		{
-			// ignore the Oid provided by encodedKeyUsage (our rules!)
-			_oid = new Oid (oid, friendlyName);
-			_raw = encodedSubjectKeyIdentifier.RawData;
-			base.Critical = critical;
-			_status = Decode (this.RawData);
-		}
-
-		public X509SubjectKeyIdentifierExtension (byte[] subjectKeyIdentifier, bool critical)
-		{
-			if (subjectKeyIdentifier == null)
-				throw new ArgumentNullException ("subjectKeyIdentifier");
-			if (subjectKeyIdentifier.Length == 0)
-				throw new ArgumentException ("subjectKeyIdentifier");
-
-			_oid = new Oid (oid, friendlyName);
-			base.Critical = critical;
-			_subjectKeyIdentifier = (byte[])subjectKeyIdentifier.Clone ();
-			RawData = Encode ();
-		}
-
-		public X509SubjectKeyIdentifierExtension (string subjectKeyIdentifier, bool critical)
-		{
-			if (subjectKeyIdentifier == null)
-				throw new ArgumentNullException ("subjectKeyIdentifier");
-			if (subjectKeyIdentifier.Length < 2)
-				throw new ArgumentException ("subjectKeyIdentifier");
-
-			_oid = new Oid (oid, friendlyName);
-			base.Critical = critical;
-			_subjectKeyIdentifier = FromHex (subjectKeyIdentifier);
-			RawData = Encode ();
-		}
-
-		[MonoTODO]
-		public X509SubjectKeyIdentifierExtension (PublicKey key, bool critical)
-			: this (key, X509SubjectKeyIdentifierHashAlgorithm.Sha1, critical)
-		{
-		}
-
-		[MonoTODO]
-		public X509SubjectKeyIdentifierExtension (PublicKey key, X509SubjectKeyIdentifierHashAlgorithm algorithm, bool critical)
-		{
-			if (key == null)
-				throw new ArgumentNullException ("key");
-		}
-
-		// properties
-
-		public string SubjectKeyIdentifier {
-			get {
-				switch (_status) {
-				case AsnDecodeStatus.Ok:
-				case AsnDecodeStatus.InformationNotAvailable:
-					if (_subjectKeyIdentifier != null)
-						_ski = CryptoConvert.ToHex (_subjectKeyIdentifier);
-					return _ski;
-				default:
-					throw new CryptographicException ("Badly encoded extension.");
-				}
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData encodedData)
-		{
-			if (encodedData == null)
-				throw new ArgumentNullException ("encodedData");
-
-			X509Extension ex = (encodedData as X509Extension);
-			if (ex == null)
-				throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
-
-			if (ex._oid == null)
-				_oid = new Oid (oid, friendlyName);
-			else 
-				_oid = new Oid (ex._oid);
-
-			RawData = ex.RawData;
-			base.Critical = ex.Critical;
-			// and we deal with the rest later
-			_status = Decode (this.RawData);
-		}
-
-		// internal
-
-		static internal byte FromHexChar (char c) 
-		{
-			if ((c >= 'a') && (c <= 'f'))
-				return (byte) (c - 'a' + 10);
-			if ((c >= 'A') && (c <= 'F'))
-				return (byte) (c - 'A' + 10);
-			if ((c >= '0') && (c <= '9'))
-				return (byte) (c - '0');
-			return 255;	// F
-		}
-
-		static internal byte FromHexChars (char c1, char c2)
-		{
-			byte result = FromHexChar (c1);
-			if (result < 255)
-				result = (byte) ((result << 4) | FromHexChar (c2));
-			return result;
-		}
-
-		static internal byte[] FromHex (string hex)
-		{
-			// here we can't use CryptoConvert.FromHex because we
-			// must convert any *illegal* (non hex) 2 characters 
-			// to 'FF' and ignore last char on odd length
-			if (hex == null)
-				return null;
-
-			int length = hex.Length >> 1;
-
-			byte[] result = new byte [length]; // + (odd ? 1 : 0)];
-			int n = 0;
-			int i = 0;
-			while (n < length) {
-				result [n++] = FromHexChars (hex [i++], hex [i++]);
-			}
-			return result;
-		}
-
-		internal AsnDecodeStatus Decode (byte[] extension)
-		{
-			if ((extension == null) || (extension.Length == 0))
-				return AsnDecodeStatus.BadAsn;
-			_ski = String.Empty;
-			if (extension [0] != 0x04)
-				return AsnDecodeStatus.BadTag;
-			if (extension.Length == 2)
-				return AsnDecodeStatus.InformationNotAvailable;
-			if (extension.Length < 3)
-				return AsnDecodeStatus.BadLength;
-
-			try {
-				ASN1 ex = new ASN1 (extension);
-				_subjectKeyIdentifier = ex.Value;
-			}
-			catch {
-				return AsnDecodeStatus.BadAsn;
-			}
-
-			return AsnDecodeStatus.Ok;
-		}
-
-		internal byte[] Encode ()
-		{
-			ASN1 ex = new ASN1 (0x04, _subjectKeyIdentifier);
-			return ex.GetBytes ();
-		}
-
-		internal override string ToString (bool multiLine)
-		{
-			switch (_status) {
-			case AsnDecodeStatus.BadAsn:
-				return String.Empty;
-			case AsnDecodeStatus.BadTag:
-			case AsnDecodeStatus.BadLength:
-				return FormatUnkownData (_raw);
-			case AsnDecodeStatus.InformationNotAvailable:
-				return "Information Not Available";
-			}
-
-			if (_oid.Value != oid)
-				return String.Format ("Unknown Key Usage ({0})", _oid.Value);
-
-			StringBuilder sb = new StringBuilder ();
-
-			for (int i=0; i < _subjectKeyIdentifier.Length; i++) {
-				sb.Append (_subjectKeyIdentifier [i].ToString ("x2"));
-				if (i != _subjectKeyIdentifier.Length - 1)
-					sb.Append (" ");
-			}
-
-			if (multiLine)
-				sb.Append (Environment.NewLine);
-
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 41
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs

@@ -1,41 +0,0 @@
-//
-// System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierHashAlgorithm
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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
-
-namespace System.Security.Cryptography.X509Certificates {
-
-	[Serializable]
-	public enum X509SubjectKeyIdentifierHashAlgorithm {
-		Sha1 = 0,
-		ShortSha1 = 1,
-		CapiSha1 = 2
-	}
-}
-
-#endif

+ 0 - 60
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs

@@ -1,60 +0,0 @@
-//
-// X509VerificationFlags.cs - System.Security.Cryptography.X509Certificates.X509VerificationFlags
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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.X509Certificates {
-
-	[Flags]
-	[Serializable]
-	public enum X509VerificationFlags {
-		NoFlag = 0,
-		IgnoreNotTimeValid = 1,
-		IgnoreCtlNotTimeValid = 2,
-		IgnoreNotTimeNested = 4,
-		IgnoreInvalidBasicConstraints = 8,
-		AllowUnknownCertificateAuthority = 16,
-		IgnoreWrongUsage = 32,
-		IgnoreInvalidName = 64,
-		IgnoreInvalidPolicy = 128,
-		IgnoreEndRevocationUnknown = 256,
-		IgnoreCtlSignerRevocationUnknown = 512,
-		IgnoreCertificateAuthorityRevocationUnknown = 1024,
-		IgnoreRootRevocationUnknown = 2048,
-		AllFlags = IgnoreNotTimeValid | IgnoreCtlNotTimeValid | IgnoreNotTimeNested |
-			IgnoreInvalidBasicConstraints | AllowUnknownCertificateAuthority |
-			IgnoreWrongUsage | IgnoreInvalidName | IgnoreInvalidPolicy | 
-			IgnoreEndRevocationUnknown | IgnoreCtlSignerRevocationUnknown |
-			IgnoreCertificateAuthorityRevocationUnknown | IgnoreRootRevocationUnknown
-	}
-}
-
-#endif

+ 0 - 319
mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs

@@ -1,319 +0,0 @@
-//
-// AsnEncodedData.cs - System.Security.Cryptography.AsnEncodedData
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 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.Security.Cryptography.X509Certificates;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.Cryptography;
-
-namespace System.Security.Cryptography {
-
-	internal enum AsnDecodeStatus {
-		NotDecoded = -1,
-		Ok = 0,
-		BadAsn = 1,
-		BadTag = 2,
-		BadLength = 3,
-		InformationNotAvailable = 4
-	}
-
-	public class AsnEncodedData {
-
-		internal Oid _oid;
-		internal byte[] _raw;
-
-		// constructors
-
-		protected AsnEncodedData ()
-		{
-		}
-	
-		public AsnEncodedData (string oid, byte[] rawData)
-		{
-			_oid = new Oid (oid);
-			RawData = rawData;
-		}
-
-		public AsnEncodedData (Oid oid, byte[] rawData)
-		{
-			Oid = oid;
-			RawData = rawData;
-
-			// yes, here oid == null is legal (by design), 
-			// but no, it would not be legal for an oid string
-			// see MSDN FDBK11479
-		}
-
-		public AsnEncodedData (AsnEncodedData asnEncodedData)
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("asnEncodedData");
-
-			Oid = new Oid (asnEncodedData._oid);
-			RawData = asnEncodedData._raw;
-		}
-
-		public AsnEncodedData (byte[] rawData)
-		{
-			RawData = rawData;
-		}
-
-		// properties
-
-		public Oid Oid {
-			get { return _oid; }
-			set {
-				if (value == null)
-					_oid = null;
-				else
-					_oid = new Oid (value);
-			}
-		}
-
-		public byte[] RawData { 
-			get { return _raw; }
-			set {
-				if (value == null)
-					throw new ArgumentNullException ("RawData");
-				_raw = (byte[])value.Clone ();
-			}
-		}
-
-		// methods
-
-		public virtual void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("asnEncodedData");
-
-			if (asnEncodedData._oid == null)
-				Oid = null;
-			else
-				Oid = new Oid (asnEncodedData._oid);
-
-			RawData = asnEncodedData._raw;
-		}
-
-		public virtual string Format (bool multiLine) 
-		{
-			if (_raw == null)
-				return String.Empty;
-
-			if (_oid == null)
-				return Default (multiLine);
-
-			return ToString (multiLine);
-		}
-
-		// internal decoding/formatting methods
-
-		internal virtual string ToString (bool multiLine)
-		{
-			switch (_oid.Value) {
-			// fx supported objects
-			case X509BasicConstraintsExtension.oid:
-				return BasicConstraintsExtension (multiLine);
-			case X509EnhancedKeyUsageExtension.oid:
-				return EnhancedKeyUsageExtension (multiLine);
-			case X509KeyUsageExtension.oid:
-				return KeyUsageExtension (multiLine);
-			case X509SubjectKeyIdentifierExtension.oid:
-				return SubjectKeyIdentifierExtension (multiLine);
-			// other known objects (i.e. supported structure) - 
-			// but without any corresponding framework class
-			case Oid.oidSubjectAltName:
-				return SubjectAltName (multiLine);
-			case Oid.oidNetscapeCertType:
-				return NetscapeCertType (multiLine);
-			default:
-				return Default (multiLine);
-			}
-		}
-
-		internal string Default (bool multiLine)
-		{
-			StringBuilder sb = new StringBuilder ();
-			for (int i=0; i < _raw.Length; i++) {
-				sb.Append (_raw [i].ToString ("x2"));
-				if (i != _raw.Length - 1)
-					sb.Append (" ");
-			}
-			return sb.ToString ();
-		}
-
-		// Indirectly (undocumented but) supported extensions
-
-		internal string BasicConstraintsExtension (bool multiLine)
-		{
-			try {
-				X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension  (this, false);
-				return bc.ToString (multiLine);
-			}
-			catch {
-				return String.Empty;
-			}
-		}
-
-		internal string EnhancedKeyUsageExtension (bool multiLine)
-		{
-			try {
-				X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension  (this, false);
-				return eku.ToString (multiLine);
-			}
-			catch {
-				return String.Empty;
-			}
-		}
-
-		internal string KeyUsageExtension (bool multiLine)
-		{
-			try {
-				X509KeyUsageExtension ku = new X509KeyUsageExtension  (this, false);
-				return ku.ToString (multiLine);
-			}
-			catch {
-				return String.Empty;
-			}
-		}
-
-		internal string SubjectKeyIdentifierExtension (bool multiLine)
-		{
-			try {
-				X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension  (this, false);
-				return ski.ToString (multiLine);
-			}
-			catch {
-				return String.Empty;
-			}
-		}
-
-		// Indirectly (undocumented but) supported extensions
-
-		internal string SubjectAltName (bool multiLine)
-		{
-			if (_raw.Length < 5)
-				return "Information Not Available";
-
-			try {
-				ASN1 ex = new ASN1 (_raw);
-				StringBuilder sb = new StringBuilder ();
-				for (int i=0; i < ex.Count; i++) {
-					ASN1 el = ex [i];
-
-					string type = null;
-					string name = null;
-
-					switch (el.Tag) {
-					case 0x81:
-						type = "RFC822 Name=";
-						name = Encoding.ASCII.GetString (el.Value);
-						break;
-					case 0x82:
-						type = "DNS Name=";
-						name = Encoding.ASCII.GetString (el.Value);
-						break;
-					default:
-						type = String.Format ("Unknown ({0})=", el.Tag);
-						name = CryptoConvert.ToHex (el.Value);
-						break;
-					}
-
-					sb.Append (type);
-					sb.Append (name);
-					if (multiLine) {
-						sb.Append (Environment.NewLine);
-					} else if (i < ex.Count - 1) {
-						sb.Append (", ");
-					}
-				}
-				return sb.ToString ();
-			}
-			catch {
-				return String.Empty;
-			}
-		}
-
-		internal string NetscapeCertType (bool multiLine)
-		{
-			// 4 byte long, BITSTRING (0x03), Value length of 2
-			if ((_raw.Length < 4) || (_raw [0] != 0x03) || (_raw [1] != 0x02))
-				return "Information Not Available";
-			// first value byte is the number of unused bits
-			int value = (_raw [3] >> _raw [2]) << _raw [2];
-
-			StringBuilder sb = new StringBuilder ();
-
-			if ((value & 0x80) == 0x80) {
-				sb.Append ("SSL Client Authentication");
-			}
-			if ((value & 0x40) == 0x40) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("SSL Server Authentication");
-			}
-			if ((value & 0x20) == 0x20) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("SMIME");
-			}
-			if ((value & 0x10) == 0x10) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Signature"); // a.k.a. Object Signing / Code Signing
-			}
-			if ((value & 0x08) == 0x08) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Unknown cert type");
-			}
-			if ((value & 0x04) == 0x04) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("SSL CA");	// CA == Certificate Authority
-			}
-			if ((value & 0x02) == 0x02) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("SMIME CA");
-			}
-			if ((value & 0x01) == 0x01) {
-				if (sb.Length > 0)
-					sb.Append (", ");
-				sb.Append ("Signature CA");
-			}
-			sb.AppendFormat (" ({0})", value.ToString ("x2"));
-			return sb.ToString ();
-		}
-	}
-}
-
-#endif

+ 0 - 102
mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs

@@ -1,102 +0,0 @@
-//
-// System.Security.Cryptography.AsnEncodedDataCollection
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
-	public sealed class AsnEncodedDataCollection : ICollection, IEnumerable {
-
-		private ArrayList _list;
-
-		// constructors
-
-		public AsnEncodedDataCollection ()
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return _list.IsSynchronized; }
-		}
-
-		public AsnEncodedData this [int index] {
-			get { return (AsnEncodedData) _list [index]; }
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		// methods
-
-		public int Add (AsnEncodedData asnEncodedData)
-		{
-			return _list.Add (asnEncodedData);
-		}
-
-		public void CopyTo (AsnEncodedData[] array, int index)
-		{
-			_list.CopyTo ((Array)array, index);
-		}
-
-		// to satisfy ICollection - private
-		void ICollection.CopyTo (Array array, int index)
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public AsnEncodedDataEnumerator GetEnumerator () 
-		{
-			return new AsnEncodedDataEnumerator (this);
-		}
-
-		// to satisfy IEnumerator - private
-		IEnumerator IEnumerable.GetEnumerator () 
-		{
-			return new AsnEncodedDataEnumerator (this);
-		}
-
-		public void Remove (AsnEncodedData asnEncodedData)
-		{
-			_list.Remove (asnEncodedData);
-		}
-	}
-}
-
-#endif

+ 0 - 88
mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs

@@ -1,88 +0,0 @@
-//
-// System.Security.Cryptography.AsnEncodedDataEnumerator
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
-	public sealed class AsnEncodedDataEnumerator : IEnumerator {
-
-		private AsnEncodedDataCollection _collection;
-		private int _position;
-
-		// note: couldn't reuse the IEnumerator from ArrayList because 
-		// it doesn't throw the same exceptions
-		internal AsnEncodedDataEnumerator (AsnEncodedDataCollection collection) 
-		{
-			_collection = collection;
-			_position = -1;
-		}
-
-		// properties
-
-		public AsnEncodedData Current {
-			get {
-				if (_position < 0)
-					throw new ArgumentOutOfRangeException ();
-				return (AsnEncodedData) _collection [_position];
-			}
-		}
-
-		object IEnumerator.Current {
-			get {
-				if (_position < 0)
-					throw new ArgumentOutOfRangeException ();
-				return _collection [_position];
-			}
-		}
-
-		// methods
-
-		public bool MoveNext () 
-		{
-			if (++_position < _collection.Count)
-				return true;
-			else {
-				// strangely we must always be able to return the last entry 
-				_position = _collection.Count - 1;
-				return false;
-			}
-		}
-
-		public void Reset () 
-		{
-			_position = -1;
-		}
-	}
-}
-
-#endif

+ 2 - 33
mcs/class/System.Security/System.Security.Cryptography/ChangeLog

@@ -1,10 +1,6 @@
-2005-05-03  Sebastien Pouliot  <[email protected]>
+2005-09-26  Sebastien Pouliot  <[email protected]>
 
-	* AsnEncodedData.cs: Allow CopyFrom to work even without an OID.
-
-2005-04-25  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedData.cs: Fix compiler warning (unused variable).
+	* Asn*.cs, Oid*.cs: Moved to System.dll
 
 2005-04-23  Sebastien Pouliot  <[email protected]>
 
@@ -15,42 +11,15 @@
 	* CryptographicAttributeEnumerator.cs: Renamed class to Cryptographic
 	AttributeObjectEnumerator to match beta2.
 
-2005-01-20  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedData.cs: Added "internal" support for SubjectAltName 
-	extension as it is required for SSL support.
-	* Oid.cs: Added Oid / FriendlyName definitions for SubjectAltName.
-
-2005-01-17  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedData.cs: Added more decoding/formatting code as this class
-	is far more intelligent (or bloated) than anticipated.
-	* Oid.cs: Added more Oid / FriendlyName definitions required for the
-	X.509 extensions and some more for some failing unit tests.
-	* OidCollection.cs: Added support to make the collection read-only.
-
 2005-01-13  Sebastien Pouliot  <[email protected]>
 
-	* AsnEncodedData.cs: Completed/fixed implementation.
 	* CryptographicAttribute.cs: Fixed implementation with updated unit
 	tests.
-	* Oid.cs: Fixed implementation with updated unit tests.
 
 2004-07-08  Sebastien Pouliot  <[email protected]>
 
-	* AsnEncodedData.cs: Fixes for Fx 2.0 beta 1 compatibility. Added
-	MonoTODO to missing functionalities.
-	* AsnEncodedDataCollection.cs: New. 
-	* AsnEncodedDataEnumerator.cs: New.
 	* CryptographicAttribute.cs: New. Moved from S.S.C.Pkcs.
 	* CryptographicAttributeCollection.cs: New. Replace S.S.C.Pkcs.
 	Pkcs9AttributeCollection.
 	* CryptographicAttributeEnumerator.cs: New. Replace S.S.C.Pkcs.
 	Pkcs9AttributeEnumerator.
-
-2003-11-06  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedData.cs: New. Class to encapsulate ASN.1 data (.NET 1.2).
-	* Oid.cs: New. Class to encapsulate OIDs (.NET 1.2).
-	* OidCollection.cs: New. ICollection based class for OIDs (.NET 1.2).
-	* OidEnumerator.cs: New. IEnumerator based class for OIDs (.NET 1.2).

+ 0 - 184
mcs/class/System.Security/System.Security.Cryptography/Oid.cs

@@ -1,184 +0,0 @@
-//
-// Oid.cs - System.Security.Cryptography.Oid
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 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.Security.Cryptography.Pkcs;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography {
-
-	public sealed class Oid {
-
-		private string _value;
-		private string _name;
-
-		// constructors
-
-		public Oid ()
-		{
-		}
-
-		public Oid (string oid) 
-		{
-			if (oid == null)
-				throw new ArgumentNullException ("oid");
-
-			_value = oid;
-			_name = GetName (oid);
-		}
-
-		public Oid (string value, string friendlyName)
-		{
-			_value = value;
-			_name = friendlyName;
-		}
-
-		public Oid (Oid oid) 
-		{
-			if (oid == null)
-				throw new ArgumentNullException ("oid");
-
-			_value = oid.Value;
-			_name = oid.FriendlyName;
-		}
-
-		// properties
-
-		public string FriendlyName {
-			get { return _name; }
-			set { 
-				_name = value;
-				_value = GetValue (_name);
-			}
-		}
-
-		public string Value { 
-			get { return _value; }
-			set { 
-				_value = value; 
-				_name = GetName (_value);
-			}
-		}
-
-		// internal stuff
-
-		// Known OID/Names not defined anywhere else (by OID order)
-		internal const string oidRSA = "1.2.840.113549.1.1.1";
-		internal const string nameRSA = "RSA";
-		internal const string oidPkcs7Data = "1.2.840.113549.1.7.1";
-		internal const string namePkcs7Data = "PKCS 7 Data";
-		internal const string oidMd5 = "1.2.840.113549.2.5";
-		internal const string nameMd5 = "md5";
-		internal const string oid3Des = "1.2.840.113549.3.7";
-		internal const string name3Des = "3des";
-		internal const string oidSha1 = "1.3.14.3.2.26";
-		internal const string nameSha1 = "sha1";
-		internal const string oidSubjectAltName = "2.5.29.17";
-		internal const string nameSubjectAltName = "Subject Alternative Name";
-		internal const string oidNetscapeCertType = "2.16.840.1.113730.1.1";
-		internal const string nameNetscapeCertType = "Netscape Cert Type";
-
-		// TODO - find the complete list
-		private string GetName (string oid) 
-		{
-			switch (oid) {
-				case oidRSA:
-					return nameRSA;
-				case oidPkcs7Data:
-					return namePkcs7Data;
-				case Pkcs9ContentType.oid:
-					return Pkcs9ContentType.friendlyName;
-				case Pkcs9MessageDigest.oid:
-					return Pkcs9MessageDigest.friendlyName;
-				case Pkcs9SigningTime.oid:
-					return Pkcs9SigningTime.friendlyName;
-				case oid3Des:
-					return name3Des;
-				case X509BasicConstraintsExtension.oid:
-					return X509BasicConstraintsExtension.friendlyName;
-				case X509KeyUsageExtension.oid:
-					return X509KeyUsageExtension.friendlyName;
-				case X509EnhancedKeyUsageExtension.oid:
-					return X509EnhancedKeyUsageExtension.friendlyName;
-				case X509SubjectKeyIdentifierExtension.oid:
-					return X509SubjectKeyIdentifierExtension.friendlyName;
-				case oidSubjectAltName:
-					return nameSubjectAltName;
-				case oidNetscapeCertType:
-					return nameNetscapeCertType;
-				case oidMd5:
-					return nameMd5;
-				case oidSha1:
-					return nameSha1;
-				default:
-					return _name;
-			}
-		}
-
-		// TODO - find the complete list
-		private string GetValue (string name) 
-		{
-			switch (name) {
-				case nameRSA:
-					return oidRSA;
-				case namePkcs7Data:
-					return oidPkcs7Data;
-				case Pkcs9ContentType.friendlyName:
-					return Pkcs9ContentType.oid;
-				case Pkcs9MessageDigest.friendlyName:
-					return Pkcs9MessageDigest.oid;
-				case Pkcs9SigningTime.friendlyName:
-					return Pkcs9SigningTime.oid;
-				case name3Des:
-					return oid3Des;
-				case X509BasicConstraintsExtension.friendlyName:
-					return X509BasicConstraintsExtension.oid;
-				case X509KeyUsageExtension.friendlyName:
-					return X509KeyUsageExtension.oid;
-				case X509EnhancedKeyUsageExtension.friendlyName:
-					return X509EnhancedKeyUsageExtension.oid;
-				case X509SubjectKeyIdentifierExtension.friendlyName:
-					return X509SubjectKeyIdentifierExtension.oid;
-				case nameSubjectAltName:
-					return oidSubjectAltName;
-				case nameNetscapeCertType:
-					return oidNetscapeCertType;
-				case nameMd5:
-					return oidMd5;
-				case nameSha1:
-					return oidSha1;
-				default:
-					return _value;
-			}
-		}
-	}
-}
-
-#endif

+ 0 - 124
mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs

@@ -1,124 +0,0 @@
-//
-// OidCollection.cs - System.Security.Cryptography.OidCollection
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 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.Collections;
-
-namespace System.Security.Cryptography {
-
-	public sealed class OidCollection : ICollection, IEnumerable {
-
-		private ArrayList _list;
-		private bool _readOnly;
-
-		// constructors
-
-		public OidCollection ()
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return _list.IsSynchronized; }
-		}
-
-		public Oid this [int index] {
-			get { return (Oid) _list [index]; }
-		}
-
-		public Oid this [string oid] {
-			get { 
-				foreach (Oid o in _list) {
-					if (o.Value == oid)
-						return o;
-				}
-				return null; 
-			}
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		// methods
-
-		public int Add (Oid oid)
-		{
-			return (_readOnly ? 0 : _list.Add (oid));
-		}
-
-		public void CopyTo (Oid[] array, int index)
-		{
-			_list.CopyTo ((Array)array, index);
-		}
-
-		// to satisfy ICollection - private
-		void ICollection.CopyTo (Array array, int index)
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public OidEnumerator GetEnumerator () 
-		{
-			return new OidEnumerator (this);
-		}
-
-		// to satisfy IEnumerator - private
-		IEnumerator IEnumerable.GetEnumerator () 
-		{
-			return new OidEnumerator (this);
-		}
-
-		// internal stuff
-
-		internal bool ReadOnly {
-			get { return _readOnly; }
-			set { _readOnly = value; }
-		}
-
-		internal OidCollection ReadOnlyCopy ()
-		{
-			OidCollection copy = new OidCollection ();
-			foreach (Oid oid in _list) {
-				copy.Add (oid);
-			}
-			copy._readOnly = true;
-			return copy;
-		}
-	}
-}
-
-#endif

+ 0 - 91
mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs

@@ -1,91 +0,0 @@
-//
-// OidEnumerator.cs - System.Security.Cryptography.OidEnumerator
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.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;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
-	// Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
-	public sealed class OidEnumerator : IEnumerator {
-
-		private OidCollection _collection;
-		private int _position;
-
-		// note: couldn't reuse the IEnumerator from ArrayList because 
-		// it doesn't throw the same exceptions
-		internal OidEnumerator (OidCollection collection) 
-		{
-			_collection = collection;
-			_position = -1;
-		}
-
-		// properties
-
-		public Oid Current {
-			get {
-				if (_position < 0)
-					throw new ArgumentOutOfRangeException ();
-				return (Oid) _collection [_position];
-			}
-		}
-
-		object IEnumerator.Current {
-			get {
-				if (_position < 0)
-					throw new ArgumentOutOfRangeException ();
-				return _collection [_position];
-			}
-		}
-
-		// methods
-
-		public bool MoveNext () 
-		{
-			if (++_position < _collection.Count)
-				return true;
-			else {
-				// strangely we must always be able to return the last entry 
-				_position = _collection.Count - 1;
-				return false;
-			}
-		}
-
-		public void Reset () 
-		{
-			_position = -1;
-		}
-	}
-}
-
-#endif

+ 4 - 17
mcs/class/System.Security/System.Security.Permissions/ChangeLog

@@ -1,14 +1,11 @@
+2005-09-26  Sebastien Pouliot  <[email protected]>
+
+	* Store*.cs: Moved in System.dll
+
 2005-05-18  Jordi Mas i Hernandez <[email protected]>
 
 	* DataProtectionPermissionAttribute.cs: fixes flag cleaning logical operation
-	* StorePermissionAttribute.cs: fixes flag cleaning logical operation
 	
-2005-04-23  Sebastien Pouliot  <[email protected]> 
-
-	* StorePermission.cs: New. CAS permission to access certificate stores.
-	* StorePermissionAttribute.cs: New. CAS permission attribute for
-	StorePermission.
-
 2005-01-05  Sebastien Pouliot  <[email protected]> 
 
 	* DataProtectionPermission.cs: Removed IBuiltInPermission (it's not in
@@ -20,13 +17,3 @@
 	* DataProtectionPermission.cs: Moved from corlib.
 	* DataProtectionPermissionAttribute.cs: Moved from corlib.
 	* DataProtectionPermissionFlags.cs: Moved from corlib.
-
-2004-07-08  Sebastien Pouliot  <[email protected]>
-
-	* StorePermissionFlags.cs: Fixed flags values. Added [Serializable]
-	attribute.
-
-2004-07-07  Sebastien Pouliot  <[email protected]>
-
-	* StorePermissionFlags.cs: New. CAS-related enum for StorePermission.
-	Adding it "creates" the namespace for corcompare.

+ 0 - 155
mcs/class/System.Security/System.Security.Permissions/StorePermission.cs

@@ -1,155 +0,0 @@
-//
-// System.Security.Permissions.StorePermission class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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.Globalization;
-
-namespace System.Security.Permissions {
-	
-	[Serializable]
-	public sealed class StorePermission : CodeAccessPermission, IUnrestrictedPermission {
-
-		private const int version = 1;
-
-		private StorePermissionFlags _flags;
-
-
-		public StorePermission (PermissionState state)
-		{
-			if (PermissionHelper.CheckPermissionState (state, true) == PermissionState.Unrestricted)
-				_flags = StorePermissionFlags.AllFlags;
-			else
-				_flags = StorePermissionFlags.NoFlags;
-		}
-
-		public StorePermission (StorePermissionFlags flags) 
-		{
-			// reuse validation by the Flags property
-			Flags = flags;
-		}
-
-
-		public StorePermissionFlags Flags {
-			get { return _flags; }
-			set {
-				if (!Enum.IsDefined (typeof (StorePermissionFlags), value)) {
-					string msg = String.Format (Locale.GetText ("Invalid enum {0}"), value);
-					throw new ArgumentException (msg, "StorePermissionFlags");
-				}
-				_flags = value;
-			}
-		}
-
-		public bool IsUnrestricted () 
-		{
-			return (_flags == StorePermissionFlags.AllFlags);
-		}
-
-		public override IPermission Copy () 
-		{
-			return new StorePermission (_flags);
-		}
-
-		public override IPermission Intersect (IPermission target) 
-		{
-			StorePermission dp = Cast (target);
-			if (dp == null)
-				return null;
-
-			if (this.IsUnrestricted () && dp.IsUnrestricted ())
-				return new StorePermission (PermissionState.Unrestricted);
-			if (this.IsUnrestricted ())
-				return dp.Copy ();
-			if (dp.IsUnrestricted ())
-				return this.Copy ();
-			return new StorePermission (_flags & dp._flags);
-		}
-
-		public override IPermission Union (IPermission target) 
-		{
-			StorePermission dp = Cast (target);
-			if (dp == null)
-				return this.Copy ();
-
-			if (this.IsUnrestricted () || dp.IsUnrestricted ())
-				return new SecurityPermission (PermissionState.Unrestricted);
-			
-			return new StorePermission (_flags | dp._flags);
-		}
-
-		public override bool IsSubsetOf (IPermission target) 
-		{
-			StorePermission dp = Cast (target);
-			if (dp == null) 
-				return (_flags == StorePermissionFlags.NoFlags);
-
-			if (dp.IsUnrestricted ())
-				return true;
-			if (this.IsUnrestricted ())
-				return false;
-
-			return ((_flags & ~dp._flags) == 0);
-		}
-
-		public override void FromXml (SecurityElement e) 
-		{
-			// General validation in CodeAccessPermission
-			PermissionHelper.CheckSecurityElement (e, "e", version, version);
-			// Note: we do not (yet) care about the return value 
-			// as we only accept version 1 (min/max values)
-
-			_flags = (StorePermissionFlags) Enum.Parse (
-				typeof (StorePermissionFlags), e.Attribute ("Flags"));
-		}
-
-		public override SecurityElement ToXml () 
-		{
-			SecurityElement e = PermissionHelper.Element (typeof (StorePermission), version);
-			e.AddAttribute ("Flags", _flags.ToString ());
-			return e;
-		}
-
-		// helpers
-
-		private StorePermission Cast (IPermission target)
-		{
-			if (target == null)
-				return null;
-
-			StorePermission dp = (target as StorePermission);
-			if (dp == null) {
-				PermissionHelper.ThrowInvalidPermission (target, typeof (StorePermission));
-			}
-
-			return dp;
-		}
-	}
-}
-
-#endif

+ 0 - 159
mcs/class/System.Security/System.Security.Permissions/StorePermissionAttribute.cs

@@ -1,159 +0,0 @@
-//
-// System.Security.Permissions.StorePermissionAttribute class
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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.Globalization;
-
-namespace System.Security.Permissions {
-
-	[AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
-		AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, 
-		AllowMultiple = true, Inherited = false)]
-	[Serializable]
-	public sealed class StorePermissionAttribute : CodeAccessSecurityAttribute {
-
-		private StorePermissionFlags _flags;
-
-		public StorePermissionAttribute (SecurityAction action)
-			: base (action) 
-		{
-			_flags = StorePermissionFlags.NoFlags;
-		}
-
-
-		public StorePermissionFlags Flags {
-			get { return _flags; }
-			set {
-				if ((value & StorePermissionFlags.AllFlags) != value) {
-					string msg = String.Format (Locale.GetText ("Invalid flags {0}"), value);
-					throw new ArgumentException (msg, "StorePermissionFlags");
-				}
-
-				_flags = value;
-			}
-		}
-
-		public bool AddToStore {
-			get { return ((_flags & StorePermissionFlags.AddToStore) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.AddToStore;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.AddToStore;
-				}
-			}
-		}
-
-		public bool CreateStore {
-			get { return ((_flags & StorePermissionFlags.CreateStore) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.CreateStore;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.CreateStore;
-				}
-			}
-		}
-
-		public bool DeleteStore {
-			get { return ((_flags & StorePermissionFlags.DeleteStore) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.DeleteStore;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.DeleteStore;
-				}
-			}
-		}
-
-		public bool EnumerateCertificates {
-			get { return ((_flags & StorePermissionFlags.EnumerateCertificates) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.EnumerateCertificates;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.EnumerateCertificates;
-				}
-			}
-		}
-
-		public bool EnumerateStores {
-			get { return ((_flags & StorePermissionFlags.EnumerateStores) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.EnumerateStores;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.EnumerateStores;
-				}
-			}
-		}
-
-		public bool OpenStore {
-			get { return ((_flags & StorePermissionFlags.OpenStore) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.OpenStore;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.OpenStore;
-				}
-			}
-		}
-
-		public bool RemoveFromStore {
-			get { return ((_flags & StorePermissionFlags.RemoveFromStore) != 0); }
-			set {
-				if (value) {
-					_flags |= StorePermissionFlags.RemoveFromStore;
-				}
-				else {
-					_flags &= ~StorePermissionFlags.RemoveFromStore;
-				}
-			}
-		}
-
-
-		public override IPermission CreatePermission ()
-		{
-			StorePermission perm = null;
-			if (this.Unrestricted)
-				perm = new StorePermission (PermissionState.Unrestricted);
-			else
-				perm = new StorePermission (_flags);
-			return perm;
-		}
-	}
-}
-
-#endif

+ 0 - 51
mcs/class/System.Security/System.Security.Permissions/StorePermissionFlags.cs

@@ -1,51 +0,0 @@
-//
-// System.Security.Permissions.StorePermissionFlags enum
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// 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.Permissions {
-
-	[Flags]
-	[SerializableAttribute]
-	public enum StorePermissionFlags {
-		NoFlags = 0,
-		CreateStore = 1,
-		DeleteStore = 2,
-		EnumerateStores = 4,
-		OpenStore = 16,
-		AddToStore = 32,
-		RemoveFromStore = 64,
-		EnumerateCertificates = 128,
-		AllFlags = AddToStore | CreateStore | DeleteStore | OpenStore |
-			EnumerateCertificates | EnumerateStores | RemoveFromStore
-	}
-}
-
-#endif

+ 0 - 42
mcs/class/System.Security/System.Security.dll.sources

@@ -2,17 +2,11 @@ Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
 Mono.Xml/XmlCanonicalizer.cs
-System.Security.Cryptography/AsnEncodedData.cs
-System.Security.Cryptography/AsnEncodedDataCollection.cs
-System.Security.Cryptography/AsnEncodedDataEnumerator.cs
 System.Security.Cryptography/CryptographicAttribute.cs
 System.Security.Cryptography/CryptographicAttributeCollection.cs
 System.Security.Cryptography/CryptographicAttributeEnumerator.cs
 System.Security.Cryptography/DataProtectionScope.cs
 System.Security.Cryptography/MemoryProtectionScope.cs
-System.Security.Cryptography/Oid.cs
-System.Security.Cryptography/OidCollection.cs
-System.Security.Cryptography/OidEnumerator.cs
 System.Security.Cryptography/ProtectedData.cs
 System.Security.Cryptography/ProtectedMemory.cs
 System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs
@@ -44,39 +38,6 @@ System.Security.Cryptography.Pkcs/SubjectIdentifier.cs
 System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs
 System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs
 System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs
-System.Security.Cryptography.X509Certificates/OpenFlags.cs
-System.Security.Cryptography.X509Certificates/PublicKey.cs
-System.Security.Cryptography.X509Certificates/StoreLocation.cs
-System.Security.Cryptography.X509Certificates/StoreName.cs
-System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs
-System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs
-System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
-System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
-System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
-System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs
-System.Security.Cryptography.X509Certificates/X509Chain.cs
-System.Security.Cryptography.X509Certificates/X509ChainElement.cs
-System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs
-System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs
-System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs
-System.Security.Cryptography.X509Certificates/X509ChainStatus.cs
-System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs
-System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs
-System.Security.Cryptography.X509Certificates/X509Extension.cs
-System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs
-System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs
-System.Security.Cryptography.X509Certificates/X509FindType.cs
-System.Security.Cryptography.X509Certificates/X509IncludeOption.cs
-System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs
-System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs
-System.Security.Cryptography.X509Certificates/X509NameType.cs
-System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs
-System.Security.Cryptography.X509Certificates/X509RevocationMode.cs
-System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs
-System.Security.Cryptography.X509Certificates/X509Store.cs
-System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs
-System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs
-System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs
 System.Security.Cryptography.Xml/CipherData.cs
 System.Security.Cryptography.Xml/CipherReference.cs
 System.Security.Cryptography.Xml/DataObject.cs
@@ -129,6 +90,3 @@ System.Security.Permissions/DataProtectionPermission.cs
 System.Security.Permissions/DataProtectionPermissionAttribute.cs
 System.Security.Permissions/DataProtectionPermissionFlags.cs
 System.Security.Permissions/PermissionHelper.cs
-System.Security.Permissions/StorePermission.cs
-System.Security.Permissions/StorePermissionAttribute.cs
-System.Security.Permissions/StorePermissionFlags.cs

+ 0 - 13
mcs/class/System.Security/System.Security_test.dll.sources

@@ -1,8 +1,4 @@
-System.Security.Cryptography/AsnEncodedDataTest.cs
 System.Security.Cryptography/CryptographicAttributeTest.cs
-System.Security.Cryptography/OidCollectionTest.cs
-System.Security.Cryptography/OidEnumeratorTest.cs
-System.Security.Cryptography/OidTest.cs
 System.Security.Cryptography/ProtectedDataTest.cs
 System.Security.Cryptography/ProtectedMemoryTest.cs
 System.Security.Cryptography.Pkcs/AlgorithmIdentifierTest.cs
@@ -21,14 +17,6 @@ System.Security.Cryptography.Pkcs/SignedCmsTest.cs
 System.Security.Cryptography.Pkcs/SignerInfoCollectionTest.cs
 System.Security.Cryptography.Pkcs/SignerInfoTest.cs
 System.Security.Cryptography.Pkcs/SubjectIdentifierTest.cs
-System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtensionTest.cs
-System.Security.Cryptography.X509Certificates/X509ChainPolicyTest.cs
-System.Security.Cryptography.X509Certificates/X509ChainTest.cs
-System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtensionTest.cs
-System.Security.Cryptography.X509Certificates/X509ExtensionTest.cs
-System.Security.Cryptography.X509Certificates/X509KeyUsageExtensionTest.cs
-System.Security.Cryptography.X509Certificates/X509StoreTest.cs
-System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtensionTest.cs
 System.Security.Cryptography.Xml/AssertCrypto.cs
 System.Security.Cryptography.Xml/DataObjectTest.cs
 System.Security.Cryptography.Xml/DSAKeyValueTest.cs
@@ -50,4 +38,3 @@ System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigXPathTransformTest.cs
 System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
 System.Security.Permissions/DataProtectionPermissionAttributeTest.cs
-System.Security.Permissions/StorePermissionAttributeTest.cs

+ 2 - 25
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/ChangeLog

@@ -1,26 +1,3 @@
-2005-04-23  Sebastien Pouliot  <[email protected]>
+2005-09-26  Sebastien Pouliot  <[email protected]>
 
-	* X509BasicConstraintsExtensionTest.cs, X509ChainPolicyTest.cs,
-	X509EnhancedKeyUsageExtensionTest.cs, X509ExtensionTest.cs,
-	X509KeyUsageExtensionTest.cs, X509StoreTest.cs, 
-	X509SubjectKeyIdentifierExtensionTest.cs: Changed X509CertificateEx to
-	X509Certificate2 and re-activated some tests on Windows that were 
-	fixed in beta2.
-
-2005-01-17  Sebastien Pouliot  <[email protected]>
-
-	* X509BasicConstraintsExtensionTest.cs: New. Unit tests.
-	* X509EnhancedKeyUsageExtensionTest.cs: New. Unit tests.
-	* X509ExtensionTest.cs: New. Unit tests.
-	* X509KeyUsageExtensionTest.cs: New. Unit tests.
-	* X509SubjectKeyIdentifierExtensionTest.cs: New. Unit tests.
-
-2003-11-08  Sebastien Pouliot  <[email protected]>
-
-	* X509ChainElementCollectionTest.cs: New. Unit tests for 
-	X509ChainElementCollection.
-	* X509ChainElementEnumeratorTest.cs: New. Unit tests for 
-	X509ChainElementEnumerator.
-	* X509ChainPolicyTest.cs: New. Unit tests for X509ChainPolicy.
-	* X509ChainTest.cs: New. (Incomplete) Unit tests for X509Chain. 
-	* X509StoreTest.cs: New. (Incomplete) Unit tests for X509Store. 
+	* All tests moved to System.dll assembly.

+ 0 - 285
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtensionTest.cs

@@ -1,285 +0,0 @@
-//
-// X509BasicConstraintsExtensionTest.cs 
-//	- NUnit tests for X509BasicConstraintsExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509BasicConstraintsExtensionTest {
-
-		private const string oid = "2.5.29.19";
-		private const string fname = "Basic Constraints";
-
-		[Test]
-		public void ConstructorEmpty ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			Assert.IsFalse (bc.Critical, "Critical");
-			Assert.IsNull (bc.RawData, "RawData");
-			Assert.AreEqual (oid, bc.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, bc.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (String.Empty, bc.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void ConstructorEmpty_CertificateAuthority ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			Assert.AreEqual (false, bc.CertificateAuthority, "CertificateAuthority");
-		}
-
-		[Test]
-		public void ConstructorEmpty_HasPathLengthConstraint ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			Assert.AreEqual (false, bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-		}
-
-		[Test]
-		public void ConstructorEmpty_PathLengthConstraint ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			Assert.AreEqual (0, bc.PathLengthConstraint, "PathLengthConstraint");
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x30, 0x06, 0x01, 0x01, 0xFF, 0x02, 0x01, 0x01 });
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (aed, true);
-			Assert.IsTrue (bc.Critical, "Critical");
-			Assert.AreEqual (8, bc.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, bc.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, bc.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.IsTrue (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsTrue (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (1, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("Subject Type=CA" + Environment.NewLine + "Path Length Constraint=1" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=CA, Path Length Constraint=1", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsn ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (aed, true);
-			Assert.AreEqual (String.Empty, bc.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, bc.Format (false), "Format(false)");
-			bool b = bc.CertificateAuthority;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnTag ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x05, 0x00 });
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (aed, true);
-			Assert.AreEqual ("0500", bc.Format (true), "Format(true)");
-			Assert.AreEqual ("0500", bc.Format (false), "Format(false)");
-			bool b = bc.CertificateAuthority;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnLength ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x30, 0x01 });
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (aed, true);
-			Assert.AreEqual ("3001", bc.Format (true), "Format(true)");
-			Assert.AreEqual ("3001", bc.Format (false), "Format(false)");
-			bool b = bc.CertificateAuthority;
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData_SmallestValid ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x30, 0x00 });
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (aed, true);
-			Assert.IsFalse (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsFalse (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (0, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-00", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=End Entity" + Environment.NewLine + "Path Length Constraint=None" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=End Entity, Path Length Constraint=None", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (NullReferenceException))]
-		public void ConstructorAsnEncodedData_Null ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (null, true);
-		}
-
-		[Test]
-		public void Constructor_TrueTrueZero ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (true, true, 0, true);
-			Assert.IsTrue (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsTrue (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (0, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-06-01-01-FF-02-01-00", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=CA" + Environment.NewLine + "Path Length Constraint=0" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=CA, Path Length Constraint=0", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void Constructor_TrueTrueMaxInt ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (true, true, Int32.MaxValue, true);
-			Assert.IsTrue (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsTrue (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (Int32.MaxValue, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-09-01-01-FF-02-04-7F-FF-FF-FF", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=CA" + Environment.NewLine + "Path Length Constraint=2147483647" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=CA, Path Length Constraint=2147483647", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void Constructor_TrueFalseNegative ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (true, false, -1, true);
-			Assert.IsTrue (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsFalse (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (0, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-03-01-01-FF", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=CA" + Environment.NewLine + "Path Length Constraint=None" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=CA, Path Length Constraint=None", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void Constructor_FalseTruePositive ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, true, 1, true);
-			Assert.IsFalse (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsTrue (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (1, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-03-02-01-01", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=End Entity" + Environment.NewLine + "Path Length Constraint=1" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=End Entity, Path Length Constraint=1", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentOutOfRangeException))]
-		public void Constructor_FalseTrueNegative ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, true, -1, true);
-		}
-
-		[Test]
-		public void Constructor_FalseFalseNegative ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, false, -1, true);
-			Assert.IsFalse (bc.CertificateAuthority, "CertificateAuthority");
-			Assert.IsFalse (bc.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (0, bc.PathLengthConstraint, "PathLengthConstraint");
-			Assert.AreEqual ("30-00", BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("Subject Type=End Entity" + Environment.NewLine + "Path Length Constraint=None" + Environment.NewLine, bc.Format (true), "Format(true)");
-			Assert.AreEqual ("Subject Type=End Entity, Path Length Constraint=None", bc.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void WrongExtension_X509KeyUsageExtension ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			bc.CopyFrom (ku);
-		}
-
-		[Test]
-		public void WrongExtension_X509Extension ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, true, 1, false);
-			Assert.IsFalse (bc.Critical, "Critical");
-			bc.CopyFrom (ex);
-			Assert.IsTrue (bc.Critical, "Critical");
-			Assert.AreEqual (String.Empty, BitConverter.ToString (bc.RawData), "RawData");
-			Assert.AreEqual ("1.2.3", bc.Oid.Value, "Oid.Value");
-			Assert.IsNull (bc.Oid.FriendlyName, "Oid.FriendlyName");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void WrongExtension_X509Extension_CertificateAuthority ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			bc.CopyFrom (ex);
-			bool b = bc.CertificateAuthority;
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void WrongAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[0]);
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, true, 1, false);
-			bc.CopyFrom (aed); // note: not the same behaviour than using the constructor!
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension ();
-			bc.CopyFrom (null);
-		}
-
-		[Test]
-		public void CopyFrom_Self ()
-		{
-			X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (false, false, -1, true);
-			Assert.IsTrue (bc.Critical, "Critical");
-			byte[] raw = bc.RawData;
-			Assert.AreEqual ("30-00", BitConverter.ToString (raw), "RawData");
-
-			AsnEncodedData aed = new AsnEncodedData (raw);
-			X509BasicConstraintsExtension copy = new X509BasicConstraintsExtension (aed, false);
-			Assert.IsFalse (copy.Critical, "Critical");
-			Assert.AreEqual (2, copy.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, copy.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, copy.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.IsFalse (copy.CertificateAuthority, "CertificateAuthority");
-			Assert.IsFalse (copy.HasPathLengthConstraint, "HasPathLengthConstraint");
-			Assert.AreEqual (0, copy.PathLengthConstraint, "PathLengthConstraint");
-		}
-	}
-}
-
-#endif

+ 0 - 169
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ChainPolicyTest.cs

@@ -1,169 +0,0 @@
-//
-// X509ChainPolicyTest.cs - NUnit tests for X509ChainPolicy
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-#if NET_2_0
-
-using NUnit.Framework;
-
-using System;
-using System.Collections;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509ChainPolicyTest : Assertion {
-
-		static string signingTimeOid = "1.2.840.113549.1.9.5";
-
-		private X509ChainPolicy GetPolicy () 
-		{
-			X509Chain c = new X509Chain ();
-			return c.ChainPolicy;
-		}
-
-		[Test]
-		public void Default () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			// default properties
-			AssertEquals ("ApplicationPolicy", 0, cp.ApplicationPolicy.Count);
-			AssertEquals ("CertificatePolicy", 0, cp.CertificatePolicy.Count);
-			AssertEquals ("ExtraStore", 0, cp.ExtraStore.Count);
-			AssertEquals ("RevocationFlag", X509RevocationFlag.ExcludeRoot, cp.RevocationFlag);
-			AssertEquals ("RevocationMode", X509RevocationMode.Online, cp.RevocationMode);
-			AssertEquals ("UrlRetrievalTimeout", 0, cp.UrlRetrievalTimeout.Ticks);
-			AssertEquals ("VerificationFlags", X509VerificationFlags.NoFlag, cp.VerificationFlags);
-			DateTime vt = cp.VerificationTime;
-			Assert ("VerificationTime", ((vt <= DateTime.Now) && (vt > DateTime.Now.AddMinutes (-1))));
-		}
-
-		[Test]
-		public void ApplicationPolicy () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.ApplicationPolicy.Add (new Oid (signingTimeOid));
-			AssertEquals ("ApplicationPolicy", 1, cp.ApplicationPolicy.Count);
-		}
-
-		[Test]
-		public void CertificatePolicy () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.CertificatePolicy.Add (new Oid (signingTimeOid));
-			AssertEquals ("CertificatePolicy", 1, cp.CertificatePolicy.Count);
-		}
-
-		[Test]
-		public void ExtraStore () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.ExtraStore.Add (new X509Certificate2 ());
-			AssertEquals ("ExtraStore", 1, cp.ExtraStore.Count);
-		}
-
-		[Test]
-		public void RevocationFlag () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.RevocationFlag = X509RevocationFlag.EndCertificateOnly;
-			AssertEquals ("EndCertificateOnly", X509RevocationFlag.EndCertificateOnly, cp.RevocationFlag);
-			cp.RevocationFlag = X509RevocationFlag.EntireChain;
-			AssertEquals ("EntireChain", X509RevocationFlag.EntireChain, cp.RevocationFlag);
-			cp.RevocationFlag = X509RevocationFlag.ExcludeRoot;
-			AssertEquals ("ExcludeRoot", X509RevocationFlag.ExcludeRoot, cp.RevocationFlag);
-		}
-
-		[Test]
-		public void RevocationMode () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.RevocationMode = X509RevocationMode.NoCheck;
-			AssertEquals ("NoCheck", X509RevocationMode.NoCheck, cp.RevocationMode);
-			cp.RevocationMode = X509RevocationMode.Offline;
-			AssertEquals ("Offline", X509RevocationMode.Offline, cp.RevocationMode);
-			cp.RevocationMode = X509RevocationMode.Online;
-			AssertEquals ("Online", X509RevocationMode.Online, cp.RevocationMode);
-		}
-
-		[Test]
-		public void UrlRetrievalTimeout ()
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.UrlRetrievalTimeout = new TimeSpan (100);
-			AssertEquals ("TimeSpan=100", 100, cp.UrlRetrievalTimeout.Ticks);
-			cp.UrlRetrievalTimeout = new TimeSpan (0);
-			AssertEquals ("TimeSpan=0", 0, cp.UrlRetrievalTimeout.Ticks);
-		}
-
-		[Test]
-		public void VerificationFlags () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.VerificationFlags = X509VerificationFlags.AllFlags;
-			AssertEquals ("AllFlags", X509VerificationFlags.AllFlags, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.AllowUnknownCertificateAuthority;
-			AssertEquals ("AllowUnknownCertificateAuthority", X509VerificationFlags.AllowUnknownCertificateAuthority, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreCertificateAuthorityRevocationUnknown;
-			AssertEquals ("IgnoreCertificateAuthorityRevocationUnknown", X509VerificationFlags.IgnoreCertificateAuthorityRevocationUnknown, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreCtlNotTimeValid;
-			AssertEquals ("IgnoreCtlNotTimeValid", X509VerificationFlags.IgnoreCtlNotTimeValid, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreCtlSignerRevocationUnknown;
-			AssertEquals ("IgnoreCtlSignerRevocationUnknown", X509VerificationFlags.IgnoreCtlSignerRevocationUnknown, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreEndRevocationUnknown;
-			AssertEquals ("IgnoreEndRevocationUnknown", X509VerificationFlags.IgnoreEndRevocationUnknown, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreInvalidBasicConstraints;
-			AssertEquals ("IgnoreInvalidBasicConstraints", X509VerificationFlags.IgnoreInvalidBasicConstraints, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreInvalidName;
-			AssertEquals ("IgnoreInvalidName", X509VerificationFlags.IgnoreInvalidName, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreInvalidPolicy;
-			AssertEquals ("IgnoreInvalidPolicy", X509VerificationFlags.IgnoreInvalidPolicy, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreNotTimeNested;
-			AssertEquals ("IgnoreNotTimeNested", X509VerificationFlags.IgnoreNotTimeNested, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreNotTimeValid;
-			AssertEquals ("IgnoreNotTimeValid", X509VerificationFlags.IgnoreNotTimeValid, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreRootRevocationUnknown;
-			AssertEquals ("IgnoreRootRevocationUnknown", X509VerificationFlags.IgnoreRootRevocationUnknown, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.IgnoreWrongUsage;
-			AssertEquals ("IgnoreWrongUsage", X509VerificationFlags.IgnoreWrongUsage, cp.VerificationFlags);
-			cp.VerificationFlags = X509VerificationFlags.NoFlag;
-			AssertEquals ("NoFlag", X509VerificationFlags.NoFlag, cp.VerificationFlags);
-		}
-
-		[Test]
-		public void Reset () 
-		{
-			X509ChainPolicy cp = GetPolicy ();
-			cp.ApplicationPolicy.Add (new Oid (signingTimeOid));
-			cp.CertificatePolicy.Add (new Oid (signingTimeOid));
-			cp.ExtraStore.Add (new X509Certificate2 ());
-			cp.RevocationFlag = X509RevocationFlag.EndCertificateOnly;
-			cp.RevocationMode = X509RevocationMode.NoCheck;
-			cp.UrlRetrievalTimeout = new TimeSpan (100);
-			cp.VerificationFlags = X509VerificationFlags.AllFlags;
-			DateTime vt = cp.VerificationTime;
-			Assert ("VerificationTime", ((vt <= DateTime.Now) && (vt > DateTime.Now.AddMinutes (-1))));
-			cp.Reset ();
-			Assert ("VerificationTime-Reset", (vt != cp.VerificationTime));
-			// default properties
-			AssertEquals ("ApplicationPolicy", 0, cp.ApplicationPolicy.Count);
-			AssertEquals ("CertificatePolicy", 0, cp.CertificatePolicy.Count);
-			AssertEquals ("ExtraStore", 0, cp.ExtraStore.Count);
-			AssertEquals ("RevocationFlag", X509RevocationFlag.ExcludeRoot, cp.RevocationFlag);
-			AssertEquals ("RevocationMode", X509RevocationMode.Online, cp.RevocationMode);
-			AssertEquals ("UrlRetrievalTimeout", 0, cp.UrlRetrievalTimeout.Ticks);
-			AssertEquals ("VerificationFlags", X509VerificationFlags.NoFlag, cp.VerificationFlags);
-			vt = cp.VerificationTime;
-			Assert ("VerificationTime", ((vt <= DateTime.Now) && (vt > DateTime.Now.AddMinutes (-1))));
-		}
-	}
-}
-
-#endif

+ 0 - 64
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ChainTest.cs

@@ -1,64 +0,0 @@
-//
-// X509ChainTest.cs - NUnit tests for X509Chain
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-#if NET_2_0
-
-using NUnit.Framework;
-
-using System;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509ChainTest : Assertion {
-
-		[Test]
-		public void ConstructorEmpty () 
-		{
-			X509Chain c = new X509Chain ();
-			// default properties
-			AssertEquals ("ChainElements", 0, c.ChainElements.Count);
-			AssertNotNull ("ChainPolicy", c.ChainPolicy);
-			AssertEquals ("ChainStatus", 0, c.ChainStatus.Length);
-		}
-
-		[Test]
-		public void ConstructorMachineContextFalse () 
-		{
-			X509Chain c = new X509Chain (false);
-			// default properties
-			AssertEquals ("ChainElements", 0, c.ChainElements.Count);
-			AssertNotNull ("ChainPolicy", c.ChainPolicy);
-			AssertEquals ("ChainStatus", 0, c.ChainStatus.Length);
-		}
-
-		[Test]
-		public void ConstructorMachineContextTrue () 
-		{
-			X509Chain c = new X509Chain (true);
-			// default properties
-			AssertEquals ("ChainElements", 0, c.ChainElements.Count);
-			AssertNotNull ("ChainPolicy", c.ChainPolicy);
-			AssertEquals ("ChainStatus", 0, c.ChainStatus.Length);
-		}
-
-		[Test]
-		public void StaticCreation () 
-		{
-			X509Chain c = X509Chain.Create ();
-			// default properties
-			AssertEquals ("ChainElements", 0, c.ChainElements.Count);
-			AssertNotNull ("ChainPolicy", c.ChainPolicy);
-			AssertEquals ("ChainStatus", 0, c.ChainStatus.Length);
-		}
-	}
-}
-
-#endif

+ 0 - 224
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtensionTest.cs

@@ -1,224 +0,0 @@
-//
-// X509EnhancedKeyUsageExtensionTest.cs 
-//	- NUnit tests for X509EnhancedKeyUsageExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509EnhancedKeyUsageExtensionTest {
-
-		private const string oid = "2.5.29.37";
-		private const string fname = "Enhanced Key Usage";
-
-		[Test]
-		public void ConstructorEmpty ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			Assert.IsFalse (eku.Critical, "Critical");
-			Assert.IsNull (eku.RawData, "RawData");
-			Assert.AreEqual (oid, eku.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, eku.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (String.Empty, eku.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, eku.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void ConstructorEmpty_EnhancedKeyUsages ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			Assert.AreEqual (0, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, true);
-			Assert.IsTrue (eku.Critical, "Critical");
-			Assert.AreEqual (7, eku.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, eku.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, eku.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (1, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
-			Assert.AreEqual ("1.2.3.4", eku.EnhancedKeyUsages[0].Value, "EnhancedKeyUsages Oid");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, eku.Format (true), "Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", eku.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsn ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, true);
-			Assert.AreEqual (String.Empty, eku.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, eku.Format (false), "Format(false)");
-			OidCollection oc = eku.EnhancedKeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnTag ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x05, 0x00 });
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, true);
-			OidCollection oc = eku.EnhancedKeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnLength ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x30, 0x01 });
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, true);
-			OidCollection oc = eku.EnhancedKeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (NullReferenceException))]
-		public void ConstructorAsnEncodedData_Null ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ((AsnEncodedData)null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorOidCollection_Null ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ((OidCollection)null, true);
-		}
-
-		[Test]
-		public void ConstructorOidCollection ()
-		{
-			OidCollection oc = new OidCollection ();
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (oc, true);
-			Assert.AreEqual ("30-00", BitConverter.ToString (eku.RawData), "RawData");
-			Assert.AreEqual (0, eku.EnhancedKeyUsages.Count, "Count 0");
-			Assert.AreEqual ("Information Not Available", eku.Format (true), "Format(true)");
-			Assert.AreEqual ("Information Not Available", eku.Format (false), "Format(false)");
-			oc.Add (new Oid ("1.2.3.4"));
-			Assert.AreEqual (0, eku.EnhancedKeyUsages.Count, "Count still 0");
-			int n = eku.EnhancedKeyUsages.Add (new Oid ("1.2.3"));
-			Assert.AreEqual (0, n, "Add");
-			Assert.AreEqual (0, eku.EnhancedKeyUsages.Count, "Count again 0");	// readonly!
-			Assert.AreEqual (1, oc.Count, "Count 1 - oc");
-			Assert.AreEqual ("1.2.3.4", oc [0].Value, "Value - oc");
-
-			oc.Add (new Oid ("1.3.6.1.5.5.7.3.1"));
-			eku = new X509EnhancedKeyUsageExtension (oc, true);
-			Assert.AreEqual (2, eku.EnhancedKeyUsages.Count, "Count 2");
-			Assert.AreEqual ("1.2.3.4", eku.EnhancedKeyUsages[0].Value, "Value - 1");
-			Assert.AreEqual ("1.3.6.1.5.5.7.3.1", eku.EnhancedKeyUsages[1].Value, "Value - 2");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine + "Server Authentication (1.3.6.1.5.5.7.3.1)" + Environment.NewLine,
-				eku.Format (true), "Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4), Server Authentication (1.3.6.1.5.5.7.3.1)", eku.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void WrongExtension_X509EnhancedKeyUsageExtension ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			eku.CopyFrom (ku);
-		}
-
-		[Test]
-		public void WrongExtension_X509Extension ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.2.3.4"));
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (oc, false);
-			Assert.AreEqual (1, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
-			Assert.IsFalse (eku.Critical, "Critical");
-			eku.CopyFrom (ex);
-			Assert.IsTrue (eku.Critical, "Critical");
-			Assert.AreEqual (String.Empty, BitConverter.ToString (eku.RawData), "RawData");
-			Assert.AreEqual ("1.2.3", eku.Oid.Value, "Oid.Value");
-			Assert.IsNull (eku.Oid.FriendlyName, "Oid.FriendlyName");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void WrongExtension_X509Extension_KeyUsages ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			eku.CopyFrom (ex);
-			Assert.AreEqual (0, eku.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void WrongAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[0]);
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (new OidCollection (), true);
-			eku.CopyFrom (aed); // note: not the same behaviour than using the constructor!
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			eku.CopyFrom (null);
-		}
-
-		[Test]
-		public void CopyFrom_Self ()
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.2.3.4"));
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (oc, true);
-			Assert.IsTrue (eku.Critical, "Critical");
-			byte[] raw = eku.RawData;
-			Assert.AreEqual ("30-05-06-03-2A-03-04", BitConverter.ToString (raw), "RawData");
-
-			AsnEncodedData aed = new AsnEncodedData (raw);
-			X509EnhancedKeyUsageExtension copy = new X509EnhancedKeyUsageExtension (aed, false);
-			Assert.IsFalse (copy.Critical, "Critical");
-			Assert.AreEqual (7, copy.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, copy.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, copy.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (1, copy.EnhancedKeyUsages.Count, "EnhancedKeyUsages");
-			Assert.AreEqual ("1.2.3.4", copy.EnhancedKeyUsages[0].Value, "EnhancedKeyUsages Oid");
-		}
-	}
-}
-
-#endif

+ 0 - 189
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509ExtensionTest.cs

@@ -1,189 +0,0 @@
-//
-// X509ExtensionTest.cs 
-//	- NUnit tests for X509Extension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	// used to test the protected constructor properly
-	public class X509Ex : X509Extension {
-
-		public X509Ex ()
-		{
-		}
-	}
-
-	[TestFixture]
-	public class X509ExtensionTest {
-
-		[Test]
-		public void ConstructorEmpty ()
-		{
-			X509Ex ex = new X509Ex ();
-			Assert.IsFalse (ex.Critical, "Critical");
-			Assert.IsNull (ex.RawData, "RawData");
-			Assert.IsNull (ex.Oid, "Oid");
-			Assert.AreEqual (String.Empty, ex.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ex.Format (false), "Format(false)");
-			
-			ex.Critical = true;
-			Assert.IsTrue (ex.Critical, "Critical 2");
-			ex.Oid = new Oid ("2.5.29.37");
-			Assert.AreEqual ("2.5.29.37", ex.Oid.Value, "Oid.Value");
-			Assert.AreEqual ("Enhanced Key Usage", ex.Oid.FriendlyName, "Oid.FriendlyName");
-			ex.RawData = new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 };
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, ex.Format (true), "Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", ex.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorAsnEncodedData_WithNullOid ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
-			X509Extension eku = new X509Extension (aed, true);
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new Oid ("2.5.29.37"), new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
-			X509Extension ex = new X509Extension (aed, true);
-			Assert.IsTrue (ex.Critical, "Critical");
-			Assert.AreEqual (7, ex.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual ("2.5.29.37", ex.Oid.Value, "Oid.Value");
-			Assert.AreEqual ("Enhanced Key Usage", ex.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, ex.Format (true), "Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", ex.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData_BadAsn ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
-			X509Extension ex = new X509Extension (aed, true);
-			Assert.AreEqual (String.Empty, ex.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ex.Format (false), "Format(false)");
-			// no exception for an "empty" extension
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData_BadAsnTag ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x05, 0x00 });
-			X509Extension ex = new X509Extension (aed, true);
-			Assert.AreEqual ("05 00", ex.Format (true), "Format(true)");
-			Assert.AreEqual ("05 00", ex.Format (false), "Format(false)");
-			// no exception for an "unknown" (ASN.1 NULL) extension
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData_BadAsnLength ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x30, 0x01 });
-			X509Extension ex = new X509Extension (aed, true);
-			Assert.AreEqual ("30 01", ex.Format (true), "Format(true)");
-			Assert.AreEqual ("30 01", ex.Format (false), "Format(false)");
-			// no exception for an bad (invalid length) extension
-		}
-
-		[Test]
-		[ExpectedException (typeof (NullReferenceException))]
-		public void ConstructorAsnEncodedData_Null ()
-		{
-			X509Extension ex = new X509Extension ((AsnEncodedData)null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorOid_Null ()
-		{
-			X509Extension ex = new X509Extension ((Oid)null, new byte[] { 0x30, 0x01 }, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorOid_RawNull ()
-		{
-			X509Extension ex = new X509Extension (new Oid ("1.2.3"), null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorString_Null ()
-		{
-			X509Extension ex = new X509Extension ((string)null, new byte[] { 0x30, 0x01 }, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorString_RawNull ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			X509Ex ex = new X509Ex ();
-			ex.CopyFrom (null);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void CopyFrom_AsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new Oid ("2.5.29.37"), new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
-			// this is recognized as an Enhanced Key Usages extension
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, aed.Format (true), "aed.Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", aed.Format (false), "aed.Format(false)");
-			X509Ex ex = new X509Ex ();
-			// but won't be accepted by the CopyFrom method (no a X509Extension)
-			ex.CopyFrom (aed);
-		}
-
-		[Test]
-		public void Build_NetscapeCertTypeExtension ()
-		{
-			X509Extension ex = new X509Extension (new Oid ("2.16.840.1.113730.1.1"), new byte[] { 0x03, 0x02, 0x00, 0xFF }, false);
-			// strangely no NewLine is being appended to Format(true)
-			Assert.AreEqual ("SSL Client Authentication, SSL Server Authentication, SMIME, Signature, Unknown cert type, SSL CA, SMIME CA, Signature CA (ff)", ex.Format (true), "aed.Format(true)");
-			Assert.AreEqual ("SSL Client Authentication, SSL Server Authentication, SMIME, Signature, Unknown cert type, SSL CA, SMIME CA, Signature CA (ff)", ex.Format (false), "aed.Format(false)");
-		}
-	}
-}
-
-#endif

+ 0 - 251
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509KeyUsageExtensionTest.cs

@@ -1,251 +0,0 @@
-//
-// X509KeyUsageExtensionTest.cs - NUnit tests for X509KeyUsageExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509KeyUsageExtensionTest {
-
-		private const string oid = "2.5.29.15";
-		private const string fname = "Key Usage";
-
-		[Test]
-		public void ConstructorEmpty () 
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			Assert.IsFalse (ku.Critical , "Critical");
-			Assert.IsNull (ku.RawData, "RawData");
-			Assert.AreEqual (oid, ku.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ku.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (String.Empty, ku.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ku.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[Category ("NotDotNet")] // MS bug reported as http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=34cdc5e9-c7f9-4f55-b390-288bfef6e44e
-		public void ConstructorEmpty_KeyUsage ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			Assert.AreEqual (0, (int)ku.KeyUsages, "KeyUsages");
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x03, 0x01, 0x00 });
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (aed, true);
-			Assert.IsTrue (ku.Critical, "Critical");
-			Assert.AreEqual (3, ku.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, ku.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ku.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("Information Not Available", ku.Format (true), "Format(true)");
-			Assert.AreEqual ("Information Not Available", ku.Format (false), "Format(false)");
-			Assert.AreEqual (0, (int)ku.KeyUsages, "KeyUsages");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsn ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (aed, true);
-			Assert.AreEqual (String.Empty, ku.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ku.Format (false), "Format(false)");
-			X509KeyUsageFlags kuf = ku.KeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnTag ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x05, 0x00 });
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (aed, true);
-			Assert.AreEqual ("0500", ku.Format (true), "Format(true)");
-			Assert.AreEqual ("0500", ku.Format (false), "Format(false)");
-			X509KeyUsageFlags kuf = ku.KeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnLength ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x03, 0x01 });
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (aed, true);
-			Assert.AreEqual ("0301", ku.Format (true), "Format(true)");
-			Assert.AreEqual ("0301", ku.Format (false), "Format(false)");
-			X509KeyUsageFlags kuf = ku.KeyUsages;
-		}
-
-		[Test]
-		[ExpectedException (typeof (NullReferenceException))]
-		public void ConstructorAsnEncodedData_Null ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (null, true);
-		}
-
-		[Test]
-		// [ExpectedException (typeof (...))]
-		public void ConstructorKeyUsage_Invalid ()
-		{
-			X509KeyUsageFlags kuf = (X509KeyUsageFlags)Int32.MinValue;
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (kuf, false);
-			Assert.AreEqual (0, (int)ku.KeyUsages, "KeyUsages");
-			Assert.AreEqual ("03-01-00", BitConverter.ToString (ku.RawData), "RawData");
-			Assert.AreEqual ("Information Not Available", ku.Format (true), "Format(true)");
-			Assert.AreEqual ("Information Not Available", ku.Format (false), "Format(false)");
-		}
-
-		private X509KeyUsageExtension ValidateKeyUsage (X509KeyUsageFlags kuf, string rawdata)
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (kuf, false);
-			Assert.IsFalse (ku.Critical, kuf.ToString () + ".Critical");
-			Assert.AreEqual (rawdata, BitConverter.ToString (ku.RawData), kuf.ToString () + ".RawData");
-			Assert.AreEqual (oid, ku.Oid.Value, kuf.ToString () + ".Oid.Value");
-			Assert.AreEqual (fname, ku.Oid.FriendlyName, kuf.ToString () + ".Oid.FriendlyName");
-			Assert.AreEqual (kuf, ku.KeyUsages, kuf.ToString () + ".KeyUsages");
-			return ku;
-		}
-
-		[Test]
-		public void ConstructorKeyUsage_CRLSign ()
-		{
-			X509KeyUsageExtension ku = ValidateKeyUsage (X509KeyUsageFlags.CrlSign, "03-02-01-02");
-			Assert.AreEqual ("Off-line CRL Signing, CRL Signing (02)", ku.Format (false), "CRLSign");
-
-			ku = ValidateKeyUsage (X509KeyUsageFlags.DataEncipherment, "03-02-04-10");
-			Assert.AreEqual ("Data Encipherment (10)", ku.Format (false), "DataEncipherment");
-
-			ku = ValidateKeyUsage (X509KeyUsageFlags.DecipherOnly, "03-03-07-00-80");
-			Assert.AreEqual ("Decipher Only (00 80)", ku.Format (false), "DecipherOnly");
-			
-			ku = ValidateKeyUsage (X509KeyUsageFlags.DigitalSignature, "03-02-07-80");
-			Assert.AreEqual ("Digital Signature (80)", ku.Format (false), "DigitalSignature");
-			
-			ku = ValidateKeyUsage (X509KeyUsageFlags.EncipherOnly, "03-02-00-01");
-			Assert.AreEqual ("Encipher Only (01)", ku.Format (false), "EncipherOnly");
-			
-			ku = ValidateKeyUsage (X509KeyUsageFlags.KeyAgreement, "03-02-03-08");
-			Assert.AreEqual ("Key Agreement (08)", ku.Format (false), "KeyAgreement");
-			
-			ku = ValidateKeyUsage (X509KeyUsageFlags.KeyCertSign, "03-02-02-04");
-			Assert.AreEqual ("Certificate Signing (04)", ku.Format (false), "KeyCertSign");
-
-			ku = ValidateKeyUsage (X509KeyUsageFlags.KeyEncipherment, "03-02-05-20");
-			Assert.AreEqual ("Key Encipherment (20)", ku.Format (false), "KeyEncipherment");
-
-			ku = ValidateKeyUsage (X509KeyUsageFlags.NonRepudiation, "03-02-06-40");
-			Assert.AreEqual ("Non-Repudiation (40)", ku.Format (false), "NonRepudiation");
-			
-			ValidateKeyUsage (X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.DecipherOnly, "03-03-07-10-80");
-			ValidateKeyUsage (X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.DecipherOnly, "03-03-07-80-80");
-			ValidateKeyUsage (X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.DecipherOnly, "03-03-07-01-80");
-			ValidateKeyUsage (X509KeyUsageFlags.NonRepudiation | X509KeyUsageFlags.DataEncipherment, "03-02-04-50");
-
-			ku = ValidateKeyUsage (X509KeyUsageFlags.CrlSign | X509KeyUsageFlags.DataEncipherment | X509KeyUsageFlags.DecipherOnly |
-				X509KeyUsageFlags.DigitalSignature | X509KeyUsageFlags.EncipherOnly | X509KeyUsageFlags.KeyAgreement | 
-				X509KeyUsageFlags.KeyCertSign | X509KeyUsageFlags.KeyEncipherment | X509KeyUsageFlags.NonRepudiation, "03-03-07-FF-80");
-			Assert.AreEqual ("Digital Signature, Non-Repudiation, Key Encipherment, Data Encipherment, Key Agreement, Certificate Signing, Off-line CRL Signing, CRL Signing, Encipher Only, Decipher Only (ff 80)" + Environment.NewLine,
-				ku.Format (true), "All");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void WrongExtension_X509EnhancedKeyUsageExtension ()
-		{
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension ();
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			ku.CopyFrom (eku);
-		}
-
-		[Test]
-		public void WrongExtension_X509Extension ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte [0], true);
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (X509KeyUsageFlags.CrlSign, true);
-			ku.CopyFrom (ex);
-			Assert.IsTrue (ku.Critical, "Critical");
-			Assert.AreEqual (String.Empty, BitConverter.ToString (ku.RawData), "RawData");
-			Assert.AreEqual ("1.2.3", ku.Oid.Value, "Oid.Value");
-			Assert.IsNull (ku.Oid.FriendlyName, "Oid.FriendlyName");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void WrongExtension_X509Extension_KeyUsages ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			ku.CopyFrom (ex);
-			Assert.AreEqual (0, ku.KeyUsages, "KeyUsages");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void WrongAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[0]);
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (X509KeyUsageFlags.CrlSign, true);
-			ku.CopyFrom (aed); // note: not the same behaviour than using the constructor!
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			X509KeyUsageExtension eku = new X509KeyUsageExtension ();
-			eku.CopyFrom (null);
-		}
-
-		[Test]
-		public void CopyFrom_Self ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension (X509KeyUsageFlags.CrlSign, true);
-			Assert.IsTrue (ku.Critical, "Critical");
-			byte[] raw = ku.RawData;
-			Assert.AreEqual ("03-02-01-02", BitConverter.ToString (raw), "RawData");
-  
-			AsnEncodedData aed = new AsnEncodedData (raw);
-			X509KeyUsageExtension copy = new X509KeyUsageExtension (aed, false);
-			Assert.IsFalse (copy.Critical, "Critical");
-			Assert.AreEqual (4, copy.RawData.Length, "RawData");	// original Oid ignored
-			Assert.AreEqual (oid, copy.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, copy.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (X509KeyUsageFlags.CrlSign, copy.KeyUsages, "KeyUsages");
-		}
-	}
-}
-
-#endif

+ 0 - 259
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509StoreTest.cs

@@ -1,259 +0,0 @@
-//
-// X509StoreTest.cs - NUnit tests for X509Store
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-#if NET_2_0
-
-using NUnit.Framework;
-
-using System;
-using System.Collections;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509StoreTest : Assertion {
-
-		[Test]
-		public void ConstructorEmpty () 
-		{
-			X509Store xs = new X509Store ();
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "MY", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-
-		[Test]
-		public void ConstructorStoreLocationCurrentUser () 
-		{
-			X509Store xs = new X509Store (StoreLocation.CurrentUser);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "MY", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreLocationLocalMachine () 
-		{
-			X509Store xs = new X509Store (StoreLocation.LocalMachine);
-			// default properties
-			AssertEquals ("Location", StoreLocation.LocalMachine, xs.Location);
-			AssertEquals ("Name", "MY", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-
-		[Test]
-		public void ConstructorStoreStringAddressBook () 
-		{
-			X509Store xs = new X509Store ("AddressBook");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "AddressBook", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringAuthRoot () 
-		{
-			X509Store xs = new X509Store ("AuthRoot");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "AuthRoot", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringCertificateAuthority () 
-		{
-			X509Store xs = new X509Store ("CA");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "CA", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringDisallowed () 
-		{
-			X509Store xs = new X509Store ("Disallowed");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "Disallowed", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringMy () 
-		{
-			X509Store xs = new X509Store ("My");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "My", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringRoot () 
-		{
-			X509Store xs = new X509Store ("Root");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "Root", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringTrustedPeople () 
-		{
-			X509Store xs = new X509Store ("TrustedPeople");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "TrustedPeople", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringTrustedPublisher () 
-		{
-			X509Store xs = new X509Store ("TrustedPublisher");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "TrustedPublisher", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreStringMono () 
-		{
-			// mono isn't defined the StoreName
-			X509Store xs = new X509Store ("Mono");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "Mono", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameAddressBook () 
-		{
-			X509Store xs = new X509Store (StoreName.AddressBook);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "AddressBook", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameAuthRoot () 
-		{
-			X509Store xs = new X509Store (StoreName.AuthRoot);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "AuthRoot", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameCertificateAuthority () 
-		{
-			X509Store xs = new X509Store (StoreName.CertificateAuthority);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "CA", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameDisallowed () 
-		{
-			X509Store xs = new X509Store (StoreName.Disallowed);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "Disallowed", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameMy () {
-			X509Store xs = new X509Store (StoreName.My);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "My", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameRoot () 
-		{
-			X509Store xs = new X509Store (StoreName.Root);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "Root", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameTrustedPeople () 
-		{
-			X509Store xs = new X509Store (StoreName.TrustedPeople);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "TrustedPeople", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-		[Test]
-		public void ConstructorStoreNameTrustedPublisher () 
-		{
-			X509Store xs = new X509Store (StoreName.TrustedPublisher);
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "TrustedPublisher", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-		}
-
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void AddEmptyCertificateToReadOnlyNonExistingStore () 
-		{
-			// mono isn't defined the StoreName
-			X509Store xs = new X509Store ("NonExistingStore");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "NonExistingStore", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-			xs.Open (OpenFlags.ReadOnly);
-			xs.Add (new X509Certificate2 ());
-			xs.Close ();
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void AddEmptyCertificateToReadWriteNonExistingStore () 
-		{
-			// mono isn't defined the StoreName
-			X509Store xs = new X509Store ("NonExistingStore");
-			// default properties
-			AssertEquals ("Location", StoreLocation.CurrentUser, xs.Location);
-			AssertEquals ("Name", "NonExistingStore", xs.Name);
-			AssertNotNull ("Certificates", xs.Certificates);
-			xs.Open (OpenFlags.ReadWrite);
-			xs.Add (new X509Certificate2 ());
-			xs.Close ();
-		}
-	}
-}
-
-#endif

+ 0 - 292
mcs/class/System.Security/Test/System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtensionTest.cs

@@ -1,292 +0,0 @@
-//
-// X509SubjectKeyIdentifierExtensionTest.cs 
-//	- NUnit tests for X509SubjectKeyIdentifierExtension
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography.X509Certificates {
-
-	[TestFixture]
-	public class X509SubjectKeyIdentifierExtensionTest {
-
-		private const string oid = "2.5.29.14";
-		private const string fname = "Subject Key Identifier";
-
-		[Test]
-		public void ConstructorEmpty ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ();
-			Assert.IsFalse (ski.Critical, "Critical");
-			Assert.IsNull (ski.RawData, "RawData");
-			Assert.AreEqual (oid, ski.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (String.Empty, ski.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void ConstructorEmpty_SubjectKeyIdentifier ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ();
-			Assert.IsNull (ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x04, 0x08, 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF });
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
-			Assert.IsTrue (ski.Critical, "Critical");
-			Assert.AreEqual (oid, ski.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("04-08-01-23-45-67-89-AB-CD-EF", BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual ("0123456789ABCDEF", ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("01 23 45 67 89 ab cd ef" + Environment.NewLine, ski.Format (true), "Format(true)");
-			Assert.AreEqual ("01 23 45 67 89 ab cd ef", ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsn ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[0]);
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
-			Assert.AreEqual (String.Empty, ski.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ski.Format (false), "Format(false)");
-			string s = ski.SubjectKeyIdentifier;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnTag ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x05, 0x00 });
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
-			Assert.AreEqual ("0500", ski.Format (true), "Format(true)");
-			Assert.AreEqual ("0500", ski.Format (false), "Format(false)");
-			string s = ski.SubjectKeyIdentifier;
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void ConstructorAsnEncodedData_BadAsnLength ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x30, 0x01 });
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
-			Assert.AreEqual ("3001", ski.Format (true), "Format(true)");
-			Assert.AreEqual ("3001", ski.Format (false), "Format(false)");
-			string s = ski.SubjectKeyIdentifier;
-		}
-
-		[Test]
-		public void ConstructorAsnEncodedData_SmallestValid ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", new byte[] { 0x04, 0x00 });
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (aed, true);
-			Assert.AreEqual (String.Empty, ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("04-00", BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual ("Information Not Available", ski.Format (true), "Format(true)");
-			Assert.AreEqual ("Information Not Available", ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (NullReferenceException))]
-		public void ConstructorAsnEncodedData_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ((AsnEncodedData)null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorByteArray_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ((byte[])null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void ConstructorByteArray_Empty ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (new byte[0], true);
-		}
-
-		[Test]
-		public void ConstructorByteArray_20 ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (new byte[20], true);
-			Assert.IsTrue (ski.Critical, "Critical");
-			Assert.AreEqual ("04-14-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00", BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual (oid, ski.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("0000000000000000000000000000000000000000", ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00" + Environment.NewLine, ski.Format (true), "Format(true)");
-			Assert.AreEqual ("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorString_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ((String)null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void ConstructorString_Empty ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (String.Empty, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void ConstructorString_Single ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("f", false);
-		}
-
-		[Test]
-		public void ConstructorString ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("ffFFfFFf", false);
-			Assert.IsFalse (ski.Critical, "Critical");
-			Assert.AreEqual ("04-04-FF-FF-FF-FF", BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual (oid, ski.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("FFFFFFFF", ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("ff ff ff ff" + Environment.NewLine, ski.Format (true), "Format(true)");
-			Assert.AreEqual ("ff ff ff ff", ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		public void ConstructorString_NotHex ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("Mono::", true);
-			Assert.IsTrue (ski.Critical, "Critical");
-			Assert.AreEqual ("04-03-FF-FF-FF", BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual (oid, ski.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("FFFFFF", ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("ff ff ff" + Environment.NewLine, ski.Format (true), "Format(true)");
-			Assert.AreEqual ("ff ff ff", ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorPublicKey_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ((PublicKey)null, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorPublicKeyHash_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (null, X509SubjectKeyIdentifierHashAlgorithm.Sha1, true);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void WrongExtension_X509KeyUsageExtension ()
-		{
-			X509KeyUsageExtension ku = new X509KeyUsageExtension ();
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ();
-			ski.CopyFrom (ku);
-		}
-
-		[Test]
-		public void WrongExtension_X509Extension ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("www.go-mono.com", false); // odd length
-			Assert.IsFalse (ski.Critical, "Critical");
-			Assert.AreEqual ("FFFFFFFFFFFFFF", ski.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-			Assert.AreEqual ("ff ff ff ff ff ff ff" + Environment.NewLine, ski.Format (true), "Format(true)");
-			Assert.AreEqual ("ff ff ff ff ff ff ff", ski.Format (false), "Format(false)");
-
-			ski.CopyFrom (ex);
-			Assert.IsTrue (ski.Critical, "Critical");
-			Assert.AreEqual (String.Empty, BitConverter.ToString (ski.RawData), "RawData");
-			Assert.AreEqual ("1.2.3", ski.Oid.Value, "Oid.Value");
-			Assert.IsNull (ski.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (String.Empty, ski.Format (true), "Format(true)");
-			Assert.AreEqual (String.Empty, ski.Format (false), "Format(false)");
-		}
-
-		[Test]
-		[ExpectedException (typeof (CryptographicException))]
-		public void WrongExtension_X509Extension_CertificateAuthority ()
-		{
-			X509Extension ex = new X509Extension ("1.2.3", new byte[0], true);
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ();
-			ski.CopyFrom (ex);
-			string s = ski.SubjectKeyIdentifier;
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void WrongAsnEncodedData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[0]);
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("www.mono-project.com", false);
-			ski.CopyFrom (aed); // note: not the same behaviour than using the constructor!
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ();
-			ski.CopyFrom (null);
-		}
-
-		[Test]
-		public void CopyFrom_Self ()
-		{
-			X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension ("ff", true);
-			Assert.IsTrue (ski.Critical, "Critical");
-			byte[] raw = ski.RawData;
-			Assert.AreEqual ("04-01-FF", BitConverter.ToString (raw), "RawData");
-
-			AsnEncodedData aed = new AsnEncodedData (raw);
-			X509SubjectKeyIdentifierExtension copy = new X509SubjectKeyIdentifierExtension (aed, false);
-			Assert.IsFalse (copy.Critical, "Critical");
-			Assert.AreEqual ("04-01-FF", BitConverter.ToString (copy.RawData), "copy.RawData");
-			Assert.AreEqual (oid, copy.Oid.Value, "Oid.Value");
-			Assert.AreEqual (fname, copy.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual ("FF", copy.SubjectKeyIdentifier, "SubjectKeyIdentifier");
-		}
-	}
-}
-
-#endif

+ 0 - 280
mcs/class/System.Security/Test/System.Security.Cryptography/AsnEncodedDataTest.cs

@@ -1,280 +0,0 @@
-//
-// AsnEncodedDataTest.cs - NUnit tests for AsnEncodedData
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-using System.Security.Cryptography.X509Certificates;
-
-namespace MonoTests.System.Security.Cryptography {
-
-	[TestFixture]
-	public class AsnEncodedDataTest {
-
-		static byte[] asnNullBytes = { 0x05, 0x00 };
-		static string asnNullString = "05 00";
-		static byte[] asnLongBytes = { 0x30,0x5C,0x02,0x55,0x2D,0x58,0xE9,0xBF,0xF0,0x31,0xCD,0x79,0x06,0x50,0x5A,0xD5,0x9E,0x0E,0x2C,0xE6,0xC2,0xF7,0xF9,0xD2,0xCE,0x55,0x64,0x85,0xB1,0x90,0x9A,0x92,0xB3,0x36,0xC1,0xBC,0xEA,0xC8,0x23,0xB7,0xAB,0x3A,0xA7,0x64,0x63,0x77,0x5F,0x84,0x22,0x8E,0xE5,0xB6,0x45,0xDD,0x46,0xAE,0x0A,0xDD,0x00,0xC2,0x1F,0xBA,0xD9,0xAD,0xC0,0x75,0x62,0xF8,0x95,0x82,0xA2,0x80,0xB1,0x82,0x69,0xFA,0xE1,0xAF,0x7F,0xBC,0x7D,0xE2,0x7C,0x76,0xD5,0xBC,0x2A,0x80,0xFB,0x02,0x03,0x01,0x00,0x01 };
-		static string asnLongString = "30 5c 02 55 2d 58 e9 bf f0 31 cd 79 06 50 5a d5 9e 0e 2c e6 c2 f7 f9 d2 ce 55 64 85 b1 90 9a 92 b3 36 c1 bc ea c8 23 b7 ab 3a a7 64 63 77 5f 84 22 8e e5 b6 45 dd 46 ae 0a dd 00 c2 1f ba d9 ad c0 75 62 f8 95 82 a2 80 b1 82 69 fa e1 af 7f bc 7d e2 7c 76 d5 bc 2a 80 fb 02 03 01 00 01";
-
-		[Test]
-		public void Constructor_StringData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("oid", asnNullBytes);
-			Assert.AreEqual ("oid", aed.Oid.Value, "Oid.Value");
-			Assert.IsNull (aed.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (BitConverter.ToString (asnNullBytes), BitConverter.ToString (aed.RawData), "RawData");
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void Constructor_StringNullData () 
-		{
-			string oid = null; // do not confuse compiler
-			AsnEncodedData aed = new AsnEncodedData (oid, asnNullBytes);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void Constructor_StringDataNull () 
-		{
-			AsnEncodedData aed = new AsnEncodedData ("oid", null);
-		}
-
-		[Test]
-		public void Constructor_OidData () 
-		{
-			Oid o = new Oid ("1.0");
-			AsnEncodedData aed = new AsnEncodedData (o, asnNullBytes);
-			Assert.AreEqual ("1.0", aed.Oid.Value, "Oid.Value");
-			Assert.IsNull (aed.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (BitConverter.ToString (asnNullBytes), BitConverter.ToString (aed.RawData), "RawData");
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format");
-		}
-
-		[Test]
-		public void Constructor_OidNullData () 
-		{
-			// this is legal - http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=38336cfa-3b97-47da-ad4e-9522d557f001
-			Oid o = null;
-			AsnEncodedData aed = new AsnEncodedData (o, asnNullBytes);
-			Assert.IsNull (aed.Oid, "Oid");
-			Assert.AreEqual (BitConverter.ToString (asnNullBytes), BitConverter.ToString (aed.RawData), "RawData");
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void Constructor_OidDataNull () 
-		{
-			Oid o = new Oid ("1.0");
-			AsnEncodedData aed = new AsnEncodedData (o, null);
-		}
-
-		[Test]
-		public void Constructor_Asn () 
-		{
-			AsnEncodedData aed = new AsnEncodedData ("oid", asnNullBytes);
-			AsnEncodedData aed2 = new AsnEncodedData (aed);
-			Assert.AreEqual (aed.Oid.Value, aed2.Oid.Value, "Oid.Value");
-			Assert.AreEqual (aed.Oid.FriendlyName, aed2.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (BitConverter.ToString (aed.RawData), BitConverter.ToString (aed2.RawData), "RawData");
-			string s1 = aed.Format (false); 
-			string s2 = aed.Format (true);
-			Assert.AreEqual (s1, s2, "Format");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void Constructor_ByteArrayNull ()
-		{
-			byte[] array = null;
-			AsnEncodedData aed = new AsnEncodedData (array);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void Constructor_AsnNull ()
-		{
-			AsnEncodedData asn = null;
-			AsnEncodedData aed = new AsnEncodedData (asn);
-		}
-
-		[Test]
-		public void Oid_CreatedNull ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ((Oid)null, asnNullBytes);
-			Assert.IsNull (aed.Oid, "Oid 1");
-			Oid o = new Oid ("1.2.3");
-			aed.Oid = o;
-			Assert.AreEqual ("1.2.3", aed.Oid.Value, "Oid 2");
-			o.Value = "1.2.4";
-			Assert.AreEqual ("1.2.3", aed.Oid.Value, "Oid 3"); // didn't change (copy)
-			aed.Oid = null;
-			Assert.IsNull (aed.Oid, "Oid 4");
-		}
-
-		[Test]
-		public void Oid ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", asnNullBytes);
-			Assert.AreEqual ("1.2.3", aed.Oid.Value, "Oid 1");
-			aed.Oid.Value = "1.2.4";
-			Assert.AreEqual ("1.2.4", aed.Oid.Value, "Oid 2"); // didn't change (copy)
-			aed.Oid = null;
-			Assert.IsNull (aed.Oid, "Oid 3");
-		}
-
-		[Test]
-		public void RawData_CanModify ()
-		{
-			byte[] data = (byte[])asnNullBytes.Clone ();
-			AsnEncodedData aed = new AsnEncodedData ("1.2.3", data);
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format 1");
-			data[0] = 0x06;
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format 2"); ; // didn't change (copy)
-			aed.RawData[0] = 0x07;
-			Assert.AreEqual ("07 00", aed.Format (true), "Format 3"); // changed!
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void RawData ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ((Oid)null, asnNullBytes);
-			Assert.AreEqual (asnNullString, aed.Format (true), "Format 1");
-			aed.RawData = null;
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyFrom_Null ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ((Oid)null, asnNullBytes);
-			aed.CopyFrom (null);
-		}
-
-		[Test]
-		public void CopyFrom ()
-		{
-			Oid o = new Oid ("1.2.3");
-			byte[] data = (byte[])asnNullBytes.Clone ();
-			AsnEncodedData aed = new AsnEncodedData (o, asnNullBytes);
-			AsnEncodedData copy = new AsnEncodedData ((Oid)null, new byte [0]);
-			copy.CopyFrom (aed);
-
-			Assert.AreEqual (aed.Oid.Value, copy.Oid.Value, "Oid 1");
-			Assert.AreEqual (aed.Format (true), copy.Format (true), "Format 1");
-
-			aed.Oid = new Oid ("1.2.4");
-			aed.RawData = new byte[1];
-
-			Assert.AreEqual ("1.2.3", copy.Oid.Value, "Oid 2");
-			Assert.AreEqual (asnNullString, copy.Format (true), "Format 2");
-		}
-
-		[Test]
-		public void Format () 
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.840.113549.1.1.1", asnLongBytes);
-			Assert.AreEqual ("1.2.840.113549.1.1.1", aed.Oid.Value, "Oid.Value");
-			Assert.AreEqual ("RSA", aed.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (BitConverter.ToString (asnLongBytes), BitConverter.ToString (aed.RawData), "RawData");
-			string result = aed.Format (false);
-			Assert.AreEqual (asnLongString, result, "Format(false)");
-		}
-
-		[Test]
-		public void FormatMultiline ()
-		{
-			AsnEncodedData aed = new AsnEncodedData ("1.2.840.113549.1.1.1", asnLongBytes);
-			Assert.AreEqual ("1.2.840.113549.1.1.1", aed.Oid.Value, "Oid.Value");
-			Assert.AreEqual ("RSA", aed.Oid.FriendlyName, "Oid.FriendlyName");
-			Assert.AreEqual (BitConverter.ToString (asnLongBytes), BitConverter.ToString (aed.RawData), "RawData");
-			string result = aed.Format (true);
-			Assert.AreEqual (asnLongString, result, "Format(true)");
-		}
-
-		[Test]
-		public void Build_X509EnhancedKeyUsageExtension ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x30, 0x05, 0x06, 0x03, 0x2A, 0x03, 0x04 });
-			Assert.AreEqual ("30 05 06 03 2a 03 04", aed.Format (true), "Format(true)");
-			Assert.AreEqual ("30 05 06 03 2a 03 04", aed.Format (false), "Format(false)");
-			aed.Oid = new Oid ("2.5.29.37");
-			// and now "AsnEncodedData" knows how to (magically) decode the data without involving the class
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, aed.Format (true), "aed.Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", aed.Format (false), "aed.Format(false)");
-			// compare with the output of the "appropriate" class
-			X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (aed, false);
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)" + Environment.NewLine, eku.Format (true), "eku.Format(true)");
-			Assert.AreEqual ("Unknown Key Usage (1.2.3.4)", eku.Format (false), "eku.Format(false)");
-		}
-
-		[Test]
-		// note: important to emulate in Mono because we need it for SSL/TLS
-		public void Build_NetscapeCertTypeExtension ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x03, 0x02, 0x01, 0x06 });
-			Assert.AreEqual ("03 02 01 06", aed.Format (true), "Format(true)");
-			Assert.AreEqual ("03 02 01 06", aed.Format (false), "Format(false)");
-			aed.Oid = new Oid ("2.16.840.1.113730.1.1");
-			// and now "AsnEncodedData" knows how to (magically) decode the data without involving the class
-			Assert.AreEqual ("SSL CA, SMIME CA (06)", aed.Format (true), "aed.Format(true)");
-			Assert.AreEqual ("SSL CA, SMIME CA (06)", aed.Format (false), "aed.Format(false)");
-			// note that the Fx doesn't "really" support this extension
-			// and strangely no NewLine is being appended to Format(true)
-			// finally this also means that the Oid "knowns" about oid not used in the Fx itself
-			Assert.AreEqual ("Netscape Cert Type", aed.Oid.FriendlyName, "FriendlyName");
-			// anyway the answer is most probably CryptoAPI
-		}
-
-		[Test]
-		// note: important to emulate in Mono because we need it for SSL/TLS
-		public void Build_SubjectAltNameExtension ()
-		{
-			AsnEncodedData aed = new AsnEncodedData (new byte[] { 0x30, 0x16, 0x82, 0x14, 0x77, 0x77, 0x77, 0x2E, 0x6D, 0x6F, 0x6E, 0x6F, 0x2D, 0x70, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x2E, 0x63, 0x6F, 0x6D });
-			Assert.AreEqual ("30 16 82 14 77 77 77 2e 6d 6f 6e 6f 2d 70 72 6f 6a 65 63 74 2e 63 6f 6d", aed.Format (true), "Format(true)");
-			Assert.AreEqual ("30 16 82 14 77 77 77 2e 6d 6f 6e 6f 2d 70 72 6f 6a 65 63 74 2e 63 6f 6d", aed.Format (false), "Format(false)");
-			aed.Oid = new Oid ("2.5.29.17");
-			// and now "AsnEncodedData" knows how to (magically) decode the data without involving the class
-			Assert.AreEqual ("DNS Name=www.mono-project.com" + Environment.NewLine, aed.Format (true), "aed.Format(true)");
-			Assert.AreEqual ("DNS Name=www.mono-project.com", aed.Format (false), "aed.Format(false)");
-			// note that the Fx doesn't "really" support this extension
-			// finally this also means that the Oid "knowns" about oid not used in the Fx itself
-			Assert.AreEqual ("Subject Alternative Name", aed.Oid.FriendlyName, "FriendlyName");
-			// anyway the answer is most probably CryptoAPI
-		}
-	}
-}
-
-#endif

+ 4 - 22
mcs/class/System.Security/Test/System.Security.Cryptography/ChangeLog

@@ -1,3 +1,7 @@
+2005-09-26  Sebastien Pouliot  <[email protected]>
+
+	* Asn*.cs, Oid*.cs: Moved to System.dll
+
 2005-04-27  Sebastien Pouliot  <[email protected]>
 
 	* ProtectedDataTest.cs: Updated to NUnit 2.2 API to use Ignore it the 
@@ -9,32 +13,10 @@
 
 	* CryptographicAttributeTest.cs: Changed class names to match beta2.
 
-2005-01-20  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedDataTest.cs: Added test case for SubjectAltName extension.
-
-2005-01-17  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedDataTest.cs: Added tests decode Fx supported Enhanced Key
-	Usage extension and Fx "officially" unsupported Netscape Cert Type
-	extension. Both are docoded sucessfully at this level.
-
 2005-01-13  Sebastien Pouliot  <[email protected]>
 
-	* AsnEncodedDataTest.cs: Added tests for Oid, RawData properties and
-	for CopyFrom method.
 	* CryptographicAttributeTest.cs: Updated to NUnit 2.2 tests.
 
 2004-07-09  Sebastien Pouliot  <[email protected]>
 
-	* AsnEncodedDataTest.cs: Fixed for Fx 2.0 beta1.
 	* CryptographicAttributeTest.cs: New. Moved from S.S.C.Pkcs.
-	* OidTest.cs: Fixed for Fx 2.0 beta1.
-
-2003-11-06  Sebastien Pouliot  <[email protected]>
-
-	* AsnEncodedDataTest.cs: New. Unit tests for AsnEncodedData (.NET 1.2).
-	* OidTest.cs: New. Unit tests for Oid (.NET 1.2).
-	* OidCollectionTest.cs: New. Unit tests for OidCollection (.NET 1.2).
-	* OidEnumeratorTest.cs: New. Unit tests for OidEnumerator (.NET 1.2).
-

+ 0 - 75
mcs/class/System.Security/Test/System.Security.Cryptography/OidCollectionTest.cs

@@ -1,75 +0,0 @@
-//
-// OidCollectionTest.cs - NUnit tests for OidCollection
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-#if NET_2_0
-
-using NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-
-namespace MonoTests.System.Security.Cryptography {
-
-	[TestFixture]
-	public class OidCollectionTest : Assertion {
-
-		[Test]
-		public void Constructor () 
-		{
-			OidCollection oc = new OidCollection ();
-			// default properties
-			AssertEquals ("Count", 0, oc.Count);
-			Assert ("IsSynchronized", !oc.IsSynchronized);
-			AssertNotNull ("SyncRoot", oc.SyncRoot);
-			AssertNotNull ("GetEnumerator", oc.GetEnumerator ());
-		}
-
-		[Test]
-		public void Add ()
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.0"));
-			AssertEquals ("Count", 1, oc.Count);
-			AssertEquals ("[0]", "1.0", oc [0].Value);
-			AssertEquals ("['1.0']", "1.0", oc ["1.0"].Value);
-		}
-
-		[Test]
-		//BUG [ExpectedException (typeof (ArgumentNullException))]
-		public void AddNull () 
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (null);
-			AssertEquals ("Count", 1, oc.Count);
-			// AssertNull ("[0]", oc); throw NullReferenceException
-		}
-
-		[Test]
-		public void CopyToOid () 
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.0"));
-			Oid[] array = new Oid [1];
-			oc.CopyTo (array, 0);
-			AssertEquals ("CopyTo(Oid)", "1.0", array [0].Value);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void CopyToOidNull ()
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.0"));
-			Oid[] array = null;
-			oc.CopyTo (array, 0);
-		}
-	}
-}
-
-#endif

+ 0 - 82
mcs/class/System.Security/Test/System.Security.Cryptography/OidEnumeratorTest.cs

@@ -1,82 +0,0 @@
-//
-// OidEnumeratorTest.cs - NUnit tests for OidEnumerator
-//
-// Author:
-//	Sebastien Pouliot ([email protected])
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-#if NET_2_0
-
-using NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-
-namespace MonoTests.System.Security.Cryptography {
-
-	[TestFixture]
-	public class OidEnumeratorTest : Assertion {
-
-		private OidEnumerator GetEnumerator () 
-		{
-			OidCollection oc = new OidCollection ();
-			oc.Add (new Oid ("1.0"));
-			oc.Add (new Oid ("1.1"));
-			oc.Add (new Oid ("1.2"));
-			return oc.GetEnumerator ();
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentOutOfRangeException))]
-		public void Current_BeforeFirstElement ()
-		{
-			OidEnumerator enumerator = GetEnumerator ();
-			Oid oid = enumerator.Current;
-		}
-
-		[Test]
-		public void Current () 
-		{
-			OidEnumerator enumerator = GetEnumerator ();
-			enumerator.MoveNext ();
-			Oid oid = enumerator.Current;
-			AssertNotNull ("Current", oid);
-		}
-
-		[Test]
-		public void Current_AfterLastElement ()
-		{
-			OidEnumerator enumerator = GetEnumerator ();
-			while (enumerator.MoveNext ());
-			Oid oid = enumerator.Current;
-			AssertNotNull ("Current_AfterLastElement", oid);
-			AssertEquals ("Current==last", "1.2", oid.Value);
-		}
-
-		[Test]
-		public void MoveNext () 
-		{
-			OidEnumerator enumerator = GetEnumerator ();
-			int n = 0;
-			while (enumerator.MoveNext ()) {
-				n++;
-			}
-			AssertEquals ("MoveNext", 3, n);
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentOutOfRangeException))]
-		public void Reset () 
-		{
-			OidEnumerator enumerator = GetEnumerator ();
-			enumerator.MoveNext ();
-			AssertNotNull ("Current before reset", enumerator.Current);
-			enumerator.Reset ();
-			AssertNotNull ("Current after reset", enumerator.Current);
-		}
-	}
-}
-
-#endif

+ 0 - 184
mcs/class/System.Security/Test/System.Security.Cryptography/OidTest.cs

@@ -1,184 +0,0 @@
-//
-// OidTest.cs - NUnit tests for Oid
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// (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 NUnit.Framework;
-
-using System;
-using System.Security.Cryptography;
-
-namespace MonoTests.System.Security.Cryptography {
-
-	[TestFixture]
-	public class OidTest {
-
-		static string invalidOid = "1.0";
-		static string invalidName = "friendlyName";
-		static string validOid = "1.2.840.113549.1.1.1";
-		static string validName = "RSA";
-
-		[Test]
-		public void ConstructorEmpty () 
-		{
-			Oid o = new Oid ();
-			Assert.IsNull (o.FriendlyName, "FriendlyName");
-			Assert.IsNull (o.Value, "Value");
-		}
-
-		[Test]
-		public void ConstructorValidString () 
-		{
-			Oid o = new Oid (validOid);
-			Assert.AreEqual (validName, o.FriendlyName, "FriendlyName");
-			Assert.AreEqual (validOid, o.Value, "Value");
-		}
-
-		[Test]
-		public void ConstructorInvalidString ()
-		{
-			Oid o = new Oid (invalidOid);
-			Assert.IsNull (o.FriendlyName, "FriendlyName");
-			Assert.AreEqual (invalidOid, o.Value, "Value");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorNullString ()
-		{
-			string oid = null; // do not confuse compiler
-			Oid o = new Oid (oid);
-		}
-
-		[Test]
-		public void ConstructorStringString ()
-		{
-			Oid o = new Oid (validOid, invalidName);
-			Assert.AreEqual (invalidName, o.FriendlyName, "FriendlyName");
-			Assert.AreEqual (validOid, o.Value, "Value");
-		}
-
-		[Test]
-		//BUG [ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorStringNullString () 
-		{
-			Oid o = new Oid (null, validName);
-			Assert.AreEqual (validName, o.FriendlyName, "FriendlyName");
-			Assert.IsNull (o.Value, "Value");
-		}
-
-		[Test]
-		public void ConstructorStringStringNull () 
-		{
-			Oid o = new Oid (validOid, null);
-			Assert.IsNull (o.FriendlyName, "FriendlyName");
-			Assert.AreEqual (validOid, o.Value, "Value");
-		}
-
-		[Test]
-		public void ConstructorOid ()
-		{
-			Oid o = new Oid (validOid, invalidName);
-			Oid o2 = new Oid (o);
-			Assert.AreEqual (invalidName, o.FriendlyName, "FriendlyName==invalid");
-			Assert.AreEqual (o.FriendlyName, o2.FriendlyName, "FriendlyName");
-			Assert.AreEqual (o.Value, o2.Value, "Value");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentNullException))]
-		public void ConstructorOidNull () 
-		{
-			Oid onull = null; // do not confuse compiler
-			Oid o = new Oid (onull);
-		}
-
-		[Test]
-		public void FriendlyName () 
-		{
-			Oid o = new Oid (invalidOid, invalidName);
-			Assert.AreEqual (invalidName, o.FriendlyName, "FriendlyName-1");
-			Assert.AreEqual (invalidOid, o.Value, "Value-1");
-			o.FriendlyName = validName;
-			Assert.AreEqual (validName, o.FriendlyName, "FriendlyName-2");
-			Assert.AreEqual (validOid, o.Value, "Value-2"); // surprise!
-		}
-
-		[Test]
-		public void FriendlyNameNull ()
-		{
-			Oid o = new Oid (validOid, invalidName);
-			Assert.AreEqual (invalidName, o.FriendlyName, "FriendlyName");
-			o.FriendlyName = null;
-			Assert.IsNull (o.FriendlyName, "FriendlyName-Null");
-		}
-
-		[Test]
-		public void Value () 
-		{
-			Oid o = new Oid (validOid, invalidName);
-			Assert.AreEqual (validOid, o.Value, "Value-1");
-			o.Value = invalidName;
-			Assert.AreEqual (invalidName, o.Value, "Value-2");
-		}
-
-		[Test]
-		public void ValueNull () 
-		{
-			Oid o = new Oid (validOid, invalidName);
-			Assert.AreEqual (validOid, o.Value, "Value");
-			o.Value = null;
-			Assert.IsNull (o.Value, "Value-Null");
-		}
-
-		[Test]
-		public void WellKnownOid () 
-		{
-			Oid o = new Oid ("1.2.840.113549.1.1.1");
-			Assert.AreEqual ("1.2.840.113549.1.1.1", o.Value, "RSA Value");
-			Assert.AreEqual ("RSA", o.FriendlyName, "RSA FriendlyName");
-
-			o = new Oid ("1.2.840.113549.1.7.1");
-			Assert.AreEqual ("1.2.840.113549.1.7.1", o.Value, "PKCS 7 Data Value");
-			Assert.AreEqual ("PKCS 7 Data", o.FriendlyName, "PKCS 7 Data FriendlyName");
-
-			o = new Oid ("1.2.840.113549.1.9.5");
-			Assert.AreEqual ("1.2.840.113549.1.9.5", o.Value, "Signing Time Value");
-			Assert.AreEqual ("Signing Time", o.FriendlyName, "Signing Time FriendlyName");
-
-			o = new Oid ("1.2.840.113549.3.7");
-			Assert.AreEqual ("1.2.840.113549.3.7", o.Value, "3des Value");
-			Assert.AreEqual ("3des", o.FriendlyName, "3des FriendlyName");
-
-			// TODO: add other well known oid as we find them
-		}
-	}
-}
-
-#endif

+ 4 - 0
mcs/class/System.Security/Test/System.Security.Permissions/ChangeLog

@@ -1,3 +1,7 @@
+2005-09-26  Sebastien Pouliot  <[email protected]>
+
+	* StorePermissionAttributeTest.cs: Moved in System.dll
+
 2005-09-22  Sebastien Pouliot  <[email protected]>
 
 	* DataProtectionPermissionAttributeTest.cs: Removed *Choice security 

+ 0 - 249
mcs/class/System.Security/Test/System.Security.Permissions/StorePermissionAttributeTest.cs

@@ -1,249 +0,0 @@
-//
-// StorePermissionAttributeTest.cs -
-//	NUnit Test Cases for StorePermissionAttributeTest
-//
-// Author:
-//	Sebastien Pouliot  <[email protected]>
-//
-// Copyright (C) 2005 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 NUnit.Framework;
-using System;
-using System.Security;
-using System.Security.Permissions;
-
-namespace MonoTests.System.Security.Permissions {
-
-	[TestFixture]
-	public class StorePermissionAttributeTest {
-
-		[Test]
-		public void Default ()
-		{
-			StorePermissionAttribute a = new StorePermissionAttribute (SecurityAction.Assert);
-			Assert.IsFalse (a.AddToStore, "AddToStore");
-			Assert.IsFalse (a.CreateStore, "CreateStore");
-			Assert.IsFalse (a.DeleteStore, "DeleteStore");
-			Assert.IsFalse (a.EnumerateCertificates, "EnumerateCertificates");
-			Assert.IsFalse (a.EnumerateStores, "EnumerateStores");
-			Assert.IsFalse (a.OpenStore, "OpenStore");
-			Assert.IsFalse (a.RemoveFromStore, "RemoveFromStore");
-
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags");
-			Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId");
-
-			StorePermission perm = (StorePermission)a.CreatePermission ();
-			Assert.AreEqual (StorePermissionFlags.NoFlags, perm.Flags, "CreatePermission.Flags");
-		}
-
-		[Test]
-		public void Action ()
-		{
-			StorePermissionAttribute a = new StorePermissionAttribute (SecurityAction.Assert);
-			Assert.AreEqual (SecurityAction.Assert, a.Action, "Action=Assert");
-			a.Action = SecurityAction.Demand;
-			Assert.AreEqual (SecurityAction.Demand, a.Action, "Action=Demand");
-			a.Action = SecurityAction.Deny;
-			Assert.AreEqual (SecurityAction.Deny, a.Action, "Action=Deny");
-			a.Action = SecurityAction.InheritanceDemand;
-			Assert.AreEqual (SecurityAction.InheritanceDemand, a.Action, "Action=InheritanceDemand");
-			a.Action = SecurityAction.LinkDemand;
-			Assert.AreEqual (SecurityAction.LinkDemand, a.Action, "Action=LinkDemand");
-			a.Action = SecurityAction.PermitOnly;
-			Assert.AreEqual (SecurityAction.PermitOnly, a.Action, "Action=PermitOnly");
-			a.Action = SecurityAction.RequestMinimum;
-			Assert.AreEqual (SecurityAction.RequestMinimum, a.Action, "Action=RequestMinimum");
-			a.Action = SecurityAction.RequestOptional;
-			Assert.AreEqual (SecurityAction.RequestOptional, a.Action, "Action=RequestOptional");
-			a.Action = SecurityAction.RequestRefuse;
-			Assert.AreEqual (SecurityAction.RequestRefuse, a.Action, "Action=RequestRefuse");
-		}
-
-		[Test]
-		public void Action_Invalid ()
-		{
-			StorePermissionAttribute a = new StorePermissionAttribute ((SecurityAction)Int32.MinValue);
-			// no validation in attribute
-		}
-
-		private StorePermissionAttribute Empty ()
-		{
-			StorePermissionAttribute a = new StorePermissionAttribute (SecurityAction.Assert);
-			a.AddToStore = false;
-			a.CreateStore = false;
-			a.DeleteStore = false;
-			a.EnumerateCertificates = false;
-			a.EnumerateStores = false;
-			a.OpenStore = false;
-			a.RemoveFromStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags");
-			return a;
-		}
-
-		[Test]
-		public void AddToStore ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.AddToStore = true;
-			Assert.AreEqual (StorePermissionFlags.AddToStore, a.Flags, "Flags=AddToStore");
-			a.AddToStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void CreateStore ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.CreateStore = true;
-			Assert.AreEqual (StorePermissionFlags.CreateStore, a.Flags, "Flags=CreateStore");
-			a.CreateStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void DeleteStore ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.DeleteStore = true;
-			Assert.AreEqual (StorePermissionFlags.DeleteStore, a.Flags, "Flags=DeleteStore");
-			a.DeleteStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void EnumerateCertificates ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.EnumerateCertificates = true;
-			Assert.AreEqual (StorePermissionFlags.EnumerateCertificates, a.Flags, "Flags=EnumerateCertificates");
-			a.EnumerateCertificates = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void EnumerateStores ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.EnumerateStores = true;
-			Assert.AreEqual (StorePermissionFlags.EnumerateStores, a.Flags, "Flags=EnumerateStores");
-			a.EnumerateStores = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void OpenStore ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.OpenStore = true;
-			Assert.AreEqual (StorePermissionFlags.OpenStore, a.Flags, "Flags=OpenStore");
-			a.OpenStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void RemoveFromStore ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.RemoveFromStore = true;
-			Assert.AreEqual (StorePermissionFlags.RemoveFromStore, a.Flags, "Flags=RemoveFromStore");
-			a.RemoveFromStore = false;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Flags=NoFlags");
-		}
-
-		[Test]
-		public void Unrestricted ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.Unrestricted = true;
-			Assert.AreEqual (StorePermissionFlags.NoFlags, a.Flags, "Unrestricted");
-
-			StorePermission perm = (StorePermission)a.CreatePermission ();
-			Assert.AreEqual (StorePermissionFlags.AllFlags, perm.Flags, "CreatePermission.Flags");
-		}
-
-		[Test]
-		public void Flags ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.Flags = StorePermissionFlags.AddToStore;
-			Assert.IsTrue (a.AddToStore, "AddToStore");
-			a.Flags |= StorePermissionFlags.CreateStore;
-			Assert.IsTrue (a.CreateStore, "CreateStore");
-			a.Flags |= StorePermissionFlags.DeleteStore;
-			Assert.IsTrue (a.DeleteStore, "DeleteStore");
-			a.Flags |= StorePermissionFlags.EnumerateCertificates;
-			Assert.IsTrue (a.EnumerateCertificates, "EnumerateCertificates");
-			a.Flags |= StorePermissionFlags.EnumerateStores;
-			Assert.IsTrue (a.EnumerateStores, "EnumerateStores");
-			a.Flags |= StorePermissionFlags.OpenStore;
-			Assert.IsTrue (a.OpenStore, "OpenStore");
-			a.Flags |= StorePermissionFlags.RemoveFromStore;
-			Assert.IsTrue (a.RemoveFromStore, "RemoveFromStore");
-
-			Assert.IsFalse (a.Unrestricted, "Unrestricted");
-			Assert.AreEqual (StorePermissionFlags.AllFlags, a.Flags, "Flags=AllFlags");
-
-			a.Flags &= ~StorePermissionFlags.AddToStore;
-			Assert.IsFalse (a.AddToStore, "AddToStore");
-			a.Flags &= ~StorePermissionFlags.CreateStore;
-			Assert.IsFalse (a.CreateStore, "CreateStore");
-			a.Flags &= ~StorePermissionFlags.DeleteStore;
-			Assert.IsFalse (a.DeleteStore, "DeleteStore");
-			a.Flags &= ~StorePermissionFlags.EnumerateCertificates;
-			Assert.IsFalse (a.EnumerateCertificates, "EnumerateCertificates");
-			a.Flags &= ~StorePermissionFlags.EnumerateStores;
-			Assert.IsFalse (a.EnumerateStores, "EnumerateStores");
-			a.Flags &= ~StorePermissionFlags.OpenStore;
-			Assert.IsFalse (a.OpenStore, "OpenStore");
-			a.Flags &= ~StorePermissionFlags.RemoveFromStore;
-			Assert.IsFalse (a.RemoveFromStore, "RemoveFromStore");
-		}
-
-		[Test]
-		[ExpectedException (typeof (ArgumentException))]
-		public void Flags_Invalid ()
-		{
-			StorePermissionAttribute a = Empty ();
-			a.Flags = ((StorePermissionFlags)Int32.MinValue);
-		}
-
-		[Test]
-		public void Attributes ()
-		{
-			Type t = typeof (StorePermissionAttribute);
-			Assert.IsTrue (t.IsSerializable, "IsSerializable");
-
-			object [] attrs = t.GetCustomAttributes (typeof (AttributeUsageAttribute), false);
-			Assert.AreEqual (1, attrs.Length, "AttributeUsage");
-			AttributeUsageAttribute aua = (AttributeUsageAttribute)attrs [0];
-			Assert.IsTrue (aua.AllowMultiple, "AllowMultiple");
-			Assert.IsFalse (aua.Inherited, "Inherited");
-			AttributeTargets at = (AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method);
-			Assert.AreEqual (at, aua.ValidOn, "ValidOn");
-		}
-	}
-}
-
-#endif