Allow DpapiNGXmlEncryptor to get the current identity's SID on CoreCLR.

This commit is contained in:
Levi B 2014-10-20 13:43:03 -07:00
parent 8fc3607a68
commit ca95189a3b
2 changed files with 2 additions and 8 deletions

View File

@ -4,15 +4,12 @@
using System;
using System.Globalization;
using System.IO;
using System.Security.Principal;
using System.Xml.Linq;
using Microsoft.AspNet.Security.DataProtection.Cng;
using Microsoft.AspNet.Security.DataProtection.KeyManagement;
using Microsoft.AspNet.Security.DataProtection.SafeHandles;
#if !ASPNETCORE50
using System.Security.Principal;
#endif
namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
{
/// <summary>
@ -79,7 +76,6 @@ namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
private static string GetDefaultProtectionDescriptorString()
{
#if !ASPNETCORE50
// Creates a SID=... protection descriptor string for the current user.
// Reminder: DPAPI:NG provides only encryption, not authentication.
using (WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent())
@ -87,9 +83,6 @@ namespace Microsoft.AspNet.Security.DataProtection.XmlEncryption
// use the SID to create an SDDL string
return String.Format(CultureInfo.InvariantCulture, "SID={0}", currentIdentity.User.Value);
}
#else
throw new NotImplementedException("TODO: Doesn't yet work on Core CLR.");
#endif
}
}
}

View File

@ -44,6 +44,7 @@
"System.Security.Cryptography.Encryption.Aes": "4.0.0-beta-*",
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-*",
"System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-*",
"System.Security.Principal.Windows": "4.0.0-beta-*",
"System.Text.Encoding.Extensions": "4.0.10-beta-*",
"System.Threading": "4.0.0-beta-*",
"System.Xml.XDocument": "4.0.0-beta-*"