Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -157,9 +157,9 @@ namespace System.Security.Cryptography {
return SubjectKeyIdentifierExtension (multiLine);
// other known objects (i.e. supported structure) -
// but without any corresponding framework class
case Oid.oidSubjectAltName:
case "2.5.29.17": // oidSubjectAltName:
return SubjectAltName (multiLine);
case Oid.oidNetscapeCertType:
case "2.16.840.1.113730.1.1": // oidNetscapeCertType
return NetscapeCertType (multiLine);
default:
return Default (multiLine);

View File

@@ -1,62 +0,0 @@
2010-05-10 Sebastien Pouliot <sebastien@ximian.com>
* AsnEncodedData.cs:
* OidCollection.cs:
* Oid.cs:
* OidEnumerator.cs:
Allow parts required to enable SSL to be built with
the moonlight profile.
2005-11-22 Sebastien Pouliot <sebastien@ximian.com>
* AsnEncodedData.cs: Create a new Oid instance _only_ if the supplied
Oid isn't null.
2005-09-27 Sebastien Pouliot <sebastien@ximian.com>
* AsnEncodedDataCollection.cs: Added new ctor.
2005-09-26 Sebastien Pouliot <sebastien@ximian.com>
* Asn*.cs, Oid*.cs: Moved from System.Security.dll
2005-05-03 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).
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.
* 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.
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).

View File

@@ -1,213 +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 SECURITY_DEP
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 oidPkcs9ContentType = "1.2.840.113549.1.9.3";
internal const string namePkcs9ContentType = "Content Type";
internal const string oidPkcs9MessageDigest = "1.2.840.113549.1.9.4";
internal const string namePkcs9MessageDigest = "Message Digest";
internal const string oidPkcs9SigningTime = "1.2.840.113549.1.9.5";
internal const string namePkcs9SigningTime = "Signing Time";
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 oidAes128 = "2.16.840.1.101.3.4.1.2";
internal const string nameAes128 = "aes128";
internal const string oidAes256 = "2.16.840.1.101.3.4.1.42";
internal const string nameAes256 = "aes256";
internal const string oidSha256 = "2.16.840.1.101.3.4.2.1";
internal const string nameSha256 = "sha256";
internal const string oidSha512 = "2.16.840.1.101.3.4.2.3";
internal const string nameSha512 = "sha512";
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 oidPkcs9ContentType:
return namePkcs9ContentType;
case oidPkcs9MessageDigest:
return namePkcs9MessageDigest;
case oidPkcs9SigningTime:
return namePkcs9SigningTime;
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 oidAes128:
return nameAes128;
case oidAes256:
return nameAes256;
case oidSha1:
return nameSha1;
case oidSha256:
return nameSha256;
case oidSha512:
return nameSha512;
default:
return _name;
}
}
// TODO - find the complete list
private string GetValue (string name)
{
switch (name) {
case nameRSA:
return oidRSA;
case namePkcs7Data:
return oidPkcs7Data;
case namePkcs9ContentType:
return oidPkcs9ContentType;
case namePkcs9MessageDigest:
return oidPkcs9MessageDigest;
case namePkcs9SigningTime:
return oidPkcs9SigningTime;
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 nameAes128:
return oidAes128;
case nameAes256:
return oidAes256;
case nameSha1:
return oidSha1;
case nameSha256:
return oidSha256;
case nameSha512:
return oidSha512;
default:
return _value;
}
}
}
}
#endif

View File

@@ -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 SECURITY_DEP
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

View File

@@ -1,89 +0,0 @@
//
// OidEnumerator.cs - System.Security.Cryptography.OidEnumerator
//
// Author:
// Sebastien Pouliot (spouliot@motus.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 SECURITY_DEP
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

View File

@@ -1,44 +0,0 @@
//
// OidGroup.cs:
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.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.
//
namespace System.Security.Cryptography
{
public enum OidGroup {
All = 0,
HashAlgorithm = 1,
EncryptionAlgorithm = 2,
PublicKeyAlgorithm = 3,
SignatureAlgorithm = 4,
Attribute = 5,
ExtensionOrAttribute = 6,
EnhancedKeyUsage = 7,
Policy = 8,
Template = 9,
KeyDerivationFunction = 10
}
}