【问题标题】:BCrypt is not allowed for Windows Store AppsWindows 应用商店应用程序不允许使用 BCrypt
【发布时间】:2016-01-31 02:32:32
【问题描述】:

我在 Windows 应用商店应用程序中使用 Bcrypt.net 哈希处理密码。在 Windows 平板电脑中构建和测试时,它工作正常。但是当我尝试上传这个应用程序来存储它时,它在支持的 API 测试中失败了。

给出以下错误详情

MSCORLIB 中的 API System.ApplicationException,PUBLICKEYTOKEN=B77A5C561934E089 不支持此应用程序类型。 BCrypt.Net.dll 调用此 API。

API System.Runtime.Serialization.SerializationInfo in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.Security.Cryptography.RandomNumberGenerator in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.ApplicationException.#ctor in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.ApplicationException.#ctor(System.String) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.ApplicationException.#ctor(System.String,System.Exception) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.ApplicationException.#ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.Text.StringBuilder.AppendFormat(System.String,System.Object) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.Security.Cryptography.RandomNumberGenerator.Create in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.
API System.Security.Cryptography.RandomNumberGenerator.GetBytes(System.Byte[]) in MSCORLIB, PUBLICKEYTOKEN=B77A5C561934E089 is not supported for this application type. BCrypt.Net.dll calls this API.

可以为此做些什么?有任何想法吗? 提前致谢。

【问题讨论】:

标签: c# windows-store-apps windows-store bcrypt.net


【解决方案1】:

如错误信息所述

MSCORLIB 中的 API System.Runtime.Serialization.SerializationInfo, 此应用程序不支持 PUBLICKEYTOKEN=B77A5C561934E089 类型。 BCrypt.Net.dll 调用此 API。

SerializationInfo 类不属于.NET for Store App

您不能在商店应用程序开发中使用 BCrypt.NET,因为它是基于完整的 .NET 构建的,我建议您在 Windows 运行时应用程序中使用 HashAlgorithmProvider class

【讨论】:

  • 适用于以安全为主要关注点的应用程序。如果我要使用 HashAlgorithmProvider 类,那么我必须使用 SHA512。但是根据 [这篇文章] (codahale.com/how-to-safely-store-a-password),SHA512 还不够好
【解决方案2】:

我知道这有点晚了,但我已经将 BCrypt.net 移植到 .net Core,所以你现在应该可以使用它了。只需将您的依赖项换成此处的依赖项即可:

https://www.nuget.org/packages/BCrypt.Net-Core/

它应该是一个替代品。

【讨论】:

  • 谢谢贵霜。我们会尝试一下。
  • @NoviceProgrammer 如果您有任何问题,请告诉我,我会尽力解决它们
猜你喜欢
  • 2013-03-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-12
  • 1970-01-01
相关资源
最近更新 更多