* Remove SerializableAttribute from many CoreFX types that will not be serializable.
* Removes serialization tests for types that are no longer serializable and fixes serializing a couple of types. Includes marking some internal serializable types as public so that they'll be reflectible with .NET Native.
* Remove unneeded pragmas
* Update based on review comments
Commit migrated from https://github.com/dotnet/corefx/commit/6dd451f51451a7d0ceea6104b51bd17005e9a0e6
- RSACng ImportParameters was throwing a CryptoException for null Exponent/Modulus. On NetFX RSACng throws an ArgumentException. The tests were modified to expect CryptoException when the RSA is not full framework and the RSA is not RSACng
- Skip the `ValidateDecryptorProperties` test on netfx because it throws a CryptoException when there isn't a key set before doing the test validation.
- `RSACryptoServiceProvider` doesn't support SHA20aep, so the `DefaultRSAProvider` test helper was modified to return false for `SupportsSha20aep` when the RSA created by the factory is an `RSACryptoServiceProvider`.
- `InvalidHashCoreArgumentsFromStream` is skipped on netfx. Netfx doesn't do argument boundary checking for stream input in ComputeHash which was fixed in netcoreapp.
Commit migrated from https://github.com/dotnet/corefx/commit/e8d3e7a72643317400e40cb3bc6d5b8a4a67210e
ECDsa.Create(ECCurve) had a check which rightly belonged in GenerateKey
behind an IsNamed check. Moved that check to where it belonged, and added
an Explicit (PrimeShortWeierstrass) test to the big create matrix.
Adding the test resulted in debugging several tests which were assuming IsNamed.
The extra debugging data seemed generally applicable, so it remains.
Commit migrated from https://github.com/dotnet/corefx/commit/41b6a68a43f64217996489d4770c4024413a5957
There are two value mutation tests proving that global state isn't modified in corefx which happen to modify global state in netfx, and once the state is corrupted any remaining tests will fail (and any parallel tests could have already failed).
So disable those tests on netfx until they would pass there.
Commit migrated from https://github.com/dotnet/corefx/commit/7f42a283a34db0943fc68da41b9ddd25a2932e0e
For any libary that is part of netstandard and needs to either add types
to desktop or satisfy a higher assembly version that we previously
shipped, ensure we have both a netfx ref and src build.
The ref build is required because previously we were using the src build
(partial facade) as both ref and lib. This is problematic because we
need to build the full netstandard.dll facade before building src
projects. Ensuring a ref build also helps reduce package size since we
don't end up shipping the partial facade implementation in ref.
Src build has been added where it wasn't already present to fill in the
missing types, members, or satisfy the previously shipped assembly
version in netstandard1.x.
Commit migrated from https://github.com/dotnet/corefx/commit/45b4c71bff924245d8962035bd751d65c45bf31d
Now instead of Use*Key a project can instead define the assembly key
in the project (genreally the common dir.pops for a project) using
the AssemblyKey property. The accepted values are Open, ECMA, MSFT,
Test.
This change allows for a repo to set the default key they want to use
for projects. In corefx we have switched the default to use the Open
key instead of the old BuildTools default of MSFT key.
As part of this update we are explicitly setting the AssemblyKey in
all the library projects (although it is really only necessary for
projects that aren't the default).
Also with this change we are updating all the new libraries that have
not yet shipped stable (compared to our 1.1 release) and making them
use the Open key. Which means that for prerelease dependencies there
might be some binary breaking changes to consume.
The following libraries ahven't shipped so there key is being
changed from MSFT to Open:
Microsoft.XmlSerializer.Generator
System.CodeDom
System.Configuration.ConfigurationManager
System.Data.Odbc
System.DirectoryServices
System.DirectoryServices.AccountManagement
System.DirectoryServices.Protocols
System.IO.Ports
System.Json
System.Memory
System.Net.HttpListener
System.Net.Mail
System.Net.ServicePoint
System.Net.WebClient
System.Net.WebProxy
System.Private.Xml
System.Private.Xml.Linq
System.Security.Cryptography.Xml
System.Security.Permissions
System.Transactions.Local
System.Web.HttpUtility
Commit migrated from https://github.com/dotnet/corefx/commit/ac09a797d09502ebab61f7167bb856846602e1e6
* Improve negative alignment for asymmetric algs.
Ensure that we get consistent (modulo HResult/exact message text) exceptions
for negative experiences across each of the three implementations of the three
asymmetric algorithms.
RSA:
* We should throw when decrypting with no private key
* We should throw when signing with no private key
* We should throw when signing and the hash value is the wrong size
* We should throw ArgumentNullException on the null hash
DSA:
* We should throw when signing with no private key
ECDSA:
* We should throw when signing with no private key
Commit migrated from https://github.com/dotnet/corefx/commit/677bfabe55e3f3e542d00bc37dd17bbbd1473553
During the design of the ECC import/export feature we concluded that
better overloads for the asymmetric algorithms' Create methods should
exist which allow the user to specify the generation space (an ECCurve for ECC,
a keysize for RSA and DSA) or to specify key parameters for importing.
These methods are currently pure convenience, but in the future they could
end up using the arguments to change a preferred back-end provider;
for example, on netfx RSA.Create() could prefer RSACng when the Exponent is
larger than 4 bytes, since RSACryptoServiceProvider cannot process those keys.
Commit migrated from https://github.com/dotnet/corefx/commit/97fcdd3f68b80b79a4b91cb94e4a0f01eeace8a5
* Fix UWP Pinvoke checker condition
* analyzer baselines
* Remove redundant local define
* Remove redundant CA lines
* Special case Registry
* Fix BlockReflectionAttribute
* Replace NETNATIVE with uap define
* baselines
* Disable Pinvoke scan on specific projects
* Disable BlockReflectionAttribute on ilproj
* Revive 2 baselines
* Disable UWP validation on SQlClient
* Convert some defines to `uwp`
* Fix S.N.Primitives baseline
* Remove dead baselines
* Clean up NET_NATIVE defines
* Remove FEATURE_CORECLR except from shared sources
* Change Threading.Thread defines to just uapaot
* Fix comment
* Fix comment 2
* Change serialization uap defines to uapaot
* Rename EnableWinRT to UWPCompatible
* Fix UAP build for Console
* Fix uap condition in XML csproj
* Fix condition in XmlSerializer project
* Replace netcore50
* Remove dead #if
* Redundant console condition
* Redundant console condition2
* Trim baseline
* Revert Console baseline to pre UAP
* Fix MemoryMappedFiles uap build
* Fix S.Linq.Expressions build for UAP by temporarily disabling it
* Fix S.N.Sockets build for uap
* No plans to put SQLClient in UWP
* Fix RuntimeInformation build
* Fix MemoryMappedFiles build for Unix
* Add UWPCompatible to all netstandard versions
* Add EnablePinvokeAnalyzer to disable Pinvoke checking entirely for some reason
* Remove dead System.Xml.XmlSerializer.Tests.settings.targets
* Fix interop services build
* Remove last uap/uapaot define in Xml tests
* PInvoke check doc
* Fix PInvoke casing
* PInvoke file is case sensitive
* Remove unnecessary references to uapaot from projects that don't have uapaot configs
* Remove unnecessary uapaot from S.R.I.RI
* Replace UWPCompatible for TargetGroup in csproj conditions
* Reverse FileSystem edit as not ready to build for UWP
Commit migrated from https://github.com/dotnet/corefx/commit/b1865ea0847a7a86baefe8378b772ecf0b785681
This adds support for using (HMAC) SHA256, SHA384, SHA512 in PBKDF2.
(HMAC)MD5 isn't being enabled at this time. We can re-evaluate that later,
but since this API change is about letting newer algorithms in it doesn't
seem like letting the older ones in is high-value.
This is staying as a managed implementation in this change, switching to
using native implementations can easily be done as a followup given the new
tests.
Commit migrated from https://github.com/dotnet/corefx/commit/29cb063b95661470340b6ba7e1381495c05bfff2
Generate RSA and ECDSA keys via a temporary keychain.
When no keychain is given, SecKeyGeneratePair will generate the keys into the
default/login keychain. Since the keys were not expected to have been in the
keychain, they permanently leak out and the keychain grows over time.
Instead, have the managed code provide a temporary keychain into which the keys
will be created. Then, export them and re-import them to the NULL keychain. The
temporary keychain can then be deleted, and the hard problem of delayed cleanup is
avoided.
Files on disk will still leak if the process terminates during the key generation
phase, but that is a much smaller window than other 'temporary file on disk' solutions.
Commit migrated from https://github.com/dotnet/corefx/commit/37ddcd39db16a0069683c3d3f95e6740c44aaec3
Broken by this change:
* A lot of TLS CipherSuites have no metadata defined.
* macOS does not support version skipping in TLS. So `Tls | Tls12` is an invalid choice.
In this change:
General:
* All OSStatus related exceptions now look up the error message.
X509Certificates:
* X509Certificate moves to using SecCertificateRef from OpenSSL's X509.
* X509 metadata comes from a managed reader after being loaded by Security.framework,
due to the significant amount of data that has no public export in Apple's libraries.
* Significant code was factored out to be shared by OpenSSL and Apple implementations for X500DistinguishedName and X509Certficate2Collection.Find.
* Loading a PFX (or, rather, the private keys from a PFX) via Apple's platform
requires importing into a Keychain, and a Keychain requires a file on disk.
A temporary keychain is created during cert loading and erased when safe.
Like the perphemeral key load on Windows this can leak files due to
abnormal program termination.
* The X.509 My store for CurrentUser and LocalMachine are the default (user) and System keychains.
* The X.509 Root store is an interpretation of the Apple SecTrustSettings data.
* The X.509 Disallowed store hasn't been implemented yet, but should be a very small change.
* Other X.509 stores cannot be created due to keychain complexity.
HttpClient:
* Initialization no longer wakes up OpenSSL
SslStream:
* New implementation based on Apple SecureTransport.
* Currently has support for SNI (for AuthenticateAsClient)
Commit migrated from https://github.com/dotnet/corefx/commit/3b19899963606a34e1623e0926b90fe907197ee6
* Marking code as unchecked (pt 7)
Marking code that may intentionally lead to over or underflows with
unchecked in preparation of turning on CheckForOverflowUnderflow for
all projects (issue dotnet/corefx#3140)
* Marking code as unchecked (pt 7a)
Additional fixes from a debugging session on macOS
* Marking code as unchecked (pt 7b)
Added missing unchecked to ConcurrentBag
Commit migrated from https://github.com/dotnet/corefx/commit/0ebc867d6bad9d777dd61afb78d0445c86143b34