From 131bd2b7b88b9d4ec44f6470011a4cf5c6556926 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 29 Nov 2025 11:03:48 +0000 Subject: [PATCH] Drop .NET 6 support and add .NET 10 support - Updated SharpCompress.csproj target frameworks from net48;net481;netstandard2.0;net6.0;net8.0 to net48;net481;netstandard2.0;net8.0;net10.0 - Updated test and build projects to use .NET 10 - Updated global.json to .NET 10 SDK - Updated CI workflow to use .NET 10 - Fixed deprecated Rfc2898DeriveBytes constructor for .NET 10 (SYSLIB0060) - Updated package description and README to reflect new supported frameworks - Updated package versions for .NET 10 compatibility Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com> --- .github/workflows/dotnetcore.yml | 2 +- Directory.Packages.props | 2 +- README.md | 2 +- build/build.csproj | 2 +- build/packages.lock.json | 2 +- global.json | 2 +- .../Common/Zip/WinzipAesEncryptionData.cs | 22 +++++++++++++--- src/SharpCompress/SharpCompress.csproj | 11 +++++--- src/SharpCompress/packages.lock.json | 14 +++++++--- .../SharpCompress.Performance.csproj | 2 +- .../packages.lock.json | 2 +- .../SharpCompress.Test.csproj | 4 +-- tests/SharpCompress.Test/packages.lock.json | 26 ++++++------------- 13 files changed, 54 insertions(+), 39 deletions(-) diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index fa268a67..3f6bef75 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions/setup-dotnet@v5 with: - dotnet-version: 8.0.x + dotnet-version: 10.0.x - run: dotnet run --project build/build.csproj - uses: actions/upload-artifact@v5 with: diff --git a/Directory.Packages.props b/Directory.Packages.props index 216d1de4..cdce4631 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,7 +14,7 @@ - + diff --git a/README.md b/README.md index f333d497..6cf8505b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # SharpCompress -SharpCompress is a compression library in pure C# for .NET Framework 4.62, .NET Standard 2.1, .NET 6.0 and NET 8.0 that can unrar, un7zip, unzip, untar unbzip2, ungzip, unlzip, unzstd, unarc and unarj with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip/lzip are implemented. +SharpCompress is a compression library in pure C# for .NET Framework 4.8/4.8.1, .NET Standard 2.0, .NET 8.0 and NET 10.0 that can unrar, un7zip, unzip, untar unbzip2, ungzip, unlzip, unzstd, unarc and unarj with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip/lzip are implemented. The major feature is support for non-seekable streams so large files can be processed on the fly (i.e. download stream). diff --git a/build/build.csproj b/build/build.csproj index 99e86377..8f5b6f3c 100644 --- a/build/build.csproj +++ b/build/build.csproj @@ -1,7 +1,7 @@ Exe - net8.0 + net10.0 diff --git a/build/packages.lock.json b/build/packages.lock.json index bc1f7953..2719488d 100644 --- a/build/packages.lock.json +++ b/build/packages.lock.json @@ -1,7 +1,7 @@ { "version": 2, "dependencies": { - "net8.0": { + "net10.0": { "Bullseye": { "type": "Direct", "requested": "[6.0.0, )", diff --git a/global.json b/global.json index 391ba3c2..512142d2 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "10.0.100", "rollForward": "latestFeature" } } diff --git a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs index 31322019..da37501b 100644 --- a/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs +++ b/src/SharpCompress/Common/Zip/WinzipAesEncryptionData.cs @@ -1,6 +1,7 @@ using System; using System.Buffers.Binary; using System.Security.Cryptography; +using System.Text; namespace SharpCompress.Common.Zip; @@ -21,6 +22,22 @@ internal class WinzipAesEncryptionData #if NETFRAMEWORK || NETSTANDARD2_0 var rfc2898 = new Rfc2898DeriveBytes(password, salt, RFC2898_ITERATIONS); + KeyBytes = rfc2898.GetBytes(KeySizeInBytes); + IvBytes = rfc2898.GetBytes(KeySizeInBytes); + var generatedVerifyValue = rfc2898.GetBytes(2); +#elif NET10_0_OR_GREATER + var derivedKeySize = (KeySizeInBytes * 2) + 2; + var passwordBytes = Encoding.UTF8.GetBytes(password); + var derivedKey = Rfc2898DeriveBytes.Pbkdf2( + passwordBytes, + salt, + RFC2898_ITERATIONS, + HashAlgorithmName.SHA1, + derivedKeySize + ); + KeyBytes = derivedKey.AsSpan(0, KeySizeInBytes).ToArray(); + IvBytes = derivedKey.AsSpan(KeySizeInBytes, KeySizeInBytes).ToArray(); + var generatedVerifyValue = derivedKey.AsSpan((KeySizeInBytes * 2), 2).ToArray(); #else var rfc2898 = new Rfc2898DeriveBytes( password, @@ -28,11 +45,10 @@ internal class WinzipAesEncryptionData RFC2898_ITERATIONS, HashAlgorithmName.SHA1 ); -#endif - - KeyBytes = rfc2898.GetBytes(KeySizeInBytes); // 16 or 24 or 32 ??? + KeyBytes = rfc2898.GetBytes(KeySizeInBytes); IvBytes = rfc2898.GetBytes(KeySizeInBytes); var generatedVerifyValue = rfc2898.GetBytes(2); +#endif var verify = BinaryPrimitives.ReadInt16LittleEndian(passwordVerifyValue); var generated = BinaryPrimitives.ReadInt16LittleEndian(generatedVerifyValue); diff --git a/src/SharpCompress/SharpCompress.csproj b/src/SharpCompress/SharpCompress.csproj index 27ec5e3e..9c7efdf1 100644 --- a/src/SharpCompress/SharpCompress.csproj +++ b/src/SharpCompress/SharpCompress.csproj @@ -6,7 +6,7 @@ 0.42.0 0.42.0 Adam Hathcock - net48;net481;netstandard2.0;net6.0;net8.0 + net48;net481;netstandard2.0;net8.0;net10.0 SharpCompress ../../SharpCompress.snk true @@ -17,7 +17,7 @@ Copyright (c) 2025 Adam Hathcock false false - SharpCompress is a compression library for NET Standard 2.0/NET 4.8/NET 4.8.1/NET 6.0/NET 8.0 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented. + SharpCompress is a compression library for NET Standard 2.0/NET 4.8/NET 4.8.1/NET 8.0/NET 10.0 that can unrar, decompress 7zip, decompress xz, zip/unzip, tar/untar lzip/unlzip, bzip2/unbzip2 and gzip/ungzip with forward-only reading and file random access APIs. Write support for zip/tar/bzip2/gzip is implemented. true true embedded @@ -28,17 +28,20 @@ true $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb - + true $(DefineConstants);DEBUG_STREAMS + + $(DefineConstants);DEBUG_STREAMS + - + diff --git a/src/SharpCompress/packages.lock.json b/src/SharpCompress/packages.lock.json index 3d0d443d..cfaec8f5 100644 --- a/src/SharpCompress/packages.lock.json +++ b/src/SharpCompress/packages.lock.json @@ -304,7 +304,13 @@ "contentHash": "N8GXpmiLMtljq7gwvyS+1QvKT/W2J8sNAvx+HVg4NGmsG/H+2k/y9QI23auLJRterrzCiDH+IWAw4V/GPwsMlw==" } }, - "net6.0": { + "net10.0": { + "Microsoft.NET.ILLink.Tasks": { + "type": "Direct", + "requested": "[10.0.0, )", + "resolved": "10.0.0", + "contentHash": "kICGrGYEzCNI3wPzfEXcwNHgTvlvVn9yJDhSdRK+oZQy4jvYH529u7O0xf5ocQKzOMjfS07+3z9PKRIjrFMJDA==" + }, "Microsoft.SourceLink.GitHub": { "type": "Direct", "requested": "[8.0.0, )", @@ -335,9 +341,9 @@ "net8.0": { "Microsoft.NET.ILLink.Tasks": { "type": "Direct", - "requested": "[8.0.21, )", - "resolved": "8.0.21", - "contentHash": "s8H5PZQs50OcNkaB6Si54+v3GWM7vzs6vxFRMlD3aXsbM+aPCtod62gmK0BYWou9diGzmo56j8cIf/PziijDqQ==" + "requested": "[10.0.0, )", + "resolved": "10.0.0", + "contentHash": "kICGrGYEzCNI3wPzfEXcwNHgTvlvVn9yJDhSdRK+oZQy4jvYH529u7O0xf5ocQKzOMjfS07+3z9PKRIjrFMJDA==" }, "Microsoft.SourceLink.GitHub": { "type": "Direct", diff --git a/tests/SharpCompress.Performance/SharpCompress.Performance.csproj b/tests/SharpCompress.Performance/SharpCompress.Performance.csproj index 460b1d53..cab757e4 100644 --- a/tests/SharpCompress.Performance/SharpCompress.Performance.csproj +++ b/tests/SharpCompress.Performance/SharpCompress.Performance.csproj @@ -1,7 +1,7 @@  Exe - net8.0 + net10.0 diff --git a/tests/SharpCompress.Performance/packages.lock.json b/tests/SharpCompress.Performance/packages.lock.json index 5c6a2b9e..df535fe2 100644 --- a/tests/SharpCompress.Performance/packages.lock.json +++ b/tests/SharpCompress.Performance/packages.lock.json @@ -1,7 +1,7 @@ { "version": 2, "dependencies": { - "net8.0": { + "net10.0": { "JetBrains.Profiler.SelfApi": { "type": "Direct", "requested": "[2.5.14, )", diff --git a/tests/SharpCompress.Test/SharpCompress.Test.csproj b/tests/SharpCompress.Test/SharpCompress.Test.csproj index 916f67b6..6ee632bd 100644 --- a/tests/SharpCompress.Test/SharpCompress.Test.csproj +++ b/tests/SharpCompress.Test/SharpCompress.Test.csproj @@ -1,12 +1,12 @@  - net8.0;net48 + net10.0;net48 SharpCompress.Test SharpCompress.Test SharpCompress.Test.snk true - + $(DefineConstants);DEBUG_STREAMS diff --git a/tests/SharpCompress.Test/packages.lock.json b/tests/SharpCompress.Test/packages.lock.json index 90c5ba11..fbc620a5 100644 --- a/tests/SharpCompress.Test/packages.lock.json +++ b/tests/SharpCompress.Test/packages.lock.json @@ -29,6 +29,12 @@ "Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3" } }, + "Mono.Posix.NETStandard": { + "type": "Direct", + "requested": "[1.0.0, )", + "resolved": "1.0.0", + "contentHash": "vSN/L1uaVwKsiLa95bYu2SGkF0iY3xMblTfxc8alSziPuVfJpj3geVqHGAA75J7cZkMuKpFVikz82Lo6y6LLdA==" + }, "xunit": { "type": "Direct", "requested": "[2.9.3, )", @@ -196,7 +202,7 @@ } } }, - "net8.0": { + "net10.0": { "AwesomeAssertions": { "type": "Direct", "requested": "[9.3.0, )", @@ -258,10 +264,7 @@ "Microsoft.TestPlatform.ObjectModel": { "type": "Transitive", "resolved": "18.0.0", - "contentHash": "Al/a99ymb8UdEEh6DKNiaoFn5i8fvX5PdM9LfU9Z/Q8NJrlyHHzF+LRHLbR+t89gRsJ2fFMpwYxgEn3eH1BQwA==", - "dependencies": { - "System.Reflection.Metadata": "8.0.0" - } + "contentHash": "Al/a99ymb8UdEEh6DKNiaoFn5i8fvX5PdM9LfU9Z/Q8NJrlyHHzF+LRHLbR+t89gRsJ2fFMpwYxgEn3eH1BQwA==" }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", @@ -277,19 +280,6 @@ "resolved": "13.0.3", "contentHash": "HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==" }, - "System.Collections.Immutable": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg==" - }, - "System.Reflection.Metadata": { - "type": "Transitive", - "resolved": "8.0.0", - "contentHash": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==", - "dependencies": { - "System.Collections.Immutable": "8.0.0" - } - }, "xunit.abstractions": { "type": "Transitive", "resolved": "2.0.3",