Commit Graph
569 Commits
Author SHA1 Message Date
Kevin Jones 214443193a Check for OpenSSL availability for OpenSsl asymmetric primitives
If you attempt to use any of the *OpenSsl primitives on macOS, this will currently abort the whole process.
This changes them to check for OpenSSL's presence and throw an appropriate exception instead of aborting.

When used as an internal implementation, the aborting behavior remains.
2021-08-16 16:52:08 -07:00
Viktor Hofer a6b9a63f35 Update libraries solution and NuGet.config files (#56430)
* Update slngen and invocation

* Update NuGet.config files

* Update solution files with slngen
2021-07-28 18:44:17 +02:00
Jeremy Barton 16eabee0b2 Disable S.S.C.OpenSSL tests on the platforms that are PNSE. 2021-07-16 14:34:07 -07:00
Jeremy Barton f94711de45 Finish migrating RSAOpenSsl from RSA* to EVP_PKEY*
This change moves the RSAOpenSsl class (and the RSA.Create() internal class on Linux) to use EVP_PKEY
for the import and export operations, making the interaction with the underlying library based on
PKCS#8 PrivateKeyInfo and X.509 SubjectPublicKeyInfo key blobs.

A large portion of the code is just from splitting the key helpers files to not need all of the encrypted PKCS#8 support
in the System.Security.Cryptography.OpenSsl library, as the encrypted PKCS#8 <-> unencrypted PKCS#8 work provided
by the base classes is sufficient.

Once PKCS#8 and SPKI became the primary modes of interaction the spanified import and export routines for those got
overridden in RSAOpenSsl to avoid SPKI->RSAParameters->SPKI-style conversions.

This change completely eliminates SafeRsaHandle, and the only time that an `RSA*` is used at all is in the legacy RSAOpenSsl(IntPtr) constructor.
2021-07-13 18:20:19 -07:00
Kevin Jones 847cc5645d Implement CBC one shots on SymmetricAlgorithm 2021-07-07 11:12:12 -07:00
Viktor Hofer 7b575d777b Dead end S.Security.Cryptography.OpenSsl package (#51854)
* Dead end S.Security.Cryptography.OpenSsl package

To reduce complexity of the cryptography OpenSsl library, dead ending
its package as most of the configurations are partial facades anyway and
adding OpenSsl to the targeting pack. It's already part of the runtime
and exposed in aspnetcore's targeting pack.

.NET Standard libraries can continue to use the latest available package
which harvests for .NET Standard configurations.

Contributes to https://github.com/dotnet/runtime/issues/47530
2021-04-26 20:52:37 +02:00
Jeremy Barton a0811a130d Use EVP_PKEY for RSA public key operations
Also change the storage model to SafeEvpPKeyHandle,
only import and export use legacy SafeRsaHandle.
2021-04-20 09:26:50 -07:00
Elinor Fung 9c9eb90fae Switch to ProjectExclusions for assembly-level ActiveIssue tests on browser (#50891) 2021-04-08 18:37:21 -07:00
Marek Safar 95201492e7 Update ref assemblies libraries unsupported on mobile (#50616)
* Update ref assemblies libraries unsupported on mobile

* Add tvOS to known platforms list
2021-04-05 09:08:50 +02:00
Jeremy Barton 6aa4d59ca2 Use EVP_PKEY for RSA Decrypt 2021-03-24 10:27:42 -07:00
Steve MacLean 34294fabcb [macOS-arm64] Disable failing libraries tests (#49400)
* Disable tests for XUnit crashes on Apple Silicon

* Apple Silicon Disable System.IO.MemoryMappedFiles.Tests

* Apple Silicon disable DirectoryServices.Protocols.Tests

* Apple Silicon disable Cryptography tests

M1 helix missing usable libssl

* Apple Silicon disable TestVirtualMemorySize64

* Apple Silicon disable ImportCollectionsFromContainerOnly

* Apple Silicon disable XmlWriterApi tests

* Fix whitespace
2021-03-10 12:02:50 -05:00
Jeremy Koritzinsky 3e21dfcc41 Fix EC key file import tests (#49253)
* Fix cofactor import and disable tests that require the ability to derive a new public key from a private key + curve + generator, order, and cofactor.

* Add missing member.

* Disable more tests against CanDeriveNewPublicKey.

* Use isSupported instead of ConditionalFact.

* Fix net47 build.
2021-03-08 23:29:15 -08:00
Elinor Fung 6513d35a0b [AndroidCrypto] Add certs that don't use RC2 in test data (#49312) 2021-03-08 19:46:36 -08:00
Jeremy Koritzinsky b72b007e9c Disable RC2 tests on Android. (#49024)
* Disable RC2 tests on Android. RC2 isn't supported by Android.

* Use PlatformSpecific attribute instead of SkipOnMono.

* Skip key file tests that use RC2 encryption on Android

* Use ConditionalFact instead of PlatformSpecific.

* Reorganize usings and fix build failure.

* Add RC2Provider.cs to OpenSSL tests to fill in the RC2Factory type.

* Fix windows build.
2021-03-03 21:06:36 +00:00
b121bcacec Build unsupported version of System.Security.Cryptography.OpenSsl for mobile targets (#48595)
Co-authored-by: Adeel Mujahid <[email protected]>
Co-authored-by: Jeremy Barton <[email protected]>
2021-02-23 09:09:59 +01:00
Jeremy Koritzinsky 3cbdf4c57e Update SafeHandle types to have public parameterless constructors and add InitHandle API (#47189)
* Update public SafeHandle types to have public parameterless constructors.

Remove now-unneeded ILLink trim files.

Make public abstract SafeHandle constructors protected.

Remove comment on SafeWaitHandle

* Make SafeHandle constructors public for internal types.

Make internal abstract SafeHandle default constructors protected. Make non-abstract internal SafeHandles sealed when possible.

More internal SafeHandle types.

* Add new Marshal.InitHandle API.

Fix SetHandle accessibility

Fix test.

Use Marshal.InitHandle.

* PR feedback.

* Remove trailing whitespace.
2021-01-20 22:01:09 +00:00
Vladimir Sadov 7b993282b4 Enable host tests on OSX (#46640)
* Enable host tests on OSX

* initialize Ssl shim on demand

* fix OpenSsl.Tests

* partial modifier

* fixed Cryptography.Algorithms

* first to dlopen libssl wins
2021-01-13 10:01:53 -08:00
Viktor Hofer ceaa8ae8f7 Inline package descriptions and remove descriptions.json files across the repo (#46306)
* Support runtime package descriptions

* Update arcade Packaging pkg

* Inline pkg descriptions for coreclr

* Inline pkg descriptions for mono

* Inline pkg descriptions for installer

* Inline pkg descriptions for libraries
2020-12-22 16:07:56 +01:00
Anirudh AgnihotryandViktor Hofer 659c5fbc7f disable restore in vs for projects targeting platform specific old frameworks (#44932)
* disable vs restore in vs for projects targeting platform specific older frameworks

* Add infra to auto-update solution files for restore

* Add NuGet.config files for solutions affected by restore issue

Co-authored-by: Viktor Hofer <[email protected]>
2020-12-02 23:18:52 +01:00
Viktor Hofer ed295782bf Add workflow to update solution files with SlnGen and update them initially (#44703)
* Add slngen infra

* Update all solution files
2020-11-17 18:23:30 +01:00
Anirudh Agnihotry a7278fd9ba Fix packaging for the browser (#40814)
* Fix packaging for the browser

* fix wasm leg

* remove unused resource
2020-08-18 13:36:55 -07:00
Anirudh Agnihotry d0efddd932 Use Roslyn apis to generate Platform Not Supported Assemblies (#40296)
* fixes on the runtime side

* address feedback

* update arcade version

* merge conflicts

* update the version
2020-08-17 17:01:27 -07:00
Maxim Lipnin 196fd1804d [browser] Mark APIs as unsupported on browser (#40612)
* Mark System.Security.Cryptography.OpenSsl as unsupported on browser

* Mark other System.Security.Cryptography APIs as unsupported on browser

* Mark System.Data.Odbc.* as unsupported on browser

* Mark System.DirectoryServices.Protocols APIs as unsupported on browser

* Mark System.Drawing.Common APIs as unsupported on browser

* Mark System.IO.Ports as unsupported on browser
2020-08-13 12:55:30 -04:00
Adam Sitnik 6e922b89ec Mark System.Security.Cryptography.OpenSsl as unsupported on Windows, fixes #40101 (#40377) 2020-08-05 18:25:25 +02:00
Viktor Hofer 809a06f451 Remove depprojs in favor of PackageReferences (#35606)
- Remove depprojs which currently binplace external references into the RefPath folders in favor of PackageReference and PackageDownload items.
- Build all configurations by default when building an individual project (either on the CLI or inside VS) same as with the official SDK. This enables .NETFramework Test Explorer support.
- Centrally define libraries that compose the shared framework instead of in each Directory.Build.props file to be able to build the targeting pack first and consume it in the OOB libraries.
- Use ProjectReferences to reference OOB projects. Compile against the reference assembly but use the implementation assembly app-local during runtime.
- Remove OOBs from the testhost and remove the testhost folder for .NETFramework as it isn't required anymore.
- Only binplace for $(NetCoreAppCurrent) to compose a) the targeting pack, b) the runtime pack, c) the testhost, d) a full closure for the shims.
- Use Targeting Packs for OOB projects (with their implicit assembly references) but still explicitly define granular references for .NETCoreApp configurations (DisableImplicitAssemblyReferences switch). Use the implicit targeting pack references in some Microsoft.Extensions.* cases.
- Remove placeholder configurations as they aren't needed anymore with explicit P2Ps vs Targeting Pack references.
- Remove implicit assembly references (ie for .NETFramework, mscorlib)
- Remove AssemblySearchPath hacks that were introduced with b7c4cb7 as the targeting pack is now used by default.
- Reduce unnecessary .NETFramework configurations that were added to run tests in favor of the already existing ref&src configurations.
- Stop hardcoding the paths for wasm assemblies and use the returned TargetPath of the ProjectReferences.
- Addressed formatting (ItemGroups, References at the bottom of the project file, ordering of references, use LibrariesProjectRoot instead of a relative path, unnecessary AssemblyName and RootNamespace properties which are identical to the project name, ordering of tfms)
- Revert "fix clean (#33758)"
2020-07-23 17:20:26 +02:00
Jose Perez RodriguezandEric StJohn b7c4cb71fe Add NetFramework Configurations to OOB packages (#39099)
* Porting new netfx configurations for packages

* Add Netfx configurations to Microsoft.Extensions and missing System packages

* Making sure net461 configurations build against targeting pack assembly versions

* Undo changes to add netfx configurations on reference projects that don't ship in their package

* Fix issue with M.E.FP.P package by removing NetStandard.Library metapackage dependency

* Fix issues with depending on higher version than the one available in net461

* Disable UTF8String verifyClosure on package

* Undo changes to Microsoft.XmlSerializer.Generator

* Update src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Microsoft.Extensions.FileProviders.Physical.csproj

Co-authored-by: Eric StJohn <[email protected]>

Co-authored-by: Eric StJohn <[email protected]>
2020-07-14 21:59:55 -07:00
Santiago Fernandez Madero 6eff5848bf Add browser tfm to test projects that used to run when it derived from Unix (#38954)
* Add browser tfm to test projects that used to run when it derived from Unix

* Don't build System.Net.Mail.Unit.Tests as they are already PNSE
2020-07-09 13:12:19 +02:00
Stephen Toub 6072e4d3a7 Update license headers (#38793) 2020-07-08 09:23:11 -04:00
Anirudh Agnihotry 5ce04ccc9a Make browser peer for windows_nt and unix (#37944)
Fixes https://github.com/dotnet/runtime/issues/38559
2020-07-08 12:59:37 +02:00
Maxim Lipnin 522d73e64c Add throwing PNSE to System.Security.Cryptography on WASM (#38379)
Since the entire set of System.Security.Cryptography.* tests has been disabled on WASM recently in https://github.com/dotnet/runtime/pull/37723, we need to let everyone know that those areas are not quite supported on WASM at the moment. In that case System.Security.Cryptography classes could throw PlatformNotSupportedException until some solution comes (https://github.com/dotnet/runtime/issues/37669)
2020-06-29 20:55:43 +02:00
Steve Pfister 8484d6c181 Disable System.Security.Cryptography.* tests for wasm. (#37723)
Since we aren't shipping openssl and browser crypto interop requires sync over async, we need to disable the tests until a viable solution is found.
2020-06-11 07:58:55 -04:00
Jeremy Barton b772f61807 Make System.Formats.Asn1 library public
* Move current ASN src and tests into new tree with no modifications

AsnReader partials are named AsnDecoder to better match the final name
for the core logic they contain.

* Make System.Formats.Asn1 package

* Apply changes from API review

Some additional tests were written to increase code coverage after the changes

* Move AsnReader consumers to public API
2020-06-08 21:33:48 -07:00
Viktor Hofer 2cda9035cb Use TargetFramework conditions consistently in libraries (#35956)
* Use TargetFramework condition consistently in libs

* Add docs section to describe the guideline

* Update Microsoft.Extensions.DependencyInjection.csproj

* Outline TargetFramework DesingTimeBuild issue

* Update Microsoft.Extensions.DependencyInjection.csproj
2020-05-11 11:00:11 -07:00
Viktor Hofer 000046f6c8 Change netcoreapp5.0 to net5.0 (#35176)
* Change netcoreapp5.0 to net5.0

* Remove tfm downgrades

* Rename S.R.CS.Unsfae include folder
2020-05-06 13:53:21 +02:00
Anirudh Agnihotry 0ac72ac366 Remove TargetsNet* from the runtime repo (#35589)
* feedbacl from previous time

* remove TargetsNet* from ItemGroup

* removing targetFramework from .targets
2020-05-04 17:12:23 +02:00
Marcus Turewicz 890fab0a64 Use attribute Link syntax for Common files (#35436)
* Change <Link>...</Link> to Link="..."

* Format existing Link="..."
2020-04-25 05:26:50 -07:00
Kevin Jones 29df078d1b Enable importing PEM-formatted keys into AsymmetricAlgorithm values 2020-04-09 09:23:17 -07:00
Kevin Jones 10828e147d Support ECParameters that contain only D (macOS).
Also remove the LimitedPrivateKeySupported test conditions, as all platforms support it now.
2020-04-08 12:48:11 -07:00
Viktor Hofer d0dc66bc0b Rename CoreFx.Private.TestUtilities and reference it in slns (#34656)
* Rename CoreFx.Private.TestUtilities to TestUtilities

* Add TestUtilities reference to slns
2020-04-08 01:26:53 +02:00
Kevin Jones 6d395de48a Support ECParameters that contain only D on Windows and Linux
If D (private key) is supplied but not the public key (Q), permit
this and allow the platform to re-calculate the public key from
the private key.

* Windows uses CNG blobs with the Q.X and Q.Y values set to (0,0).
* LInux uses the ECC math module to recompute Q from D and G.
* macOS is TBD.
2020-04-05 12:11:43 -07:00
Krzysztof WicherandJeremy Barton 960b9a8df8 Support Rfc3279 signature format for DSA and EcDSA (#1612)
This change adds overloads for SignData and SignHash/ComputeSignature on the DSA and ECDsa classes to make it easier for callers that need to use RFC3279's signature format to work with the classes in .NET.

It also moves more temporary work from temporary buffers to stackallocs.

Co-authored-by: Jeremy Barton <[email protected]>
2020-03-18 08:19:25 -07:00
Santiago Fernandez Madero b3346807be Enable cryptography tests hitting libssl issue (#32255) 2020-02-14 09:52:31 -08:00
Eirik Tsarpalis e0a3b05fe1 Merge pull request #32174 from eiriktsarpalis/annotate-system-security-cryptography-openssl
Nullable annotate System.Security.Cryptography.OpenSSL
2020-02-14 17:49:41 +00:00
Levi Broderick 0d08b0232d API review URL should be HTTPS, not HTTP (#32281) 2020-02-14 08:07:46 -08:00
Eirik Tsarpalis f075e74041 Nullable annotate System.Security.Cryptography.OpenSSL 2020-02-14 16:02:18 +00:00
Anirudh Agnihotry 83b76b2b27 add fromPackage to exclude properties (#32063) 2020-02-11 00:33:55 +00:00
Santiago Fernandez Madero 3203ee2cf5 Disable crypto tests affected by libssl in OSX (#31879) 2020-02-06 12:48:32 -08:00
Anirudh Agnihotry 725968c3c5 New Configuration System (#1787)
* libraries -restore for vertical build without test restore

* Automatic test change and regex to remove the addition of an extra line at eof

* manual test restore fixed (restore completely done for vertical build)

* build native done

* Automatic ref change and regex to remove the last line

* manual reference assebly change and generated shims build

* automatic src change and regex

* native bin place and src build manual change

* apicompat and pretest.csproj done

* fixing the package build

* fixing all config

* packaging and feedback

* adding back placeholder configuration

* fixing the shims

* delete configuration.props

* making the build work in master

* Test Change

* fixing the packageing, test restore replacing TargetFramework -> OriginalTargetFramework

* delete test configuraiton.props, trailing semicolon and use targetFramework

* reverting the package change

* enable apicompat and fixing configurationGroup for individual projects

* fixing the api compat

* making ilproj work

* adding the outerBuildTest

* adding the arcade package version

* fixing the merge conflicts

* minor changes

* adding additional configs and setting the runtimeOS

* making the  vs stuff work

* removing the target Group to fix the apicompat

* fixing the linux build and some minor changes

* making additionalBuildTargetFramework LOcalProperty

* fixing the allConfigurations build

* fixing the netfx build

* fixing package Testing and restore

* Missing  TargetFrameworks tag

* making the VSdesgin stuff work

* Remove OriginalFramework Entirely

* some minor pr feedback

* RemoveExtraSemicolon

* use boolean exclude flag

* fixing yml scripts to pass tests

* adding comments and some minor feedback

* moving packaging property to correct plave

* fixing the build for web assembly

* Fixing the live ci build

* Fixing the live build for shims

* fixing the tests

* fixing the packaging and enterprise linux

* fixing  package sizes

* Fix the targetFramework

* updating the targetFramework sdl

* removing the buildOS and be able to use OSGroup as done in the old system

* Fixing the osgroup stuff for send to helix task

* Fix OSX failures

* Fixing the osx build

* uploading tmp folder to artifacts

* running restore for runtime.deproj correctly
2020-02-06 05:24:08 +00:00
Jan Kotas 099a512445 Merging small assemblies (part 1/N) (#2189)
* Delete unnecessary ClsCompliant

* Merge System.Diagnostics.Tools\src into CoreLib

* Merge System.Security.Pricipal\src into CoreLib

* Delete System.IO.UnmanagedMemoryStream\ref\System.IO.UnmanagedMemoryStream.cs

* Delete System.Reflection\ref\System.Reflection.cs

* Delete  System.Threading.Timer\src\ApiCompatBaseline.uapaot.txt

* Delete System.Buffers\src\Resources\Strings.resx

* Merge System.Buffers\ref into System.Runtime

* Merge System.Diagnostics.Debug\ref into System.Runtime

* Delete *\MatchingRefApiCompatBaseline.txt

* Merge System.Diagnostics.Tools into System.Runtime\ref

* Merge System.Resources.ResourceManager into System.Runtime\ref

* Cleanup System.IO.* project references

* Cleanup System.Reflection project references

* Cleanup System.Runtime.Handles project references

* Merge System.Threading.Thread\src into CoreLib

* Merge System.Threading.Timer\ref into System.Runtime

* Merge System.Threading.Tasks\ref into System.Runtime
2020-01-29 10:02:22 -08:00
Jan Kotas 0647ec3149 Replace GetDirectoryNameOfFileAbove with GetPathOfFileAbove where possible (#1175) 2019-12-27 00:31:18 -08:00