You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -73,13 +73,9 @@ using System.Runtime.InteropServices;
|
||||
[assembly: DefaultDependency (LoadHint.Always)]
|
||||
[assembly: StringFreezing]
|
||||
|
||||
#if NET_2_1
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
|
||||
[assembly: InternalsVisibleTo ("System.Core, PublicKey=00240000048000009400000006020000002400005253413100040000010001008D56C76F9E8649383049F383C44BE0EC204181822A6C31CF5EB7EF486944D032188EA1D3920763712CCB12D75FB77E9811149E6148E5D32FBAAB37611C1878DDC19E20EF135D0CB2CFF2BFEC3D115810C3D9069638FE4BE215DBF795861920E5AB6F7DB2E2CEEF136AC23D5DD2BF031700AEC232F6C6B1C785B4305C123B37AB")]
|
||||
#else
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=00000000000000000400000000000000")]
|
||||
[assembly: InternalsVisibleTo ("System.Core, PublicKey=00000000000000000400000000000000")]
|
||||
#endif
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
|
||||
[assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
|
||||
|
||||
[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")]
|
||||
|
||||
#if MONOTOUCH
|
||||
|
||||
@@ -1,192 +0,0 @@
|
||||
2010-06-18 Rolf Bjarne Kvinge <RKvinge@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: We need to be friends with System.Core now too.
|
||||
|
||||
2010-03-16 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: use MOONLIGHT symbol to disambiguate
|
||||
MonoTouch and Moonlight code.
|
||||
|
||||
2010-02-09 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Mono.CompilerServices.SymbolWriter does not
|
||||
need to access mscorlib.dll internals anymore (ArrayList and
|
||||
Hashtable)
|
||||
|
||||
2009-11-30 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: Remove the MOON_A11Y_INTERNAL_HACK define
|
||||
for MoonAtkBridge after audit finished in r147098.
|
||||
|
||||
2009-09-20 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Remove ComCompatibleVersion and
|
||||
AllowPartiallyTrustedCallers for NET_2_1
|
||||
|
||||
2009-06-12 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: Changing the public key, as we now use
|
||||
mono-uia.snk.
|
||||
|
||||
2009-05-26 Andrés G. Aragoneses <aaragoneses@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: Add InternalsVisibleTo for MoonAtkBridge
|
||||
under a MOON_A11Y_INTERNAL_HACK define.
|
||||
|
||||
2009-04-29 Chris Toshok <toshok@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: in the 2.1 case we're InternalsVisibleTo
|
||||
System.Windows.Browser
|
||||
|
||||
2009-04-22 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: allow System.ServiceModel.Web access to mscorlib
|
||||
internals (e.g. non-generic System.Collections.*)
|
||||
|
||||
2009-04-21 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: allow System.ServiceModel access to mscorlib
|
||||
internals (e.g. non-generic System.Collections.*)
|
||||
|
||||
2009-04-16 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: allow System, System.Xml and Mono.
|
||||
CompilerServices.SymbolWriter access to mscorlib internals
|
||||
for 2.1 (Moonlight) so they can access internalized types
|
||||
like non-generic System.Collections
|
||||
|
||||
2009-04-02 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: allow System.Runtime.Serialization to see
|
||||
mscorlib's internals. Fix Encoding.get_CodeBase (and likely
|
||||
others too)
|
||||
|
||||
2009-02-06 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: allow System.Net to see mscorlib's internals,
|
||||
as it needs Thread.Interrupt.
|
||||
|
||||
2008-05-07 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Change InternalsVisibleTo on Mono.Moonlight to
|
||||
a key we control.
|
||||
|
||||
2008-04-23 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
|
||||
|
||||
* AssemblyInfo.cs: Added missing attributes
|
||||
|
||||
2008-04-13 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: rename agmono to Mono.Moonlight
|
||||
as a friend assembly for the 2.1 profile.
|
||||
Merged from the Moonlight 2 branch.
|
||||
|
||||
2007-08-20 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: agclr doesn't need to
|
||||
be friend anymore.
|
||||
|
||||
2007-08-20 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: System.Silverlight doesn't need to
|
||||
be friend anymore.
|
||||
|
||||
2007-08-11 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: Also add agmono as a friend assembly (needed
|
||||
for access to the AppDomain stuff).
|
||||
|
||||
2007-08-11 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: add agclr as a friend assembly
|
||||
|
||||
2007-08-11 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: add System.SilverLight as a friend assembly
|
||||
|
||||
2005-08-06 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* AssemblyInfo.cs: Fixed AssemblyDescription to match MS.NET.
|
||||
|
||||
2005-02-18 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* AssemblyInfo.cs [BOOTSTRAP_WITH_OLDLIB]: Disable SecurityPermission.
|
||||
|
||||
2005-01-24 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Add SkipVerification to assembly RequestMinimum
|
||||
security permissions.
|
||||
|
||||
2004-11-25 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* Consts.cs (UnmanageType_80) [BOOTSTRAP_WITH_OLDLIB]: Update to
|
||||
changed name of bootstrap-only constant.
|
||||
|
||||
2004-09-08 Miguel de Icaza <miguel@ximian.com>
|
||||
|
||||
* Locale.cs: Added overload that calls String.Format.
|
||||
|
||||
2004-06-22 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
Refine previous change to work with mcs 0.31.
|
||||
* Consts.cs (UnmanagedType_80): While bootstrapping, refer to new
|
||||
internal bootstrap-only define in UnmanagedType.
|
||||
|
||||
2004-06-18 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* Consts.cs (UnmanagedType_80): New constant. Used to workaround
|
||||
problems like in tests/test-272.cs.
|
||||
|
||||
2004-06-03 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* AssemblyInfo.cs: Don't sign if BOOTSTRAP_WITH_OLDLIB.
|
||||
|
||||
2004-05-29 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Sign corlib for net_2_0 now too.
|
||||
|
||||
2004-05-26 Jordi Mas <jordi@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: fixes CS1024: Preprocessor directive expected
|
||||
when compling with csc
|
||||
|
||||
2004-05-07 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* AssemblyInfo.cs (AssemblyDelaySign, AssemblyKeyFile): Disable
|
||||
with BOOTSTRAP_WITH_OLDLIB. Mono 0.31 runtime crashes on this.
|
||||
|
||||
2004-05-03 Lluis Sanches Gual <lluis@ximian.com>
|
||||
|
||||
* Consts.cs: Added.
|
||||
|
||||
2004-04-29 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Set version number correctly for the bootstrap
|
||||
corlib. For some reason setting key files does not work with gmcs
|
||||
and the bootstrap corlib.
|
||||
|
||||
2004-04-29 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Add 2.0 version attributes.
|
||||
|
||||
2004-02-22 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
|
||||
|
||||
* AssemblyInfo.cs: Added missing attribute, commented
|
||||
excess attributes, prepared signkey attributes
|
||||
|
||||
2004-02-04 Marek Safar <marek.safar@seznam.cz>
|
||||
|
||||
* AssemblyInfo.cs: corlib now has CLSCompliant attribute.
|
||||
|
||||
2003-11-12 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* AssemblyInfo.cs: Change assembly name to mscorlib
|
||||
|
||||
2003-08-06 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
|
||||
|
||||
* Locale.cs: Added
|
||||
|
||||
2003-07-17 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
|
||||
|
||||
* AssemblyInfo.cs: Added
|
||||
* ChangeLog: Added
|
||||
File diff suppressed because it is too large
Load Diff
130
mcs/class/corlib/CommonCrypto/CommonCrypto.cs
Normal file
130
mcs/class/corlib/CommonCrypto/CommonCrypto.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
// CommonCrypto bindings for MonoMac and MonoTouch
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2012-2014 Xamarin Inc.
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Crimson.CommonCrypto {
|
||||
|
||||
// int32_t -> CommonCryptor.h
|
||||
enum CCCryptorStatus {
|
||||
Success = 0,
|
||||
ParamError = -4300,
|
||||
BufferTooSmall = -4301,
|
||||
MemoryFailure = -4302,
|
||||
AlignmentError = -4303,
|
||||
DecodeError = -4304,
|
||||
Unimplemented = -4305
|
||||
}
|
||||
|
||||
// uint32_t -> CommonCryptor.h
|
||||
// note: not exposed publicly so it can stay signed
|
||||
enum CCOperation {
|
||||
Encrypt = 0,
|
||||
Decrypt,
|
||||
}
|
||||
|
||||
// uint32_t -> CommonCryptor.h
|
||||
// note: not exposed publicly so it can stay signed
|
||||
enum CCAlgorithm {
|
||||
AES128 = 0,
|
||||
DES,
|
||||
TripleDES,
|
||||
CAST,
|
||||
RC4,
|
||||
RC2,
|
||||
Blowfish
|
||||
}
|
||||
|
||||
// uint32_t -> CommonCryptor.h
|
||||
// note: not exposed publicly so it can stay signed
|
||||
[Flags]
|
||||
enum CCOptions {
|
||||
None = 0,
|
||||
PKCS7Padding = 1,
|
||||
ECBMode = 2
|
||||
}
|
||||
|
||||
static class Cryptor {
|
||||
|
||||
const string libSystem = "/usr/lib/libSystem.dylib";
|
||||
|
||||
// size_t was changed to IntPtr for 32/64 bits size difference - even if mono is (moslty) used in 32bits only on OSX today
|
||||
// not using `nint` to be able to resue this outside (if needed)
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorCreate (CCOperation op, CCAlgorithm alg, CCOptions options, /* const void* */ byte[] key, /* size_t */ IntPtr keyLength, /* const void* */ byte[] iv, /* CCCryptorRef* */ ref IntPtr cryptorRef);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorRelease (/* CCCryptorRef */ IntPtr cryptorRef);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorUpdate (/* CCCryptorRef */ IntPtr cryptorRef, /* const void* */ byte[] dataIn, /* size_t */ IntPtr dataInLength, /* void* */ byte[] dataOut, /* size_t */ IntPtr dataOutAvailable, /* size_t* */ ref IntPtr dataOutMoved);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorUpdate (/* CCCryptorRef */ IntPtr cryptorRef, /* const void* */ IntPtr dataIn, /* size_t */ IntPtr dataInLength, /* void* */ IntPtr dataOut, /* size_t */ IntPtr dataOutAvailable, /* size_t* */ ref IntPtr dataOutMoved);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorFinal (/* CCCryptorRef */ IntPtr cryptorRef, /* void* */ byte[] dataOut, /* size_t */ IntPtr dataOutAvailable, /* size_t* */ ref IntPtr dataOutMoved);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static int CCCryptorGetOutputLength (/* CCCryptorRef */ IntPtr cryptorRef, /* size_t */ IntPtr inputLength, bool final);
|
||||
|
||||
[DllImport (libSystem)]
|
||||
extern internal static CCCryptorStatus CCCryptorReset (/* CCCryptorRef */ IntPtr cryptorRef, /* const void* */ IntPtr iv);
|
||||
|
||||
// helper method to reduce the amount of generate code for each cipher algorithm
|
||||
static internal IntPtr Create (CCOperation operation, CCAlgorithm algorithm, CCOptions options, byte[] key, byte[] iv)
|
||||
{
|
||||
if (key == null)
|
||||
throw new CryptographicException ("A null key was provided");
|
||||
|
||||
// unlike the .NET framework CommonCrypto does not support two-keys triple-des (128 bits) ref: #6967
|
||||
if ((algorithm == CCAlgorithm.TripleDES) && (key.Length == 16)) {
|
||||
byte[] key3 = new byte [24];
|
||||
Buffer.BlockCopy (key, 0, key3, 0, 16);
|
||||
Buffer.BlockCopy (key, 0, key3, 16, 8);
|
||||
key = key3;
|
||||
}
|
||||
|
||||
IntPtr cryptor = IntPtr.Zero;
|
||||
CCCryptorStatus status = Cryptor.CCCryptorCreate (operation, algorithm, options, key, (IntPtr) key.Length, iv, ref cryptor);
|
||||
if (status != CCCryptorStatus.Success)
|
||||
throw new CryptographicUnexpectedOperationException ();
|
||||
return cryptor;
|
||||
}
|
||||
|
||||
// size_t was changed to IntPtr for 32/64 bits size difference - even if mono is (moslty) used in 32bits only on OSX today
|
||||
[DllImport ("/System/Library/Frameworks/Security.framework/Security")]
|
||||
extern internal static /* int */ int SecRandomCopyBytes (/* SecRandomRef */ IntPtr rnd, /* size_t */ IntPtr count, /* uint8_t* */ byte[] bytes);
|
||||
|
||||
static internal void GetRandom (byte[] buffer)
|
||||
{
|
||||
if (SecRandomCopyBytes (IntPtr.Zero, (IntPtr) buffer.Length, buffer) != 0)
|
||||
throw new CryptographicException (Marshal.GetLastWin32Error ()); // errno
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !XAMMAC
|
||||
static class KeyBuilder {
|
||||
static public byte[] Key (int size)
|
||||
{
|
||||
byte[] buffer = new byte [size];
|
||||
Cryptor.GetRandom (buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static public byte[] IV (int size)
|
||||
{
|
||||
byte[] buffer = new byte [size];
|
||||
Cryptor.GetRandom (buffer);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
24
mcs/class/corlib/CommonCrypto/CorlibExtras.cs
Normal file
24
mcs/class/corlib/CommonCrypto/CorlibExtras.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// CorlibExtras.cs: additional stuff not provided by autogenerated code
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot (sebastien@xamarun.com)
|
||||
//
|
||||
// Copyright (C) 2012 Xamarin Inc. All rights reserved.
|
||||
//
|
||||
|
||||
namespace System.Security.Cryptography {
|
||||
|
||||
// required to ensure compatibility with MS implementation
|
||||
public sealed partial class RC2CryptoServiceProvider : RC2 {
|
||||
|
||||
public override int EffectiveKeySize {
|
||||
get { return base.EffectiveKeySize; }
|
||||
set {
|
||||
if (value != KeySizeValue)
|
||||
throw new CryptographicUnexpectedOperationException ("Effective key size must match key size for compatibility");
|
||||
base.EffectiveKeySize = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
mcs/class/corlib/CommonCrypto/CryptorTransform.cs
Normal file
60
mcs/class/corlib/CommonCrypto/CryptorTransform.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
// ICryptoTransform implementation on top of CommonCrypto and SymmetricTransform
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2012 Xamarin Inc.
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Crimson.CommonCrypto {
|
||||
|
||||
class CryptorTransform : SymmetricTransform {
|
||||
|
||||
IntPtr handle;
|
||||
IntPtr handle_e;
|
||||
bool encryption;
|
||||
|
||||
public CryptorTransform (IntPtr cryptor, IntPtr special, SymmetricAlgorithm algo, bool encryption, byte[] iv)
|
||||
: base (algo, encryption, iv)
|
||||
{
|
||||
handle = cryptor;
|
||||
// for CFB we need to encrypt data while decrypting
|
||||
handle_e = special;
|
||||
this.encryption = encryption;
|
||||
}
|
||||
|
||||
~CryptorTransform ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
// PRO: doing this ensure all cipher modes and padding modes supported by .NET will be available with CommonCrypto (drop-in replacements)
|
||||
// CON: doing this will only process one block at the time, so it's not ideal for performance, but still a lot better than managed
|
||||
protected override void ECB (byte[] input, byte[] output)
|
||||
{
|
||||
IntPtr len = IntPtr.Zero;
|
||||
CCCryptorStatus s = Cryptor.CCCryptorUpdate ((encrypt == encryption) ? handle : handle_e,
|
||||
input, (IntPtr) input.Length, output, (IntPtr) output.Length, ref len);
|
||||
if (((int) len != output.Length) || (s != CCCryptorStatus.Success))
|
||||
throw new CryptographicUnexpectedOperationException (s.ToString ());
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (handle != IntPtr.Zero) {
|
||||
Cryptor.CCCryptorRelease (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
if (handle_e != IntPtr.Zero) {
|
||||
Cryptor.CCCryptorRelease (handle_e);
|
||||
handle_e = IntPtr.Zero;
|
||||
}
|
||||
base.Dispose (disposing);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
}
|
||||
}
|
||||
348
mcs/class/corlib/CommonCrypto/FastCryptorTransform.cs
Normal file
348
mcs/class/corlib/CommonCrypto/FastCryptorTransform.cs
Normal file
@@ -0,0 +1,348 @@
|
||||
// Fast, multi-block, ICryptoTransform implementation on top of CommonCrypto
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2012 Xamarin Inc.
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Crimson.CommonCrypto {
|
||||
|
||||
unsafe class FastCryptorTransform : ICryptoTransform {
|
||||
|
||||
IntPtr handle;
|
||||
bool encrypt;
|
||||
int BlockSizeByte;
|
||||
byte[] workBuff;
|
||||
bool lastBlock;
|
||||
PaddingMode padding;
|
||||
|
||||
public FastCryptorTransform (IntPtr cryptor, SymmetricAlgorithm algo, bool encryption, byte[] iv)
|
||||
{
|
||||
BlockSizeByte = (algo.BlockSize >> 3);
|
||||
|
||||
if (iv == null) {
|
||||
iv = KeyBuilder.IV (BlockSizeByte);
|
||||
} else if (iv.Length < BlockSizeByte) {
|
||||
string msg = String.Format ("IV is too small ({0} bytes), it should be {1} bytes long.",
|
||||
iv.Length, BlockSizeByte);
|
||||
throw new CryptographicException (msg);
|
||||
}
|
||||
|
||||
handle = cryptor;
|
||||
encrypt = encryption;
|
||||
padding = algo.Padding;
|
||||
// transform buffer
|
||||
workBuff = new byte [BlockSizeByte];
|
||||
}
|
||||
|
||||
~FastCryptorTransform ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
Dispose (true);
|
||||
}
|
||||
|
||||
protected virtual void Dispose (bool disposing)
|
||||
{
|
||||
if (handle != IntPtr.Zero) {
|
||||
Cryptor.CCCryptorRelease (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
public virtual bool CanTransformMultipleBlocks {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public virtual bool CanReuseTransform {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public virtual int InputBlockSize {
|
||||
get { return BlockSizeByte; }
|
||||
}
|
||||
|
||||
public virtual int OutputBlockSize {
|
||||
get { return BlockSizeByte; }
|
||||
}
|
||||
|
||||
int Transform (byte[] input, int inputOffset, byte[] output, int outputOffset, int length)
|
||||
{
|
||||
IntPtr len = IntPtr.Zero;
|
||||
IntPtr in_len = (IntPtr) length;
|
||||
IntPtr out_len = (IntPtr) (output.Length - outputOffset);
|
||||
fixed (byte* inputBuffer = &input [0])
|
||||
fixed (byte* outputBuffer = &output [0]) {
|
||||
CCCryptorStatus s = Cryptor.CCCryptorUpdate (handle, (IntPtr) (inputBuffer + inputOffset), in_len, (IntPtr) (outputBuffer + outputOffset), out_len, ref len);
|
||||
if (s != CCCryptorStatus.Success)
|
||||
throw new CryptographicException (s.ToString ());
|
||||
}
|
||||
return (int) len;
|
||||
}
|
||||
|
||||
private void CheckInput (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
if (inputBuffer == null)
|
||||
throw new ArgumentNullException ("inputBuffer");
|
||||
if (inputOffset < 0)
|
||||
throw new ArgumentOutOfRangeException ("inputOffset", "< 0");
|
||||
if (inputCount < 0)
|
||||
throw new ArgumentOutOfRangeException ("inputCount", "< 0");
|
||||
// ordered to avoid possible integer overflow
|
||||
if (inputOffset > inputBuffer.Length - inputCount)
|
||||
throw new ArgumentException ("inputBuffer", "Overflow");
|
||||
}
|
||||
|
||||
// this method may get called MANY times so this is the one to optimize
|
||||
public virtual int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
CheckInput (inputBuffer, inputOffset, inputCount);
|
||||
// check output parameters
|
||||
if (outputBuffer == null)
|
||||
throw new ArgumentNullException ("outputBuffer");
|
||||
if (outputOffset < 0)
|
||||
throw new ArgumentOutOfRangeException ("outputOffset", "< 0");
|
||||
|
||||
// ordered to avoid possible integer overflow
|
||||
int len = outputBuffer.Length - inputCount - outputOffset;
|
||||
if (!encrypt && (0 > len) && ((padding == PaddingMode.None) || (padding == PaddingMode.Zeros))) {
|
||||
throw new CryptographicException ("outputBuffer", "Overflow");
|
||||
} else if (KeepLastBlock) {
|
||||
if (0 > len + BlockSizeByte) {
|
||||
throw new CryptographicException ("outputBuffer", "Overflow");
|
||||
}
|
||||
} else {
|
||||
if (0 > len) {
|
||||
// there's a special case if this is the end of the decryption process
|
||||
if (inputBuffer.Length - inputOffset - outputBuffer.Length == BlockSizeByte)
|
||||
inputCount = outputBuffer.Length - outputOffset;
|
||||
else
|
||||
throw new CryptographicException ("outputBuffer", "Overflow");
|
||||
}
|
||||
}
|
||||
return InternalTransformBlock (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
|
||||
}
|
||||
|
||||
private bool KeepLastBlock {
|
||||
get {
|
||||
return ((!encrypt) && (padding != PaddingMode.None) && (padding != PaddingMode.Zeros));
|
||||
}
|
||||
}
|
||||
|
||||
private int InternalTransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
int offs = inputOffset;
|
||||
int full;
|
||||
|
||||
// this way we don't do a modulo every time we're called
|
||||
// and we may save a division
|
||||
if (inputCount != BlockSizeByte) {
|
||||
if ((inputCount % BlockSizeByte) != 0)
|
||||
throw new CryptographicException ("Invalid input block size.");
|
||||
|
||||
full = inputCount / BlockSizeByte;
|
||||
} else
|
||||
full = 1;
|
||||
|
||||
if (KeepLastBlock)
|
||||
full--;
|
||||
|
||||
int total = 0;
|
||||
|
||||
if (lastBlock) {
|
||||
Transform (workBuff, 0, outputBuffer, outputOffset, BlockSizeByte);
|
||||
outputOffset += BlockSizeByte;
|
||||
total += BlockSizeByte;
|
||||
lastBlock = false;
|
||||
}
|
||||
|
||||
if (full > 0) {
|
||||
int length = full * BlockSizeByte;
|
||||
Transform (inputBuffer, offs, outputBuffer, outputOffset, length);
|
||||
offs += length;
|
||||
outputOffset += length;
|
||||
total += length;
|
||||
}
|
||||
|
||||
if (KeepLastBlock) {
|
||||
Buffer.BlockCopy (inputBuffer, offs, workBuff, 0, BlockSizeByte);
|
||||
lastBlock = true;
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
private void Random (byte[] buffer, int start, int length)
|
||||
{
|
||||
byte[] random = new byte [length];
|
||||
Cryptor.GetRandom (random);
|
||||
Buffer.BlockCopy (random, 0, buffer, start, length);
|
||||
}
|
||||
|
||||
private void ThrowBadPaddingException (PaddingMode padding, int length, int position)
|
||||
{
|
||||
string msg = String.Format ("Bad {0} padding.", padding);
|
||||
if (length >= 0)
|
||||
msg += String.Format (" Invalid length {0}.", length);
|
||||
if (position >= 0)
|
||||
msg += String.Format (" Error found at position {0}.", position);
|
||||
throw new CryptographicException (msg);
|
||||
}
|
||||
|
||||
private byte[] FinalEncrypt (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
// are there still full block to process ?
|
||||
int full = (inputCount / BlockSizeByte) * BlockSizeByte;
|
||||
int rem = inputCount - full;
|
||||
int total = full;
|
||||
|
||||
switch (padding) {
|
||||
case PaddingMode.ANSIX923:
|
||||
case PaddingMode.ISO10126:
|
||||
case PaddingMode.PKCS7:
|
||||
// we need to add an extra block for padding
|
||||
total += BlockSizeByte;
|
||||
break;
|
||||
default:
|
||||
if (inputCount == 0)
|
||||
return new byte [0];
|
||||
if (rem != 0) {
|
||||
if (padding == PaddingMode.None)
|
||||
throw new CryptographicException ("invalid block length");
|
||||
// zero padding the input (by adding a block for the partial data)
|
||||
byte[] paddedInput = new byte [full + BlockSizeByte];
|
||||
Buffer.BlockCopy (inputBuffer, inputOffset, paddedInput, 0, inputCount);
|
||||
inputBuffer = paddedInput;
|
||||
inputOffset = 0;
|
||||
inputCount = paddedInput.Length;
|
||||
total = inputCount;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
byte[] res = new byte [total];
|
||||
int outputOffset = 0;
|
||||
|
||||
// process all blocks except the last (final) block
|
||||
if (total > BlockSizeByte) {
|
||||
outputOffset = InternalTransformBlock (inputBuffer, inputOffset, total - BlockSizeByte, res, 0);
|
||||
inputOffset += outputOffset;
|
||||
}
|
||||
|
||||
// now we only have a single last block to encrypt
|
||||
byte pad = (byte) (BlockSizeByte - rem);
|
||||
switch (padding) {
|
||||
case PaddingMode.ANSIX923:
|
||||
// XX 00 00 00 00 00 00 07 (zero + padding length)
|
||||
res [res.Length - 1] = pad;
|
||||
Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
|
||||
// the last padded block will be transformed in-place
|
||||
InternalTransformBlock (res, full, BlockSizeByte, res, full);
|
||||
break;
|
||||
case PaddingMode.ISO10126:
|
||||
// XX 3F 52 2A 81 AB F7 07 (random + padding length)
|
||||
Random (res, res.Length - pad, pad - 1);
|
||||
res [res.Length - 1] = pad;
|
||||
Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
|
||||
// the last padded block will be transformed in-place
|
||||
InternalTransformBlock (res, full, BlockSizeByte, res, full);
|
||||
break;
|
||||
case PaddingMode.PKCS7:
|
||||
// XX 07 07 07 07 07 07 07 (padding length)
|
||||
for (int i = res.Length; --i >= (res.Length - pad);)
|
||||
res [i] = pad;
|
||||
Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
|
||||
// the last padded block will be transformed in-place
|
||||
InternalTransformBlock (res, full, BlockSizeByte, res, full);
|
||||
break;
|
||||
default:
|
||||
InternalTransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset);
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private byte[] FinalDecrypt (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
if ((inputCount % BlockSizeByte) > 0)
|
||||
throw new CryptographicException ("Invalid input block size.");
|
||||
|
||||
int total = inputCount;
|
||||
if (lastBlock)
|
||||
total += BlockSizeByte;
|
||||
|
||||
byte[] res = new byte [total];
|
||||
int outputOffset = 0;
|
||||
|
||||
if (inputCount > 0)
|
||||
outputOffset = InternalTransformBlock (inputBuffer, inputOffset, inputCount, res, 0);
|
||||
|
||||
if (lastBlock) {
|
||||
Transform (workBuff, 0, res, outputOffset, BlockSizeByte);
|
||||
outputOffset += BlockSizeByte;
|
||||
lastBlock = false;
|
||||
}
|
||||
|
||||
// total may be 0 (e.g. PaddingMode.None)
|
||||
byte pad = ((total > 0) ? res [total - 1] : (byte) 0);
|
||||
switch (padding) {
|
||||
case PaddingMode.ANSIX923:
|
||||
if ((pad == 0) || (pad > BlockSizeByte))
|
||||
ThrowBadPaddingException (padding, pad, -1);
|
||||
for (int i = pad - 1; i > 0; i--) {
|
||||
if (res [total - 1 - i] != 0x00)
|
||||
ThrowBadPaddingException (padding, -1, i);
|
||||
}
|
||||
total -= pad;
|
||||
break;
|
||||
case PaddingMode.ISO10126:
|
||||
if ((pad == 0) || (pad > BlockSizeByte))
|
||||
ThrowBadPaddingException (padding, pad, -1);
|
||||
total -= pad;
|
||||
break;
|
||||
case PaddingMode.PKCS7:
|
||||
if ((pad == 0) || (pad > BlockSizeByte))
|
||||
ThrowBadPaddingException (padding, pad, -1);
|
||||
for (int i = pad - 1; i > 0; i--) {
|
||||
if (res [total - 1 - i] != pad)
|
||||
ThrowBadPaddingException (padding, -1, i);
|
||||
}
|
||||
total -= pad;
|
||||
break;
|
||||
case PaddingMode.None: // nothing to do - it's a multiple of block size
|
||||
case PaddingMode.Zeros: // nothing to do - user must unpad himself
|
||||
break;
|
||||
}
|
||||
|
||||
// return output without padding
|
||||
if (total > 0) {
|
||||
byte[] data = new byte [total];
|
||||
Buffer.BlockCopy (res, 0, data, 0, total);
|
||||
// zeroize decrypted data (copy with padding)
|
||||
Array.Clear (res, 0, res.Length);
|
||||
return data;
|
||||
}
|
||||
else
|
||||
return new byte [0];
|
||||
}
|
||||
|
||||
public virtual byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
CheckInput (inputBuffer, inputOffset, inputCount);
|
||||
|
||||
if (encrypt)
|
||||
return FinalEncrypt (inputBuffer, inputOffset, inputCount);
|
||||
else
|
||||
return FinalDecrypt (inputBuffer, inputOffset, inputCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
212
mcs/class/corlib/CommonCrypto/RC4CommonCrypto.cs
Normal file
212
mcs/class/corlib/CommonCrypto/RC4CommonCrypto.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
// A CommonCrypto-based implementation of RC4(tm)
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
// Copyright 2012-2014 Xamarin Inc.
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Crimson.CommonCrypto;
|
||||
|
||||
#if MONOTOUCH || XAMMAC
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Cryptography {
|
||||
|
||||
#if !INSIDE_CORLIB
|
||||
public
|
||||
#endif
|
||||
sealed partial class ARC4Managed : RC4, ICryptoTransform {
|
||||
|
||||
IntPtr handle;
|
||||
|
||||
public ARC4Managed ()
|
||||
{
|
||||
}
|
||||
|
||||
~ARC4Managed ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
#else
|
||||
namespace Crimson.Security.Cryptography {
|
||||
|
||||
public abstract class RC4 : SymmetricAlgorithm {
|
||||
|
||||
private static KeySizes[] s_legalBlockSizes = {
|
||||
new KeySizes (64, 64, 0)
|
||||
};
|
||||
|
||||
private static KeySizes[] s_legalKeySizes = {
|
||||
new KeySizes (40, 512, 8)
|
||||
};
|
||||
|
||||
public RC4 ()
|
||||
{
|
||||
KeySizeValue = 128;
|
||||
BlockSizeValue = 64;
|
||||
FeedbackSizeValue = BlockSizeValue;
|
||||
LegalBlockSizesValue = s_legalBlockSizes;
|
||||
LegalKeySizesValue = s_legalKeySizes;
|
||||
}
|
||||
|
||||
// required for compatibility with .NET 2.0
|
||||
public override byte[] IV {
|
||||
get { return new byte [0]; }
|
||||
set { ; }
|
||||
}
|
||||
|
||||
new static public RC4 Create()
|
||||
{
|
||||
return Create ("RC4");
|
||||
}
|
||||
|
||||
new static public RC4 Create (string algName)
|
||||
{
|
||||
object o = CryptoConfig.CreateFromName (algName);
|
||||
return (RC4) o ?? new RC4CommonCrypto ();
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RC4CommonCrypto : RC4, ICryptoTransform {
|
||||
|
||||
IntPtr handle;
|
||||
|
||||
public RC4CommonCrypto ()
|
||||
{
|
||||
}
|
||||
|
||||
~RC4CommonCrypto ()
|
||||
{
|
||||
Dispose (false);
|
||||
}
|
||||
#endif
|
||||
|
||||
public bool CanReuseTransform {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool CanTransformMultipleBlocks {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public int InputBlockSize {
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public int OutputBlockSize {
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public override byte[] Key {
|
||||
get {
|
||||
return base.Key;
|
||||
}
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("Key");
|
||||
|
||||
int length = (value.Length << 3);
|
||||
KeySizeValue = length;
|
||||
KeyValue = (byte[]) value.Clone ();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose (bool disposing)
|
||||
{
|
||||
if (handle != IntPtr.Zero) {
|
||||
Cryptor.CCCryptorRelease (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
base.Dispose (disposing);
|
||||
GC.SuppressFinalize (this);
|
||||
}
|
||||
|
||||
public override void GenerateIV ()
|
||||
{
|
||||
// not used for a stream cipher
|
||||
IVValue = new byte [0];
|
||||
}
|
||||
|
||||
public override void GenerateKey ()
|
||||
{
|
||||
KeyValue = KeyBuilder.Key (KeySizeValue >> 3);
|
||||
}
|
||||
|
||||
public override ICryptoTransform CreateDecryptor (byte[] rgbKey, byte[] rgbIV)
|
||||
{
|
||||
KeyValue = rgbKey;
|
||||
IVValue = rgbIV;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
|
||||
{
|
||||
KeyValue = rgbKey;
|
||||
IVValue = rgbIV;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void CheckInput (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
if (inputBuffer == null)
|
||||
throw new ArgumentNullException ("inputBuffer");
|
||||
if (inputOffset < 0)
|
||||
throw new ArgumentOutOfRangeException ("inputOffset", "< 0");
|
||||
if (inputCount < 0)
|
||||
throw new ArgumentOutOfRangeException ("inputCount", "< 0");
|
||||
// ordered to avoid possible integer overflow
|
||||
if (inputOffset > inputBuffer.Length - inputCount)
|
||||
throw new ArgumentException ("inputBuffer", "Overflow");
|
||||
}
|
||||
|
||||
public unsafe int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
|
||||
{
|
||||
CheckInput (inputBuffer, inputOffset, inputCount);
|
||||
if (inputCount == 0)
|
||||
return 0;
|
||||
|
||||
// check output parameters
|
||||
if (outputBuffer == null)
|
||||
throw new ArgumentNullException ("outputBuffer");
|
||||
if (outputOffset < 0)
|
||||
throw new ArgumentOutOfRangeException ("outputOffset", "< 0");
|
||||
// ordered to avoid possible integer overflow
|
||||
if (outputOffset > outputBuffer.Length - inputCount)
|
||||
throw new ArgumentException ("outputBuffer", "Overflow");
|
||||
if (outputBuffer.Length == 0)
|
||||
throw new CryptographicException ("output buffer too small");
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
handle = Cryptor.Create (CCOperation.Encrypt, CCAlgorithm.RC4, CCOptions.None, KeyValue, IVValue);
|
||||
|
||||
IntPtr len = IntPtr.Zero;
|
||||
IntPtr in_len = (IntPtr) (inputBuffer.Length - inputOffset);
|
||||
IntPtr out_len = (IntPtr) (outputBuffer.Length - outputOffset);
|
||||
fixed (byte* input = &inputBuffer [0])
|
||||
fixed (byte* output = &outputBuffer [0]) {
|
||||
CCCryptorStatus s = Cryptor.CCCryptorUpdate (handle, (IntPtr) (input + inputOffset), in_len, (IntPtr) (output + outputOffset), out_len, ref len);
|
||||
if ((len != out_len) || (s != CCCryptorStatus.Success))
|
||||
throw new CryptographicUnexpectedOperationException (s.ToString ());
|
||||
}
|
||||
return (int) out_len;
|
||||
}
|
||||
|
||||
public byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
|
||||
{
|
||||
CheckInput (inputBuffer, inputOffset, inputCount);
|
||||
try {
|
||||
byte[] output = new byte [inputCount];
|
||||
TransformBlock (inputBuffer, inputOffset, inputCount, output, 0);
|
||||
return output;
|
||||
}
|
||||
finally {
|
||||
Cryptor.CCCryptorRelease (handle);
|
||||
handle = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
119
mcs/class/corlib/CommonCrypto/RijndaelManaged.cs
Normal file
119
mcs/class/corlib/CommonCrypto/RijndaelManaged.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
//
|
||||
// RijndaelManaged.cs: Use CommonCrypto AES when possible,
|
||||
// fallback on RijndaelManagedTransform otherwise
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@xamarin.com>
|
||||
//
|
||||
// Copyright 2012 Xamarin Inc.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Cryptography;
|
||||
using Crimson.CommonCrypto;
|
||||
|
||||
namespace System.Security.Cryptography {
|
||||
|
||||
public sealed class RijndaelManaged : Rijndael {
|
||||
|
||||
public RijndaelManaged ()
|
||||
{
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
// AES is Rijndael with a 128 bits block size, so we can use CommonCrypto in this case
|
||||
if (BlockSize == 128) {
|
||||
IntPtr decryptor = IntPtr.Zero;
|
||||
switch (Mode) {
|
||||
case CipherMode.CBC:
|
||||
decryptor = Cryptor.Create (CCOperation.Decrypt, CCAlgorithm.AES128, CCOptions.None, rgbKey, rgbIV);
|
||||
return new FastCryptorTransform (decryptor, this, false, rgbIV);
|
||||
case CipherMode.ECB:
|
||||
decryptor = Cryptor.Create (CCOperation.Decrypt, CCAlgorithm.AES128, CCOptions.ECBMode, rgbKey, rgbIV);
|
||||
return new FastCryptorTransform (decryptor, this, false, rgbIV);
|
||||
default:
|
||||
// CFB cipher mode is not supported by the (old) API we used (for compatibility) so we fallback for them
|
||||
// FIXME: benchmark if we're better with RijndaelManagedTransform or CryptorTransform for CFB mode
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEncryptor(rgbKey,
|
||||
ModeValue,
|
||||
rgbIV,
|
||||
FeedbackSizeValue,
|
||||
RijndaelManagedTransformMode.Decrypt);
|
||||
}
|
||||
|
||||
public override ICryptoTransform CreateEncryptor (byte[] rgbKey, byte[] rgbIV)
|
||||
{
|
||||
if (BlockSize == 128) {
|
||||
IntPtr encryptor = IntPtr.Zero;
|
||||
switch (Mode) {
|
||||
case CipherMode.CBC:
|
||||
encryptor = Cryptor.Create (CCOperation.Encrypt, CCAlgorithm.AES128, CCOptions.None, rgbKey, rgbIV);
|
||||
return new FastCryptorTransform (encryptor, this, true, rgbIV);
|
||||
case CipherMode.ECB:
|
||||
encryptor = Cryptor.Create (CCOperation.Encrypt, CCAlgorithm.AES128, CCOptions.ECBMode, rgbKey, rgbIV);
|
||||
return new FastCryptorTransform (encryptor, this, true, rgbIV);
|
||||
default:
|
||||
// CFB cipher mode is not supported by the (old) API we used (for compatibility) so we fallback for them
|
||||
// FIXME: benchmark if we're better with RijndaelManagedTransform or CryptorTransform for CFB mode
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEncryptor(rgbKey,
|
||||
ModeValue,
|
||||
rgbIV,
|
||||
FeedbackSizeValue,
|
||||
RijndaelManagedTransformMode.Encrypt);
|
||||
}
|
||||
|
||||
|
||||
private ICryptoTransform NewEncryptor (byte[] rgbKey,
|
||||
CipherMode mode,
|
||||
byte[] rgbIV,
|
||||
int feedbackSize,
|
||||
RijndaelManagedTransformMode encryptMode) {
|
||||
// Build the key if one does not already exist
|
||||
if (rgbKey == null) {
|
||||
rgbKey = Utils.GenerateRandom(KeySizeValue / 8);
|
||||
}
|
||||
|
||||
// If not ECB mode, make sure we have an IV. In CoreCLR we do not support ECB, so we must have
|
||||
// an IV in all cases.
|
||||
#if !FEATURE_CRYPTO
|
||||
if (mode != CipherMode.ECB) {
|
||||
#endif // !FEATURE_CRYPTO
|
||||
if (rgbIV == null) {
|
||||
rgbIV = Utils.GenerateRandom(BlockSizeValue / 8);
|
||||
}
|
||||
#if !FEATURE_CRYPTO
|
||||
}
|
||||
#endif // !FEATURE_CRYPTO
|
||||
|
||||
// Create the encryptor/decryptor object
|
||||
return new RijndaelManagedTransform (rgbKey,
|
||||
mode,
|
||||
rgbIV,
|
||||
BlockSizeValue,
|
||||
feedbackSize,
|
||||
PaddingValue,
|
||||
encryptMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
81
mcs/class/corlib/CommonCrypto/SecRandom.cs
Normal file
81
mcs/class/corlib/CommonCrypto/SecRandom.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// SecRandom.cs: based on Mono's System.Security.Cryptography.RNGCryptoServiceProvider
|
||||
//
|
||||
// Authors:
|
||||
// Mark Crichton (crichton@gimp.org)
|
||||
// Sebastien Pouliot (sebastien@xamarun.com)
|
||||
//
|
||||
// (C) 2002
|
||||
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2012-2014 Xamarin Inc.
|
||||
//
|
||||
// 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 Crimson.CommonCrypto;
|
||||
|
||||
// http://developer.apple.com/library/ios/#DOCUMENTATION/Security/Reference/RandomizationReference/Reference/reference.html
|
||||
#if MONOTOUCH || XAMMAC
|
||||
namespace System.Security.Cryptography {
|
||||
public class RNGCryptoServiceProvider : RandomNumberGenerator {
|
||||
public RNGCryptoServiceProvider ()
|
||||
{
|
||||
}
|
||||
|
||||
~RNGCryptoServiceProvider ()
|
||||
{
|
||||
}
|
||||
#else
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace Crimson.Security.Cryptography {
|
||||
|
||||
public class SecRandom : RandomNumberGenerator {
|
||||
#endif
|
||||
|
||||
public override void GetBytes (byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentNullException ("data");
|
||||
|
||||
Cryptor.GetRandom (data);
|
||||
}
|
||||
|
||||
public override void GetNonZeroBytes (byte[] data)
|
||||
{
|
||||
if (data == null)
|
||||
throw new ArgumentNullException ("data");
|
||||
|
||||
byte[] random = new byte [data.Length * 2];
|
||||
int i = 0;
|
||||
// one pass should be enough but hey this is random ;-)
|
||||
while (i < data.Length) {
|
||||
Cryptor.GetRandom (random);
|
||||
for (int j=0; j < random.Length; j++) {
|
||||
if (i == data.Length)
|
||||
break;
|
||||
if (random [j] != 0)
|
||||
data [i++] = random [j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
110
mcs/class/corlib/CoreFoundation/CFHelpers.cs
Normal file
110
mcs/class/corlib/CoreFoundation/CFHelpers.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace XamMac.CoreFoundation
|
||||
{
|
||||
internal static class CFHelpers
|
||||
{
|
||||
internal const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
|
||||
internal const string SecurityLibrary = "/System/Library/Frameworks/Security.framework/Security";
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
internal extern static void CFRelease (IntPtr obj);
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
internal extern static IntPtr CFRetain (IntPtr obj);
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct CFRange {
|
||||
public IntPtr loc;
|
||||
public IntPtr len;
|
||||
|
||||
public CFRange (int loc, int len)
|
||||
: this ((long) loc, (long) len)
|
||||
{
|
||||
}
|
||||
|
||||
public CFRange (long l, long len)
|
||||
{
|
||||
this.loc = (IntPtr) l;
|
||||
this.len = (IntPtr) len;
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)]
|
||||
extern static IntPtr CFStringCreateWithCharacters (IntPtr allocator, string str, IntPtr count);
|
||||
|
||||
[DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)]
|
||||
extern static IntPtr CFStringGetLength (IntPtr handle);
|
||||
|
||||
[DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)]
|
||||
extern static IntPtr CFStringGetCharactersPtr (IntPtr handle);
|
||||
|
||||
[DllImport (CoreFoundationLibrary, CharSet=CharSet.Unicode)]
|
||||
extern static IntPtr CFStringGetCharacters (IntPtr handle, CFRange range, IntPtr buffer);
|
||||
|
||||
internal static string FetchString (IntPtr handle)
|
||||
{
|
||||
if (handle == IntPtr.Zero)
|
||||
return null;
|
||||
|
||||
string str;
|
||||
|
||||
int l = (int)CFStringGetLength (handle);
|
||||
IntPtr u = CFStringGetCharactersPtr (handle);
|
||||
IntPtr buffer = IntPtr.Zero;
|
||||
if (u == IntPtr.Zero){
|
||||
CFRange r = new CFRange (0, l);
|
||||
buffer = Marshal.AllocCoTaskMem (l * 2);
|
||||
CFStringGetCharacters (handle, r, buffer);
|
||||
u = buffer;
|
||||
}
|
||||
unsafe {
|
||||
str = new string ((char *) u, 0, l);
|
||||
}
|
||||
|
||||
if (buffer != IntPtr.Zero)
|
||||
Marshal.FreeCoTaskMem (buffer);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
extern static IntPtr CFDataGetLength (IntPtr handle);
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
extern static IntPtr CFDataGetBytePtr (IntPtr handle);
|
||||
|
||||
internal static byte[] FetchDataBuffer (IntPtr handle)
|
||||
{
|
||||
var length = (int)CFDataGetLength (handle);
|
||||
var buffer = new byte [length];
|
||||
var ptr = CFDataGetBytePtr (handle);
|
||||
Marshal.Copy (ptr, buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
extern static IntPtr CFDataCreateWithBytesNoCopy (IntPtr allocator, IntPtr bytes, IntPtr length, IntPtr bytesDeallocator);
|
||||
|
||||
[DllImport (CoreFoundationLibrary)]
|
||||
extern static IntPtr CFDataCreate (IntPtr allocator, IntPtr bytes, IntPtr length);
|
||||
|
||||
[DllImport (SecurityLibrary)]
|
||||
extern static IntPtr SecCertificateCreateWithData (IntPtr allocator, IntPtr cfData);
|
||||
|
||||
unsafe internal static IntPtr CreateCertificateFromData (byte[] data)
|
||||
{
|
||||
fixed (void *ptr = data) {
|
||||
var cfdata = CFDataCreate (IntPtr.Zero, (IntPtr)ptr, new IntPtr (data.Length));
|
||||
if (cfdata == IntPtr.Zero)
|
||||
return IntPtr.Zero;
|
||||
|
||||
var certificate = SecCertificateCreateWithData (IntPtr.Zero, cfdata);
|
||||
if (cfdata != IntPtr.Zero)
|
||||
CFRelease (cfdata);
|
||||
return certificate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ $(error Unknown framework version)
|
||||
endif
|
||||
endif
|
||||
|
||||
RESOURCE_STRINGS = ../../../external/referencesource/mscorlib/mscorlib.txt
|
||||
RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt
|
||||
|
||||
LIBRARY_COMPILE = $(BOOT_COMPILE)
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
|
||||
@@ -37,6 +37,10 @@ RESOURCE_FILES = \
|
||||
|
||||
REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT
|
||||
|
||||
ifndef MOBILE_PROFILE
|
||||
REFERENCE_SOURCES_FLAGS += -d:FEATURE_MACL
|
||||
endif
|
||||
|
||||
ifndef MOBILE_STATIC
|
||||
REFERENCE_SOURCES_FLAGS += -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY
|
||||
endif
|
||||
@@ -60,10 +64,38 @@ WARNING_ABOUT_DISABLED_WARNING=1635
|
||||
LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
|
||||
DEFAULT_REFERENCES =
|
||||
|
||||
TEST_LIB_REFS = System.Core System
|
||||
|
||||
ifndef MOBILE_STATIC
|
||||
TEST_LIB_REFS += Mono.Posix
|
||||
endif
|
||||
|
||||
# System.IO/DirectoryInfoTest.cs needs Mono.Posix
|
||||
TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll -r:System.dll \
|
||||
TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \
|
||||
-define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%)
|
||||
|
||||
|
||||
CC_PROFILE := $(filter monotouch% xammac, $(PROFILE))
|
||||
ifdef CC_PROFILE
|
||||
|
||||
BUILT_SOURCES = \
|
||||
CommonCrypto/MD5CryptoServiceProvider.g.cs \
|
||||
CommonCrypto/SHA256Managed.g.cs \
|
||||
CommonCrypto/RC2CryptoServiceProvider.g.cs \
|
||||
CommonCrypto/SHA384Managed.g.cs \
|
||||
CommonCrypto/DESCryptoServiceProvider.g.cs \
|
||||
CommonCrypto/SHA1CryptoServiceProvider.g.cs \
|
||||
CommonCrypto/SHA512Managed.g.cs \
|
||||
CommonCrypto/MD2Managed.g.cs \
|
||||
CommonCrypto/SHA1Managed.g.cs \
|
||||
CommonCrypto/TripleDESCryptoServiceProvider.g.cs \
|
||||
CommonCrypto/MD4Managed.g.cs
|
||||
|
||||
CommonCrypto/%.g.cs:
|
||||
$(MAKE) -C CommonCrypto
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
Test/resources/MyResources.resources \
|
||||
Test/resources/MyResources.de.resources \
|
||||
@@ -89,39 +121,6 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
|
||||
|
||||
include $(topdir)/build/library.make
|
||||
|
||||
ifdef FIXME_CORLIB_CMP
|
||||
# corlib_cmp
|
||||
corlib_flags = -unsafe -nostdlib
|
||||
cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
|
||||
cmppdb = $(cmplib:.dll=.pdb)
|
||||
cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
|
||||
cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
|
||||
cmp_flags = -r:$(PLATFORM_CORLIB) $(corlib_flags)
|
||||
|
||||
EXTRA_DISTFILES += corlib_cmp.dll.excludes
|
||||
CLEAN_FILES += $(cmplib) $(cmp_response) $(cmp_makefrag) $(cmppdb)
|
||||
|
||||
$(cmplib): $(cmp_makefrag) $(cmp_response)
|
||||
$(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) -target:library -out:$@ @$(cmp_response)
|
||||
|
||||
$(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
|
||||
@echo Creating $@ ...
|
||||
@sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
|
||||
|
||||
$(cmp_makefrag): $(cmp_response)
|
||||
@echo Creating $@ ...
|
||||
@sed 's,^,$(cmplib): ,' $< >$@
|
||||
|
||||
# Since we make corlib_cmp on demand, there isn't a real need
|
||||
# to have full dep tracking for it. Also, the generation of this
|
||||
# file is busted on Win32 ('sort' seems to mess up line endings),
|
||||
# leading to a broken build.
|
||||
#
|
||||
# -include $(cmp_makefrag)
|
||||
|
||||
$(cmp_response) $(cmp_makefrag): Makefile $(depsdir)/.stamp
|
||||
endif
|
||||
|
||||
$(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE): %.resources: %.resx
|
||||
$(RESGEN) $< || cp $@.prebuilt $@
|
||||
|
||||
@@ -134,11 +133,11 @@ $(test_lib): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2)
|
||||
|
||||
$(satellite_assembly1): Test/resources/culture-es-ES.cs Test/resources/Resources.es-ES.resources
|
||||
@mkdir -p es-ES
|
||||
$(CSCOMPILE) -target:library -r:$(corlib) Test/resources/culture-es-ES.cs -resource:Test/resources/Resources.es-ES.resources -out:$@
|
||||
$(CSCOMPILE) -target:library -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll Test/resources/culture-es-ES.cs -resource:Test/resources/Resources.es-ES.resources -out:$@
|
||||
|
||||
$(satellite_assembly2): Test/resources/culture-nn-NO.cs Test/resources/Resources.nn-NO.resources
|
||||
@mkdir -p nn-NO
|
||||
$(CSCOMPILE) -target:library -r:$(corlib) Test/resources/culture-nn-NO.cs -resource:Test/resources/Resources.nn-NO.resources -out:$@
|
||||
$(CSCOMPILE) -target:library -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll Test/resources/culture-nn-NO.cs -resource:Test/resources/Resources.nn-NO.resources -out:$@
|
||||
|
||||
vtsdir = Test/System.Runtime.Serialization.Formatters.Binary/VersionTolerantSerialization
|
||||
vtslibs = \
|
||||
@@ -153,11 +152,13 @@ test-vts: $(vtslibs) $(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersion
|
||||
|
||||
$(vtsdir)/$(PROFILE)_TestLib/%/Address.dll: $(vtsdir)/VersionTolerantSerializationTestLib/%/Address.cs
|
||||
@mkdir -p $(dir $@)
|
||||
$(CSCOMPILE) -target:library -r:$(corlib) -warn:0 -out:$@ $^
|
||||
$(CSCOMPILE) -target:library -warn:0 -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -out:$@ $^
|
||||
|
||||
$(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersions.exe: $(vtsdir)/BinarySerializationOverVersions.cs $(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll $(test_nunit_dep)
|
||||
$(CSCOMPILE) $(test_nunit_ref) -warn:0 -r:$(corlib) \
|
||||
$(CSCOMPILE) $(test_nunit_ref) -warn:0 \
|
||||
-r:$(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll \
|
||||
-r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll \
|
||||
-r:$(topdir)/class/lib/$(PROFILE)/System.dll \
|
||||
$(vtsdir)/BinarySerializationOverVersions.cs -out:$@
|
||||
@cp $(vtsdir)/$(PROFILE)_TestLib/1.0/Address.dll $(vtsdir)/$(PROFILE)_TestLib
|
||||
|
||||
@@ -166,11 +167,19 @@ TEST_MONO_PATH=$(PWD)/../lib/$(PROFILE)
|
||||
|
||||
run-test-vts: test-vts
|
||||
@echo Running vts tests...
|
||||
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) -noshadow \
|
||||
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(NOSHADOW_FLAG) \
|
||||
$(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersions.exe
|
||||
ifndef NO_TEST
|
||||
|
||||
ifdef NO_TEST
|
||||
NO_VTS_TEST = yes
|
||||
endif
|
||||
|
||||
ifndef NO_VTS_TEST
|
||||
test: test-vts
|
||||
run-test: run-test-vts
|
||||
else
|
||||
test:
|
||||
run-test:
|
||||
endif
|
||||
|
||||
EXTRA_DISTFILES += \
|
||||
@@ -192,8 +201,8 @@ TMP_FILE2=tzi2.tmp
|
||||
# Remove some code that is protected so we don't have to include all the corlib files.
|
||||
tzi.exe:System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/common/Consts.cs ../../build/common/Locale.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
trap "rm -f $(TMP_FILE1) $(TMP_FILE2)" EXIT INT QUIT TERM && \
|
||||
sed 's/Environment\.GetResourceString/string.Format/g' ../../../external/referencesource/mscorlib/system/timezoneinfo.cs > $(TMP_FILE1) && \
|
||||
sed 's/StringBuilder\.DefaultCapacity/100/g' ../../../external/referencesource/mscorlib/system/text/stringbuildercache.cs > $(TMP_FILE2) && \
|
||||
sed 's/Environment\.GetResourceString/string.Format/g' ../referencesource/mscorlib/system/timezoneinfo.cs > $(TMP_FILE1) && \
|
||||
sed 's/StringBuilder\.DefaultCapacity/100/g' ../referencesource/mscorlib/system/text/stringbuildercache.cs > $(TMP_FILE2) && \
|
||||
$(MCS) /debug+ /out:$@ -unsafe -nowarn:612,618 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS) "/d:SELF_TEST;NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;MOBILE;MOBILE_DYNAMIC;MONODROID;ANDROID" $^ $(TMP_FILE1) $(TMP_FILE2)
|
||||
|
||||
android-pull-tzdb:
|
||||
|
||||
@@ -1,368 +0,0 @@
|
||||
2010-07-25 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* UnixRegistryApi.cs: From the static ctor of KeyHandler remove the
|
||||
volatile keys directory if the last registered boot time has changed.
|
||||
This way we *actually* have our volatile keys removed if the system as
|
||||
rebooted.
|
||||
|
||||
2010-07-19 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* UnixRegistryApi.cs: Remove the in-memmory approach to volatile keys,
|
||||
as it becomes trickier to handle deep hiearchies, subkeys and values
|
||||
in some scenarios. So for now we keep them in disk, we in an
|
||||
alternative directory, so we can cleam them properly later.
|
||||
|
||||
2010-07-13 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* RegistryKey.cs: Call the proper UnixRegistryApi.CreateSubKey overload.
|
||||
* UnixRegistryApi.cs: Implement basic support for volatile keys, by
|
||||
storing them in memory instead of disk. We lack the support to have
|
||||
them available to other processes - and given the fact that a
|
||||
workaround would be gross, just don't implement that now.
|
||||
|
||||
2010-07-11 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* RegistryKey.cs: Add 4.0 CreateSubKey overloads taking a RegistryOptions
|
||||
parameter.
|
||||
* IRegistryApi.cs: Add a new overload for CreateSubKey for the 4.0
|
||||
profile. Not nice, but better than to change the signature for each
|
||||
profile.
|
||||
* Win32RegistryApi.cs: Properly recognize a handle where a volatile
|
||||
key is requested.
|
||||
* UnixRegistryApi.cs: Stubbed.
|
||||
|
||||
2010-07-09 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* Win32RegistryApi.cs: Use RegCreateKeyEx instead of RegCreateKey, as
|
||||
we need it to further support both the missing bits and the 4.0
|
||||
features.
|
||||
|
||||
2010-02-08 Carlos Alberto Cortez <calberto.cortez@gmail.com>
|
||||
|
||||
* UnixRegistryApi.cs: When retrieving the registry keys from file in a
|
||||
unix system, if the value returned by a SecurityElement is null,
|
||||
use String.Empty, since at this point we know that this registry key
|
||||
*exists* and *cannot* have a null value, as specified in the public
|
||||
api.
|
||||
Fixes #543206.
|
||||
|
||||
2009-11-21 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* RegistryKey.cs: Implement a GetValueKind and a handful of
|
||||
methods.
|
||||
|
||||
2009-04-25 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* *.cs: Exclude the files for the NET_2_1 profile, since they are
|
||||
unneeded and adds a bunch (23) [SecuritySafeCritical] to audit for
|
||||
Moonlight
|
||||
|
||||
2008-02-25 Robert Jordan <robertj@gmx.net>
|
||||
|
||||
* Win32RegistryApi.cs (ToString): Don't emit the handle value
|
||||
under NET_2_0.
|
||||
See http://msdn2.microsoft.com/en-us/netframework/aa497241.aspx.
|
||||
|
||||
2008-02-01 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* RegistryKey.cs: Added missing checks on length of subkey and value
|
||||
names. On 2.0 profile, allow subkey <= 255 characters. Modified
|
||||
ArgumentNullException argument names to match MS.
|
||||
* UnixRegistryApi.cs: In SetValue (string, object, RegistryValueKind),
|
||||
use a zero-length string for name if it is null. In OpenSubKey,
|
||||
respect value of writable argument when creating well-known subkey.
|
||||
Fixes bug #357883. Removed argument names for ArgumentException's to
|
||||
match MS.
|
||||
|
||||
2008-01-15 Zoltan Varga <vargaz@gmail.com>
|
||||
|
||||
* RegistryKey.cs: Fix some argument names to be consistent with MS.
|
||||
|
||||
2007-10-13 kevin.fitzgerald@soarce.us
|
||||
|
||||
* UnixRegistryApi.cs: Escape the strings before passing them to
|
||||
SecurityElement. This fixes bug #322839
|
||||
|
||||
2007-08-30 Marek Habersack <mhabersack@novell.com>
|
||||
|
||||
* UnixRegistryApi.cs: properly retrieve values of type
|
||||
'bytearray'.
|
||||
|
||||
2007-08-13 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* RegistryKeyPermissionCheck.cs: Do not include in 1.0 profile.
|
||||
Removed extra using directive and empty lines.
|
||||
|
||||
2007-05-01 Dick Porter <dick@ximian.com>
|
||||
|
||||
* RegistryKeyPermissionCheck.cs: Not serializable
|
||||
|
||||
2007-04-30 Dick Porter <dick@ximian.com>
|
||||
|
||||
* Registry.cs:
|
||||
* RegistryHive.cs:
|
||||
* RegistryKey.cs:
|
||||
* RegistryValueKind.cs:
|
||||
* RegistryKeyPermissionCheck.cs: Updated for 2.0 profile
|
||||
|
||||
2006-10-29 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* UnixRegistryApi.cs (KeyHandler.MachineStore): Add support for
|
||||
loading/storing values from the system registry, instead of having
|
||||
the system ones be user-based.
|
||||
|
||||
(KeyHandler, Load): turn IO exceptions into Security exceptions.
|
||||
|
||||
2006-09-03 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* IRegistryApi.cs: Added OpenRemoteBaseKey method.
|
||||
* Win32ResultCode.cs: Added code for win32 error 53.
|
||||
* RegistryKey.cs: Implemented support for OpenRemoteBaseKEy on
|
||||
Windows. To achieve this, the handle of the remote hive must be
|
||||
stored separately from the RegistryHive value. Removed isRoot field, as
|
||||
we now determine whether we're a root key (hive) by checking if hive
|
||||
is not null. Added internal ctor for registry hives that takes a
|
||||
RegistryHive, a key handle and a bool to indicate whether its a remote
|
||||
hive. Renamed Data field to handle and added internal property to
|
||||
access it. Throw ObjectDisposedException in ToString if key is
|
||||
closed/disposed. Added Hive property, which is used in UnixRegistryApi.
|
||||
Added GetHiveName method which translates a RegistryHive value to its
|
||||
(key) name.
|
||||
* Win32RegistryApi.cs: Added pinvoke for RegConnectRegistry. GetHandle
|
||||
no longer needs to know whether the key refers to a hive (base key)
|
||||
or not. Implemented OpenRemoteBaseKey.
|
||||
* UnixRegistryApi.cs: Added OpenRemoteBaseKey implementation which
|
||||
always throws NotImplementedException.
|
||||
* Registry.cs: The key name of the base key no longer needs to be
|
||||
passed to the ctor, as it's looked up in the ctor itself. This avoids
|
||||
having a different logical for local or remote base keys.
|
||||
|
||||
2006-08-23 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* Win32RegistryApi.cs: Use a StringBuilder instead of byte [] for
|
||||
RegEnumKey. Fixed issue in GetSubKeyNames where buffer was not cleared
|
||||
while iterating over subkeys.
|
||||
|
||||
2006-08-20 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* RegistryValueOptions.cs: Add the real one.
|
||||
|
||||
2006-08-20 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* RegistryValueOptions.cs : build fix, easier than reverting all.
|
||||
|
||||
2006-08-20 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* IRegistryApi.cs: Modified GetValue to take RegistryValueOptions enum
|
||||
and removed obsolete return_default_value argument.
|
||||
* RegistryKey.cs: Added missing ComVisible attribute on SetValue.
|
||||
Use new GetValue method on IRegistryApi that takes RegistryValueOptions
|
||||
enum. Added GetValue overload that takes RegistryValueOptions (2.0).
|
||||
* Win32RegistryApi.cs: Modified GetValue to take RegistryValueOptions
|
||||
enum, and removed obsolete returnDefaultValue argument. Added support
|
||||
for ExpandString value type. Do no expand if DoNotExpand... is set.
|
||||
* UnixRegistryApi.cs: Modified KeyHandler.GetValue to take
|
||||
RegistryValueOptions enum, and do no expand environment variables in
|
||||
an ExpandString if DoNotExpandEnvironmentNames is set. Modified
|
||||
UnixRegistryApi.GetValue to take RegistryValueOptions enum, and
|
||||
removed obsolete return_default_value argument.
|
||||
|
||||
2006-08-14 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* UnixRegistryApi.cs: Undo change for new eventlog implementation that
|
||||
was not rolled back earlier this week, and which does not make sense
|
||||
without that implementation anyway.
|
||||
|
||||
2006-08-14 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* Win32ResultCode.cs: Added error code for attempting to perform an
|
||||
operation on registry key that is marked for deletion.
|
||||
* RegistryKey.cs: Keep writable state. Automatically flush changes to
|
||||
disk when closing key (to match MS). Allow values to be set on root
|
||||
keys. Throw UnauthorizedAccessException when attempting to set/delete
|
||||
value or create/delete sub key on registry key that is openen
|
||||
read-only. Fixed DecodeString to only strip trailing nullchars (as
|
||||
documented).
|
||||
* Win32RegistryApi.cs: For a key that is marked for deletion, return
|
||||
null when attempting to get a value of that key (and no default value
|
||||
was specified) or open a subkey. Throw an IOException when attempting
|
||||
to perform the following operation on a key that is marked for
|
||||
deletion:
|
||||
1) set value on key
|
||||
2) obtain SubKeyCount
|
||||
3) obtain ValueCount
|
||||
4) create a sub key
|
||||
5) obtain value names
|
||||
and ignore deleting a value. Ignore flushing changes of a key and
|
||||
closing a when the key is closed.
|
||||
* UnixRegistryApi.cs: Maintain handler cache per directory instead of
|
||||
caching registry keys. This allows both a single key to be in memory
|
||||
in both read-only and read-write key configuration, while sharing the
|
||||
KeyHandler. Use case-insensitive hashtable for mapping directory to
|
||||
KeyHandler. Added support for keys that have been marked for deletion
|
||||
by another operation (eg. DeleteSubKeyTree). Allow different file store
|
||||
for machine-level and user-level hives (but have them use the same
|
||||
file store, needs further discussion). Allow KeyHandler failure when
|
||||
create directory, or saving values file to bubble up. Do not save
|
||||
values file when key is marked for deletion. Encapsulate access to
|
||||
values collection. When setting value with null name, use zero-length
|
||||
name instead. Treat key name case-insensitive in DeleteKey to match
|
||||
OpenSubKey.
|
||||
|
||||
2006-08-14 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* RegistryValueKind.cs: Make this public in 2.0, and rename from
|
||||
previous version.
|
||||
|
||||
* Win32RegistryApi.cs: Include version to check for version;
|
||||
Eliminate old internal enum, and instead use the new 2.0 enum.
|
||||
|
||||
* UnixRegistryApi.cs: Add support for typed versions of values.
|
||||
|
||||
Add support for ExpandString.
|
||||
|
||||
* Registry.cs (SetValue): implement version with type arguments.
|
||||
|
||||
2006-08-13 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* Registry.cs (SetValue, GetValue): implement.
|
||||
|
||||
* UnixRegistryApi.cs (KeyHandler.LoadKey, KeyHandler.Save): Add
|
||||
support for qwords.
|
||||
|
||||
(KeyHandler.Save): Do not save the entries if they have been
|
||||
deleted/dropped. Fixes a crash.
|
||||
|
||||
(UnixRegistryApi.DeleteKey): bug fix, call ToUnix on the keyname.
|
||||
|
||||
2006-08-12 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* Registry.cs: Fixed copy/paste bug.
|
||||
|
||||
2006-08-11 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* UnixRegistryApi.cs: Consider HKLM\SYSTEM\CurrentControlSet\Services\
|
||||
EventLog a wellknown key. Required for new EventLog implementation.
|
||||
Added RegistryStore property.
|
||||
|
||||
2006-06-06 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* UnixRegistryApi.cs: Do not crash if there are no values stored.
|
||||
|
||||
2006-05-28 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* UnixRegistryApi.cs: GetSubKeyNames returns only names of subkeys,
|
||||
not the qualified name. Fixes bug #78519.
|
||||
|
||||
2006-04-20 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* UnixRegistryApi.cs: In KeyHandler.SetValue, immediately convert
|
||||
instances of non-native registry types (meaning int, string, string[]
|
||||
or byte[]) to string. This avoids returning an instance of a non-native
|
||||
registry type in calls to UnixRegistryApi.GetValue. Allow instances of
|
||||
non-native registry types in UnixRegistryApi.SetValue. Fixes bug #78132.
|
||||
|
||||
2006-04-18 Gert Driesen <drieseng@users.sourceforge.net>
|
||||
|
||||
* UnixRegistryApi.cs: Only consider the "software" subkey a well-known
|
||||
key if the parent is either HKEY_USERS or HKEY_LOCAL_MACHINE.
|
||||
|
||||
2006-04-15 Robert Jordan <robertj@gmx.net>
|
||||
|
||||
* UnixRegistryApi.cs (DeleteValue): Avoid crash, fixes bug
|
||||
#77772. Patch reapplied, since r57881 was not applied correctly.
|
||||
|
||||
2006-04-13 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||
|
||||
* UnixRegistryApi.cs: create well-known keys when trying to open them.
|
||||
|
||||
2006-03-12 Robert Jordan <robertj@gmx.net>
|
||||
|
||||
* UnixRegistryApi.cs (DeleteValue): Avoid crash, fixes bug
|
||||
#77772
|
||||
|
||||
2006-01-14 Robert Jordan <robertj@gmx.net>
|
||||
|
||||
* RegistryKey.cs: Added internal IsRoot accessor.
|
||||
* Win32RegistryApi.cs: Fixed access to RegistryKey.Data.
|
||||
Fixes bug #77212. Thanks to Don Edvalson (don@edvalson.net)
|
||||
for spotting this out.
|
||||
|
||||
2005-12-02 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* Win32RegistryApi.cs : fixed invalid cast. Now mono is not to blame
|
||||
for not being able to run NAnt on Windows.
|
||||
|
||||
2005-11-12 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* RegistryKey.cs: Add support for a Registry on Unix based on
|
||||
files under ~/.mono/registry.
|
||||
|
||||
Vastly refactored the code, reworked the interface between the
|
||||
frontend and the backends.
|
||||
|
||||
If "RegistryKey" was not sealed, things could have been a lot
|
||||
cleaner.
|
||||
|
||||
2005-01-31 mei (mei@work.email.ne.jp)
|
||||
|
||||
* RegistryKey.cs: Fixes bug 70451: When the key doesn't exist, and
|
||||
the default value is not specified, it is necessary to return
|
||||
null. and DecodeString function's bug is fixed.
|
||||
|
||||
2004-04-10 Gert Driesen (driesen@users.sourceforge.net)
|
||||
|
||||
* RegistryKey.cs: explicit implementation of IDisposable to match
|
||||
MS corlib
|
||||
|
||||
2004-03-17 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* Win32RegistryApi.cs: Fix typo. Patch by Gert Driesen.
|
||||
|
||||
2004-03-03 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* Win32RegistryApi.cs: Specify entry points.
|
||||
|
||||
2004-03-03 Jackson Harper <jackson@ximian.com>
|
||||
|
||||
* Win32RegistryApi.cs: New file - pinvokes to the win32
|
||||
registry. Patch by Erik LeBel.
|
||||
* IRegistryApi.cs: New file - Interface to a registry backend
|
||||
(win32 on windows, no implementation on unix). This interface will
|
||||
probably change when we write a Linux backend.
|
||||
* Win32ResultCode.cs: New file - Win32 result codes needed to
|
||||
check pinvoke. Patch by Erik LeBel.
|
||||
* Registry.cs: Create the keys. Patch by Erik LeBel.
|
||||
* RegistryKey.cs: Implement. Patch by Erik LeBel.
|
||||
|
||||
2003-12-27 Nick Drochak <ndrochak@gol.com>
|
||||
|
||||
* RegistryKey.cs: Add some missing overloads.
|
||||
|
||||
2003-02-10 Nick Drochak <ndrochak@gol.com>
|
||||
|
||||
* Registry.cs: Class should be sealed and have a private default ctor.
|
||||
|
||||
2002-11-28 Alejandro Sánchez Acosta <raciel@es.gnu.org>
|
||||
|
||||
* Registry.cs: Added missed field.
|
||||
|
||||
2002-11-28 Gonzalo Paniagua Javier <gonzalo@ximian.com>
|
||||
|
||||
* RegistryHive.cs: patch from Jackson Harper that fixes compilation.
|
||||
|
||||
2002-11-27 DennisHayes <dennish@raytek.com>
|
||||
|
||||
* checkin for Alexandre Pigolkine (pigolkine@gmx.de) with minor changes
|
||||
* needed for System.Windows.Forms
|
||||
|
||||
* RegistryHive.cs
|
||||
* Registry.cs
|
||||
* added files, fully implmented?
|
||||
|
||||
* RegistryKey.cs
|
||||
* added more iplmentation
|
||||
|
||||
2002-11-20 Nick Drochak <ndrochak@gol.com>
|
||||
|
||||
* RegistryKey.cs: Fix typo.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -505,7 +505,8 @@ Console.WriteLine (" -> '{0}'", c.Replacement);
|
||||
|
||||
static bool IsIgnorable (int i, COpt opt)
|
||||
{
|
||||
return Uni.IsIgnorable (i, (byte) (1 +
|
||||
return Uni.IsIgnorable (i, (byte)
|
||||
(((opt & (COpt.Ordinal | COpt.OrdinalIgnoreCase)) == 0 ? 1 : 0) +
|
||||
((opt & COpt.IgnoreSymbols) != 0 ? 2 : 0) +
|
||||
((opt & COpt.IgnoreNonSpace) != 0 ? 4 : 0)));
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
2010-01-19 Tom Hindle <tom_hindle@sil.org>
|
||||
|
||||
* ComInteropProxy.cs: Don't add proxy if it has already been added.
|
||||
Instread increment ref_count. Fixes bug #572043.
|
||||
|
||||
2009-07-11 Robert Jordan <robertj@gmx.net>
|
||||
|
||||
* ComInteropProxy.cs: Implement CreateProxy. Hide public/internal
|
||||
ctors forcing CreateProxy's usage. Hide CacheProxy since the
|
||||
runtime is able to lookup it anyways.
|
||||
Fixes bug #520437.
|
||||
|
||||
2007-07-26 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Call Marshal.Release after Marshal.QI
|
||||
since it AddRef's the object. Fixes COM leak. Also fix eol-style.
|
||||
|
||||
2007-05-25 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Call __ComObject.GetInterface overload
|
||||
that does not throw exception. Fixes as and is operators for COM objects.
|
||||
|
||||
2007-02-08 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Moved some code to unmanaged and cleanup some things.
|
||||
|
||||
2006-10-18 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* IUnknown.cs: Added.
|
||||
* IDispatch.cs: Added.
|
||||
|
||||
2006-08-10 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Fix default constructor being always
|
||||
being called.
|
||||
|
||||
2006-07-28 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Added support for marshalling objects.
|
||||
|
||||
2006-07-15 Jonathan Chambers <joncham@gmail.com>
|
||||
|
||||
* ComInteropProxy.cs: Added.
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Mono.Interop
|
||||
{
|
||||
// called from unmanaged code after .ctor is invoked
|
||||
// we need .ctor to create unmanaged object and thus IUnknown property value
|
||||
if (FindProxy(com_object.IUnknown) == null)
|
||||
if (FindProxy (com_object.IUnknown) == null)
|
||||
AddProxy (com_object.IUnknown, this);
|
||||
else
|
||||
System.Threading.Interlocked.Increment (ref ref_count);
|
||||
@@ -82,7 +82,7 @@ namespace Mono.Interop
|
||||
internal ComInteropProxy (IntPtr pUnk, Type t)
|
||||
: base (t)
|
||||
{
|
||||
com_object = new __ComObject (pUnk);
|
||||
com_object = new __ComObject (pUnk, this);
|
||||
CacheProxy ();
|
||||
}
|
||||
|
||||
@@ -108,17 +108,20 @@ namespace Mono.Interop
|
||||
// already known, a cached proxy will be returned.
|
||||
internal static ComInteropProxy CreateProxy (Type t)
|
||||
{
|
||||
ComInteropProxy proxy = new ComInteropProxy (t);
|
||||
proxy.com_object.Initialize (t);
|
||||
|
||||
ComInteropProxy cachedProxy = FindProxy (proxy.com_object.IUnknown);
|
||||
IntPtr iunknown = __ComObject.CreateIUnknown (t);
|
||||
ComInteropProxy proxy;
|
||||
ComInteropProxy cachedProxy = FindProxy (iunknown);
|
||||
if (cachedProxy != null) {
|
||||
// check that the COM type of the cached proxy matches
|
||||
// the requested type. See 2nd part of bug #520437.
|
||||
Type cachedType = cachedProxy.com_object.GetType ();
|
||||
if (cachedType != t)
|
||||
throw new InvalidCastException (String.Format ("Unable to cast object of type '{0}' to type '{1}'.", cachedType, t));
|
||||
return cachedProxy;
|
||||
proxy = cachedProxy;
|
||||
Marshal.Release (iunknown);
|
||||
} else {
|
||||
proxy = new ComInteropProxy (t);
|
||||
proxy.com_object.Initialize (iunknown, proxy);
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
@@ -1,379 +0,0 @@
|
||||
2010-05-25 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* CryptoTools.cs: make types internal for INSIDE_SYSCORE as well.
|
||||
|
||||
2010-03-16 Jb Evain <jbevain@novell.com>
|
||||
|
||||
* CryptoTools.cs, PKCS1.cs, PKCS8.cs, SymmetricTransform.cs,
|
||||
KeyPairPersistence.cs: use MOONLIGHT symbol to disambiguate
|
||||
MonoTouch and Moonlight code.
|
||||
|
||||
2009-09-18 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS1.cs: Fix compiler warning for NET_2_1
|
||||
|
||||
2009-04-30 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs, PKCS8.cs: Adapt to work with only [DSA|RSA]
|
||||
Managed when built for NET_2_1, i.e. remove use of [DSA|RSA]
|
||||
CryptoServiceProvider
|
||||
* KeyPairPersistence.cs: Remove from NET_2_1
|
||||
|
||||
2009-04-29 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS1.cs: Make this work under NET_2_1 where SHA384 and SHA512
|
||||
are not available in the BCL.
|
||||
|
||||
2008-08-07 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Make this (more) usable with SL2 limited
|
||||
crypto support.
|
||||
|
||||
2008-08-05 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoTools.cs: Make this usable with Silverlight 2.0 (NET_2_1)
|
||||
|
||||
2008-04-21 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Fix HMAC to respect start index inside an array.
|
||||
Patch by Kazuki Oikawa.
|
||||
|
||||
2008-03-13 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Re-order exception handling to report the most
|
||||
precise error to caller. Apply RSA extra check to DSA.
|
||||
* RSAManaged.cs: Test imported parameters to ensure the public and
|
||||
private parts of the keypair match together.
|
||||
|
||||
2008-03-04 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fix ANSIX923 padding check (#366623) to be
|
||||
just like PKCS7 (but comparing to 0).
|
||||
|
||||
2008-02-03 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* DSAManaged.cs: Replace "" (found by Gendarme) with more useful text.
|
||||
* RSAManaged.cs: Replace "" (found by Gendarme) with more useful text.
|
||||
|
||||
2008-01-10 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS1.cs: Add a new method that optionally checks for badly
|
||||
padding, technically invalid, PKCS#1 block. This is required to
|
||||
support timestamping verification for Authenticode (since the
|
||||
main timestamping service does this). Fix for #350958
|
||||
|
||||
2007-11-18 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* RSAManaged.cs: Fix the rare case where the inverse of q modulo p
|
||||
can result in bigint one byte shorter than expected, which could
|
||||
mess up the export/import of the key.
|
||||
|
||||
2007-05-08 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Sync with Mono.Security version - mostly the patch
|
||||
from Randolph Chung to add DSA CAPI BLOB support.
|
||||
|
||||
2007-05-08 Randolph Chung <tausq@debian.org>
|
||||
|
||||
* DSAManaged.cs: Do not reject the input if only Y is null.
|
||||
Fixes #81558. [small edits from Sebastien]
|
||||
|
||||
2007-03-22 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Before 2.0 an IndexOutOfRangeException was
|
||||
thrown (for all unmanaged transforms) in case of an overflow.
|
||||
|
||||
2007-03-05 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fix KeepLastBlock to be true for decryption
|
||||
with no padding or zero padding. Part of the fix for #81008.
|
||||
|
||||
2007-01-08 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fix #80439 again. This time we have tests for
|
||||
all ciphers, modes and padding.
|
||||
|
||||
2007-01-04 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fix previous fix (for #80439) as we were now
|
||||
too permissive.
|
||||
|
||||
2007-01-03 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Reduce inputCount if larger than the output
|
||||
data can hold. Fix bug #80439.
|
||||
|
||||
2006-12-11 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS8.cs: Synchronize source with Mono.Security.dll
|
||||
|
||||
2006-09-27 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* RSAManaged.cs: Ensure that the results of Encrypt and Decrypt will
|
||||
always be the same length as the key. If smaller then we left pad the
|
||||
result with 0x00 (same integer, correct length for everyone). Fix bug
|
||||
#79502 where an LDAP/SSL server didn't like the missing byte.
|
||||
|
||||
2006-09-05 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* RSAManaged.cs: Fix a NRE when decrypting without a private key
|
||||
(#79269). We now throw a CryptographicException with an appropriate
|
||||
text message.
|
||||
|
||||
2006-06-15 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoTools.cs: Fix offset in block processor. This fix the HMAC
|
||||
algorithms when large buffer where used (with multiple calls to
|
||||
TransformBlock).
|
||||
|
||||
2005-11-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Virtualized some methods (like Dispose). Fix
|
||||
bug #76801.
|
||||
|
||||
2005-11-22 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* DSAManaged.cs: Don't export J if it wasn't imported (i.e. it was
|
||||
calculated from the other parameters).
|
||||
|
||||
2005-10-21 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Clone IV so it cannot be changed once the
|
||||
transform starts. Generate a new IV if null is specified (not really
|
||||
useful but compatible with MS behaviour). Added a check for IV length
|
||||
on 2.0.
|
||||
|
||||
2005-05-26 Ben Maurer <bmaurer@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: Lock *before* checking if things are null
|
||||
to prevent race conditions. Also, do not lock on typeof object.
|
||||
|
||||
2005-05-09 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: Use PlatformID.Unix under NET_2_0.
|
||||
|
||||
2005-04-27 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS8.cs: New. Copied from Mono.Security.dll to allow support of
|
||||
PKCS#12 files in X509Certificate for 2.0.
|
||||
|
||||
2005-04-18 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fixed a division by zero if someone changes
|
||||
the feedback value to 0.
|
||||
|
||||
2005-03-30 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fixed a padding bug affecting that can occurs
|
||||
when no padding is used.
|
||||
|
||||
2005-01-11 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* DSAManaged.cs: PublicOnly now reports false when a key hasn't yet
|
||||
been generated.
|
||||
* RSAManaged.cs: PublicOnly now reports false when a key hasn't yet
|
||||
been generated.
|
||||
|
||||
2005-01-10 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* MACAlgorithm.cs: Added support for different padding modes (required
|
||||
in 2.0).
|
||||
* SymmetricTransform.cs: Added support for ANSI X9.23 padding and
|
||||
ISO 10126 padding modes (applies to all symmetric block ciphers).
|
||||
|
||||
2004-12-22 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: Commented imperative asserts until it is
|
||||
supported by the runtime.
|
||||
|
||||
2004-12-06 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* RSAManaged.cs: Implement key blinding for RSA decryption with, or
|
||||
without, using CRT.
|
||||
|
||||
2004-11-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* PKCS1.cs: Fix PKCS#1 v1.5 decryption when the ciphertext isn't
|
||||
exactly the same of the public key (which happens sometimes on Fx 1.1
|
||||
probably because it doesn't do the last I2OSP operation to left pad
|
||||
the resulting big integer with zeros).
|
||||
|
||||
2004-10-28 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: Added localization for exceptions messages.
|
||||
Also added more details (type and path) when an exception is thrown.
|
||||
|
||||
2004-09-29 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* RSAManaged.cs: KeySize is always a multiple of 8 bits (promotion to
|
||||
a bigger size if required) to match MS implementation (and other
|
||||
issues like SSL).
|
||||
|
||||
2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Fixed warning (l4) for unused variables.
|
||||
* KeyPairPersistence.cs: Fixed warning (l4) for unused variable.
|
||||
* PKCS1.cs: Added empty {} to fix warning about possible empty stmnt.
|
||||
|
||||
2004-07-07 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* MACAlgorithm.cs: Removed the hardcoded PaddingMode.Zeros as this is
|
||||
now selectable in Fx 2.0.
|
||||
* SymmetricTransform.cs: Throw CryptographicException when CipherMode
|
||||
CTS or OFB is being used (to match MS implementation).
|
||||
|
||||
2004-06-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Reduce by one the number of block when
|
||||
decrypting. This operation was in CryptoStream before but is only
|
||||
required for decryption (which CryptoStream can't know).
|
||||
Fix bug #60573.
|
||||
|
||||
2004-05-27 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* SymmetricTransform.cs: Fixed possible integer overflow. Added
|
||||
missing exception handling in TransformBlock and TransformFinalBlock.
|
||||
|
||||
2004-05-01 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Synched with Mono.Security.dll. Fix bug #57941
|
||||
(truncated key pair).
|
||||
* RSAManaged.cs: Synched with Mono.Security.dll. Fix bug #57941
|
||||
(truncated key pair).
|
||||
|
||||
2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: In sync with Mono.Security.dll version.
|
||||
* CryptoTools.cs: In sync with Mono.Security.dll version.
|
||||
* DSAManaged.cs: Changed delegate to please FxCop.
|
||||
* PKCS1.cs: In sync with Mono.Security.dll version.
|
||||
* RSAManaged.cs: In sync with Mono.Security.dll version.
|
||||
* SymmetricTransform.cs: Fixed a bug when offset > 0 in destination
|
||||
buffer. Changed Array.Copy to Buffer.BlockCopy.
|
||||
|
||||
2004-04-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: Completed key pair protection for both
|
||||
Linux and Windows (protection done by runtime).
|
||||
|
||||
2004-04-08 Bernie Solomon <bernard@ugsolutions.com>
|
||||
|
||||
* PKCS1.cs: Use BitConverterLE
|
||||
|
||||
2004-04-06 Bernie Solomon <bernard@ugsolutions.com>
|
||||
|
||||
* CryptoConvert.cs: Add private methods to always
|
||||
handle data as little endian (GetBytesLE, ToInt32LE, ToUInt32LE).
|
||||
|
||||
2004-03-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Added support for public keys preceded by an
|
||||
header like the one generated by "sn -e".
|
||||
|
||||
2004-03-23 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Added exception for null and bad parameters.
|
||||
* RSAManaged.cs: CryptographicException thrown when trying to export
|
||||
the private key when only the public key is present (CRT aware).
|
||||
|
||||
2004-03-22 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* CryptoConvert.cs: Added new methods to convert [From|To]Hex. Added
|
||||
new version of FromCapiPublicKeyBlob with an integer offset.
|
||||
|
||||
2004-02-06 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* DSAManaged.cs: Added an event after key generation (so that
|
||||
DSACryptoServiceProvider can persist the keypair if required). Added
|
||||
PublicOnly property (like 1.2) so we do not have to catch an exception
|
||||
to know if a private key is present or not. Added a Random property so
|
||||
we do not always have to create a RNG instance (not always required).
|
||||
* RSAManaged.cs: Added an event after key generation (so that
|
||||
DSACryptoServiceProvider can persist the keypair if required). Added
|
||||
PublicOnly property (like 1.2) so we do not have to catch an exception
|
||||
to know if a private key is present or not.
|
||||
* SymmetricTransform.cs: This class was split from S.S.C.
|
||||
SymmetricAlgorithm.cs so it could be reused in Mono.Security
|
||||
assembly for other symmetric algorithms transforms.
|
||||
|
||||
2004-02-05 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* KeyPairPersistence.cs: New. Class to persist keypairs in an XML
|
||||
format to mimic the CryptoAPI key containers.
|
||||
|
||||
2004-01-12 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* CryptoConvert.cs: RSA doesn't start with a Q - at least that what
|
||||
a strongname told me. Sorry Ron :(
|
||||
|
||||
2003-12-15 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* MACAlgorithm.cs: Fixed difference between 1.0 and 1.1 framework.
|
||||
The 1.0 framework is adding an additional padding block (empty)
|
||||
to MAC when MACing an exact multiple of the TripleDES block size.
|
||||
* PKCS1.cs: Fixed a typo which prevented "lame" (without OID)
|
||||
signature verification.
|
||||
|
||||
2003-10-30 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* CryptoConvert.cs: Fixed strongname generation for small exponents
|
||||
(like 17). Part of the fixed for bug #50341.
|
||||
|
||||
2003-10-17 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* CryptoConvert.cs: Added from Mono.Security to support StrongNames.
|
||||
|
||||
2003-07-05 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* DSAManaged.cs: Fixed bugs that appeared with the new unit tests.
|
||||
* RSAManaged.cs: Fixed bugs that appeared with the new unit tests.
|
||||
|
||||
2003-07-02 Zoltan Varga <vargaz@freemail.hu>
|
||||
|
||||
* PKCS1.cs DSAManaged.cs: Changed strange characters in comments to
|
||||
human-readable ones, since they break XML export in monocov.
|
||||
|
||||
2003-06-15 Sebastien Pouliot <spouliot@motus.com>
|
||||
|
||||
* RSAManaged.cs: Now includes CRT (Chinese Remainder Theorem)
|
||||
optimization when using the private key (DecryptValue). This
|
||||
cut more than 5 seconds of nunit on my system (out of 14 sec
|
||||
for complete asymmetric tests). Thanks to Ben Maurer for help!
|
||||
|
||||
2003-06-11 Sebastien Pouliot <spouliot@motus.com>
|
||||
|
||||
* DSAManaged.cs: Refactored from DSACryptoServiceProvider.cs. Cannot
|
||||
be reused outside [ms]corlib because DSA constructor is internal :-(
|
||||
|
||||
* PKCS1.cs: Now support any hash algorithm when encoding PKCS 1.5
|
||||
(i.e. not limited to pre-calculated values for known hashes). Some
|
||||
other API changes to ease the use of other hash algorithms.
|
||||
|
||||
* RSAManaged.cs: Refactored from RSACryptoServiceProvider.cs. This
|
||||
class is required for custom PKCS#1 padding in SSL (which is not
|
||||
possible using RSACryptoServiceProvider).
|
||||
|
||||
2003-05-12 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* PKCS1.cs: Corrected I2OSP to match PKCS#1 v.2.1 test vector
|
||||
and fix the OAEP incompatibility issue.
|
||||
|
||||
2003-04-01 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* PKCS1.cs: Corrected fix (partially) for the lame PKCS1 v1.5
|
||||
signatures done without specifying an OID.
|
||||
|
||||
2003-03-01 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* PKCS1.cs: Fix for some (lame) PKCS1 v1.5 signatures done
|
||||
without specifying an OID.
|
||||
|
||||
2003-02-08 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* CryptoTools.cs: Renamed namespace to match new location.
|
||||
* PKCS1.cs: Renamed namespace to match new location.
|
||||
* HMACAlgorithm.cs: New. Generic class to implement HMAC
|
||||
using any hash algorithm (was in S.S.C.HMACSHA1.cs).
|
||||
* MACAlgorithm.cs: New. Generic class to implement MAC
|
||||
using any symmetric algorithm (was in S.S.C.MACTripleDES.cs).
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
2008-08-07 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* MiniParser.cs: Remove. It is not used anymore inside corlib
|
||||
|
||||
2005-11-07 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* SecurityParser.cs : SecurityElement receives raw XML strings for
|
||||
values.
|
||||
|
||||
2005-06-15 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* SmallXmlParser.cs, SecurityParser.cs : they can be CLSCompliant now.
|
||||
|
||||
2005-05-12 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* SmallXmlParser.cs,
|
||||
SecurityParser.cs : Use new SmallXmlParser.cs instead of MiniParser.
|
||||
|
||||
2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
|
||||
|
||||
* MiniParser.cs: Fixed warning (l4) for unused variables. Removed
|
||||
duplicate (and identical) license.
|
||||
|
||||
2004-05-14 Marek Safar <marek.safar@seznam.cz>
|
||||
|
||||
* MiniParser.cs, SecurityParser.cs: [CLSCompliant (false)]
|
||||
only for public mode.
|
||||
|
||||
2003-07-05 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* SecurityParser.cs: Parse an XML string and convert it to a
|
||||
SecurityElement object.
|
||||
|
||||
2003-02-08 Sebastien Pouliot <spouliot@videotron.ca>
|
||||
|
||||
* MiniParser.cs: Renamed namespace to match new location.
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
2010-06-17 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* DataConverter.cs: On bracketed cases, save the position as well,
|
||||
like we do in the repeat case without brackets. Fixes #595929
|
||||
|
||||
2010-03-07 Rodrigo Kumpera <rkumpera@novell.com>
|
||||
|
||||
* Runtime.cs: Document how NewObject() is meant to be used.
|
||||
|
||||
2010-03-04 Geoff Norton <gnorton@novell.com>
|
||||
|
||||
* Runtime.cs: Add a new private internal icall to construct
|
||||
an object from its type without running the ctor.
|
||||
|
||||
2008-11-17 Chris Howie <cdhowie@gmail.com>
|
||||
|
||||
* DataConverter.cs: Fix alignment for strings when the
|
||||
natural-alignment parameter is used '!'.
|
||||
|
||||
Disables CLS errors when not compiling with the CLS flag.
|
||||
|
||||
Fixes #445867
|
||||
|
||||
2008-03-12 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* DataConverter.cs: Fencepost bug fix from Kenneth D. Weinert
|
||||
<kenw@quarter-flash.com>
|
||||
|
||||
Fix from Kenneth as well to avoid getting stuck on a loop on
|
||||
repeat patterns (example: _6C!i!i), it would loop inside the '6'
|
||||
never continuing the decoding of the format string.
|
||||
|
||||
2008-02-10 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* DataConverter.cs: Apply fix from Cliff Brake
|
||||
<cliff.brake@gmail.com>, we were incrementing b.i in two places.
|
||||
|
||||
2007-05-30 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* DataConverter.cs: Fix the PutBytesLE and PutByteBE, they were
|
||||
overwriting memory that was out of range.
|
||||
|
||||
Fix based on patch from Luis Gomes.
|
||||
|
||||
A couple of fixes to compile with MS.NET 2.0 (from Luis as well).
|
||||
|
||||
2007-04-06 Miguel de Icaza <miguel@novell.com>
|
||||
|
||||
* a.cs: Test this stuff.
|
||||
|
||||
* DataConverter.cs: Implement Paolo's suggestion: provide a
|
||||
PutBytes interface that stores data into an existing byte array
|
||||
and make the GetBytes operations be wrappers around PutBytes.
|
||||
|
||||
2005-06-05 Kornél Pál <kornelpal@hotmail.com>
|
||||
|
||||
* Runtime.cs: Added GetDisplayName:
|
||||
Returns the name and version of the runtime for reporting.
|
||||
This method is intended for public use using reflection.
|
||||
|
||||
2004-05-22 Todd Berman <tberman@sevenl.net>
|
||||
|
||||
* Runtime.cs: Add this back, gnome# needs it. Mark everything internal.
|
||||
|
||||
2002-10-08 Miguel de Icaza <miguel@ximian.com>
|
||||
|
||||
* Runtime.cs: New file.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user