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

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2005-09-26 18:08:58 +0400
committerSebastien Pouliot <sebastien@ximian.com>2005-09-26 18:08:58 +0400
commit6a080fe2bdbe19466ea1d53037a41e749fff1720 (patch)
treebfcf209567e7bdedbb8ed0b048c25b6c1552cc97 /mcs/class/System.Security/System.Security.Cryptography
parentc09f673f6d7a7e7d61b0731522095f7ad4d7f205 (diff)
In Test/System.Security.Cryptography:
2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * Asn*.cs, Oid*.cs: Moved to System.dll In Test/System.Security.Permissions: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * StorePermissionAttributeTest.cs: Moved in System.dll In Test/System.Security.Cryptography.X509Certificates: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * All tests moved to System.dll assembly. In System.Security.Cryptography: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * Asn*.cs, Oid*.cs: Moved to System.dll In System.Security.Permissions: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * Store*.cs: Moved in System.dll In .: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * System.Security.dll.sources: Remove all X509 related classes. * System.Security_test.dll.sources: Remove all X509 related tests. * System.Security.Cryptography.X509Certificates/*.cs: moved to System.dll assembly. * Test/System.Security.Cryptography.X509Certificates/*.cs: moved to System.dll assembly. In System.Security.Cryptography.X509Certificates: 2005-09-26 Sebastien Pouliot <sebastien@ximian.com> * All classes moved in System.dll svn path=/trunk/mcs/; revision=50770
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography')
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs319
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs102
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs88
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/ChangeLog35
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/Oid.cs184
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs124
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs91
7 files changed, 2 insertions, 941 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs b/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs
deleted file mode 100644
index ccbc5ddcabe..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedData.cs
+++ /dev/null
@@ -1,319 +0,0 @@
-//
-// AsnEncodedData.cs - System.Security.Cryptography.AsnEncodedData
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System.Security.Cryptography.X509Certificates;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.Cryptography;
-
-namespace System.Security.Cryptography {
-
- internal enum AsnDecodeStatus {
- NotDecoded = -1,
- Ok = 0,
- BadAsn = 1,
- BadTag = 2,
- BadLength = 3,
- InformationNotAvailable = 4
- }
-
- public class AsnEncodedData {
-
- internal Oid _oid;
- internal byte[] _raw;
-
- // constructors
-
- protected AsnEncodedData ()
- {
- }
-
- public AsnEncodedData (string oid, byte[] rawData)
- {
- _oid = new Oid (oid);
- RawData = rawData;
- }
-
- public AsnEncodedData (Oid oid, byte[] rawData)
- {
- Oid = oid;
- RawData = rawData;
-
- // yes, here oid == null is legal (by design),
- // but no, it would not be legal for an oid string
- // see MSDN FDBK11479
- }
-
- public AsnEncodedData (AsnEncodedData asnEncodedData)
- {
- if (asnEncodedData == null)
- throw new ArgumentNullException ("asnEncodedData");
-
- Oid = new Oid (asnEncodedData._oid);
- RawData = asnEncodedData._raw;
- }
-
- public AsnEncodedData (byte[] rawData)
- {
- RawData = rawData;
- }
-
- // properties
-
- public Oid Oid {
- get { return _oid; }
- set {
- if (value == null)
- _oid = null;
- else
- _oid = new Oid (value);
- }
- }
-
- public byte[] RawData {
- get { return _raw; }
- set {
- if (value == null)
- throw new ArgumentNullException ("RawData");
- _raw = (byte[])value.Clone ();
- }
- }
-
- // methods
-
- public virtual void CopyFrom (AsnEncodedData asnEncodedData)
- {
- if (asnEncodedData == null)
- throw new ArgumentNullException ("asnEncodedData");
-
- if (asnEncodedData._oid == null)
- Oid = null;
- else
- Oid = new Oid (asnEncodedData._oid);
-
- RawData = asnEncodedData._raw;
- }
-
- public virtual string Format (bool multiLine)
- {
- if (_raw == null)
- return String.Empty;
-
- if (_oid == null)
- return Default (multiLine);
-
- return ToString (multiLine);
- }
-
- // internal decoding/formatting methods
-
- internal virtual string ToString (bool multiLine)
- {
- switch (_oid.Value) {
- // fx supported objects
- case X509BasicConstraintsExtension.oid:
- return BasicConstraintsExtension (multiLine);
- case X509EnhancedKeyUsageExtension.oid:
- return EnhancedKeyUsageExtension (multiLine);
- case X509KeyUsageExtension.oid:
- return KeyUsageExtension (multiLine);
- case X509SubjectKeyIdentifierExtension.oid:
- return SubjectKeyIdentifierExtension (multiLine);
- // other known objects (i.e. supported structure) -
- // but without any corresponding framework class
- case Oid.oidSubjectAltName:
- return SubjectAltName (multiLine);
- case Oid.oidNetscapeCertType:
- return NetscapeCertType (multiLine);
- default:
- return Default (multiLine);
- }
- }
-
- internal string Default (bool multiLine)
- {
- StringBuilder sb = new StringBuilder ();
- for (int i=0; i < _raw.Length; i++) {
- sb.Append (_raw [i].ToString ("x2"));
- if (i != _raw.Length - 1)
- sb.Append (" ");
- }
- return sb.ToString ();
- }
-
- // Indirectly (undocumented but) supported extensions
-
- internal string BasicConstraintsExtension (bool multiLine)
- {
- try {
- X509BasicConstraintsExtension bc = new X509BasicConstraintsExtension (this, false);
- return bc.ToString (multiLine);
- }
- catch {
- return String.Empty;
- }
- }
-
- internal string EnhancedKeyUsageExtension (bool multiLine)
- {
- try {
- X509EnhancedKeyUsageExtension eku = new X509EnhancedKeyUsageExtension (this, false);
- return eku.ToString (multiLine);
- }
- catch {
- return String.Empty;
- }
- }
-
- internal string KeyUsageExtension (bool multiLine)
- {
- try {
- X509KeyUsageExtension ku = new X509KeyUsageExtension (this, false);
- return ku.ToString (multiLine);
- }
- catch {
- return String.Empty;
- }
- }
-
- internal string SubjectKeyIdentifierExtension (bool multiLine)
- {
- try {
- X509SubjectKeyIdentifierExtension ski = new X509SubjectKeyIdentifierExtension (this, false);
- return ski.ToString (multiLine);
- }
- catch {
- return String.Empty;
- }
- }
-
- // Indirectly (undocumented but) supported extensions
-
- internal string SubjectAltName (bool multiLine)
- {
- if (_raw.Length < 5)
- return "Information Not Available";
-
- try {
- ASN1 ex = new ASN1 (_raw);
- StringBuilder sb = new StringBuilder ();
- for (int i=0; i < ex.Count; i++) {
- ASN1 el = ex [i];
-
- string type = null;
- string name = null;
-
- switch (el.Tag) {
- case 0x81:
- type = "RFC822 Name=";
- name = Encoding.ASCII.GetString (el.Value);
- break;
- case 0x82:
- type = "DNS Name=";
- name = Encoding.ASCII.GetString (el.Value);
- break;
- default:
- type = String.Format ("Unknown ({0})=", el.Tag);
- name = CryptoConvert.ToHex (el.Value);
- break;
- }
-
- sb.Append (type);
- sb.Append (name);
- if (multiLine) {
- sb.Append (Environment.NewLine);
- } else if (i < ex.Count - 1) {
- sb.Append (", ");
- }
- }
- return sb.ToString ();
- }
- catch {
- return String.Empty;
- }
- }
-
- internal string NetscapeCertType (bool multiLine)
- {
- // 4 byte long, BITSTRING (0x03), Value length of 2
- if ((_raw.Length < 4) || (_raw [0] != 0x03) || (_raw [1] != 0x02))
- return "Information Not Available";
- // first value byte is the number of unused bits
- int value = (_raw [3] >> _raw [2]) << _raw [2];
-
- StringBuilder sb = new StringBuilder ();
-
- if ((value & 0x80) == 0x80) {
- sb.Append ("SSL Client Authentication");
- }
- if ((value & 0x40) == 0x40) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("SSL Server Authentication");
- }
- if ((value & 0x20) == 0x20) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("SMIME");
- }
- if ((value & 0x10) == 0x10) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("Signature"); // a.k.a. Object Signing / Code Signing
- }
- if ((value & 0x08) == 0x08) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("Unknown cert type");
- }
- if ((value & 0x04) == 0x04) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("SSL CA"); // CA == Certificate Authority
- }
- if ((value & 0x02) == 0x02) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("SMIME CA");
- }
- if ((value & 0x01) == 0x01) {
- if (sb.Length > 0)
- sb.Append (", ");
- sb.Append ("Signature CA");
- }
- sb.AppendFormat (" ({0})", value.ToString ("x2"));
- return sb.ToString ();
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs b/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs
deleted file mode 100644
index 0f38e8c5188..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataCollection.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-//
-// System.Security.Cryptography.AsnEncodedDataCollection
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- public sealed class AsnEncodedDataCollection : ICollection, IEnumerable {
-
- private ArrayList _list;
-
- // constructors
-
- public AsnEncodedDataCollection ()
- {
- _list = new ArrayList ();
- }
-
- // properties
-
- public int Count {
- get { return _list.Count; }
- }
-
- public bool IsSynchronized {
- get { return _list.IsSynchronized; }
- }
-
- public AsnEncodedData this [int index] {
- get { return (AsnEncodedData) _list [index]; }
- }
-
- public object SyncRoot {
- get { return _list.SyncRoot; }
- }
-
- // methods
-
- public int Add (AsnEncodedData asnEncodedData)
- {
- return _list.Add (asnEncodedData);
- }
-
- public void CopyTo (AsnEncodedData[] array, int index)
- {
- _list.CopyTo ((Array)array, index);
- }
-
- // to satisfy ICollection - private
- void ICollection.CopyTo (Array array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public AsnEncodedDataEnumerator GetEnumerator ()
- {
- return new AsnEncodedDataEnumerator (this);
- }
-
- // to satisfy IEnumerator - private
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new AsnEncodedDataEnumerator (this);
- }
-
- public void Remove (AsnEncodedData asnEncodedData)
- {
- _list.Remove (asnEncodedData);
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs
deleted file mode 100644
index e8c90decefd..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/AsnEncodedDataEnumerator.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// System.Security.Cryptography.AsnEncodedDataEnumerator
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- public sealed class AsnEncodedDataEnumerator : IEnumerator {
-
- private AsnEncodedDataCollection _collection;
- private int _position;
-
- // note: couldn't reuse the IEnumerator from ArrayList because
- // it doesn't throw the same exceptions
- internal AsnEncodedDataEnumerator (AsnEncodedDataCollection collection)
- {
- _collection = collection;
- _position = -1;
- }
-
- // properties
-
- public AsnEncodedData Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return (AsnEncodedData) _collection [_position];
- }
- }
-
- object IEnumerator.Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return _collection [_position];
- }
- }
-
- // methods
-
- public bool MoveNext ()
- {
- if (++_position < _collection.Count)
- return true;
- else {
- // strangely we must always be able to return the last entry
- _position = _collection.Count - 1;
- return false;
- }
- }
-
- public void Reset ()
- {
- _position = -1;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography/ChangeLog
index e32a6cb3d7f..bbf7fc1941c 100644
--- a/mcs/class/System.Security/System.Security.Cryptography/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography/ChangeLog
@@ -1,10 +1,6 @@
-2005-05-03 Sebastien Pouliot <sebastien@ximian.com>
+2005-09-26 Sebastien Pouliot <sebastien@ximian.com>
- * AsnEncodedData.cs: Allow CopyFrom to work even without an OID.
-
-2005-04-25 Sebastien Pouliot <sebastien@ximian.com>
-
- * AsnEncodedData.cs: Fix compiler warning (unused variable).
+ * Asn*.cs, Oid*.cs: Moved to System.dll
2005-04-23 Sebastien Pouliot <sebastien@ximian.com>
@@ -15,42 +11,15 @@
* CryptographicAttributeEnumerator.cs: Renamed class to Cryptographic
AttributeObjectEnumerator to match beta2.
-2005-01-20 Sebastien Pouliot <sebastien@ximian.com>
-
- * AsnEncodedData.cs: Added "internal" support for SubjectAltName
- extension as it is required for SSL support.
- * Oid.cs: Added Oid / FriendlyName definitions for SubjectAltName.
-
-2005-01-17 Sebastien Pouliot <sebastien@ximian.com>
-
- * AsnEncodedData.cs: Added more decoding/formatting code as this class
- is far more intelligent (or bloated) than anticipated.
- * Oid.cs: Added more Oid / FriendlyName definitions required for the
- X.509 extensions and some more for some failing unit tests.
- * OidCollection.cs: Added support to make the collection read-only.
-
2005-01-13 Sebastien Pouliot <sebastien@ximian.com>
- * AsnEncodedData.cs: Completed/fixed implementation.
* CryptographicAttribute.cs: Fixed implementation with updated unit
tests.
- * Oid.cs: Fixed implementation with updated unit tests.
2004-07-08 Sebastien Pouliot <spouliot@videotron.ca>
- * AsnEncodedData.cs: Fixes for Fx 2.0 beta 1 compatibility. Added
- MonoTODO to missing functionalities.
- * AsnEncodedDataCollection.cs: New.
- * AsnEncodedDataEnumerator.cs: New.
* CryptographicAttribute.cs: New. Moved from S.S.C.Pkcs.
* CryptographicAttributeCollection.cs: New. Replace S.S.C.Pkcs.
Pkcs9AttributeCollection.
* CryptographicAttributeEnumerator.cs: New. Replace S.S.C.Pkcs.
Pkcs9AttributeEnumerator.
-
-2003-11-06 Sebastien Pouliot <spouliot@videotron.ca>
-
- * AsnEncodedData.cs: New. Class to encapsulate ASN.1 data (.NET 1.2).
- * Oid.cs: New. Class to encapsulate OIDs (.NET 1.2).
- * OidCollection.cs: New. ICollection based class for OIDs (.NET 1.2).
- * OidEnumerator.cs: New. IEnumerator based class for OIDs (.NET 1.2).
diff --git a/mcs/class/System.Security/System.Security.Cryptography/Oid.cs b/mcs/class/System.Security/System.Security.Cryptography/Oid.cs
deleted file mode 100644
index f2da65231ec..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/Oid.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-//
-// Oid.cs - System.Security.Cryptography.Oid
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System.Security.Cryptography.Pkcs;
-using System.Security.Cryptography.X509Certificates;
-
-namespace System.Security.Cryptography {
-
- public sealed class Oid {
-
- private string _value;
- private string _name;
-
- // constructors
-
- public Oid ()
- {
- }
-
- public Oid (string oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- _value = oid;
- _name = GetName (oid);
- }
-
- public Oid (string value, string friendlyName)
- {
- _value = value;
- _name = friendlyName;
- }
-
- public Oid (Oid oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- _value = oid.Value;
- _name = oid.FriendlyName;
- }
-
- // properties
-
- public string FriendlyName {
- get { return _name; }
- set {
- _name = value;
- _value = GetValue (_name);
- }
- }
-
- public string Value {
- get { return _value; }
- set {
- _value = value;
- _name = GetName (_value);
- }
- }
-
- // internal stuff
-
- // Known OID/Names not defined anywhere else (by OID order)
- internal const string oidRSA = "1.2.840.113549.1.1.1";
- internal const string nameRSA = "RSA";
- internal const string oidPkcs7Data = "1.2.840.113549.1.7.1";
- internal const string namePkcs7Data = "PKCS 7 Data";
- internal const string oidMd5 = "1.2.840.113549.2.5";
- internal const string nameMd5 = "md5";
- internal const string oid3Des = "1.2.840.113549.3.7";
- internal const string name3Des = "3des";
- internal const string oidSha1 = "1.3.14.3.2.26";
- internal const string nameSha1 = "sha1";
- internal const string oidSubjectAltName = "2.5.29.17";
- internal const string nameSubjectAltName = "Subject Alternative Name";
- internal const string oidNetscapeCertType = "2.16.840.1.113730.1.1";
- internal const string nameNetscapeCertType = "Netscape Cert Type";
-
- // TODO - find the complete list
- private string GetName (string oid)
- {
- switch (oid) {
- case oidRSA:
- return nameRSA;
- case oidPkcs7Data:
- return namePkcs7Data;
- case Pkcs9ContentType.oid:
- return Pkcs9ContentType.friendlyName;
- case Pkcs9MessageDigest.oid:
- return Pkcs9MessageDigest.friendlyName;
- case Pkcs9SigningTime.oid:
- return Pkcs9SigningTime.friendlyName;
- case oid3Des:
- return name3Des;
- case X509BasicConstraintsExtension.oid:
- return X509BasicConstraintsExtension.friendlyName;
- case X509KeyUsageExtension.oid:
- return X509KeyUsageExtension.friendlyName;
- case X509EnhancedKeyUsageExtension.oid:
- return X509EnhancedKeyUsageExtension.friendlyName;
- case X509SubjectKeyIdentifierExtension.oid:
- return X509SubjectKeyIdentifierExtension.friendlyName;
- case oidSubjectAltName:
- return nameSubjectAltName;
- case oidNetscapeCertType:
- return nameNetscapeCertType;
- case oidMd5:
- return nameMd5;
- case oidSha1:
- return nameSha1;
- default:
- return _name;
- }
- }
-
- // TODO - find the complete list
- private string GetValue (string name)
- {
- switch (name) {
- case nameRSA:
- return oidRSA;
- case namePkcs7Data:
- return oidPkcs7Data;
- case Pkcs9ContentType.friendlyName:
- return Pkcs9ContentType.oid;
- case Pkcs9MessageDigest.friendlyName:
- return Pkcs9MessageDigest.oid;
- case Pkcs9SigningTime.friendlyName:
- return Pkcs9SigningTime.oid;
- case name3Des:
- return oid3Des;
- case X509BasicConstraintsExtension.friendlyName:
- return X509BasicConstraintsExtension.oid;
- case X509KeyUsageExtension.friendlyName:
- return X509KeyUsageExtension.oid;
- case X509EnhancedKeyUsageExtension.friendlyName:
- return X509EnhancedKeyUsageExtension.oid;
- case X509SubjectKeyIdentifierExtension.friendlyName:
- return X509SubjectKeyIdentifierExtension.oid;
- case nameSubjectAltName:
- return oidSubjectAltName;
- case nameNetscapeCertType:
- return oidNetscapeCertType;
- case nameMd5:
- return oidMd5;
- case nameSha1:
- return oidSha1;
- default:
- return _value;
- }
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs b/mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs
deleted file mode 100644
index e5b8684e6ce..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/OidCollection.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-//
-// OidCollection.cs - System.Security.Cryptography.OidCollection
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2005 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- public sealed class OidCollection : ICollection, IEnumerable {
-
- private ArrayList _list;
- private bool _readOnly;
-
- // constructors
-
- public OidCollection ()
- {
- _list = new ArrayList ();
- }
-
- // properties
-
- public int Count {
- get { return _list.Count; }
- }
-
- public bool IsSynchronized {
- get { return _list.IsSynchronized; }
- }
-
- public Oid this [int index] {
- get { return (Oid) _list [index]; }
- }
-
- public Oid this [string oid] {
- get {
- foreach (Oid o in _list) {
- if (o.Value == oid)
- return o;
- }
- return null;
- }
- }
-
- public object SyncRoot {
- get { return _list.SyncRoot; }
- }
-
- // methods
-
- public int Add (Oid oid)
- {
- return (_readOnly ? 0 : _list.Add (oid));
- }
-
- public void CopyTo (Oid[] array, int index)
- {
- _list.CopyTo ((Array)array, index);
- }
-
- // to satisfy ICollection - private
- void ICollection.CopyTo (Array array, int index)
- {
- _list.CopyTo (array, index);
- }
-
- public OidEnumerator GetEnumerator ()
- {
- return new OidEnumerator (this);
- }
-
- // to satisfy IEnumerator - private
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return new OidEnumerator (this);
- }
-
- // internal stuff
-
- internal bool ReadOnly {
- get { return _readOnly; }
- set { _readOnly = value; }
- }
-
- internal OidCollection ReadOnlyCopy ()
- {
- OidCollection copy = new OidCollection ();
- foreach (Oid oid in _list) {
- copy.Add (oid);
- }
- copy._readOnly = true;
- return copy;
- }
- }
-}
-
-#endif
diff --git a/mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs b/mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs
deleted file mode 100644
index fa1cdb5728e..00000000000
--- a/mcs/class/System.Security/System.Security.Cryptography/OidEnumerator.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-//
-// OidEnumerator.cs - System.Security.Cryptography.OidEnumerator
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#if NET_2_0
-
-using System;
-using System.Collections;
-
-namespace System.Security.Cryptography {
-
- // Note: Match the definition of framework version 1.2.3400.0 on http://longhorn.msdn.microsoft.com
-
- public sealed class OidEnumerator : IEnumerator {
-
- private OidCollection _collection;
- private int _position;
-
- // note: couldn't reuse the IEnumerator from ArrayList because
- // it doesn't throw the same exceptions
- internal OidEnumerator (OidCollection collection)
- {
- _collection = collection;
- _position = -1;
- }
-
- // properties
-
- public Oid Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return (Oid) _collection [_position];
- }
- }
-
- object IEnumerator.Current {
- get {
- if (_position < 0)
- throw new ArgumentOutOfRangeException ();
- return _collection [_position];
- }
- }
-
- // methods
-
- public bool MoveNext ()
- {
- if (++_position < _collection.Count)
- return true;
- else {
- // strangely we must always be able to return the last entry
- _position = _collection.Count - 1;
- return false;
- }
- }
-
- public void Reset ()
- {
- _position = -1;
- }
- }
-}
-
-#endif \ No newline at end of file