使用公钥解密 [英] decrypt using public key

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

问题描述

您好

之前已经提出此问题。但是,让我以不同的方式表达它。

This question has been asked previously. However let me put it in a different way.

我想使用RSA使用私钥加密,并使用公钥解密我的应用程序。

I would like to use RSA to encrypt using private key and decrypt using public key for licensing my application.

基本上使用私钥生成许可证,然后在客户端计算机上验证它们。这些是我的理由:

Basically generate licenses using private key and then verify them on the client machine. These are my reasons:

1。公钥并不是真正公开的 - 它嵌入在被混淆的程序中。

1. public key is not really public - it is embedded inside the program which is obfuscated.

2。在最糟糕的情况下,当公钥被黑客攻击时,仍然无法生成新的许可证。

2. In the worst case scenario when the public key is hacked, new licenses can still not be generated.

3。在签名的情况下,"签名字符串"是指"签名字符串"。这是许可证字符串有一些可读字符 - 所以我们需要再次加密,它也会增加最终字符串的长度。

3. In case of signing, the "signed string" which is the license string has some readable characters - so we need to be encrypt again anyway and it also increases the length of the final string.

MS RSACryptoServiceProvider不允许我这样做。我发现在网上提到了其他图书馆(bouncycastle)允许这样做。

MS RSACryptoServiceProvider is not allowing me to do this. I find mention of other libraries on the net (bouncycastle) which do allow this.

上面有更好/更简单的方法吗?

Is there a better / easier way to achieve above ?

谢谢

Abhishek

推荐答案

Abhishek,使用私钥加密并使用公钥解密是什么被称为签署和验证。您可以使用RSACryptoServiceProvider类中的(SignData和VerifyData)或(SignHash和VerifyHash)方法来实现此目的。

Abhishek, Encrypting with private key and decrypting with public key is what is referred to as signing and verification. You can achieve this using either (SignData and VerifyData) or (SignHash and VerifyHash) methods from RSACryptoServiceProvider class.

http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx



----

Nima Sharifimehr。

sbucsc at yahoo dot com


----
Nima Sharifimehr.
sbucsc at yahoo dot com


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆