2003-12-07 Sebastien Pouliot <spouliot@videotron.ca>
authorSebastien Pouliot <sebastien@ximian.com>
Mon, 8 Dec 2003 01:38:13 +0000 (01:38 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Mon, 8 Dec 2003 01:38:13 +0000 (01:38 -0000)
* PublicKey.cs: New (1.2). Class that encapsulate an ASN.1 encoded
public key.
* X509BasicConstraintsExtension.cs: New (1.2). X.509 certification
extension for BasicConstraints.
* X509CertificateEx.cs: New (1.2). Augmented class to use X.509
certificates.
* X509CertificateExCollection.cs: New (1.2). Collection class for
X509CertificateEx.
* X509CertificateExEnumerator.cs: New (1.2). Enumerator class for
X509CertificateEx.
* X509ChainElement.cs: New (1.2). Information (certificate, status,
informations) for a member of a certificate chain.
* X509ChainElementCollection.cs: New (1.2). Collection class for
X509ChainElement.
* X509ChainElementEnumerator.cs: New (1.2). Enumerator class for
X509ChainElement.
* X509ChainStatus.cs: New (1.2). Chain status (many can apply to a
single X509ChainElement).
* X509Extension.cs: New (1.2). Base class for all certificate
extensions.
* X509ExtensionCollection.cs: New (1.2). Collection class for
X509Extension.
* X509ExtensionEnumerator.cs: New (1.2). Enumerator class for
X509Extension.

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

13 files changed:
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/ChangeLog
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/PublicKey.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElement.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs [new file with mode: 0755]
mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs [new file with mode: 0755]

index 7bcd9167157415f97bdb61156c2dcd26eef1a3f3..eae3138c79e797e40caf2ff2f2262f0a3d4bf843 100755 (executable)
@@ -1,3 +1,30 @@
+2003-12-07  Sebastien Pouliot  <spouliot@videotron.ca>
+
+       * PublicKey.cs: New (1.2). Class that encapsulate an ASN.1 encoded 
+       public key. 
+       * X509BasicConstraintsExtension.cs: New (1.2). X.509 certification 
+       extension for BasicConstraints.
+       * X509CertificateEx.cs: New (1.2). Augmented class to use X.509 
+       certificates.
+       * X509CertificateExCollection.cs: New (1.2). Collection class for 
+       X509CertificateEx.
+       * X509CertificateExEnumerator.cs: New (1.2). Enumerator class for 
+       X509CertificateEx.
+       * X509ChainElement.cs: New (1.2). Information (certificate, status, 
+       informations) for a member of a certificate chain.
+       * X509ChainElementCollection.cs: New (1.2). Collection class for 
+       X509ChainElement.
+       * X509ChainElementEnumerator.cs: New (1.2). Enumerator class for 
+       X509ChainElement.
+       * X509ChainStatus.cs: New (1.2). Chain status (many can apply to a 
+       single X509ChainElement).
+       * X509Extension.cs: New (1.2). Base class for all certificate 
+       extensions.
+       * X509ExtensionCollection.cs: New (1.2). Collection class for 
+       X509Extension.
+       * X509ExtensionEnumerator.cs: New (1.2). Enumerator class for 
+       X509Extension.
+
 2003-11-08  Sebastien Pouliot  <spouliot@videotron.ca>
 
        * OpenFlags.cs: New (1.2). Enumeration for certificate stores.
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/PublicKey.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/PublicKey.cs
new file mode 100755 (executable)
index 0000000..2efd8a0
--- /dev/null
@@ -0,0 +1,59 @@
+//
+// PublicKey.cs - System.Security.Cryptography.PublicKey
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class PublicKey {
+
+               private AsymmetricAlgorithm _key;
+               private AsnEncodedData _keyValue;
+               private AsnEncodedData _params;
+               private Oid _oid;
+
+               internal PublicKey (Mono.Security.X509.X509Certificate certificate)
+               {
+                       if (certificate.KeyAlgorithm == "1.2.840.113549.1.1.1") {
+                               _key = certificate.RSA;
+                       }
+                       else {
+                               _key = certificate.DSA;
+                       }
+
+                       _oid = new Oid (certificate.KeyAlgorithm);
+                       _keyValue = new AsnEncodedData (_oid, certificate.PublicKey);
+                       _params = new AsnEncodedData (_oid, certificate.KeyAlgorithmParameters);
+               }
+
+               // properties
+
+               public AsnEncodedData EncodedKeyValue {
+                       get { return _keyValue; }
+               }
+
+               public AsnEncodedData EncodedParameters {
+                       get { return _params; }
+               }
+
+               public AsymmetricAlgorithm Key {
+                       get { return _key; }
+               }
+
+               public Oid Oid {
+                       get { return _oid; }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs
new file mode 100755 (executable)
index 0000000..a6eb1ae
--- /dev/null
@@ -0,0 +1,36 @@
+//
+// X509BasicConstraintsExtension.cs - System.Security.Cryptography.X509BasicConstraintsExtension
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509BasicConstraintsExtension : X509Extension {
+
+               public X509BasicConstraintsExtension () {}
+
+               public bool CertificateAuthority {
+                       get { return false; }
+               }
+
+               public bool HasPathLengthConstraint {
+                       get { return false; }
+               }
+
+               public int PathLengthConstraint {
+                       get { return 0; }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateEx.cs
new file mode 100755 (executable)
index 0000000..29cb538
--- /dev/null
@@ -0,0 +1,218 @@
+//
+// X509CertificateEx.cs - System.Security.Cryptography.X509CertificateEx
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Text;
+
+using MX = Mono.Security.X509;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509CertificateEx : X509Certificate {
+
+               private bool _archived;
+               private X509ExtensionCollection _extensions;
+               private string _name;
+               private string _serial;
+               private PublicKey _publicKey;
+
+               private MX.X509Certificate _cert;
+
+               // constructors
+
+               public X509CertificateEx () : base () 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (byte[] rawData) : base (rawData) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (byte[] rawData, string password) : base (rawData, password) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
+                       : base (rawData, password, keyStorageFlags) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (string fileName) : base (fileName) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (string fileName, string password) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (string fileName, string password, X509KeyStorageFlags keyStorageFlags)
+                       : base (fileName, password, keyStorageFlags) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (IntPtr handle) : base (handle) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               public X509CertificateEx (X509CertificateEx certificate) 
+               {
+                       _cert = new MX.X509Certificate (this.RawData);
+               }
+
+               // properties
+
+               public bool Archived {
+                       get { return _archived; }
+                       set { _archived = value; }
+               }
+
+               public X509ExtensionCollection Extensions {
+                       get { return _extensions; }
+               }
+
+               public string FriendlyName {
+                       get { return _name; }
+                       set { _name = value; }
+               }
+
+               public string Issuer {
+                       get { return _cert.IssuerName; }
+               } 
+
+               public DateTime NotAfter {
+                       get { return _cert.ValidUntil; }
+               }
+
+               public DateTime NotBefore {
+                       get { return _cert.ValidFrom; }
+               }
+
+               public AsymmetricAlgorithm PrivateKey {
+                       get { 
+                               return _cert.RSA; 
+                       }
+               } 
+
+               public PublicKey PublicKey {
+                       get { 
+                               if (_publicKey == null) {
+                                       _publicKey = new PublicKey (_cert);
+                               }
+                               return _publicKey;
+                       }
+               } 
+
+               public byte[] RawData {
+                       get { return base.GetRawCertData (); }
+               } 
+
+               public string SerialNumber {
+                       get { 
+                               if (_serial == null) {
+                                       StringBuilder sb = new StringBuilder ();
+                                       byte[] serial = _cert.SerialNumber;
+                                       for (int i=serial.Length - 1; i >= 0; i--)
+                                               sb.Append (serial [i].ToString ("X2"));
+                                       _serial = sb.ToString ();
+                               }
+                               return _serial; 
+                       }
+               } 
+
+               public Oid SignatureAlgorithm {
+                       get { return null; }
+               } 
+
+               public string Subject {
+                       get { return _cert.SubjectName; }
+               } 
+
+               public string Thumbprint {
+                       get { return base.GetCertHashString (); }
+               } 
+
+               public int Version {
+                       get { return _cert.Version; }
+               }
+
+               // methods
+
+               public void Display () {}
+
+               public void Display (IntPtr hwndParent) {}
+
+               public string GetNameInfo (X509NameType nameType, bool forIssuer) 
+               {
+                       return null;
+               }
+
+               public override void Import (byte[] rawData) 
+               {
+                       base.Import (rawData);
+               }
+
+               public override void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
+               {
+                       base.Import (rawData, password, keyStorageFlags);
+               }
+
+               public override void Import (string fileName) 
+               {
+                       base.Import (fileName);
+               }
+
+               public override void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) 
+               {
+                       base.Import (fileName, password, keyStorageFlags);
+               }
+
+               public override void Reset () 
+               {
+                       _serial = null;
+                       _publicKey = null;
+                       base.Reset ();
+               }
+
+               public override string ToString ()
+               {
+                       return null;
+               }
+
+               public override string ToString (bool verbose)
+               {
+                       return null;
+               }
+
+               // static methods
+
+               public static X509ContentType GetCertContentType (byte[] rawData)
+               {
+                       return X509ContentType.Unknown;
+               }
+
+               public static X509ContentType GetCertContentType (string fileName)
+               {
+                       return X509ContentType.Unknown;
+               }
+       }
+}
+
+#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExCollection.cs
new file mode 100755 (executable)
index 0000000..691149d
--- /dev/null
@@ -0,0 +1,179 @@
+//
+// X509CertificateExCollection.cs - System.Security.Cryptography.X509Certificates.X509CertificateExCollection
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509CertificateExCollection : X509CertificateCollection {
+
+               // constructors
+
+               public X509CertificateExCollection () {}
+
+               public X509CertificateExCollection (X509CertificateExCollection certificates)
+               {
+                       AddRange (certificates);
+               }
+
+               public X509CertificateExCollection (X509CertificateEx[] certificates) 
+               {
+                       AddRange (certificates);
+               }
+
+               // properties
+
+               public new X509CertificateEx this [int index] {
+                       get {
+                               if (index < 0)
+                                       throw new ArgumentOutOfRangeException ("negative index");
+                               if (index >= InnerList.Count)
+                                       throw new ArgumentOutOfRangeException ("index >= Count");
+                               return (X509CertificateEx) InnerList [index];
+                       }
+               }
+
+               // methods
+
+               public int Add (X509CertificateEx certificate)
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+
+                       return InnerList.Add (certificate);
+               }
+
+               // note: transactional
+               public void AddRange (X509CertificateEx[] certificates) 
+               {
+                       if (certificates == null)
+                               throw new ArgumentNullException ("certificates");
+
+                       for (int i=0; i < certificates.Length; i++)
+                               InnerList.Add (certificates [i]);
+               }
+
+               // note: transactional
+               public void AddRange (X509CertificateExCollection certificates) 
+               {
+                       if (certificates == null)
+                               throw new ArgumentNullException ("certificates");
+
+                       InnerList.AddRange (certificates);
+               }
+
+               public bool Contains (X509CertificateEx certificate) 
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+
+                       foreach (X509CertificateEx c in InnerList) {
+                               if (certificate.Equals (c))
+                                       return true;
+                       }
+                       return false;
+               }
+
+               public byte[] Export (X509ContentType contentType) 
+               {
+                       return null;
+               }
+
+               public byte[] Export (X509ContentType contentType, string password) 
+               {
+                       return null;
+               }
+
+               public X509CertificateExCollection Find (X509FindType findType, object findValue, bool validOnly) 
+               {
+                       return null;
+               }
+
+               public new X509CertificateExEnumerator GetEnumerator () 
+               {
+                       return null;
+               }
+
+               public void Import (byte[] rawData) 
+               {
+               }
+
+               public void Import (byte[] rawData, string password, X509KeyStorageFlags keyStorageFlags)
+               {
+               }
+
+               public void Import (string fileName) 
+               {
+               }
+
+               public void Import (string fileName, string password, X509KeyStorageFlags keyStorageFlags) 
+               {
+               }
+
+               public void Insert (int index, X509CertificateEx certificate) 
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+                       if (index < 0)
+                               throw new ArgumentOutOfRangeException ("negative index");
+                       if (index >= InnerList.Count)
+                               throw new ArgumentOutOfRangeException ("index >= Count");
+
+                       InnerList.Insert (index, certificate);
+               }
+
+               public void Remove (X509CertificateEx certificate) 
+               {
+                       if (certificate == null)
+                               throw new ArgumentNullException ("certificate");
+
+                       for (int i=0; i < InnerList.Count; i++) {
+                               X509CertificateEx c = (X509CertificateEx) InnerList [i];
+                               if (certificate.Equals (c)) {
+                                       InnerList.RemoveAt (i);
+                                       // only first instance is removed
+                                       return;
+                               }
+                       }
+               }
+
+               // note: transactional
+               public void RemoveRange (X509CertificateEx[] certificates)
+               {
+                       if (certificates == null)
+                               throw new ArgumentNullException ("certificate");
+               }
+
+               // note: transactional
+               public void RemoveRange (X509CertificateExCollection certificates) 
+               {
+                       if (certificates == null)
+                               throw new ArgumentNullException ("certificate");
+               }
+
+               // note: UI
+               public X509CertificateExCollection Select (string title, string message, X509SelectionFlag selectionFlag)
+               {
+                       return null;
+               }
+
+               // note: UI
+               public X509CertificateExCollection Select (string title, string message, X509SelectionFlag selectionFlag, IntPtr hwndParent) 
+               {
+                       return null;
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509CertificateExEnumerator.cs
new file mode 100755 (executable)
index 0000000..a256392
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// X509CertificateExEnumerator.cs - System.Security.Cryptography.X509Certificates.X509CertificateExEnumerator
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509CertificateExEnumerator : IEnumerator {
+
+               private IEnumerator enumerator;
+
+               internal X509CertificateExEnumerator (X509CertificateExCollection collection) 
+               {
+                       enumerator = ((IEnumerable) collection).GetEnumerator ();
+               }
+
+               // properties
+
+               public X509CertificateEx Current {
+                       get { return (X509CertificateEx) enumerator.Current; }
+               }
+
+               object IEnumerator.Current {
+                       get { return enumerator.Current; }
+               }
+
+               // methods
+
+               public bool MoveNext () 
+               {
+                       return enumerator.MoveNext ();
+               }
+
+               public void Reset ()
+               {
+                       enumerator.Reset ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElement.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElement.cs
new file mode 100755 (executable)
index 0000000..28c7b75
--- /dev/null
@@ -0,0 +1,44 @@
+//
+// X509ChainElement.cs - System.Security.Cryptography.X509Certificates.X509ChainElement
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public class X509ChainElement {
+
+               // constructors
+
+               // only accessible from X509Chain.ChainElements
+               internal X509ChainElement () {}
+
+               // properties
+
+               [MonoTODO]
+               public X509CertificateEx Certificate {
+                       get { return null; }
+               }
+
+               [MonoTODO]
+               public X509ChainStatus[] ChainElementStatus {
+                       get { return null; }
+               }
+
+               [MonoTODO]
+               public string Information {
+                       get { return null; }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs
new file mode 100755 (executable)
index 0000000..4d92545
--- /dev/null
@@ -0,0 +1,73 @@
+//
+// X509ChainElementCollection.cs - System.Security.Cryptography.X509Certificates.X509ChainElementCollection
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509ChainElementCollection : ICollection, IEnumerable {
+
+               private ArrayList _list;
+
+               // constructors
+
+               // only accessible from X509Chain
+               internal X509ChainElementCollection () 
+               {
+                       _list = new ArrayList ();
+               }
+
+               // properties
+
+               public int Count {
+                       get { return _list.Count; }
+               }
+
+               public bool IsSynchronized {
+                       get { return _list.IsSynchronized; }
+               }
+
+               public X509ChainElement this [int index] {
+                       get { return (X509ChainElement) _list [index]; }
+               }
+
+               public object SyncRoot {
+                       get { return _list.SyncRoot; }
+               }
+
+               // methods
+
+               public void CopyTo (X509ChainElement[] array, int index) 
+               {
+                       _list.CopyTo ((Array)array, index);
+               }
+
+               void ICollection.CopyTo (Array array, int index) 
+               {
+                       _list.CopyTo (array, index);
+               }
+
+               public X509ChainElementEnumerator GetEnumerator ()
+               {
+                       return new X509ChainElementEnumerator (_list);
+               }
+
+               IEnumerator IEnumerable.GetEnumerator ()
+               {
+                       return new X509ChainElementEnumerator (_list);
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs
new file mode 100755 (executable)
index 0000000..f2720c2
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// X509ChainElementEnumerator.cs - System.Security.Cryptography.X509Certificates.X509ChainElementEnumerator
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509ChainElementEnumerator : IEnumerator {
+
+               private IEnumerator enumerator;
+
+               internal X509ChainElementEnumerator (IEnumerable enumerable) 
+               {
+                       enumerator = enumerable.GetEnumerator ();
+               }
+
+               // properties
+
+               public X509ChainElement Current {
+                       get { return (X509ChainElement) enumerator.Current; }
+               }
+
+               object IEnumerator.Current {
+                       get { return enumerator.Current; }
+               }
+
+               // methods
+
+               public bool MoveNext ()
+               {
+                       return enumerator.MoveNext ();
+               }
+
+               public void Reset() 
+               {
+                       enumerator.Reset ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ChainStatus.cs
new file mode 100755 (executable)
index 0000000..d5da0a6
--- /dev/null
@@ -0,0 +1,37 @@
+//
+// X509ChainStatus.cs - System.Security.Cryptography.X509Certificates.X509ChainStatus
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public struct X509ChainStatus {
+
+               private X509ChainStatusFlags _status;
+               private string _info;
+
+               // properties
+
+               public X509ChainStatusFlags Status {
+                       get { return _status; }
+                       set { _status = value; }
+               }
+
+               public string StatusInformation {
+                       get { return _info; }
+                       set { _info = value; }
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509Extension.cs
new file mode 100755 (executable)
index 0000000..8528826
--- /dev/null
@@ -0,0 +1,56 @@
+//
+// X509Extension.cs - System.Security.Cryptography.X509Extension
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public class X509Extension {
+
+               private bool _critical;
+               private AsnEncodedData _extn;
+               private Oid _oid;
+
+               // constructors
+
+               protected X509Extension () {}
+
+               // properties
+
+               public bool Critical {
+                       get { return _critical; }
+               }
+
+               public AsnEncodedData EncodedExtension {
+                       get  { return _extn; }
+               }
+
+               public Oid Oid {
+                       get { return _oid; }
+               }
+
+               // methods
+
+               public virtual void CopyFrom (X509Extension extension) 
+               {
+                       if (extension == null)
+                               throw new ArgumentNullException ("extension");
+
+                       _critical = extension._critical;
+                       _extn = extension._extn;
+                       _oid = extension._oid;
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs
new file mode 100755 (executable)
index 0000000..bb84c05
--- /dev/null
@@ -0,0 +1,71 @@
+//
+// X509ExtensionCollection.cs - System.Security.Cryptography.X509ExtensionCollection
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509ExtensionCollection : ICollection, IEnumerable {
+
+               // properties
+
+               public int Count {
+                       get { return 0; }
+               }
+
+               public bool IsSynchronized {
+                       get { return false; }
+               }
+
+               public object SyncRoot {
+                       get { return null; }
+               }
+
+               public X509Extension this [int index] {
+                       get { return null; }
+               }
+
+               public X509Extension this [string oid] {
+                       get { return null; }
+               }
+
+               // methods
+
+               public void CopyTo (X509Extension[] array, int index) 
+               {
+                       if (array == null)
+                               throw new ArgumentNullException ("array");
+                       if (index < 0)
+                               throw new ArgumentException ("negative index");
+                       if (index > array.Length)
+                               throw new ArgumentOutOfRangeException ("index > array.Length");
+               }
+
+               void ICollection.CopyTo (Array array, int index)
+               {
+               }
+
+               public X509ExtensionEnumerator GetEnumerator () 
+               {
+                       return new X509ExtensionEnumerator (this);
+               }
+
+               IEnumerator IEnumerable.GetEnumerator () 
+               {
+                       return new X509ExtensionEnumerator (this);
+               }
+       }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs
new file mode 100755 (executable)
index 0000000..2f8d1fc
--- /dev/null
@@ -0,0 +1,52 @@
+//
+// X509ExtensionEnumerator.cs - System.Security.Cryptography.X509ExtensionEnumerator
+//
+// Author:
+//     Sebastien Pouliot (spouliot@motus.com)
+//
+// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
+//
+
+#if NET_1_2
+
+using System;
+using System.Collections;
+
+namespace System.Security.Cryptography.X509Certificates {
+
+       // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
+
+       public sealed class X509ExtensionEnumerator : IEnumerator {
+
+               private IEnumerator enumerator;
+
+               internal X509ExtensionEnumerator (X509ExtensionCollection collection)
+               {
+                       enumerator = ((IEnumerable) collection).GetEnumerator ();
+               }
+
+               // properties
+
+               public X509Extension Current {
+                       get { return (X509Extension) enumerator.Current; }
+               }
+
+               object IEnumerator.Current {
+                       get { return enumerator.Current; }
+               }
+
+               // methods
+
+               public bool MoveNext () 
+               {
+                       return enumerator.MoveNext ();
+               }
+
+               public void Reset ()
+               {
+                       enumerator.Reset ();
+               }
+       }
+}
+
+#endif
\ No newline at end of file