ProtectedData encryption not available non-Windows with dotnet #2655
Unanswered
TheCakeIsNaOH
asked this question in
General
Replies: 1 comment 1 reply
-
This is definitely an interesting problem, and one which we should watch closely to see how the NuGet Team deal with. I am assuming that the biggest stumbling block here will be the migration from old encrypted values, to the new encryption that we end up using. Correct? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Chocolatey CLI uses
System.Security.Cryptography.ProtectedData
to encrypt remembered arguments in.arguments
files and to encrypt sensitive information in its configuration file.This API is available on Windows only, because it uses DPAPI, which is part of Windows.
https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.protecteddata?view=dotnet-plat-ext-6.0
dotnet/runtime#22886 (comment)
The problem
Currently, Chocolatey CLI is on .Net framework on Windows, and Mono on non-Windows. Mono does have a (less secure) implementation of this API, so there are no issues currently.
However, once Chocolatey CLI is upgraded to running on dotnet (core/5/6/7 or whatever), that will cause an issue on non-Windows systems, because then the
ProtectedData
API will not be available.#2436
This causes two problems:
ProtectedData
Solutions?
For problem one, there are multiple options I can think of:
System.Security.Cryptography
or pre-existing encryption library to encrypt the string.Upstream Nuget has run into this issue, and is hoping to get this fix this year: NuGet/Home#1851
We may want to wait and see what they do about this.
For the second problem about migrating from Mono to dotnet, I'm open to suggestions.
Beta Was this translation helpful? Give feedback.
All reactions