<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="10.0.0-preview.7.25380.108" />

CryptoThrowHelper

static class CryptoThrowHelper
using System.Security.Cryptography; namespace Internal.Cryptography { internal static class CryptoThrowHelper { public static CryptographicException ToCryptographicException(this int hr) { string message = global::Interop.Kernel32.GetMessage(hr); if (hr >= 0) hr = ((hr & 65535) | -2147024896); return new CryptographicException(message) { HResult = hr }; } } }