Commit Graph
313 Commits
Author SHA1 Message Date
Sebastien Pouliot 16dbea555d Revert "Missing Args checks."
This reverts commit 8b9c60075f.
2014-10-02 13:44:35 -04:00
Marc-Andre Ferland 8b9c60075f Missing Args checks. 2014-09-14 00:28:33 -04:00
Marc-Andre Ferland 6354f74888 Missing setting disposed to true 2014-09-14 00:27:25 -04:00
Marek Safar 8d282b527e [corlib] Fix typo 2014-06-26 17:20:29 +02:00
Jonathan Pryor bd130f3a2c [mscorlib] Support OID names in RSACryptoServiceProvider.SignData()
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13953

MSDN documents that RSACryptoServiceProvider.SignData()'s provider
paramter may contain an OID name:

http://msdn.microsoft.com/en-us/library/y2wf1b6k.aspx
> The halg parameter can accept a String, a HashAlgorithm, or a Type.
> The string value can be one of the following:
> * The object identifier (OID) friendly name of the hash algorithm to use,
>   either a name registered in the crypto config file or one in the
>   Crypto API OID table.
> * The OID value. The OID must be one recognized by the Crypto API.
> For example, you could use SignData(new byte[5], "1.3.14.3.2.26") or
> SignData(new byte[5], "sha1"), or SignData(new byte[5], "SHA1").

Add support for this OID names as the provider.
2013-08-13 12:09:56 -04:00
Sebastien Pouliot 8bb86180f6 [ios] Allow some level of configuration when CryptoConfig is used (as a last resort fallback) 2013-05-29 16:52:50 -04:00
Sebastien Pouliot 01c8c99e7b Refactor the [D|R]SACryptoServiceProvider constructors so it's possible for the linker to remove the dependency on the XML parser when CspParameters are not used (saves 42KB) 2013-05-24 10:31:41 -04:00
Sebastien Pouliot 5a00ed32ae Share a bit more code wrt OID/hash so X.509 CRL can use any of them (like the certificates) and make the code a little bit more linker friendly 2013-05-23 15:19:29 -04:00
Sebastien Pouliot b176adcc0e Do not bring (linking-wise) most of ToBase64Transform when Convert.ToBase64String is used 2013-05-17 11:10:13 -04:00
Sebastien Pouliot 4526c6c27b For HMAC avoid using the hash names to create instances (since it bring CryptoConfig) when under FULL_AOT_RUNTIME. Also simplify the 'legacy' support for 384/512 2013-05-15 16:37:27 -04:00
Sebastien Pouliot 473fbfd3e1 Do not require an exception to detect if SHA1 is used. 2013-05-15 16:32:19 -04:00
Sebastien Pouliot 240c354baa Avoid calling TripleDES.Create(string), which calls CryptoConfig, when possible (e.g. from the default .ctor) since it makes linked applications smaller 2013-05-15 16:32:18 -04:00
Rodrigo Kumpera b96d05dac3 Kill the MOONLIGHT define in corlib. 2013-02-11 16:03:28 -05:00
Sebastien Pouliot b26f53d9df Fix several, but not all, cases where CFB does not work with Rijndael and AES. ref: bug #9247 2013-01-06 20:08:03 -05:00
Sebastien Pouliot 1ef4fa1c1f Fix CFB for AesCryptoServiceProvider (only CFB8 worked, 16-64 did not) and move the different CFB implementation to Rijndael's transform (since it's the only implementation 'working' this way. 2013-01-06 20:08:02 -05:00
Sebastien Pouliot 5181eb820d SymmetricAlgorithm.FeedbackSize must be a multiple of 8 (bits) 2013-01-06 20:08:01 -05:00
Sebastien Pouliot 3a4876210d Get better linker results when doing full-aot wrt the cryptographic stack 2012-11-07 11:56:24 -05:00
Rodrigo Kumpera bbb7592661 Make the Crypto stack work with Full AOT.
* System.Security.Cryptography.*cs: To make Crypto work with
	Full AOT we remove the usage of providers and reflection. We hardcode
	the default algorithms for hashing, rng and symmetric cyphers.
2012-11-06 18:18:16 -05:00
Marek Safar 5fad3b0dce Remove some redundant initializations 2012-10-05 16:37:05 +01:00
Marek Safar c45375b4c8 Fix types signature 2012-07-27 12:25:43 +01:00
Marek Safar f1b0051d92 Add new 4.5 api 2012-06-07 11:38:53 +01:00
Miguel de Icaza 93b810834d [class libraries] drop ONLY_1_1 2012-06-02 21:31:50 -04:00
Miguel de Icaza ae0feab435 Removal of NET_1_1 defines and some NET_2_0; Both defines are true these days in Mono, no versions prior to 2.0 are supported 2012-06-01 18:04:24 -04:00
Sebastien Pouliot 003bbd80f3 Create a store when importing from a CspBlob so we can export it with the same KeyNumber (signature vs key exchange). Fix #5299 2012-05-30 14:32:07 -04:00
Sebastien Pouliot 859e29e694 Move RijndaelTransform code from RijndaelManaged.cs to RijndaelManagedTransform.cs to ease code reuse 2012-03-26 14:36:13 -04:00
Sebastien Pouliot 2b2c3495c3 Fix finalizer where a NRE can occur if the ctor fails to complete 2012-03-22 20:20:22 -04:00
Sebastien Pouliot ae5e52145f Implement new FX4 methods to add new algorithms/oids with code (not just machine.config). Fix bug to replace (not just add) algorithms/oids 2012-01-04 10:48:29 -05:00
Juho Vähä-Herttua 6fd492dcfb Fix HMACSHA384 and HMACSHA512 for key length of [65, 128] bytes. 2011-09-21 17:16:01 +03:00
Sebastien Pouliot 99909e0e61 Return null instead of catching Activator exception (and return null). What was a corner case before is now very common when the linker is used (e.g. monotouch, m4a). Reported in assistly #1741 2011-09-09 10:13:43 -04:00
Steven Robbins 8f2985b24c Fix for out of bounds exception 2011-07-07 12:11:14 +01:00
Sebastien Pouliot 940bdeca94 Match IDisposable with 4.0 changes in System.Security.Cryptography
* AsymmetricAlgorithm.cs:
* CryptoAPITransform.cs:
* DeriveBytes.cs:
* FromBase64Transform.cs:
* HashAlgorithm.cs:
* PasswordDeriveBytes.cs:
* Rfc2898DeriveBytes.cs:
* RijndaelManagedTransform.cs:
* SymmetricAlgorithm.cs:
* ToBase64Transform.cs:
	Adjust changes to IDisposable wrt 4.0
2011-05-02 12:14:53 -04:00
Sebastien Pouliot 01ddb1883b Add some new 4.0 features in System.Security.Cryptography
* CspProviderFlags.cs: Add new CreateEphemeralKey (128) value
* CryptoConfig.cs: Add 4.0 AllowOnlyFipsAlgorithms (always false) and
stubs for AddAlgorithm and AddOID
* CryptoStream.cs: Remove Close override (from 1.x days) and implement
HasFlushedFinalBlock (4.0)
2011-05-02 12:13:23 -04:00
Sebastien Pouliot 57713434f5 Implemented IDisposable on System.Security.Cryptography.DeriveBytes to match the .Net 4.0 implementation.
From: Chris Shaffer <[email protected]>
2011-04-17 10:40:06 -04:00
Rolf Bjarne Kvinge f64261401d Fix many corcompare issues for moonlight 2011-03-31 16:05:03 +02:00
Marek Habersack 997394024f [crypto] Added missing 4.0 algorithm names 2011-02-08 00:32:41 +01:00
Marek Habersack 773e8b4d03 [corlib,crypto] RandomNumberGenerator implements IDisposable in 4.0 2011-01-25 15:47:13 +01:00
Sebastien Pouliot 25280a542d Allow RSACryptoServiceProvider.SignHash to work with SHA-2 family
* System.Security.Cryptography/CryptoConfig.cs: Add OID for RIPEMD160
* System.Security.Cryptography/RSACryptoServiceProvider.cs: Update
GetHashNameFromOID to include SHA2-family OIDs. Remove historical
comments about 1.x FX behavior.

* Test/System.Security.Cryptography/CryptoConfigTest.cs: Add test cases
wrt RIPEMD160 OID
* Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs: Add
test case for SignHash with all FX-provided hash implementations (all
working except RIPEMD160). Remove some NET_2_0/NET_1_1 defines.
* Test/System.Security.Cryptography/RSAPKCS1SignatureFormatterTest.cs:
Remove hacks that were needed for running the tests under FX 1.x. Remove
some NET_2_0/NET_1_1 defines.
2011-01-11 10:01:56 -05:00
Sebastien Pouliot 570ddb5097 [moon] Allow creating AES with the fully qualified name in S.Core
* CryptoConfig_2_1.cs: Add fully qualified name (to simple name) to
allow the creation of AES using (internal) CryptoConfig
2010-11-11 15:28:52 -05:00
Marek Habersack 70f77d14ac Fix mixed newlines 2010-11-03 03:26:26 +01:00
Pablo Ruiz Garcia 6276334d1b [API] X509 related enhacemnts to allow 1) associating keystore's private keys with their corresponding public certificates found at X509Stores, and 2) importing private keys to X509Stores along with certificates.
mcs/class/corlib/Mono.Security.X509/X509Store.cs:
mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs:
mcs/class/corlib/Mono.Security.X509/X509StoreManager.cs:
mcs/class/Mono.Security/Mono.Security.X509/X509StoreManager.cs:
	Modified MSX.X509Store to allow importing privateKeys along certificates (by using RSACryptoServiceProvider and KeyPairPersister).
	Fixed X509Store to use certificate's hash as CspParameters.KeyContainerName.

mcs/tools/security/certmgr.cs:
	Added a new -importKey action to certmgr, which allows importing a PKCS12 contained key into our KeyPair store.
	Added a more (verbose) output to certmgr's -list action.

man/certmgr.1:
	Updated certmgr man page ti reflect -importKey addition.

mcs/class/corlib/System.Security.Cryptography/CspParameters.cs:
mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs:
	Implemented RSACryptoServiceProvider.CspKeyContainerInfo getter
	RSACryptoServiceProvider will not take into account CspParameterFlags.UseExistingKey by throwing a CryptographicException if keyset identified by KeyContainerName does not exists.
2010-11-02 19:26:22 -04:00
Gonzalo Paniagua Javier 7912621a54 Buffer sizes
workingBlock should be the InputBlockSize and currentBlock the
	OutputBlockSize. Allocate currentBlock lazily.

	Test contributed by Bassam Tabbara.
	Fixes bug #644740.
2010-10-08 15:31:43 -04:00
Gonzalo Paniagua Javier 8d29212331 [CryptoStream] Invalid enum in ctor
Throw on invalid enum value in the ctor.
2010-10-08 15:31:43 -04:00
Gonzalo Paniagua Javier 1ffb522d65 Dispose calls FlushFinalBlock
Dispose calls FlushFinalBlock (even for Read mode) and this in turn
	calls either FlushFinalBlock or Flush on the underlying stream.
2010-10-08 15:31:43 -04:00
Gonzalo Paniagua Javier 8fbfdf3790 Fix CryptoStream.Dispose
-Dispose will call TransformFinalBlock() for Read streams. Fixes bug #644648.
	-Dispose () will call Dispose (bool). Fixes bug #644654.
	-Stream.Close calls GC.SuppressFinalize(). Fixes bug #644660.
2010-10-07 14:59:52 -04:00
Raja R Harinath cd51491631 Fix a few cases of mixed line-endings
This is a scripted conversion of mixed line-ending files to LF-only or CRLF-only
based on which patch is smaller.  I used a threshold of upto a quarter of the
lines to determine whether to keep the patch or not.
2010-07-26 02:20:13 +05:30
Raja R Harinath b293948fb7 EOL handling
This set of .gitattributes was automatically generated from the list of files
that GIT tried to normalize when I enabled automatic EOL conversion.

With this set of attributes, we prevent automated EOL conversion on files that
we know will cause trouble down the road.
2010-07-25 20:17:39 +05:30
Sebastien Pouliot b647abaadc 2010-07-21 Sebastien Pouliot <[email protected]>
* CryptoConfig_2_1.cs: Ensure Aes[Managed] can be created from
	our managed SSL/TLS implementation


svn path=/trunk/mcs/; revision=160673
2010-07-21 13:28:22 +00:00
Sebastien Pouliot a4bdc71082 2010-05-10 Sebastien Pouliot <[email protected]>
* DES.cs:
	* DESCryptoServiceProvider.cs:
	* RC2.cs:
	* RC2CryptoServiceProvider.cs:
	* TripleDES.cs:
	* TripleDESCryptoServiceProvider.cs:
		Remove !MOONLIGHT check since we need those for SSL


svn path=/trunk/mcs/; revision=157053
2010-05-10 19:50:31 +00:00
Jb Evain a3f7ce80a7 use MOONLIGHT symbol
svn path=/trunk/mcs/; revision=153667
2010-03-16 12:19:11 +00:00
Marek Safar d02179ed24 Warnings cleanup
svn path=/trunk/mcs/; revision=149459
2010-01-13 13:14:15 +00:00