Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
//
// System.Security.Cryptography.Aes.cs
// based on mcs/class/corlib/System.Security.Cryptography/Rijndael.cs
//
// Authors:
// Dan Lewis (dihlewis@yahoo.co.uk)
// Andrew Birkett (andy@nobugs.org)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2002
// Copyright (C) 2004-2006,2008 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.
//
// Since 4.0 (both FX and SL) this type is defined in mscorlib - before 4.0 it was in System.Core.dll
#if (INSIDE_CORLIB && (NET_4_0)) || (!INSIDE_CORLIB && !NET_4_0 && !MOBILE)
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Security.Cryptography {
// References:
// a. FIPS PUB 197: Advanced Encryption Standard
// http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
#if INSIDE_CORLIB
// since 4.0 (both FX and SL) this type now resides inside mscorlib.dll and link back to System.Core.dll
#if MOBILE
// version has not changed between SL3 (System.Core) and SL4
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
// use 3.5 version
[TypeForwardedFrom ("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
#endif
#endif
public abstract class Aes : SymmetricAlgorithm {
public static new Aes Create ()
{
#if FULL_AOT_RUNTIME
// The Aes base class was moved from System.Core to mscorlib - so we can't just return a new AesCryptoServiceProvider instance
// note: the linker is aware of this condition
return (Aes) Activator.CreateInstance (Type.GetType ("System.Security.Cryptography.AesManaged, " + Consts.AssemblySystem_Core));
#else
return Create ("System.Security.Cryptography.AesCryptoServiceProvider, " + Consts.AssemblySystem_Core);
#endif
}
public static new Aes Create (string algorithmName)
{
return (Aes) CryptoConfig.CreateFromName (algorithmName);
}
protected Aes ()
{
KeySizeValue = 256;
BlockSizeValue = 128;
FeedbackSizeValue = 128;
LegalKeySizesValue = new KeySizes [1];
LegalKeySizesValue [0] = new KeySizes (128, 256, 64);
LegalBlockSizesValue = new KeySizes [1];
LegalBlockSizesValue [0] = new KeySizes (128, 128, 0);
}
}
}
#endif

View File

@@ -0,0 +1,123 @@
//
// System.Security.Cryptography.AesCryptoServiceProvider class
//
// Authors:
// Sebastien Pouliot (sebastien@xamarin.com)
//
// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
// Copyright 2013 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.
//
using System.Security.Permissions;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography {
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort=true)]
public sealed class AesCryptoServiceProvider : Aes {
public AesCryptoServiceProvider ()
{
FeedbackSizeValue = 8;
}
public override void GenerateIV ()
{
IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
}
public override void GenerateKey ()
{
KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
}
public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
{
if ((Mode == CipherMode.CFB) && (FeedbackSize > 64))
throw new CryptographicException ("CFB with Feedbaack > 64 bits");
return new AesTransform (this, false, rgbKey, rgbIV);
}
public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
{
if ((Mode == CipherMode.CFB) && (FeedbackSize > 64))
throw new CryptographicException ("CFB with Feedbaack > 64 bits");
return new AesTransform (this, true, rgbKey, rgbIV);
}
// I suppose some attributes differs ?!? because this does not look required
public override byte[] IV {
get { return base.IV; }
set { base.IV = value; }
}
public override byte[] Key {
get { return base.Key; }
set { base.Key = value; }
}
public override int KeySize {
get { return base.KeySize; }
set { base.KeySize = value; }
}
public override int FeedbackSize {
get { return base.FeedbackSize; }
set { base.FeedbackSize = value; }
}
public override CipherMode Mode {
get { return base.Mode; }
set {
switch (value) {
case CipherMode.CTS:
throw new CryptographicException ("CTS is not supported");
default:
base.Mode = value;
break;
}
}
}
public override PaddingMode Padding {
get { return base.Padding; }
set { base.Padding = value; }
}
public override ICryptoTransform CreateDecryptor ()
{
return CreateDecryptor (Key, IV);
}
public override ICryptoTransform CreateEncryptor()
{
return CreateEncryptor (Key, IV);
}
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
}
}
}

View File

@@ -0,0 +1,130 @@
//
// System.Security.Cryptography.AesManaged.cs
//
// Authors:
// Mark Crichton (crichton@gimp.org)
// Andrew Birkett (andy@nobugs.org)
// Sebastien Pouliot (sebastien@xamarin.com)
// Kazuki Oikawa (kazuki@panicode.com)
//
// (C) 2002
// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2005,2008 Novell, Inc (http://www.novell.com)
// Copyright 2013 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.
//
using System.Security.Permissions;
using Mono.Security.Cryptography;
namespace System.Security.Cryptography {
// References:
// a. FIPS PUB 197: Advanced Encryption Standard
// http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
// b. Aes Specification
// http://csrc.nist.gov/CryptoToolkit/aes/Aes/Aes-ammended.pdf
[HostProtection (SecurityAction.LinkDemand, MayLeakOnAbort=true)]
public sealed class AesManaged : Aes {
public AesManaged ()
{
}
public override void GenerateIV ()
{
IVValue = KeyBuilder.IV (BlockSizeValue >> 3);
}
public override void GenerateKey ()
{
KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
}
public override ICryptoTransform CreateDecryptor (byte[] key, byte[] iv)
{
return new AesTransform (this, false, key, iv);
}
public override ICryptoTransform CreateEncryptor (byte[] key, byte[] iv)
{
return new AesTransform (this, true, key, iv);
}
// I suppose some attributes differs ?!? because this does not look required
public override byte[] IV {
get { return base.IV; }
set { base.IV = value; }
}
public override byte[] Key {
get { return base.Key; }
set { base.Key = value; }
}
public override int KeySize {
get { return base.KeySize; }
set { base.KeySize = value; }
}
public override int FeedbackSize {
get { return base.FeedbackSize; }
set { base.FeedbackSize = value; }
}
public override CipherMode Mode {
get { return base.Mode; }
set {
switch (value) {
case CipherMode.CBC:
case CipherMode.ECB:
base.Mode = value;
break;
default:
throw new CryptographicException ("CipherMode is not supported");
}
}
}
public override PaddingMode Padding {
get { return base.Padding; }
set { base.Padding = value; }
}
public override ICryptoTransform CreateDecryptor ()
{
return CreateDecryptor (Key, IV);
}
public override ICryptoTransform CreateEncryptor()
{
return CreateEncryptor (Key, IV);
}
protected override void Dispose (bool disposing)
{
base.Dispose (disposing);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,66 @@
2011-02-17 Juho Vähä-Herttua <juhovh@iki.fi>
* CngAlgorithm.cs, CngAlgorithmGroup.cs: Change the private
variable name to match .NET when the class is serialized
* CngKeyBlobFormat.cs: New.
* CngKeyCreationParameters.cs: New.
* CngProperty.cs: New.
* CngPropertyCollection.cs: New.
* CngProvider.cs: New.
* CngUIPolicy.cs: New.
2011-02-16 Juho Vähä-Herttua <juhovh@iki.fi>
* CngExportPolicies.cs: New.
* CngKeyCreationOptions.cs: New.
* CngKeyOpenOptions.cs: New.
* CngKeyUsages.cs: New.
* CngPropertyOptions.cs: New.
* CngUIProtectionLevels.cs: New.
* ECDiffieHellmanKeyDerivationFunction.cs: New.
* ECKeyXmlFormat.cs: New.
2010-03-18 Sebastien Pouliot <sebastien@ximian.com>
* Aes.cs: Build here before NET_4_0 (or MOONLIGHT) otherwise
build only if compiled from mscorlib.dll
2009-11-12 Jb Evain <jbevain@novell.com>
* Aes.cs: avoid using an hardcoded assembly version for System.Core.
2009-07-20 Sebastien Pouliot <sebastien@ximian.com>
* Aes.cs: Use the fully qualified name since this is not a type known
in the default corlib (2.0 or 1.x).
2009-04-29 Sebastien Pouliot <sebastien@ximian.com>
* MD5Cng.cs, SHA1Cng.cs, SHA256Cng.cs, SHA256CryptoServiceProvider.cs,
SHA384Cng.cs, SHA384CryptoServiceProvider.cs, SHA512Cng.cs,
SHA512CryptoServiceProvider.cs: Regenerated to be excluded from
NET_2_1
2008-08-07 Sebastien Pouliot <sebastien@ximian.com>
* Aes.cs: Don't set the (unexisting) FeedbackSizeValue field
for NET_2_1
* AesTransform.cs: Remove code for blocksize != 128 bits
2008-08-05 Sebastien Pouliot <sebastien@ximian.com>
* Aes.cs: New. Base class for AES cipher.
* AesCryptoServiceProvider.cs: New. CSP implementation
of AES. For mono we're reusing the managed AesTransform
* AesManaged.cs: New. Managed implementation of AES.
* AesTransform.cs: New. Actual managed code for AES.
* CngAlgorithm.cs: New.
* CngAlgorithmGroup.cs: New.
* MD5Cng.cs: New. Generated code.
* SHA1Cng.cs: New. Generated code.
* SHA256Cng.cs: New. Generated code.
* SHA256CryptoServiceProvider.cs: New. Generated code.
* SHA384Cng.cs: New. Generated code.
* SHA384CryptoServiceProvider.cs: New. Generated code.
* SHA512Cng.cs: New. Generated code.
* SHA512CryptoServiceProvider.cs: New. Generated code.

View File

@@ -0,0 +1,192 @@
//
// System.Security.Cryptography.CngAlgorithm
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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 {
// note: CNG stands for "Cryptography API: Next Generation"
[Serializable]
public sealed class CngAlgorithm : IEquatable<CngAlgorithm> {
private string m_algorithm;
public CngAlgorithm (string algorithm)
{
if (algorithm == null)
throw new ArgumentNullException ("algorithm");
if (algorithm.Length == 0)
throw new ArgumentException ("algorithm");
m_algorithm = algorithm;
}
public string Algorithm {
get { return m_algorithm; }
}
public bool Equals (CngAlgorithm other)
{
if (other == null)
return false;
return m_algorithm == other.m_algorithm;
}
public override bool Equals (object obj)
{
return Equals (obj as CngAlgorithm);
}
public override int GetHashCode ()
{
return m_algorithm.GetHashCode ();
}
public override string ToString ()
{
return m_algorithm;
}
// static
static CngAlgorithm dh256;
static CngAlgorithm dh384;
static CngAlgorithm dh521;
static CngAlgorithm dsa256;
static CngAlgorithm dsa384;
static CngAlgorithm dsa521;
static CngAlgorithm md5;
static CngAlgorithm sha1;
static CngAlgorithm sha256;
static CngAlgorithm sha384;
static CngAlgorithm sha512;
public static CngAlgorithm ECDiffieHellmanP256 {
get {
if (dh256 == null)
dh256 = new CngAlgorithm ("ECDH_P256");
return dh256;
}
}
public static CngAlgorithm ECDiffieHellmanP384 {
get {
if (dh384 == null)
dh384 = new CngAlgorithm ("ECDH_P384");
return dh384;
}
}
public static CngAlgorithm ECDiffieHellmanP521 {
get {
if (dh521 == null)
dh521 = new CngAlgorithm ("ECDH_P521");
return dh521;
}
}
public static CngAlgorithm ECDsaP256 {
get {
if (dsa256 == null)
dsa256 = new CngAlgorithm ("ECDSA_P256");
return dsa256;
}
}
public static CngAlgorithm ECDsaP384 {
get {
if (dsa384 == null)
dsa384 = new CngAlgorithm ("ECDSA_P384");
return dsa384;
}
}
public static CngAlgorithm ECDsaP521 {
get {
if (dsa521 == null)
dsa521 = new CngAlgorithm ("ECDSA_P521");
return dsa521;
}
}
public static CngAlgorithm MD5 {
get {
if (md5 == null)
md5 = new CngAlgorithm ("MD5");
return md5;
}
}
public static CngAlgorithm Sha1 {
get {
if (sha1 == null)
sha1 = new CngAlgorithm ("SHA1");
return sha1;
}
}
public static CngAlgorithm Sha256 {
get {
if (sha256 == null)
sha256 = new CngAlgorithm ("SHA256");
return sha256;
}
}
public static CngAlgorithm Sha384 {
get {
if (sha384 == null)
sha384 = new CngAlgorithm ("SHA384");
return sha384;
}
}
public static CngAlgorithm Sha512 {
get {
if (sha512 == null)
sha512 = new CngAlgorithm ("SHA512");
return sha512;
}
}
public static bool operator == (CngAlgorithm left, CngAlgorithm right)
{
if ((object)left == null)
return ((object)right == null);
return left.Equals (right);
}
public static bool operator != (CngAlgorithm left, CngAlgorithm right)
{
if ((object)left == null)
return ((object)right != null);
return !left.Equals (right);
}
}
}

View File

@@ -0,0 +1,138 @@
//
// System.Security.Cryptography.CngAlgorithmGroup
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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 {
// note: CNG stands for "Cryptography API: Next Generation"
[Serializable]
public sealed class CngAlgorithmGroup : IEquatable<CngAlgorithmGroup> {
private string m_algorithmGroup;
public CngAlgorithmGroup (string algorithmGroup)
{
if (algorithmGroup == null)
throw new ArgumentNullException ("algorithmGroup");
if (algorithmGroup.Length == 0)
throw new ArgumentException ("algorithmGroup");
m_algorithmGroup = algorithmGroup;
}
public string AlgorithmGroup {
get { return m_algorithmGroup; }
}
public bool Equals (CngAlgorithmGroup other)
{
if (other == null)
return false;
return m_algorithmGroup == other.m_algorithmGroup;
}
public override bool Equals (object obj)
{
return Equals (obj as CngAlgorithmGroup);
}
public override int GetHashCode ()
{
return m_algorithmGroup.GetHashCode ();
}
public override string ToString ()
{
return m_algorithmGroup;
}
// static
private static CngAlgorithmGroup dh;
private static CngAlgorithmGroup dsa;
private static CngAlgorithmGroup ecdh;
private static CngAlgorithmGroup ecdsa;
private static CngAlgorithmGroup rsa;
public static CngAlgorithmGroup DiffieHellman {
get {
if (dh == null)
dh = new CngAlgorithmGroup ("DH");
return dh;
}
}
public static CngAlgorithmGroup Dsa {
get {
if (dsa == null)
dsa = new CngAlgorithmGroup ("DSA");
return dsa;
}
}
public static CngAlgorithmGroup ECDiffieHellman {
get {
if (ecdh == null)
ecdh = new CngAlgorithmGroup ("ECDH");
return ecdh;
}
}
public static CngAlgorithmGroup ECDsa {
get {
if (ecdsa == null)
ecdsa = new CngAlgorithmGroup ("ECDSA");
return ecdsa;
}
}
public static CngAlgorithmGroup Rsa {
get {
if (rsa == null)
rsa = new CngAlgorithmGroup ("RSA");
return rsa;
}
}
public static bool operator == (CngAlgorithmGroup left, CngAlgorithmGroup right)
{
if ((object)left == null)
return ((object)right == null);
return left.Equals (right);
}
public static bool operator != (CngAlgorithmGroup left, CngAlgorithmGroup right)
{
if ((object)left == null)
return ((object)right != null);
return !left.Equals (right);
}
}
}

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.MD5Cng
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around MD5CryptoServiceProvider
// see README.CNG and README.CSP for more details
public sealed class MD5Cng : MD5 {
static byte[] Empty = new byte [0];
private MD5 hash;
[SecurityCritical]
public MD5Cng ()
{
// note: we don't use MD5.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new MD5CryptoServiceProvider ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA1Cng
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA1Managed
// see README.CNG and README.CSP for more details
public sealed class SHA1Cng : SHA1 {
static byte[] Empty = new byte [0];
private SHA1 hash;
[SecurityCritical]
public SHA1Cng ()
{
// note: we don't use SHA1.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA1Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA256Cng
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA256Managed
// see README.CNG and README.CSP for more details
public sealed class SHA256Cng : SHA256 {
static byte[] Empty = new byte [0];
private SHA256 hash;
[SecurityCritical]
public SHA256Cng ()
{
// note: we don't use SHA256.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA256Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA256CryptoServiceProvider
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA256Managed
// see README.CNG and README.CSP for more details
public sealed class SHA256CryptoServiceProvider : SHA256 {
static byte[] Empty = new byte [0];
private SHA256 hash;
[SecurityCritical]
public SHA256CryptoServiceProvider ()
{
// note: we don't use SHA256.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA256Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA384Cng
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA384Managed
// see README.CNG and README.CSP for more details
public sealed class SHA384Cng : SHA384 {
static byte[] Empty = new byte [0];
private SHA384 hash;
[SecurityCritical]
public SHA384Cng ()
{
// note: we don't use SHA384.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA384Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA384CryptoServiceProvider
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA384Managed
// see README.CNG and README.CSP for more details
public sealed class SHA384CryptoServiceProvider : SHA384 {
static byte[] Empty = new byte [0];
private SHA384 hash;
[SecurityCritical]
public SHA384CryptoServiceProvider ()
{
// note: we don't use SHA384.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA384Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA512Cng
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA512Managed
// see README.CNG and README.CSP for more details
public sealed class SHA512Cng : SHA512 {
static byte[] Empty = new byte [0];
private SHA512 hash;
[SecurityCritical]
public SHA512Cng ()
{
// note: we don't use SHA512.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA512Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif

View File

@@ -0,0 +1,82 @@
//
// NOTE: DO NOT EDIT - This file was automatically generated using
// /mcs/class/System.Core/tools/hashwrap.cs
//
// System.Security.Cryptography.SHA512CryptoServiceProvider
//
// Authors:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2008 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_1
namespace System.Security.Cryptography {
// this is a wrapper around SHA512Managed
// see README.CNG and README.CSP for more details
public sealed class SHA512CryptoServiceProvider : SHA512 {
static byte[] Empty = new byte [0];
private SHA512 hash;
[SecurityCritical]
public SHA512CryptoServiceProvider ()
{
// note: we don't use SHA512.Create since CryptoConfig could,
// if set to use this class, result in a endless recursion
hash = new SHA512Managed ();
}
[SecurityCritical]
public override void Initialize ()
{
hash.Initialize ();
}
[SecurityCritical]
protected override void HashCore (byte[] array, int ibStart, int cbSize)
{
hash.TransformBlock (array, ibStart, cbSize, null, 0);
}
[SecurityCritical]
protected override byte[] HashFinal ()
{
hash.TransformFinalBlock (Empty, 0, 0);
HashValue = hash.Hash;
return HashValue;
}
[SecurityCritical]
protected override void Dispose (bool disposing)
{
(hash as IDisposable).Dispose ();
base.Dispose (disposing);
}
}
}
#endif