如何使用私钥加密并使用dotnet核心RSA中的公钥解密 [英] How to encrypt with private key and decrypt with public key in dotnet core RSA
本文介绍了如何使用私钥加密并使用dotnet核心RSA中的公钥解密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
I found several solutions where I can use the RSA Provider to Encrypt a message with the public key and Decrypt it with the private one.
But what I want to have is to Encrypt with the private key and Decrypt with the public key.
I want to store the public key in my app and encrypt a license for example on my dev machine with the private key, send it to the app and let the information decrypt with a public key.
How can I achieve that?
我的尝试:
我试图关注这篇文章,但它工作不正常。
RSA私钥加密 [ ^ ]
推荐答案
不应该这样工作:公钥不安全如果它在您的应用程序中,因为任何有权访问该应用程序的人都可以从中获取公钥!
请参阅此处:cryptography - 可以使用私钥加密/使用公钥解密吗? - 堆栈溢出 [ ^ ]
It's not supposed to work that way: the public key isn't safe if it's inside your app, because anyone who has access to the app can get the public key from that!
See here: cryptography - Can one encrypt with a private key/decrypt with a public key? - Stack Overflow[^]
这篇关于如何使用私钥加密并使用dotnet核心RSA中的公钥解密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文