public string Protect(string serializedData, RedwoodRequestContext context) { if (serializedData == null) throw new ArgumentNullException("serializedData"); if (string.IsNullOrWhiteSpace(serializedData)) throw new ArgumentException("Value cannot be empty or whitespace only string.", "serializedData"); if (context == null) throw new ArgumentNullException("context"); // Get application key helper var keyHelper = new ApplicationKeyHelper(context.Configuration.Security); // Protect serialized data var userIdentity = ProtectionHelpers.GetUserIdentity(context); var requestIdentity = ProtectionHelpers.GetRequestIdentity(context); return keyHelper.ProtectString(serializedData, KDF_LABEL, userIdentity, requestIdentity); }