Просмотр исходного кода

Import System.Security.Cryptography.Pkcs from CoreFX. (#8994)

* Import System.Security.Cryptography.Pkcs from CoreFX.

* Change 'as' operator to a cast.

* Add missing EnvelopedCms overloads.

* Include CMS signing classes in all builds.

* [csproj] Update project files

* Add missing DSACertificateExtensions class.

* Update references.

* Rename EnvelopedCms.Overloads.cs to EnvelopedCms.cs.

* Enable some of the System.Security.Cryptography.Pkcs xunit tests.

* Update references.

* Bump API snapshot submodule

* Disable xunit tests that may depend on Windows PAL.

Contributes to https://github.com/mono/mono/issues/7589
Filip Navara 7 лет назад
Родитель
Сommit
6db2c5a1f8
34 измененных файлов с 268 добавлено и 2055 удалено
  1. 1 1
      external/binary-reference-assemblies
  2. 1 1
      external/corefx
  3. 1 0
      mcs/class/System.Core/System.Core.csproj
  4. 64 0
      mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs
  5. 1 0
      mcs/class/System.Core/common_System.Core.dll.sources
  6. 1 1
      mcs/class/System.Security/Makefile
  7. 0 123
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs
  8. 0 112
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs
  9. 6 202
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs
  10. 0 73
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs
  11. 0 71
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs
  12. 0 79
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs
  13. 0 111
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs
  14. 0 105
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs
  15. 0 105
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs
  16. 0 109
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs
  17. 4 4
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs
  18. 0 65
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs
  19. 0 94
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs
  20. 0 72
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs
  21. 0 305
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs
  22. 0 127
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs
  23. 0 103
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs
  24. 0 72
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs
  25. 0 57
      mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs
  26. 77 37
      mcs/class/System.Security/System.Security.csproj
  27. 0 5
      mcs/class/System.Security/System.Security.dll.sources
  28. 16 0
      mcs/class/System.Security/System.Security_xtest.dll.sources
  29. 1 2
      mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs
  30. 1 1
      mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs
  31. 2 2
      mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs
  32. 77 12
      mcs/class/System.Security/common_System.Security.dll.sources
  33. 13 4
      mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs
  34. 2 0
      mcs/class/test-helpers/PlatformDetection.cs

+ 1 - 1
external/binary-reference-assemblies

@@ -1 +1 @@
-Subproject commit 3cb3efa3696ce6d6dc5ecd1ed673c1e0077c1106
+Subproject commit bdc6cdaabf92a903e41a48aa8b94ed516e9536b8

+ 1 - 1
external/corefx

@@ -1 +1 @@
-Subproject commit 78a03ecb6e44f2e2c1b4a9b9a35be8876db44c98
+Subproject commit ca8bc154a3ed46de33b136c3ad61932519c7511f

+ 1 - 0
mcs/class/System.Core/System.Core.csproj

@@ -486,6 +486,7 @@
     <Compile Include="System.IO.Pipes\PipeStreamImpersonationWorker.cs" />
     <Compile Include="System.IO.Pipes\PipeTransmissionMode.cs" />
     <Compile Include="System.Runtime.InteropServices\ComAwareEventInfo.cs" />
+    <Compile Include="System.Security.Cryptography.X509Certificates\DSACertificateExtensions.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\ECDsaCertificateExtensions.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\RSACertificateExtensions.cs" />
     <Compile Include="System.Security.Cryptography\AesCng.cs" />

+ 64 - 0
mcs/class/System.Core/System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs

@@ -0,0 +1,64 @@
+//
+// DSACertificateExtensions.cs
+//
+// Authors:
+//	Filip Navara <[email protected]>
+//
+// Copyright (C) 2018 .NET Foundation and Contributors
+//
+// 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.
+//
+
+namespace System.Security.Cryptography.X509Certificates
+{
+	public static class DSACertificateExtensions
+	{
+		/// <summary>
+		/// Gets the <see cref="DSA" /> public key from the certificate or null if the certificate does not have a DSA public key.
+		/// </summary>
+		public static DSA GetDSAPublicKey(this X509Certificate2 certificate)
+		{
+			if (certificate == null)
+				throw new ArgumentNullException("certificate");
+			return certificate.PrivateKey as DSA;
+		}
+
+		/// <summary>
+		/// Gets the <see cref="DSA" /> private key from the certificate or null if the certificate does not have a DSA private key.
+		/// </summary>
+		public static DSA GetDSAPrivateKey(this X509Certificate2 certificate)
+		{
+			if (certificate == null)
+				throw new ArgumentNullException("certificate");
+			return certificate.PublicKey.Key as DSA;
+		}
+
+		[MonoTODO]
+		public static X509Certificate2 CopyWithPrivateKey(this X509Certificate2 certificate, DSA privateKey)
+		{
+			if (certificate == null)
+				throw new ArgumentNullException(nameof(certificate));
+			if (privateKey == null)
+				throw new ArgumentNullException(nameof(privateKey));
+
+			throw new NotImplementedException ();
+		}
+	}
+}

+ 1 - 0
mcs/class/System.Core/common_System.Core.dll.sources

@@ -10,6 +10,7 @@ Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
 System.Security.Cryptography/AesCng.cs
 System.Security.Cryptography/TripleDESCng.cs
 System.Security.Cryptography.X509Certificates/ECDsaCertificateExtensions.cs
+System.Security.Cryptography.X509Certificates/DSACertificateExtensions.cs
 System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
 Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
 Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs

+ 1 - 1
mcs/class/System.Security/Makefile

@@ -10,7 +10,7 @@ LIBRARY = System.Security.dll
 API_BIN_REFS := System.Numerics System.Core
 LIB_REFS = $(MONO_SECURITY) System System.Xml
 KEYFILE = ../msfinal.pub
-LIB_MCS_FLAGS = -nowarn:414,618 -d:SECURITY_DEP
+LIB_MCS_FLAGS = -unsafe -nowarn:414,618 -d:SECURITY_DEP
 
 LOCAL_MCS_FLAGS =
 

+ 0 - 123
mcs/class/System.Security/System.Security.Cryptography.Pkcs/CmsSigner.cs

@@ -1,123 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.CmsSigner 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 SECURITY_DEP
-
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class CmsSigner {
-
-		private SubjectIdentifierType _signer;
-		private X509Certificate2 _certificate;
-		private X509Certificate2Collection _coll;
-		private Oid _digest;
-		private X509IncludeOption _options;
-		private CryptographicAttributeObjectCollection _signed;
-		private CryptographicAttributeObjectCollection _unsigned;
-
-		// constructors
-
-		public CmsSigner () 
-		{
-			_signer = SubjectIdentifierType.IssuerAndSerialNumber;
-			_digest = new Oid ("1.3.14.3.2.26");
-			_options = X509IncludeOption.ExcludeRoot;
-			_signed = new CryptographicAttributeObjectCollection ();
-			_unsigned = new CryptographicAttributeObjectCollection ();
-			_coll = new X509Certificate2Collection ();
-		}
-
-		public CmsSigner (SubjectIdentifierType signerIdentifierType) : this ()
-		{
-			if (signerIdentifierType == SubjectIdentifierType.Unknown)
-				_signer = SubjectIdentifierType.IssuerAndSerialNumber;
-			else
-				_signer = signerIdentifierType;
-		}
-
-		public CmsSigner (SubjectIdentifierType signerIdentifierType, X509Certificate2 certificate) 
-			: this (signerIdentifierType)
-		{
-			_certificate = certificate;
-		}
-
-		public CmsSigner (X509Certificate2 certificate) : this ()
-		{
-			_certificate = certificate;
-		}
-
-		[MonoTODO]
-		public CmsSigner (CspParameters parameters) : this ()
-		{
-		}		
-
-		// properties
-
-		public CryptographicAttributeObjectCollection SignedAttributes {
-			get { return _signed; }
-		}
-
-		public X509Certificate2 Certificate {
-			get { return _certificate; }
-			set { _certificate = value; }
-		}
-
-		public X509Certificate2Collection Certificates {
-			get { return _coll; }
-		}
-
-		public Oid DigestAlgorithm {
-			get { return _digest; }
-			set { _digest = value; }
-		} 
-
-		public X509IncludeOption IncludeOption {
-			get { return _options; }
-			set { _options = value; }
-		} 
-
-		public SubjectIdentifierType SignerIdentifierType {
-			get { return _signer; }
-			set { 
-				if (value == SubjectIdentifierType.Unknown)
-					throw new ArgumentException ("value");
-
-				_signer = value;
-			}
-		}
-
-		public CryptographicAttributeObjectCollection UnsignedAttributes {
-			get { return _unsigned; }
-		}
-	}
-}
-
-#endif

+ 0 - 112
mcs/class/System.Security/System.Security.Cryptography.Pkcs/ContentInfo.cs

@@ -1,112 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.ContentInfo
-//
-// 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 SECURITY_DEP
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	/*
-	* ContentInfo ::= SEQUENCE {
-	*	contentType ContentType,
-	*	content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL 
-	* }
-	* ContentType ::= OBJECT IDENTIFIER
-	*/
-
-	public sealed class ContentInfo {
-
-		private Oid _oid;
-		private byte[] _content;
-
-		// constructors
-
-		public ContentInfo (byte[] content) 
-			: this (new Oid ("1.2.840.113549.1.7.1"), content)
-		{
-		} 
-
-		public ContentInfo (Oid contentType, byte[] content) 
-		{
-			if (contentType == null)
-				throw new ArgumentNullException ("contentType");
-			if (content == null)
-				throw new ArgumentNullException ("content");
-
-			_oid = contentType;
-			_content = content;
-		}
-
-		~ContentInfo () 
-		{
-		}
-
-		// properties
-
-		public byte[] Content { 
-			get { return (byte[]) _content.Clone (); }
-		}
-
-		public Oid ContentType { 
-			get { return _oid; }
-		}
-
-		// static methods
-
-		[MonoTODO ("MS is stricter than us about the content structure")]
-		public static Oid GetContentType (byte[] encodedMessage)
-		{
-			if (encodedMessage == null)
-				throw new ArgumentNullException ("algorithm");
-
-			try {
-				PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage);
-				switch (ci.ContentType) {
-				case PKCS7.Oid.data:
-				case PKCS7.Oid.signedData:		// see SignedCms class
-				case PKCS7.Oid.envelopedData:		// see EnvelopedCms class
-				case PKCS7.Oid.digestedData:
-				case PKCS7.Oid.encryptedData:
-					return new Oid (ci.ContentType);
-				default:
-					// Note: the constructor will accept any "valid" OID (but that 
-					// doesn't mean it's a valid ContentType structure - ASN.1 wise).
-					string msg = Locale.GetText ("Bad ASN1 - invalid OID '{0}'");
-					throw new CryptographicException (String.Format (msg, ci.ContentType));
-				}
-			}
-			catch (Exception e) {
-				throw new CryptographicException (Locale.GetText ("Bad ASN1 - invalid structure"), e);
-			}
-		}
-	}
-}
-
-#endif

+ 6 - 202
mcs/class/System.Security/System.Security.Cryptography.Pkcs/EnvelopedCms.cs

@@ -27,221 +27,25 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if SECURITY_DEP
-
-using System.Collections;
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-
-using Mono.Security;
-
 namespace System.Security.Cryptography.Pkcs {
-
-	// References
-	// a.	PKCS #7: Cryptographic Message Syntax, Version 1.5, Section 10
-	//	http://www.faqs.org/rfcs/rfc2315.html
-
-	public sealed class EnvelopedCms {
-
-		private ContentInfo _content;
-		private AlgorithmIdentifier _identifier;
-		private X509Certificate2Collection _certs;
-		private RecipientInfoCollection _recipients;
-		private CryptographicAttributeObjectCollection _uattribs;
-		private SubjectIdentifierType _idType;
-		private int _version;
-
-		// constructors
-
-		public EnvelopedCms () 
-		{
-			_certs = new X509Certificate2Collection ();
-			_recipients = new RecipientInfoCollection ();
-			_uattribs = new CryptographicAttributeObjectCollection ();
-		}
-
-		public EnvelopedCms (ContentInfo contentInfo) : this ()
-		{
-			if (contentInfo == null)
-				throw new ArgumentNullException ("contentInfo");
-
-			_content = contentInfo;
-		}
-
-		public EnvelopedCms (ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
-			: this (contentInfo) 
-		{
-			if (encryptionAlgorithm == null)
-				throw new ArgumentNullException ("encryptionAlgorithm");
-
-			_identifier = encryptionAlgorithm;
-		}
-
+	public sealed partial class EnvelopedCms {
 		public EnvelopedCms (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo) 
 			: this (contentInfo) 
 		{
-			_idType = recipientIdentifierType;
-			if (_idType == SubjectIdentifierType.SubjectKeyIdentifier)
-				_version = 2;
+			if (recipientIdentifierType == SubjectIdentifierType.SubjectKeyIdentifier)
+				Version = 2;
 		}
 
 		public EnvelopedCms (SubjectIdentifierType recipientIdentifierType, ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
 			: this (contentInfo, encryptionAlgorithm) 
 		{
-			_idType = recipientIdentifierType;
-			if (_idType == SubjectIdentifierType.SubjectKeyIdentifier)
-				_version = 2;
-		}
-
-		// properties
-
-		public X509Certificate2Collection Certificates {
-			get { return _certs; }
-		}
-
-		public AlgorithmIdentifier ContentEncryptionAlgorithm {
-			get { 
-				if (_identifier == null)
-					_identifier = new AlgorithmIdentifier ();
-				return _identifier; 
-			}
-		} 
-
-		public ContentInfo ContentInfo {
-			get { 
-				if (_content == null) {
-					Oid oid = new Oid (PKCS7.Oid.data);
-					_content = new ContentInfo (oid, new byte [0]);
-				}
-				return _content; 
-			}
+			if (recipientIdentifierType == SubjectIdentifierType.SubjectKeyIdentifier)
+				Version = 2;
 		}
 
-		public RecipientInfoCollection RecipientInfos {
-			get { return _recipients; }
-		}
-
-		public CryptographicAttributeObjectCollection UnprotectedAttributes { 
-			get { return _uattribs; }
-		}
-
-		public int Version {
-			get { return _version; }
-		}
-
-		// methods
-
-		private X509IssuerSerial GetIssuerSerial (string issuer, byte[] serial) 
-		{
-			X509IssuerSerial xis = new X509IssuerSerial ();
-			xis.IssuerName = issuer;
-			StringBuilder sb = new StringBuilder ();
-			foreach (byte b in serial)
-				sb.Append (b.ToString ("X2"));
-			xis.SerialNumber = sb.ToString ();
-			return xis;
-		}
-
-		[MonoTODO]
-		public void Decode (byte[] encodedMessage)
-		{
-			if (encodedMessage == null)
-				throw new ArgumentNullException ("encodedMessage");
-
-			PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage);
-			if (ci.ContentType != PKCS7.Oid.envelopedData)
-				throw new Exception ("");
-
-			PKCS7.EnvelopedData ed = new PKCS7.EnvelopedData (ci.Content);
-
-			Oid oid = new Oid (ed.ContentInfo.ContentType);
-			_content = new ContentInfo (oid, new byte [0]); //ed.ContentInfo.Content.Value);
-
-			foreach (PKCS7.RecipientInfo ri in ed.RecipientInfos) {
-				Oid o = new Oid (ri.Oid);
-				AlgorithmIdentifier ai = new AlgorithmIdentifier (o);
-				SubjectIdentifier si = null;
-				if (ri.SubjectKeyIdentifier != null) {
-					si = new SubjectIdentifier (SubjectIdentifierType.SubjectKeyIdentifier, ri.SubjectKeyIdentifier);
-				}
-				else if ((ri.Issuer != null) && (ri.Serial != null)) {
-					X509IssuerSerial xis = GetIssuerSerial (ri.Issuer, ri.Serial);
-					si = new SubjectIdentifier (SubjectIdentifierType.IssuerAndSerialNumber, (object)xis);
-				}
-				
-				KeyTransRecipientInfo _keyTrans = new KeyTransRecipientInfo (ri.Key, ai, si, ri.Version);
-				_recipients.Add (_keyTrans);
-			}
-
-			// TODO - Certificates
-			// TODO - UnprotectedAttributes 
-
-			_version = ed.Version;
-		}
-
-		[MonoTODO]
-		public void Decrypt () 
-		{
-			throw new InvalidOperationException ("not encrypted");
-		}
-
-		[MonoTODO]
-		public void Decrypt (RecipientInfo recipientInfo) 
-		{
-			if (recipientInfo == null)
-				throw new ArgumentNullException ("recipientInfo");
-			Decrypt ();
-		}
-
-		[MonoTODO]
-		public void Decrypt (RecipientInfo recipientInfo, X509Certificate2Collection extraStore)
-		{
-			if (recipientInfo == null)
-				throw new ArgumentNullException ("recipientInfo");
-			if (extraStore == null)
-				throw new ArgumentNullException ("extraStore");
-			Decrypt ();
-		}
-
-		[MonoTODO]
-		public void Decrypt (X509Certificate2Collection extraStore) 
-		{
-			if (extraStore == null)
-				throw new ArgumentNullException ("extraStore");
-			Decrypt ();
-		}
-
-		[MonoTODO]
-		public byte[] Encode ()
-		{
-			throw new InvalidOperationException ("not encrypted");
-		}
-
-		[MonoTODO]
 		public void Encrypt () 
 		{
-			if ((_content == null) || (_content.Content == null) || (_content.Content.Length == 0))
-				throw new CryptographicException ("no content to encrypt");
-		}
-
-		[MonoTODO]
-		public void Encrypt (CmsRecipient recipient)
-		{
-			if (recipient == null)
-				throw new ArgumentNullException ("recipient");
-			// TODO
-			Encrypt ();
-		}
-
-		[MonoTODO]
-		public void Encrypt (CmsRecipientCollection recipients)
-		{
-			if (recipients == null)
-				throw new ArgumentNullException ("recipients");
-			// ? foreach on Encrypt CmsRecipient ?
+			Encrypt (new CmsRecipientCollection ());
 		}
 	}
 }
-
-#endif

+ 0 - 73
mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs

@@ -1,73 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.KeyAgreeRecipientInfo 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 SECURITY_DEP
-
-namespace System.Security.Cryptography.Pkcs {
-
-	[MonoTODO]
-	public sealed class KeyAgreeRecipientInfo : RecipientInfo {
-
-		// only accessible from EnvelopedCms.RecipientInfos
-		internal KeyAgreeRecipientInfo () 
-			: base (RecipientInfoType.KeyAgreement) 
-		{
-		}
-
-		public DateTime Date {
-			get { return DateTime.MinValue; }
-		}
-
-		public override byte[] EncryptedKey {
-			get { return null; }
-		}
-
-		public override AlgorithmIdentifier KeyEncryptionAlgorithm {
-			get { return null; }
-		}
-
-		public SubjectIdentifierOrKey OriginatorIdentifierOrKey {
-			get { return null; }
-		}
-
-		public CryptographicAttributeObject OtherKeyAttribute {
-			get { return null; }
-		}
-
-		public override SubjectIdentifier RecipientIdentifier {
-			get { return null; }
-		}
-
-		public override int Version {
-			get { return 0; }
-		}
-	}
-}
-
-#endif

+ 0 - 71
mcs/class/System.Security/System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs

@@ -1,71 +0,0 @@
-//
-// KeyTransRecipientInfo.cs - System.Security.Cryptography.Pkcs.KeyTransRecipientInfo
-//
-// 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 SECURITY_DEP
-
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class KeyTransRecipientInfo : RecipientInfo {
-
-		private byte[] _encryptedKey;
-		private AlgorithmIdentifier _keyEncryptionAlgorithm;
-		private SubjectIdentifier _recipientIdentifier;
-		private int _version;
-
-		// only accessible from EnvelopedCms.RecipientInfos
-		internal KeyTransRecipientInfo (byte[] encryptedKey, AlgorithmIdentifier keyEncryptionAlgorithm, SubjectIdentifier recipientIdentifier, int version)
-			: base (RecipientInfoType.KeyTransport)
-		{
-			_encryptedKey = encryptedKey;
-			_keyEncryptionAlgorithm = keyEncryptionAlgorithm;
-			_recipientIdentifier = recipientIdentifier;
-			_version = version;
-		}
-
-		public override byte[] EncryptedKey {
-			get { return _encryptedKey; }
-		}
-
-		public override AlgorithmIdentifier KeyEncryptionAlgorithm {
-			get { return _keyEncryptionAlgorithm; }
-		} 
-
-		public override SubjectIdentifier RecipientIdentifier {
-			get { return _recipientIdentifier; }
-		} 
-
-		public override int Version {
-			get { return _version; }
-		}
-	}
-}
-
-#endif

+ 0 - 79
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs

@@ -1,79 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.Pkcs9AttributeObject 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 SECURITY_DEP
-
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public class Pkcs9AttributeObject : AsnEncodedData {
-
-		// constructors
-
-		public Pkcs9AttributeObject () 
-			: base ()
-		{
-		}
-
-		public Pkcs9AttributeObject (AsnEncodedData asnEncodedData)
-			: base (asnEncodedData)
-		{
-		}
-
-		public Pkcs9AttributeObject (Oid oid, byte[] encodedData) 
-		{
-			if (oid == null)
-				throw new ArgumentNullException ("oid");
-			base.Oid = oid;
-			RawData = encodedData;
-		}
-
-		public Pkcs9AttributeObject (string oid, byte[] encodedData)
-			: base (oid, encodedData) 
-		{
-		}
-
-		// this (sadly) removes the "set" accessor
-		public new Oid Oid {
-			get { return base.Oid; }
-			internal set { base.Oid = value; }
-		}
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			if (asnEncodedData == null)
-				throw new ArgumentNullException ("asnEncodedData");
-
-			throw new ArgumentException ("Cannot convert the PKCS#9 attribute.");
-		}
-	}
-}
-
-#endif

+ 0 - 111
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs

@@ -1,111 +0,0 @@
-//
-// Pkcs9ContentType.cs - System.Security.Cryptography.Pkcs.Pkcs9ContentType
-//
-// 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 SECURITY_DEP
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class Pkcs9ContentType : Pkcs9AttributeObject {
-
-		internal const string oid = "1.2.840.113549.1.9.3";
-		internal const string friendlyName = "Content Type";
-
-		private Oid _contentType;
-		private byte[] _encoded;
-
-		// constructors
-
-		public Pkcs9ContentType () 
-		{
-			// Pkcs9Attribute remove the "set" accessor on Oid :-(
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			_encoded = null;
-		}
-
-		internal Pkcs9ContentType (string contentType) 
-		{
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			_contentType = new Oid (contentType);
-			RawData = Encode ();
-			_encoded = null;
-		}
-
-		internal Pkcs9ContentType (byte[] encodedContentType) 
-		{
-			if (encodedContentType == null)
-				throw new ArgumentNullException ("encodedContentType");
-
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			RawData = encodedContentType;
-			Decode (encodedContentType);
-		}
-
-		// properties
-
-		public Oid ContentType {
-			get {
-				if (_encoded != null)
-					Decode (_encoded);
-				return _contentType;
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			base.CopyFrom (asnEncodedData);
-			_encoded = asnEncodedData.RawData;
-		}
-
-		// internal stuff
-
-		internal void Decode (byte[] attribute)
-		{
-			if ((attribute == null) || (attribute [0] != 0x06))
-				throw new CryptographicException (Locale.GetText ("Expected an OID."));
-
-			ASN1 oid = new ASN1 (attribute);
-			_contentType = new Oid (ASN1Convert.ToOid (oid));
-			_encoded = null;
-		}
-
-		internal byte[] Encode ()
-		{
-			if (_contentType == null)
-				return null;
-			return ASN1Convert.FromOid (_contentType.Value).GetBytes ();
-		}
-	}
-}
-
-#endif

+ 0 - 105
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs

@@ -1,105 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.Pkcs9DocumentDescription 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 SECURITY_DEP
-
-using System.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class Pkcs9DocumentDescription : Pkcs9AttributeObject {
-
-		internal const string oid = "1.3.6.1.4.1.311.88.2.2";
-		internal const string friendlyName = null;
-
-		private string _desc;
-
-		public Pkcs9DocumentDescription ()
-		{
-			// Pkcs9Attribute remove the "set" accessor on Oid :-(
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-		}
-
-		public Pkcs9DocumentDescription (string documentDescription)
-		{
-			if (documentDescription == null)
-				throw new ArgumentNullException ("documentName");
-
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			_desc = documentDescription;
-			RawData = Encode ();
-		}
-
-		public Pkcs9DocumentDescription (byte[] encodedDocumentDescription)
-		{
-			if (encodedDocumentDescription == null)
-				throw new ArgumentNullException ("encodedDocumentDescription");
-
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			RawData = encodedDocumentDescription;
-			Decode (encodedDocumentDescription);
-		}
-
-		public string DocumentDescription {
-			get { return _desc; }
-		}
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			base.CopyFrom (asnEncodedData);
-			Decode (this.RawData);
-		}
-
-		// internal stuff
-
-		internal void Decode (byte[] attribute)
-		{
-			if (attribute [0] != 0x04)
-				return; // throw ?
-
-			ASN1 attr = new ASN1 (attribute);
-			byte[] str = attr.Value;
-			int length = str.Length;
-			if (str [length - 2] == 0x00)
-				length -= 2;	// zero-terminated (normal)
-			_desc = Encoding.Unicode.GetString (str, 0, length);
-		}
-
-		internal byte[] Encode ()
-		{
-			// OCTETSTRING (0x04) Of the zero-terminated unicode string
-			ASN1 attr = new ASN1 (0x04, Encoding.Unicode.GetBytes (_desc + (char)0));
-			return attr.GetBytes ();
-		}
-	}
-}
-
-#endif

+ 0 - 105
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs

@@ -1,105 +0,0 @@
-//
-// Pkcs9DocumentName.cs - System.Security.Cryptography.Pkcs.Pkcs9DocumentName
-//
-// 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 SECURITY_DEP
-
-using System.Text;
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class Pkcs9DocumentName : Pkcs9AttributeObject	{
-
-		internal const string oid = "1.3.6.1.4.1.311.88.2.1";
-		internal const string friendlyName = null;
-
-		private string _name;
-
-		public Pkcs9DocumentName () 
-		{
-			// Pkcs9Attribute remove the "set" accessor on Oid :-(
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-		}
-
-		public Pkcs9DocumentName (string documentName) 
-		{
-			if (documentName == null)
-				throw new ArgumentNullException ("documentName");
-
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			_name = documentName;
-			RawData = Encode ();
-		}
-
-		public Pkcs9DocumentName (byte[] encodedDocumentName)
-		{
-			if (encodedDocumentName == null)
-				throw new ArgumentNullException ("encodedDocumentName");
-
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			RawData = encodedDocumentName;
-			Decode (encodedDocumentName);
-		}
-
-		public string DocumentName {
-			get { return _name; }
-		}
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			base.CopyFrom (asnEncodedData);
-			Decode (this.RawData);
-		}
-
-		// internal stuff
-
-		internal void Decode (byte[] attribute)
-		{
-			if (attribute [0] != 0x04)
-				return; // throw ?
-
-			ASN1 attr = new ASN1 (attribute);
-			byte[] str = attr.Value;
-			int length = str.Length;
-			if (str [length - 2] == 0x00)
-				length -= 2;	// zero-terminated (normal)
-			_name = Encoding.Unicode.GetString (str, 0, length);
-		}
-
-		internal byte[] Encode ()
-		{
-			// OCTETSTRING (0x04) Of the zero-terminated unicode string
-			ASN1 attr = new ASN1 (0x04, Encoding.Unicode.GetBytes (_name + (char)0));
-			return attr.GetBytes ();
-		}
-	}
-}
-
-#endif

+ 0 - 109
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs

@@ -1,109 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.Pkcs9MessageDigest class
-//
-// 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 SECURITY_DEP
-
-using Mono.Security;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class Pkcs9MessageDigest : Pkcs9AttributeObject {
-
-		internal const string oid = "1.2.840.113549.1.9.4";
-		internal const string friendlyName = "Message Digest";
-
-		private byte[] _messageDigest;
-		private byte[] _encoded;
-
-		// constructors
-
-		public Pkcs9MessageDigest () 
-		{
-			// Pkcs9Attribute remove the "set" accessor on Oid :-(
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-			_encoded = null;
-		}
-
-		internal Pkcs9MessageDigest (byte[] messageDigest, bool encoded) 
-		{
-			if (messageDigest == null)
-				throw new ArgumentNullException ("messageDigest");
-
-			if (encoded) {
-				(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-				RawData = messageDigest;
-				Decode (messageDigest);
-			} else {
-				(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
-				_messageDigest = (byte[]) _messageDigest.Clone ();
-				RawData = Encode ();
-			}
-		}
-
-		// properties
-
-		public byte[] MessageDigest {
-			get {
-				if (_encoded != null)
-					Decode (_encoded);
-				// FIXME: beta2 returns a reference
-				return _messageDigest;
-			}
-		}
-
-		// methods
-
-		public override void CopyFrom (AsnEncodedData asnEncodedData)
-		{
-			base.CopyFrom (asnEncodedData);
-			_encoded = asnEncodedData.RawData;
-		}
-
-		// internal stuff
-
-		internal void Decode (byte[] attribute)
-		{
-			if ((attribute == null) || (attribute [0] != 0x04))
-				throw new CryptographicException (Locale.GetText ("Expected an OCTETSTRING."));
-
-			ASN1 md = new ASN1 (attribute);
-			_messageDigest = md.Value;
-			_encoded  = null;
-		}
-
-		internal byte[] Encode ()
-		{
-			ASN1 md = new ASN1 (0x04, _messageDigest);
-			return md.GetBytes ();
-		}
-	}
-}
-
-#endif

+ 4 - 4
mcs/class/System.Security/System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs

@@ -46,14 +46,14 @@ namespace System.Security.Cryptography.Pkcs {
 		public Pkcs9SigningTime () 
 		{
 			// Pkcs9Attribute remove the "set" accessor on Oid :-(
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
+			((AsnEncodedData)this).Oid = new Oid (oid, friendlyName);
 			_signingTime = DateTime.Now;
 			RawData = Encode ();
 		}
 
 		public Pkcs9SigningTime (DateTime signingTime)
 		{
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
+			((AsnEncodedData)this).Oid = new Oid (oid, friendlyName);
 			_signingTime = signingTime;
 			RawData = Encode ();
 		}
@@ -63,7 +63,7 @@ namespace System.Security.Cryptography.Pkcs {
 			if (encodedSigningTime == null)
 				throw new ArgumentNullException ("encodedSigningTime");
 
-			(this as AsnEncodedData).Oid = new Oid (oid, friendlyName);
+			((AsnEncodedData)this).Oid = new Oid (oid, friendlyName);
 			RawData = encodedSigningTime;
 			Decode (encodedSigningTime);
 		}
@@ -78,7 +78,7 @@ namespace System.Security.Cryptography.Pkcs {
 				throw new ArgumentNullException ("asnEncodedData");
 
 			Decode (asnEncodedData.RawData);
-			Oid = asnEncodedData.Oid;
+			((AsnEncodedData)this).Oid = asnEncodedData.Oid;
 			RawData = asnEncodedData.RawData;
 		}
 

+ 0 - 65
mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfo.cs

@@ -1,65 +0,0 @@
-//
-// RecipientInfo.cs - System.Security.Cryptography.Pkcs.RecipientInfo
-//
-// 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 SECURITY_DEP
-
-using System;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public abstract class RecipientInfo {
-
-		private RecipientInfoType _type;
-
-		// constructors
-
-		// documented as protected at http://longhorn.msdn.microsoft.com
-		// but not present in the 1.2 beta SDK
-		internal RecipientInfo (RecipientInfoType recipInfoType) 
-		{
-			_type = recipInfoType;
-		}
-
-		// properties
-
-		public abstract byte[] EncryptedKey { get; }
-
-		public abstract AlgorithmIdentifier KeyEncryptionAlgorithm { get; }
-
-		public abstract SubjectIdentifier RecipientIdentifier { get; }
-
-		public RecipientInfoType Type {
-			get { return _type; }
-		}
-
-		public abstract int Version { get; }
-	}
-}
-
-#endif

+ 0 - 94
mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs

@@ -1,94 +0,0 @@
-//
-// RecipientInfoCollection.cs - System.Security.Cryptography.Pkcs.RecipientInfoCollection
-//
-// 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 SECURITY_DEP
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class RecipientInfoCollection : ICollection {
-
-		private ArrayList _list;
-
-		// only accessible from EnvelopedPkcs7.RecipientInfos
-		internal RecipientInfoCollection () 
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return _list.IsSynchronized; }
-		}
-
-		public RecipientInfo this [int index] {
-			get { return (RecipientInfo) _list [index]; }
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		// methods
-
-		internal int Add (RecipientInfo ri) 
-		{
-			return _list.Add (ri);
-		}
-
-		public void CopyTo (Array array, int index) 
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public void CopyTo (RecipientInfo[] array, int index) 
-		{
-			_list.CopyTo (array, index);
-		}
-
-		public RecipientInfoEnumerator GetEnumerator ()
-		{
-			return new RecipientInfoEnumerator (_list);
-		}
-
-		IEnumerator IEnumerable.GetEnumerator () 
-		{
-			return new RecipientInfoEnumerator (_list);
-		}
-	}
-}
-
-#endif

+ 0 - 72
mcs/class/System.Security/System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs

@@ -1,72 +0,0 @@
-//
-// RecipientInfoEnumerator.cs - System.Security.Cryptography.Pkcs.RecipientInfoEnumerator
-//
-// 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 SECURITY_DEP
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class RecipientInfoEnumerator : IEnumerator {
-
-		private IEnumerator enumerator;
-
-		// constructors
-
-		internal RecipientInfoEnumerator (IEnumerable enumerable)
-		{
-			enumerator = enumerable.GetEnumerator ();
-		}
-
-		// properties
-
-		public RecipientInfo Current {
-			get { return (RecipientInfo) enumerator.Current; }
-		}
-
-		object IEnumerator.Current {
-			get { return enumerator.Current; }
-		}
-
-		// methods
-
-		public bool MoveNext ()
-		{
-			return enumerator.MoveNext ();
-		}
-
-		public void Reset ()
-		{
-			enumerator.Reset ();
-		}
-	}
-}
-
-#endif

+ 0 - 305
mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignedCms.cs

@@ -1,305 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.SignedCms 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 SECURITY_DEP
-
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.X509;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class SignedCms {
-
-		private ContentInfo _content;
-		private bool _detached;
-		private SignerInfoCollection _info;
-		private X509Certificate2Collection _certs;
-		private SubjectIdentifierType _type;
-		private int _version;
-
-		// constructors
-
-		public SignedCms () 
-		{
-			_certs = new X509Certificate2Collection ();
-			_info = new SignerInfoCollection ();
-		}
-
-		public SignedCms (ContentInfo contentInfo) 
-			: this (contentInfo, false)
-		{
-		}
-
-		public SignedCms (ContentInfo contentInfo, bool detached) 
-			: this ()
-		{
-			if (contentInfo == null)
-				throw new ArgumentNullException ("contentInfo");
-
-			_content = contentInfo;
-			_detached = detached;
-		}
-
-		public SignedCms (SubjectIdentifierType signerIdentifierType) : this ()
-		{
-			_type = signerIdentifierType;
-		}
-
-		public SignedCms (SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo) 
-			: this (contentInfo, false) 
-		{
-			_type = signerIdentifierType;
-		}
-
-		public SignedCms (SubjectIdentifierType signerIdentifierType, ContentInfo contentInfo, bool detached) 
-			: this (contentInfo, detached) 
-		{
-			_type = signerIdentifierType;
-		}
-
-		// properties
-
-		public X509Certificate2Collection Certificates { 
-			get { return _certs; }
-		}
-
-		public ContentInfo ContentInfo { 
-			get { 
-				if (_content == null) {
-					Oid oid = new Oid (PKCS7.Oid.data);
-					_content = new ContentInfo (oid, new byte [0]);
-				}
-				return _content; 
-			}
-		}
-
-		public bool Detached { 
-			get { return _detached; }
-		}
-
-		public SignerInfoCollection SignerInfos {
-			get { return _info; }
-		}
-
-		public int Version { 
-			get { return _version; }
-		}
-
-		// methods
-
-		[MonoTODO]
-		public void CheckSignature (bool verifySignatureOnly)
-		{
-			foreach (SignerInfo si in _info) {
-				si.CheckSignature (verifySignatureOnly);
-			}
-		}
-
-		[MonoTODO]
-		public void CheckSignature (X509Certificate2Collection extraStore, bool verifySignatureOnly) 
-		{
-			foreach (SignerInfo si in _info) {
-				si.CheckSignature (extraStore, verifySignatureOnly);
-			}
-		}
-
-		[MonoTODO]
-		public void CheckHash () 
-		{
-			throw new InvalidOperationException ("");
-		}
-
-		[MonoTODO]
-		public void ComputeSignature () 
-		{
-			throw new CryptographicException ("");
-		}
-
-		[MonoTODO]
-		public void ComputeSignature (CmsSigner signer)
-		{
-			ComputeSignature ();
-		}
-
-		[MonoTODO]
-		public void ComputeSignature (CmsSigner signer, bool silent)
-		{
-			ComputeSignature ();
-		}
-
-		private string ToString (byte[] array, bool reverse) 
-		{
-			StringBuilder sb = new StringBuilder ();
-			if (reverse) {
-				for (int i=array.Length - 1; i >= 0; i--)
-					sb.Append (array [i].ToString ("X2"));
-			} else {
-				for (int i=0; i < array.Length; i++)
-					sb.Append (array [i].ToString ("X2"));
-			}
-			return sb.ToString ();
-		}
-
-		private byte[] GetKeyIdentifier (Mono.Security.X509.X509Certificate x509) 
-		{
-			// if present in certificate return value of the SubjectKeyIdentifier
-			Mono.Security.X509.X509Extension extn = x509.Extensions ["2.5.29.14"];
-			if (extn != null) {
-				ASN1 bs = new ASN1 (extn.Value.Value);
-				return bs.Value;
-			}
-			// strangely DEPRECATED keyAttributes isn't used here (like KeyUsage)
-
-			// if not then we must calculate the SubjectKeyIdentifier ourselve
-			// Note: MS does that hash on the complete subjectPublicKeyInfo (unlike PKIX)
-			// http://groups.google.ca/groups?selm=e7RqM%24plCHA.1488%40tkmsftngp02&oe=UTF-8&output=gplain
-			ASN1 subjectPublicKeyInfo = new ASN1 (0x30);
-			ASN1 algo = subjectPublicKeyInfo.Add (new ASN1 (0x30));
-			algo.Add (new ASN1 (CryptoConfig.EncodeOID (x509.KeyAlgorithm)));
-			// FIXME: does it work for DSA certs (without an 2.5.29.14 extension ?)
-			algo.Add (new ASN1 (x509.KeyAlgorithmParameters)); 
-			byte[] pubkey = x509.PublicKey;
-			byte[] bsvalue = new byte [pubkey.Length + 1]; // add unused bits (0) before the public key
-			Array.Copy (pubkey, 0, bsvalue, 1, pubkey.Length);
-			subjectPublicKeyInfo.Add (new ASN1 (0x03, bsvalue));
-			SHA1 sha = SHA1.Create ();
-			return sha.ComputeHash (subjectPublicKeyInfo.GetBytes ());
-		}
-
-		[MonoTODO("incomplete - missing attributes")]
-		public void Decode (byte[] encodedMessage) 
-		{
-			PKCS7.ContentInfo ci = new PKCS7.ContentInfo (encodedMessage);
-			if (ci.ContentType != PKCS7.Oid.signedData) 
-				throw new Exception ("");
-
-			PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content);
-			SubjectIdentifierType type = SubjectIdentifierType.Unknown;
-			object o = null;
-
-			X509Certificate2 x509 = null;
-			if (sd.SignerInfo.Certificate != null) {
-				x509 = new X509Certificate2 (sd.SignerInfo.Certificate.RawData);
-			}
-			else if ((sd.SignerInfo.IssuerName != null) && (sd.SignerInfo.SerialNumber != null)) {
-				byte[] serial = sd.SignerInfo.SerialNumber;
-				Array.Reverse (serial); // ???
-				type = SubjectIdentifierType.IssuerAndSerialNumber;
-				X509IssuerSerial xis = new X509IssuerSerial ();
-				xis.IssuerName = sd.SignerInfo.IssuerName;
-				xis.SerialNumber = ToString (serial, true);
-				o = xis;
-				// TODO: move to a FindCertificate (issuer, serial, collection)
-				foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
-					if (x.IssuerName == sd.SignerInfo.IssuerName) {
-						if (ToString (x.SerialNumber, true) == xis.SerialNumber) {
-							x509 = new X509Certificate2 (x.RawData);
-							break;
-						}
-					}
-				}
-			}
-			else if (sd.SignerInfo.SubjectKeyIdentifier != null) {
-				string ski = ToString (sd.SignerInfo.SubjectKeyIdentifier, false);
-				type = SubjectIdentifierType.SubjectKeyIdentifier;
-				o = (object) ski;
-				// TODO: move to a FindCertificate (ski, collection)
-				foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
-					if (ToString (GetKeyIdentifier (x), false) == ski) {
-						x509 = new X509Certificate2 (x.RawData);
-						break;
-					}
-				}
-			}
-
-			SignerInfo si = new SignerInfo (sd.SignerInfo.HashName, x509, type, o, sd.SignerInfo.Version);
-			// si.AuthenticatedAttributes
-			// si.UnauthenticatedAttributes
-			_info.Add (si);
-
-			ASN1 content = sd.ContentInfo.Content;
-			Oid oid = new Oid (sd.ContentInfo.ContentType);
-
-			if (!_detached || _content == null) {
-				if (content[0] == null)
-					throw new ArgumentException ("ContentInfo has no content. Detached signature ?");
-
-				_content = new ContentInfo (oid, content[0].Value);
-			}
-
-			foreach (Mono.Security.X509.X509Certificate x in sd.Certificates) {
-				_certs.Add (new X509Certificate2 (x.RawData));
-			}
-
-			_version = sd.Version;
-		}
-
-		[MonoTODO]
-		public byte[] Encode ()
-		{
-/*			Mono.Security.X509.X509Certificate x509 = null;
-			Cms.SignerInfo si = new Cms.SignerInfo ();
-			switch (_type) {
-				case SubjectIdentifierType.SubjectKeyIdentifier:
-					si.SubjectKeyIdentifier = GetKeyIdentifier (x509);
-					break;
-				default: 
-					// SubjectIdentifierType.IssuerAndSerialNumber 
-					si.IssuerName = x509.IssuerName;
-					si.SerialNumber = x509.SerialNumber;
-					break;
-			}
-
-			Cms.SignedData sd = new Cms.SignedData ();
-			sd.Version = _version;
-			sd.SignerInfo = si;
-
-			Cms.ContentInfo ci = new Cms.ContentInfo (Cms.signedData);
-			ci.Content = sd.ASN1;
-			return ci.GetBytes ();*/
-			return null;
-		}
-
-		[MonoTODO]
-		public void RemoveSignature (SignerInfo signerInfo)
-		{
-		}
-
-		[MonoTODO]
-		public void RemoveSignature (int index)
-		{
-		}
-	}
-}
-
-#endif

+ 0 - 127
mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfo.cs

@@ -1,127 +0,0 @@
-//
-// System.Security.Cryptography.Pkcs.SignerInfo 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 SECURITY_DEP
-
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class SignerInfo {
-
-		private SubjectIdentifier _signer;
-		private X509Certificate2 _certificate;
-		private Oid _digest;
-		private SignerInfoCollection _counter;
-		private CryptographicAttributeObjectCollection _signed;
-		private CryptographicAttributeObjectCollection _unsigned;
-		private int _version;
-
-		// only accessible from SignedPkcs7.SignerInfos
-		internal SignerInfo (string hashName, X509Certificate2 certificate, SubjectIdentifierType type, object o, int version)
-		{
-			_digest = new Oid (CryptoConfig.MapNameToOID (hashName) ?? hashName);
-			_certificate = certificate;
-			_counter = new SignerInfoCollection ();
-			_signed = new CryptographicAttributeObjectCollection ();
-			_unsigned = new CryptographicAttributeObjectCollection ();
-			_signer = new SubjectIdentifier (type, o);
-			_version = version;
-		}
-
-		// properties
-
-		public CryptographicAttributeObjectCollection SignedAttributes {
-			get { return _signed; }
-		} 
-
-		public X509Certificate2 Certificate {
-			get { return _certificate; }
-		}
-
-		public SignerInfoCollection CounterSignerInfos {
-			get { return _counter; }
-		}
-
-		public Oid DigestAlgorithm {
-			get { return _digest; }
-		}
-
-		public SubjectIdentifier SignerIdentifier {
-			get { return _signer; }
-		}
-
-		public CryptographicAttributeObjectCollection UnsignedAttributes {
-			get { return _unsigned; }
-		}
-
-		public int Version {
-			get { return _version; }
-		}
-
-		// methods
-
-		[MonoTODO]
-		public void CheckHash ()
-		{
-		}
-
-		[MonoTODO]
-		public void CheckSignature (bool verifySignatureOnly)
-		{
-		}
-
-		[MonoTODO]
-		public void CheckSignature (X509Certificate2Collection extraStore, bool verifySignatureOnly)
-		{
-		}
-
-		[MonoTODO]
-		public void ComputeCounterSignature ()
-		{
-		}
-
-		[MonoTODO]
-		public void ComputeCounterSignature (CmsSigner signer)
-		{
-		}
-
-		[MonoTODO]
-		public void RemoveCounterSignature (SignerInfo counterSignerInfo)
-		{
-		}
-
-		[MonoTODO]
-		public void RemoveCounterSignature (int index)
-		{
-		}
-	}
-}
-
-#endif

+ 0 - 103
mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoCollection.cs

@@ -1,103 +0,0 @@
-//
-// SignerInfoCollection.cs - System.Security.Cryptography.Pkcs.SignerInfoCollection
-//
-// 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 SECURITY_DEP
-
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class SignerInfoCollection : ICollection {
-
-		private ArrayList _list;
-
-		// only accessible from SignedPkcs7.SignerInfos or SignerInfo.CounterSignerInfos
-		internal SignerInfoCollection () 
-		{
-			_list = new ArrayList ();
-		}
-
-		// properties
-
-		public int Count {
-			get { return _list.Count; }
-		}
-
-		public bool IsSynchronized {
-			get { return false; }	// as documented
-		}
-
-		public SignerInfo this [int index] {
-			get { return (SignerInfo) _list [index]; }
-		}
-
-		public object SyncRoot {
-			get { return _list.SyncRoot; }
-		}
-
-		// methods
-
-		internal void Add (SignerInfo signer) 
-		{
-			_list.Add (signer);
-		}
-
-		public void CopyTo (Array array, int index) 
-		{
-			if (array == null)
-				throw new ArgumentNullException ("array");
-			if ((index < 0) || (index >= array.Length))
-				throw new ArgumentOutOfRangeException ("index");
-
-			_list.CopyTo (array, index);
-		}
-
-		public void CopyTo (SignerInfo[] array, int index)
-		{
-			if (array == null)
-				throw new ArgumentNullException ("array");
-			if ((index < 0) || (index >= array.Length))
-				throw new ArgumentOutOfRangeException ("index");
-
-			_list.CopyTo (array, index);
-		}
-
-		public SignerInfoEnumerator GetEnumerator ()
-		{
-			return new SignerInfoEnumerator (_list);
-		}
-
-		IEnumerator IEnumerable.GetEnumerator () 
-		{
-			return new SignerInfoEnumerator (_list);
-		}
-	}
-}
-
-#endif

+ 0 - 72
mcs/class/System.Security/System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs

@@ -1,72 +0,0 @@
-//
-// SignerInfoEnumerator.cs - System.Security.Cryptography.Pkcs.SignerInfoEnumerator
-//
-// 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 SECURITY_DEP
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class SignerInfoEnumerator : IEnumerator {
-
-		private IEnumerator enumerator;
-
-		// constructors
-
-		internal SignerInfoEnumerator (IEnumerable enumerable) 
-		{
-			enumerator = enumerable.GetEnumerator ();
-		}
-
-		// properties
-
-		public SignerInfo Current {
-			get { return (SignerInfo) enumerator.Current; }
-		}
-
-		object IEnumerator.Current {
-			get { return enumerator.Current; }
-		}
-
-		// methods
-
-		public bool MoveNext () 
-		{
-			return enumerator.MoveNext ();
-		}
-
-		public void Reset ()
-		{
-			enumerator.Reset ();
-		}
-	}
-}
-
-#endif

+ 0 - 57
mcs/class/System.Security/System.Security.Cryptography.Pkcs/SubjectIdentifier.cs

@@ -1,57 +0,0 @@
-//
-// SubjectIdentifier.cs - System.Security.Cryptography.Pkcs.SubjectIdentifier
-//
-// 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.
-//
-
-
-using System;
-
-namespace System.Security.Cryptography.Pkcs {
-
-	public sealed class SubjectIdentifier {
-
-		private SubjectIdentifierType _type;
-		private object _value;
-
-		internal SubjectIdentifier (SubjectIdentifierType type, object value)
-		{
-			_type = type;
-			_value = value;
-		}
-
-		// properties
-
-		public SubjectIdentifierType Type {
-			get { return _type; }
-		}
-
-		public object Value {
-			get { return _value; }
-		}
-	}
-}
-

+ 77 - 37
mcs/class/System.Security/System.Security.csproj

@@ -14,6 +14,7 @@
     <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
     <NoStdLib>True</NoStdLib>
     <NoConfig>True</NoConfig>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <AssemblyName>System.Security</AssemblyName>
     <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
     <SignAssembly>true</SignAssembly>
@@ -104,15 +105,91 @@
   </PropertyGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <ItemGroup>
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Security\Cryptography\Asn1V2.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Security\Cryptography\Asn1V2.Serializer.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Security\Cryptography\AsnReader.cs" />
+    <Compile Include="..\..\..\external\corefx\src\Common\src\System\Security\Cryptography\AsnWriter.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\DecryptorPal.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Helpers.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\KeyAgreeRecipientInfoPal.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\KeyLengths.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\KeyTransRecipientInfoPal.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Oids.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\AsnHelpers.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.Asn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.Decode.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.Decrypt.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.Encrypt.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.Exceptions.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyAgree.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\ManagedPal.KeyTrans.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\Pal\AnyOS\PkcsPal.AnyOS.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\PkcsPal.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\Internal\Cryptography\RecipientInfoPal.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\CryptographicAttributeObject.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\CryptographicAttributeObjectCollection.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\CryptographicAttributeObjectEnumerator.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\AlgorithmIdentifierAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\AttributeAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\CertificateChoiceAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\ContentInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\EncapsulatedContentInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\EncryptedContentInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\EnvelopedDataAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\GeneralName.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\IssuerAndSerialNumberAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\KeyAgreeRecipientIdentifierAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\KeyAgreeRecipientInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\KeyTransRecipientInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\MessageImprint.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\OriginatorIdentifierOrKeyAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\OriginatorInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\OriginatorPublicKeyAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\OtherKeyAttributeAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\PssParamsAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\Rc2CbcParameters.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\RecipientEncryptedKeyAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\RecipientIdentifierAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\RecipientInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\RecipientKeyIdentifier.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\Rfc3161Accuracy.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\Rfc3161TimeStampReq.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\Rfc3161TimeStampResp.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\Rfc3161TstInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\SignedDataAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\SignerIdentifierAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\SignerInfoAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\SigningCertificateAsn.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Asn1\X509ExtensionAsn.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsRecipient.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsRecipientCollection.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsRecipientEnumerator.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsSignature.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsSignature.DSA.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsSignature.ECDsa.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsSignature.RSA.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\CmsSigner.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\ContentInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\EnvelopedCms.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\KeyAgreeRecipientInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\KeyTransRecipientInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Pkcs9AttributeObject.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Pkcs9ContentType.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Pkcs9DocumentDescription.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Pkcs9DocumentName.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\Pkcs9MessageDigest.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\PublicKeyInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\RecipientInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\RecipientInfoCollection.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\RecipientInfoEnumerator.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\RecipientInfoType.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignedCms.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignedCms.CtorOverloads.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfo.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfoCollection.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SignerInfoEnumerator.cs" />
+    <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SubjectIdentifier.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SubjectIdentifierOrKey.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SubjectIdentifierOrKeyType.cs" />
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Pkcs\src\System\Security\Cryptography\Pkcs\SubjectIdentifierType.cs" />
@@ -125,20 +202,8 @@
     <Compile Include="Assembly\AssemblyInfo.cs" />
     <Compile Include="corefx\SR.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\AlgorithmIdentifier.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\ContentInfo.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\EnvelopedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeRecipientInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\KeyTransRecipientInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9Attribute.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9ContentType.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9DocumentDescription.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9DocumentName.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9MessageDigest.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\Pkcs9SigningTime.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\RecipientInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\RecipientInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\RecipientInfoEnumerator.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SubjectIdentifier.cs" />
     <Compile Include="System.Security.Cryptography\ProtectedData.cs" />
   </ItemGroup>
   <ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
@@ -219,12 +284,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\CmsSigner.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeKeyChoice.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoEnumerator.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2UI.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509SelectionFlag.cs" />
     <Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />
@@ -313,12 +373,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\CmsSigner.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeKeyChoice.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoEnumerator.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2UI.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509SelectionFlag.cs" />
     <Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />
@@ -407,12 +462,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\CmsSigner.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeKeyChoice.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoEnumerator.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2UI.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509SelectionFlag.cs" />
     <Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />
@@ -501,12 +551,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\CmsSigner.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeKeyChoice.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoEnumerator.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2UI.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509SelectionFlag.cs" />
     <Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />
@@ -595,12 +640,7 @@
     <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
     <Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />
     <Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\CmsSigner.cs" />
     <Compile Include="System.Security.Cryptography.Pkcs\KeyAgreeKeyChoice.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignedCms.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfo.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoCollection.cs" />
-    <Compile Include="System.Security.Cryptography.Pkcs\SignerInfoEnumerator.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509Certificate2UI.cs" />
     <Compile Include="System.Security.Cryptography.X509Certificates\X509SelectionFlag.cs" />
     <Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />

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

@@ -5,11 +5,6 @@ Mono.Security.Cryptography/NativeDapiProtection.cs
 System.Security.Cryptography/MemoryProtectionScope.cs
 System.Security.Cryptography/ProtectedMemory.cs
 System.Security.Cryptography.Pkcs/KeyAgreeKeyChoice.cs
-System.Security.Cryptography.Pkcs/CmsSigner.cs
-System.Security.Cryptography.Pkcs/SignedCms.cs
-System.Security.Cryptography.Pkcs/SignerInfo.cs
-System.Security.Cryptography.Pkcs/SignerInfoCollection.cs
-System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs
 System.Security.Cryptography.X509Certificates/X509Certificate2UI.cs
 System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs
 

+ 16 - 0
mcs/class/System.Security/System.Security_xtest.dll.sources

@@ -1,5 +1,20 @@
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CryptographicAttributeObjectCollectionTests.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CmsRecipientCollectionTests.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/CertificateTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/ContentEncryptionAlgorithmTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/DecryptTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/DecryptTests.KeyPersistence.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/EdgeCasesTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/GeneralTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/KeyAgreeRecipientInfoTests.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/KeyTransRecipientInfoTests.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/StateTests.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/EnvelopedCms/UnprotectedAttributeTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/CmsSignerTests.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/CounterSigningDerOrder.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsWholeDocumentTests.cs
+# ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignerInfoTests.cs
 
 # Dependencies
 ../../../external/corefx/src/CoreFx.Private.TestUtilities/src/System/AssertExtensions.cs
@@ -8,3 +23,4 @@
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CertLoader.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/CertLoader.Settings.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/Certificates.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedDocuments.cs

+ 1 - 2
mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/ContentInfoTest.cs

@@ -149,10 +149,9 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
 		}
 
 		[Test]
-		[ExpectedException (typeof (CryptographicException))]
 		public void GetContentType_signedAndEnvelopedData ()
 		{
-			// Note: signedAndEnvelopedData isn't defined in RFC2630
+			// Note: signedAndEnvelopedData isn't defined in RFC2630, but it is supported by the CMS classes
 			byte[] signedAndEnvelopedData = { 0x30, 0x82, 0x01, 0x1C, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x04, 0xA0, 0x82, 0x01, 0x0D, 0x30, 0x82, 0x01, 0x09, 0x02, 0x01, 0x00, 0x31, 0x81, 0xD6, 0x30, 0x81, 0xD3, 0x02, 0x01, 0x00, 0x30, 0x3C, 0x30, 0x28, 0x31, 0x26, 0x30, 0x24, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x1D, 0x4D, 0x6F, 0x74, 0x75, 0x73, 0x20, 0x54, 0x65, 0x63, 0x68, 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x69, 0x6E, 0x63, 0x2E, 0x28, 0x74, 0x65, 0x73, 0x74, 0x29, 0x02, 0x10, 0x91, 0xC4, 0x4B, 0x0D, 0xB7, 0xD8, 0x10, 0x84, 0x42, 0x26, 0x71, 0xB3, 0x97, 0xB5, 0x00, 0x97, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x04, 0x81, 0x80, 0xCA, 0x4B, 0x97, 0x9C, 0xAB, 0x79, 0xC6, 0xDF, 0x6A, 0x27, 0xC7, 0x24, 0xC4, 0x5E, 0x3B, 0x31, 0xAD, 0xBC, 0x25, 0xE6, 0x38, 0x5E, 0x79, 0x26, 0x0E, 0x68, 0x46, 0x1D, 0x21, 0x81, 0x38, 0x92, 0xEC, 0xCB, 0x7C, 0x91, 0xD6, 0x09, 0x38, 0x91, 0xCE, 0x50, 0x5B, 0x70, 0x31, 0xB0, 0x9F, 0xFC, 0xE2, 0xEE, 0x45, 0xBC, 0x4B, 0xF8, 0x9A, 0xD9, 0xEE, 0xE7, 0x4A, 0x3D, 0xCD, 0x8D, 0xFF, 0x10, 0xAB, 0xC8, 0x19, 0x05, 0x54, 0x5E, 0x40, 0x7A, 0xBE, 0x2B, 0xD7, 0x22, 0x97, 0xF3, 0x23, 0xAF, 0x50, 0xF5, 0xEB, 0x43, 0x06, 0xC3, 0xFB, 0x17, 0xCA, 0xBD, 0xAD, 0x28, 0xD8, 0x10, 0x0F, 0x61, 0xCE, 0xF8, 0x25, 0x70, 0xF6, 0xC8, 0x1E, 0x7F, 0x82, 0xE5, 0x94, 0xEB, 0x11, 0xBF, 0xB8, 0x6F, 0xEE, 0x79, 0xCD, 0x63, 0xDD, 0x59, 0x8D, 0x25, 0x0E, 0x78, 0x55, 0xCE, 0x21, 0xBA, 0x13, 0x6B, 0x30, 0x2B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x07, 0x01, 0x30, 0x14, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x03, 0x07, 0x04, 0x08, 0x8C, 0x5D, 0xC9, 0x87, 0x88, 0x9C, 0x05, 0x72, 0x80, 0x08, 0x2C, 0xAF, 0x82, 0x91, 0xEC, 0xAD, 0xC5, 0xB5 };
 			Oid o = ContentInfo.GetContentType (signedAndEnvelopedData);
 			Assert.AreEqual ("1.2.840.113549.1.7.4", o.Value, "GetContentType");

+ 1 - 1
mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignedCmsTest.cs

@@ -374,7 +374,7 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
 		}
 
 		[Test]
-		[ExpectedException (typeof (CryptographicException))]
+		[ExpectedException (typeof (PlatformNotSupportedException))]
 		public void ComputeEmptySignature ()
 		{
 			SignedCms sp = new SignedCms ();

+ 2 - 2
mcs/class/System.Security/Test/System.Security.Cryptography.Pkcs/SignerInfoTest.cs

@@ -110,14 +110,14 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
 
 			SignerInfo si = GetSignerInfo (data);
 			// default properties
-			Assert.AreEqual (0, si.SignedAttributes.Count, "SignedAttributes");
+			Assert.AreEqual (5, si.SignedAttributes.Count, "SignedAttributes");
 			Assert.IsNotNull (si.Certificate, "Certificate");
 			Assert.AreEqual (0, si.CounterSignerInfos.Count, "CounterSignerInfos");
 			Assert.AreEqual ("sha256", si.DigestAlgorithm.FriendlyName, "DigestAlgorithm.FriendlyName");
 			Assert.AreEqual ("2.16.840.1.101.3.4.2.1", si.DigestAlgorithm.Value, "DigestAlgorithm.Value");
 			Assert.AreEqual (SubjectIdentifierType.SubjectKeyIdentifier, si.SignerIdentifier.Type, "SignerIdentifier.Type");
 			Assert.AreEqual ("F1CC7184EBDA537140C1A57416017810DF133020", (string)si.SignerIdentifier.Value, "SignerIdentifier.Value");
-			Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes");
+			Assert.AreEqual (1, si.UnsignedAttributes.Count, "UnsignedAttributes");
 			Assert.AreEqual (3, si.Version, "Version");
 		}
 	}

+ 77 - 12
mcs/class/System.Security/common_System.Security.dll.sources

@@ -15,29 +15,94 @@ corefx/SR.cs
 System.Security.Cryptography/ProtectedData.cs
 
 # System.Security.Cryptography.Pkcs
+../../../external/corefx/src/Common/src/System/Security/Cryptography/Asn1V2.cs
+../../../external/corefx/src/Common/src/System/Security/Cryptography/Asn1V2.Serializer.cs
+../../../external/corefx/src/Common/src/System/Security/Cryptography/AsnReader.cs
+../../../external/corefx/src/Common/src/System/Security/Cryptography/AsnWriter.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/AlgorithmIdentifierAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/AttributeAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/CertificateChoiceAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/ContentInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EncapsulatedContentInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/GeneralName.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/IssuerAndSerialNumberAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/MessageImprint.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/PssParamsAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161Accuracy.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TimeStampReq.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TimeStampResp.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rfc3161TstInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignedDataAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignerIdentifierAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SignerInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/SigningCertificateAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/X509ExtensionAsn.cs
 System.Security.Cryptography.Pkcs/AlgorithmIdentifier.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipient.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipientCollection.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsRecipientEnumerator.cs
-System.Security.Cryptography.Pkcs/ContentInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/ContentInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/EnvelopedCms.cs
 System.Security.Cryptography.Pkcs/EnvelopedCms.cs
-System.Security.Cryptography.Pkcs/KeyAgreeRecipientInfo.cs
-System.Security.Cryptography.Pkcs/KeyTransRecipientInfo.cs
-System.Security.Cryptography.Pkcs/Pkcs9Attribute.cs
-System.Security.Cryptography.Pkcs/Pkcs9ContentType.cs
-System.Security.Cryptography.Pkcs/Pkcs9DocumentDescription.cs
-System.Security.Cryptography.Pkcs/Pkcs9DocumentName.cs
-System.Security.Cryptography.Pkcs/Pkcs9MessageDigest.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/KeyAgreeRecipientInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/KeyTransRecipientInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9AttributeObject.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9ContentType.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9DocumentName.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Pkcs9MessageDigest.cs
 System.Security.Cryptography.Pkcs/Pkcs9SigningTime.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/PublicKeyInfo.cs
-System.Security.Cryptography.Pkcs/RecipientInfo.cs
-System.Security.Cryptography.Pkcs/RecipientInfoCollection.cs
-System.Security.Cryptography.Pkcs/RecipientInfoEnumerator.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoCollection.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoEnumerator.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/RecipientInfoType.cs
-System.Security.Cryptography.Pkcs/SubjectIdentifier.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifier.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierOrKey.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierOrKeyType.cs
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SubjectIdentifierType.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/DecryptorPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyAgreeRecipientInfoPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyLengths.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyTransRecipientInfoPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/PkcsPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/RecipientInfoPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/AsnHelpers.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Asn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Decode.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Decrypt.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Exceptions.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.KeyAgree.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.KeyTrans.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/PkcsPal.AnyOS.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EncryptedContentInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/EnvelopedDataAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyAgreeRecipientIdentifierAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyAgreeRecipientInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/KeyTransRecipientInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorIdentifierOrKeyAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OriginatorPublicKeyAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/OtherKeyAttributeAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/Rc2CbcParameters.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientEncryptedKeyAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientIdentifierAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientInfoAsn.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/Asn1/RecipientKeyIdentifier.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.RSA.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.DSA.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSignature.ECDsa.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/CmsSigner.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignedCms.CtorOverloads.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfo.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoCollection.cs
+../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfoEnumerator.cs
 
 # System.Security.Cryptography.Xml
 ../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs

+ 13 - 4
mcs/class/System/System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs

@@ -33,6 +33,7 @@
 
 using System.Collections;
 using System.Globalization;
+using Mono.Security;
 
 namespace System.Security.Cryptography.X509Certificates {
 
@@ -146,6 +147,17 @@ namespace System.Security.Cryptography.X509Certificates {
 
 		static string[] newline_split = new string[] { Environment.NewLine };
 		
+		private string GetKeyIdentifier (X509Certificate2 x) 
+		{
+			// if present in certificate return value of the SubjectKeyIdentifier
+			X509SubjectKeyIdentifierExtension ski = (x.Extensions ["2.5.29.14"] as X509SubjectKeyIdentifierExtension);
+			if (ski == null) {
+				// if not then we must calculate the SubjectKeyIdentifier ourselve
+				ski = new X509SubjectKeyIdentifierExtension (x.PublicKey, X509SubjectKeyIdentifierHashAlgorithm.CapiSha1, false);
+			}
+			return ski.SubjectKeyIdentifier;
+		}
+
 		[MonoTODO ("Does not support X509FindType.FindByTemplateName, FindByApplicationPolicy and FindByCertificatePolicy")]
 		public X509Certificate2Collection Find (X509FindType findType, object findValue, bool validOnly) 
 		{
@@ -261,10 +273,7 @@ namespace System.Security.Cryptography.X509Certificates {
 					// TODO - find a valid test case
 					break;
 				case X509FindType.FindBySubjectKeyIdentifier:
-					X509SubjectKeyIdentifierExtension ski = (x.Extensions ["2.5.29.14"] as X509SubjectKeyIdentifierExtension);
-					if (ski != null) {
-						value_match = (String.Compare (str, ski.SubjectKeyIdentifier, true, cinv) == 0);
-					}
+					value_match = (String.Compare (str, GetKeyIdentifier (x), true, cinv) == 0);
 					break;
 				case X509FindType.FindByApplicationPolicy:
 					// note: include when no extensions are present (even if v3)

+ 2 - 0
mcs/class/test-helpers/PlatformDetection.cs

@@ -22,6 +22,8 @@ namespace System
 		public static bool IsOpenSUSE => false;
 		public static bool IsUbuntu1404 => false;
 
+		public static bool IsNetfx462OrNewer => false;
+
 		public static bool IsWindows {
 			get {
 				PlatformID id = Environment.OSVersion.Platform;