system.security.cryptography.rsa中的错误不包含encrypt的定义 [英] Error in system.security.cryptography.rsa does not contain definition for encrypt
问题描述
我正在尝试RSA加密代码,在线参考一些代码,我试过这个
I was trying out the RSA encryption code, referring to some of the codes online, and I tried this
var encryptedData = RSA.Encrypt(testDatabyte, publicKey)
但出现错误提到
but error came out mentioning that
System.Security.Cryptography.RSA does not contain definition for Encrypt
我正在使用.NET framework 4.5.1。我可以知道我该怎么办?
我尝试过:
-提供给msdn microsoft,并试图添加如
的程序集System.Security.Cryptography.AsymmetricAlgorithm
System.Security.Cryptography.RSA
System.Security.Cryptography.RSACryptoServiceProvider
但是所有这些都不是命名空间的类型
-检查msdn中的.Net框架版本,它确实提到了它支持
I am using .NET framework 4.5.1. Can i know how should I proceed?
What I have tried:
-referred to msdn microsoft and tried to add assemblies like
System.Security.Cryptography.AsymmetricAlgorithm
System.Security.Cryptography.RSA
System.Security.Cryptography.RSACryptoServiceProvider
but all of them is a type not a namespace
-have check the .Net framework version in msdn, and it did mention it is supported
推荐答案
你没有告诉我们你如何实现你的'RSA'对象 - 它需要是RSACryptoServiceProvider类型
我建议你从这里开始一个有效的例子 RSACryptoServiceProvider类(System.Security.Cryptography) [ ^ ]
并请不要在多个论坛中发布相同的问题[/ edit]
you dont show us how you instanciate your 'RSA' object - it needs to be of type RSACryptoServiceProvider
I suggest you start here for a working example RSACryptoServiceProvider Class (System.Security.Cryptography)[^]
[edit] and please dont post the same question in more than one forum [/edit]
这篇关于system.security.cryptography.rsa中的错误不包含encrypt的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!