From 73a5efac271ec0b3851a555996e8ec9692af17cf Mon Sep 17 00:00:00 2001 From: "Javier \" Ciberman" Date: Thu, 20 May 2021 09:39:25 -0300 Subject: [PATCH 1/5] Fix creation of SHA512 Crypto service In NET Framework 3.5, the class SHA512CryptoService provider throws an error when instantiated in the regular way. If I replace the `new SHA512CryptoService()` with a `SHA512.Create()`, it works fine. --- LicencingNET/Licence.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LicencingNET/Licence.cs b/LicencingNET/Licence.cs index 83e7436..2e898e4 100644 --- a/LicencingNET/Licence.cs +++ b/LicencingNET/Licence.cs @@ -158,7 +158,7 @@ public ValidationResult Validate(AsymmetricAlgorithm publicKey, bool useNtp = tr return ValidationResult.NotStarted; } - using (SHA512CryptoServiceProvider sha = new SHA512CryptoServiceProvider()) + using (SHA512 sha = SHA512.Create()) { byte[] licenceBinary = ToBinary(false); @@ -209,7 +209,7 @@ public bool Sign(AsymmetricAlgorithm privateKey) throw new ArgumentNullException(nameof(privateKey), "Private key cannot be null"); } - using (SHA512CryptoServiceProvider sha = new SHA512CryptoServiceProvider()) + using (SHA512 sha = SHA512.Create()) { byte[] licenceBinary = ToBinary(false); From 1c07ed970b59dafb30d5fff8ae379c3ce8cd425c Mon Sep 17 00:00:00 2001 From: Javier Ciberman Mora Date: Sat, 14 Aug 2021 01:02:10 -0300 Subject: [PATCH 2/5] Change target from netcoreapp2.0 to netcoreapp3.1 --- LicencingNET/LicencingNET.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LicencingNET/LicencingNET.csproj b/LicencingNET/LicencingNET.csproj index ed5f32a..87cc2c5 100644 --- a/LicencingNET/LicencingNET.csproj +++ b/LicencingNET/LicencingNET.csproj @@ -1,6 +1,6 @@ 7.1 - net35;net45;net471;netcoreapp2.0;netstandard2.0 + net35;net45;net471;netcoreapp3.1;netstandard2.0 From c1cb1fc2ea42ba16ffbc0b60699c901c7b75171f Mon Sep 17 00:00:00 2001 From: Jens Willmer Date: Fri, 22 Oct 2021 13:35:52 +0200 Subject: [PATCH 3/5] Update LicencingNET.csproj --- LicencingNET/LicencingNET.csproj | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/LicencingNET/LicencingNET.csproj b/LicencingNET/LicencingNET.csproj index 87cc2c5..be21334 100644 --- a/LicencingNET/LicencingNET.csproj +++ b/LicencingNET/LicencingNET.csproj @@ -2,5 +2,18 @@ 7.1 net35;net45;net471;netcoreapp3.1;netstandard2.0 + LICENCE + https://github.com/RemoteCloud/LicencingNET + MIT Licence + https://github.com/TwoTenPvP/LicencingNET + Fork of LicencingNET project with the intention of building a NuGet package. + Maranics.LicencingNET + Contains pull request 2 modifications to be compatible with NET Framework 3.5 + + + True + + + From 4399dba9a8a49ab21792048609a88573c472e979 Mon Sep 17 00:00:00 2001 From: Jens Willmer Date: Fri, 22 Oct 2021 13:36:49 +0200 Subject: [PATCH 4/5] Create create_nuget.yml --- .github/workflows/create_nuget.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/create_nuget.yml diff --git a/.github/workflows/create_nuget.yml b/.github/workflows/create_nuget.yml new file mode 100644 index 0000000..8ed387d --- /dev/null +++ b/.github/workflows/create_nuget.yml @@ -0,0 +1,36 @@ +name: Publish NuGet Package + +on: + push: + branches: + - master + +jobs: + publish_to_nuget: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./LicencingNET + + name: Update NuGet + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0' + source-url: https://nuget.pkg.github.com/RemoteCloud/index.json + env: + NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build source + run: dotnet build --configuration Release + + - name: Create package + run: dotnet pack LicencingNET.csproj --output nuget-package --configuration Release + + # --no-symbols true is a bug workaround. In the future --no-symbols should just work + - name: Push to GitHub registry + run: dotnet nuget push ./nuget-package/*.nupkg --skip-duplicate --no-symbols true --api-key ${{ secrets.GITHUB_TOKEN }} From d92f4ad3e152036376ce1d33eae3a37f2fb5b155 Mon Sep 17 00:00:00 2001 From: Jens Willmer Date: Fri, 22 Oct 2021 13:47:09 +0200 Subject: [PATCH 5/5] Update LicencingNET.csproj --- LicencingNET/LicencingNET.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LicencingNET/LicencingNET.csproj b/LicencingNET/LicencingNET.csproj index be21334..eeb863f 100644 --- a/LicencingNET/LicencingNET.csproj +++ b/LicencingNET/LicencingNET.csproj @@ -1,7 +1,7 @@ 7.1 - net35;net45;net471;netcoreapp3.1;netstandard2.0 + netstandard2.0 LICENCE https://github.com/RemoteCloud/LicencingNET MIT Licence