diff --git a/src/Microsoft.AspNet.Security.DataProtection/DataProtectionProvider.cs b/src/Microsoft.AspNet.Security.DataProtection/DataProtectionProvider.cs
index 91d48649d0..fc011d8c0a 100644
--- a/src/Microsoft.AspNet.Security.DataProtection/DataProtectionProvider.cs
+++ b/src/Microsoft.AspNet.Security.DataProtection/DataProtectionProvider.cs
@@ -1,7 +1,6 @@
using System;
using System.Globalization;
using System.Reflection;
-using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection
diff --git a/src/Microsoft.AspNet.Security.DataProtection/DataProtectorImpl.cs b/src/Microsoft.AspNet.Security.DataProtection/DataProtectorImpl.cs
index d6489d56c3..dec7c4c485 100644
--- a/src/Microsoft.AspNet.Security.DataProtection/DataProtectorImpl.cs
+++ b/src/Microsoft.AspNet.Security.DataProtection/DataProtectorImpl.cs
@@ -1,7 +1,6 @@
using System;
using System.Diagnostics;
using System.Security.Cryptography;
-using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection
diff --git a/src/Microsoft.AspNet.Security.DataProtection/DpapiDataProtectorImpl.cs b/src/Microsoft.AspNet.Security.DataProtection/DpapiDataProtectorImpl.cs
index 5678e3a2f3..13e5319e1a 100644
--- a/src/Microsoft.AspNet.Security.DataProtection/DpapiDataProtectorImpl.cs
+++ b/src/Microsoft.AspNet.Security.DataProtection/DpapiDataProtectorImpl.cs
@@ -3,7 +3,6 @@ using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
-using Microsoft.AspNet.Security.DataProtection.Resources;
using Microsoft.AspNet.Security.DataProtection.Util;
namespace Microsoft.AspNet.Security.DataProtection
diff --git a/src/Microsoft.AspNet.Security.DataProtection/PBKDF2.cs b/src/Microsoft.AspNet.Security.DataProtection/PBKDF2.cs
index f027571411..c8824b37c1 100644
--- a/src/Microsoft.AspNet.Security.DataProtection/PBKDF2.cs
+++ b/src/Microsoft.AspNet.Security.DataProtection/PBKDF2.cs
@@ -22,15 +22,15 @@ namespace Microsoft.AspNet.Security.DataProtection
{
if (String.IsNullOrEmpty(algorithmName))
{
- throw new ArgumentNullException("algorithmName");
+ throw new ArgumentException(Res.Common_NullOrEmpty, "algorithmName");
}
if (password == null || password.Length == 0)
{
- throw new ArgumentNullException("password");
+ throw new ArgumentException(Res.Common_NullOrEmpty, "password");
}
if (salt == null || salt.Length == 0)
{
- throw new ArgumentNullException("salt");
+ throw new ArgumentException(Res.Common_NullOrEmpty, "salt");
}
if (iterationCount <= 0)
{
diff --git a/src/Microsoft.AspNet.Security.DataProtection/Properties/AssemblyInfo.cs b/src/Microsoft.AspNet.Security.DataProtection/Properties/AssemblyInfo.cs
deleted file mode 100644
index d4b33b324e..0000000000
--- a/src/Microsoft.AspNet.Security.DataProtection/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System;
-using System.Reflection;
-using System.Resources;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-
-[assembly: AssemblyTitle("Microsoft.AspNet.Security.DataProtection")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyProduct("Microsoft.AspNet.Security.DataProtection")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
-[assembly: Guid("130d9afa-6535-42bf-ba70-610b677d5acf")]
-[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-[assembly: NeutralResourcesLanguage("en-US")]
-
-// for OOB servicing
-
-[assembly: AssemblyMetadata("Serviceable", "True")]
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Security.DataProtection/Properties/Res.Designer.cs b/src/Microsoft.AspNet.Security.DataProtection/Properties/Res.Designer.cs
new file mode 100644
index 0000000000..bac3e9fcff
--- /dev/null
+++ b/src/Microsoft.AspNet.Security.DataProtection/Properties/Res.Designer.cs
@@ -0,0 +1,94 @@
+//
+namespace Microsoft.AspNet.Security.DataProtection
+{
+ using System.Globalization;
+ using System.Reflection;
+ using System.Resources;
+
+ internal static class Res
+ {
+ private static readonly ResourceManager _resourceManager
+ = new ResourceManager("Microsoft.AspNet.Security.DataProtection.Res", typeof(Res).GetTypeInfo().Assembly);
+
+ ///
+ /// Argument cannot be null or empty.
+ ///
+ internal static string Common_NullOrEmpty
+ {
+ get { return GetString("Common_NullOrEmpty"); }
+ }
+
+ ///
+ /// Argument cannot be null or empty.
+ ///
+ internal static string FormatCommon_NullOrEmpty()
+ {
+ return GetString("Common_NullOrEmpty");
+ }
+
+ ///
+ /// The master key is too short. It must be at least {0} bytes in length.
+ ///
+ internal static string DataProtectorFactory_MasterKeyTooShort
+ {
+ get { return GetString("DataProtectorFactory_MasterKeyTooShort"); }
+ }
+
+ ///
+ /// The master key is too short. It must be at least {0} bytes in length.
+ ///
+ internal static string FormatDataProtectorFactory_MasterKeyTooShort(object p0)
+ {
+ return string.Format(CultureInfo.CurrentCulture, GetString("DataProtectorFactory_MasterKeyTooShort"), p0);
+ }
+
+ ///
+ /// The data to decrypt is invalid.
+ ///
+ internal static string DataProtectorImpl_BadEncryptedData
+ {
+ get { return GetString("DataProtectorImpl_BadEncryptedData"); }
+ }
+
+ ///
+ /// The data to decrypt is invalid.
+ ///
+ internal static string FormatDataProtectorImpl_BadEncryptedData()
+ {
+ return GetString("DataProtectorImpl_BadEncryptedData");
+ }
+
+ ///
+ /// Couldn't protect data. Perhaps the user profile isn't loaded?
+ ///
+ internal static string DpapiDataProtectorImpl_ProfileNotLoaded
+ {
+ get { return GetString("DpapiDataProtectorImpl_ProfileNotLoaded"); }
+ }
+
+ ///
+ /// Couldn't protect data. Perhaps the user profile isn't loaded?
+ ///
+ internal static string FormatDpapiDataProtectorImpl_ProfileNotLoaded()
+ {
+ return GetString("DpapiDataProtectorImpl_ProfileNotLoaded");
+ }
+
+ private static string GetString(string name, params string[] formatterNames)
+ {
+ var value = _resourceManager.GetString(name);
+
+ System.Diagnostics.Debug.Assert(value != null);
+
+ if (formatterNames != null)
+ {
+ for (var i = 0; i < formatterNames.Length; i++)
+ {
+ value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}");
+ }
+ }
+
+ return value;
+ }
+ }
+}
diff --git a/src/Microsoft.AspNet.Security.DataProtection/Resources/Res.resx b/src/Microsoft.AspNet.Security.DataProtection/Res.resx
similarity index 97%
rename from src/Microsoft.AspNet.Security.DataProtection/Resources/Res.resx
rename to src/Microsoft.AspNet.Security.DataProtection/Res.resx
index d195f18d48..0a01c8908d 100644
--- a/src/Microsoft.AspNet.Security.DataProtection/Resources/Res.resx
+++ b/src/Microsoft.AspNet.Security.DataProtection/Res.resx
@@ -117,6 +117,9 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ Argument cannot be null or empty.
+
The master key is too short. It must be at least {0} bytes in length.
diff --git a/src/Microsoft.AspNet.Security.DataProtection/Resources/Res.Designer.cs b/src/Microsoft.AspNet.Security.DataProtection/Resources/Res.Designer.cs
deleted file mode 100644
index 45215fb506..0000000000
--- a/src/Microsoft.AspNet.Security.DataProtection/Resources/Res.Designer.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.34014
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace Microsoft.AspNet.Security.DataProtection.Resources {
- using System;
- using System.Reflection;
-
- ///
- /// A strongly-typed resource class, for looking up localized strings, etc.
- ///
- // This class was auto-generated by the StronglyTypedResourceBuilder
- // class via a tool like ResGen or Visual Studio.
- // To add or remove a member, edit your .ResX file then rerun ResGen
- // with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Res {
-
- private static global::System.Resources.ResourceManager resourceMan;
-
- private static global::System.Globalization.CultureInfo resourceCulture;
-
- [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
- internal Res() {
- }
-
- ///
- /// Returns the cached ResourceManager instance used by this class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager {
- get {
- if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.AspNet.Security.DataProtection.Res", typeof(Res).GetTypeInfo().Assembly);
- resourceMan = temp;
- }
- return resourceMan;
- }
- }
-
- ///
- /// Overrides the current thread's CurrentUICulture property for all
- /// resource lookups using this strongly typed resource class.
- ///
- [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture {
- get {
- return resourceCulture;
- }
- set {
- resourceCulture = value;
- }
- }
-
- ///
- /// Looks up a localized string similar to The master key is too short. It must be at least {0} bytes in length..
- ///
- internal static string DataProtectorFactory_MasterKeyTooShort {
- get {
- return ResourceManager.GetString("DataProtectorFactory_MasterKeyTooShort", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to The data to decrypt is invalid..
- ///
- internal static string DataProtectorImpl_BadEncryptedData {
- get {
- return ResourceManager.GetString("DataProtectorImpl_BadEncryptedData", resourceCulture);
- }
- }
-
- ///
- /// Looks up a localized string similar to Couldn't protect data. Perhaps the user profile isn't loaded?.
- ///
- internal static string DpapiDataProtectorImpl_ProfileNotLoaded {
- get {
- return ResourceManager.GetString("DpapiDataProtectorImpl_ProfileNotLoaded", resourceCulture);
- }
- }
- }
-}