Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Paket.Core/ConfigFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ let private getRandomSalt() =
/// Encrypts a string with a user specific keys
let Encrypt (password : string) =
let salt = getRandomSalt()
let encryptedPassword = ProtectedData.Protect(Encoding.UTF8.GetBytes password, salt, DataProtectionScope.CurrentUser)
let encryptedPassword =
try
ProtectedData.Protect(Encoding.UTF8.GetBytes password, salt, DataProtectionScope.CurrentUser)
with | :? CryptographicException as e ->
verbosefn "could not protect password: %s\n for current user" e.Message
ProtectedData.Protect(Encoding.UTF8.GetBytes password, salt, DataProtectionScope.LocalMachine)
salt |> Convert.ToBase64String ,
encryptedPassword |> Convert.ToBase64String

Expand Down