使用RSA公钥解密数据

使用RSA公钥解密数据

本文介绍了使用RSA公钥解密数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,这不是打字错误,我想使用公开 解密。这样做的目的是挑战第三方,以确保他们做,事实上,有对应的公钥的私钥。基本上,我会发送一些随机数据,他们将用他们的私钥加密,我会使用公钥解密,并将解密的值与我发送的随机数据进行比较。我相信这是一个非常标准的程序在公共密钥加密,但由于某种原因用公共密钥解密似乎是禁忌。

First off, that is not a typo, I want to decrypt using a public key. The purpose for doing this is to challenge a third party to ensure they do, in fact, have the private key that corresponds to the public key. Basically, I would send some random data, they would encrypt it with their private key, I would decrypt it using the public key and compare the decrypted value to the random data that I sent. I believe this is a pretty standard procedure in public key crypto but for some reason decrypting with a public key seems to be taboo.

我只是使用 RSACryptoServiceProvider 。但是,当我调用 Decrypt 时,它会引发一个 CryptographicException ,消息 $ c>。关键是不坏(我可以加密没有问题),但似乎它不会让我解密只用公共密钥。是什么赋予了?这必须是可能的。

I am simply using the RSACryptoServiceProvider in .NET 2.0. However, when I call Decrypt it throws a CryptographicException with message Bad Key. The key is not bad (I can Encrypt with no problem), but it appears as though it will not let me decrypt with just the public key. What gives? This must be possible to do.

推荐答案

我认为被认可的术语是签名的。他们使用私钥 签名,并使用公钥验证。我承认我不理解低级数学以及我应该,但我的理解是签名真的只是用私钥加密。

I think the recognized term is signing. They sign with the private key, and you verify with the public key. I admit I don't understand the low-level math as well as I should, but my understanding is signing is really just encrypting with the private key.

使用 RSACryptoServiceProvider 的符号并验证方法系列。事实上, SignHash 实际上说,用私钥加密它。

Use RSACryptoServiceProvider's sign and verify family of methods. In fact, SignHash actually says, "encrypting it with the private key."

这篇关于使用RSA公钥解密数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:47