Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.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# 如何在C中使用RSA算法使用私钥对消息进行签名#_C#_Visual Studio 2008_Cryptography_Rsa_Windows Mobile 6 - Fatal编程技术网

C# 如何在C中使用RSA算法使用私钥对消息进行签名#

C# 如何在C中使用RSA算法使用私钥对消息进行签名#,c#,visual-studio-2008,cryptography,rsa,windows-mobile-6,C#,Visual Studio 2008,Cryptography,Rsa,Windows Mobile 6,背景:我已获得私钥(XXX.key)及其密码。另外,我还有一个为PocketPC开发的应用程序,它使用windows mobile 6(.NET Compact Edition 3.5)。 场景:我需要使用以下步骤对邮件进行签名: 1.使用SHA1算法加密消息。 2.使用提供的私钥,使用RSA算法对消解进行签名。 3.将结果转换为以64位为基数编码的等效字符串表示形式。 我能够通过以下几行实现第一步: // Step 1 string message = "this message will b

背景:我已获得私钥(XXX.key)及其密码。另外,我还有一个为PocketPC开发的应用程序,它使用windows mobile 6(.NET Compact Edition 3.5)。 场景:我需要使用以下步骤对邮件进行签名: 1.使用SHA1算法加密消息。 2.使用提供的私钥,使用RSA算法对消解进行签名。 3.将结果转换为以64位为基数编码的等效字符串表示形式。 我能够通过以下几行实现第一步:

// Step 1
string message = "this message will be encrypted";
byte[] messageBytes = Encoding.UTF8.GetBytes(message);
SHA1 sha1 = SHA1.Create();
byte[] digestion = sha1.ComputeHash(messageBytes, 0, messageBytes.Length);

// Step 2 Here I need to sign with the private key.
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

// Step 3
string signedMessage = Convert.ToBase64String();
值得一提的是,对于无法访问互联网的Pocket,这些步骤必须在应用程序中实现。 我的问题是,我不知道如何将私钥放入RSA算法中。而且,我不是安全方面的专家。 请不要告诉我为什么要这样做;我不是这样设计的。 有人知道如何实施第二步吗??
提前感谢。

不幸的是
。据我所知,key
不是标准扩展,因此如果我们不知道其格式,我们无法告诉您如何将密钥导入.net环境。你能透露更多关于格式的信息吗?PS你的方向是正确的,“消化”应该是“消化”,但消化发生在你吃东西后的消化系统:)据我所知,关键文件的格式应该是PKCS#8