Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# System.PlatformNotSupportedException AESCryptServiceProvider_C#_Sharepoint_Web Services_Aescryptoserviceprovider - Fatal编程技术网

C# System.PlatformNotSupportedException AESCryptServiceProvider

C# System.PlatformNotSupportedException AESCryptServiceProvider,c#,sharepoint,web-services,aescryptoserviceprovider,C#,Sharepoint,Web Services,Aescryptoserviceprovider,我有以下问题 我创建了一个类,它使用AESCryptServiceProvider对一些数据进行加密和解密。我正在SharePoint Web部件中使用该类,一切正常。我还在自定义SharePoint Web服务中的同一Web应用程序上使用同一个类,每次调用System.Security.Cryptography.AESCryptServiceProvider的构造函数时,它都会抛出System.PlatformNotSupportedException和以下堆栈跟踪 System.Platfo

我有以下问题

我创建了一个类,它使用AESCryptServiceProvider对一些数据进行加密和解密。我正在SharePoint Web部件中使用该类,一切正常。我还在自定义SharePoint Web服务中的同一Web应用程序上使用同一个类,每次调用System.Security.Cryptography.AESCryptServiceProvider的构造函数时,它都会抛出System.PlatformNotSupportedException和以下堆栈跟踪

System.PlatformNotSupportedException: The specified cryptographic algorithm is not supported on this platform.
   at System.Security.Cryptography.CapiNative.AcquireCsp(String keyContainer, String providerName, ProviderType providerType, CryptAcquireContextFlags flags, Boolean throwPlatformException)
   at System.Security.Cryptography.AesCryptoServiceProvider..ctor()
   at m2009_wu.ProvisioningLibrary.ConfigManager..ctor()
我试图在不做任何更改的情况下,为不同的平台编译包含类的webservice和库

我的开发环境运行的系统是Windows Server 2008标准SP1 x64,带有Microsoft Office SharePoint Server 2007 SP2 x64和Visual Studio 2008 SP1。服务器上安装了.Net Framework 3.5 SP1

如果有人能给我指出正确的方向,我将不胜感激

问候 Rene Windegger来自MSDN:

PlatformNotSupportedException-当前平台不支持密钥大小

你用什么尺寸的钥匙

密钥的最小大小为128位,最大大小为256位


你的例外情况是:

此平台不支持指定的加密算法


您需要尝试其他加密提供程序。并非所有加密提供程序在所有系统上都可用。MSDN有完整的列表。

您的服务器位于哪里?微软不允许在世界某些地区(中国、朝鲜等)使用高密钥强度加密


此外,还可以强制执行组策略设置,以防止使用某些加密(例如,政府机构要求通过组策略只允许使用FIPS算法)。

我踢了ASP.Net Web服务并引入了WCF服务,现在一切正常。

我使用的密钥大小为256位。由于调用构造函数时会出现问题,而从Web部件调用构造函数时构造函数会工作,所以我不知道平台中的差异应该在哪里。我使用的密钥大小为256位。由于问题发生在调用构造函数时,而从Web部件调用构造函数时构造函数正在工作,我不知道平台中的差异应该在哪里。是的,验证声明该算法在平台上不受支持。当从与webservice位于同一应用程序池中的Web部件中调用时,它可以工作。只有当从Web服务调用异常时,才会发生异常。由于webservice和webpart在同一平台上运行,这不会是问题。您仍然应该尝试其他提供商。好吧,这个例外很简单。从来没有听说过它在错误的条件下被抛出。服务器位于奥地利,我没有发现任何东西表明奥地利不支持高密钥强度加密。在machine.config中对AES有限制吗?