Is there any way to use RNGCryptoServiceProvider class in C# Portable class Library

主宰稳场 提交于 2020-01-01 18:26:19

问题


I am working on a encryption algorithm and using cryptography for this. I want to make this portable, but didn't find any way to resolve this class.


回答1:


You can also use the full managed Bouncy Castle Library. A Portable Class Library Patch is available here: http://www.bouncycastle.org/jira/browse/BMA-107

A pre-build of Bouncy Castle 1.7 with the PCL Patch is available here for example: https://github.com/dnauck/Portable.Licensing/tree/master/lib




回答2:


You Didn't mention what profile you are looking for

In any case... RNGCryptoServiceProvider it seems to exist only in

.NET Framework Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0 .NET Framework Client Profile Supported in: 4, 3.5 SP1

As per documentation at RNGCryptoServiceProvider Class

I started dealing with cryptography, with pclContrib but I didn't find it complete enough, basic functionality I needed to calculate some hashes worked fine as far I stick to what pclcomtrib had,

But then it got a little messy with the references in the projects mostly with the Silverlight side because these are adapters PCLContrib FAQ .

I ended up abstracting all the security bits using interfaces within the pcl's where the implementations are platform specific

pretty much the same thing you might face with file access (depends how portable you want to go).

I'm afraid pclcontrib might not be your case too

Portable.Security.Cryptography    
 System.Security.Cryptography.AesManaged
 System.Security.Cryptography.HMACSHA1
 System.Security.Cryptography.HMACSHA256
 System.Security.Cryptography.SHA1Managed
 System.Security.Cryptography.SHA256Managed
 System.Security.Cryptography.Rfc2898DeriveBytes

You might want to have a look at the following questions/answers that I think will (indirectly)answer your question.

Questions tagged portable-class-library with Cryptography keyword




回答3:


You may want to check out http://pclcontrib.codeplex.com. It has support for cryptography.



来源:https://stackoverflow.com/questions/16294383/is-there-any-way-to-use-rngcryptoserviceprovider-class-in-c-sharp-portable-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!