如何生成公钥和私钥XML字符串u [英] How to generate public key and private key XML string u
本文介绍了如何生成公钥和私钥XML字符串u的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i希望通过传递我们自己的字符串来生成公钥和私钥。
假设我的字符串是你好你好吗我想为这个字符串生成公钥和私钥。
我尝试过的事情:
hello,
i want to generate the public key and private key by passing our own string.
Suppose my string is "hello how are you" and i want to generate the public and private key for this string.
What I have tried:
RSACryptoServiceProvider rsa;
const int PROVIDER_RSA_FULL = 1;
const string CONTAINER_NAME = "test";
CspParameters cspParams;
cspParams = new CspParameters(PROVIDER_RSA_FULL);
cspParams.KeyContainerName = CONTAINER_NAME;
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
rsa = new RSACryptoServiceProvider(cspParams);
string publicPrivateKeyXML = rsa.ToXmlString(true);
string publicOnlyKeyXML = rsa.ToXmlString(false);
这里我使用此代码从一个站点复制它。在这里我很困惑,我们可以通过自己的字符串来获取公钥和私钥。
here i am using this code by copied it from one site. here i am confuse in can we pass our own string to get public key and private key.
推荐答案
const string CONTAINER_NAME = "hello how are you";
或
or
string friendlyString = "hello how are you";
const string CONTAINER_NAME = friendlyString;
这篇关于如何生成公钥和私钥XML字符串u的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文