Using a previously generated RSA public/private key with the .net framework

前端 未结 2 1260
醉酒成梦
醉酒成梦 2020-12-11 04:56

I have a pre-existing public/private key pair for RSA encryption which I need to use in .net . All the examples I can find online demonstrate how to generate a new private/p

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-11 05:31

    I realise this is a very old question but maybe someone still looks at this...

    Nowadays you can retrieve/store your keys in XML format (which you possibly could back in the days too).

    Example import:

    this.RSAKey = RSA.FromXmlString(xmlString: myRSAXMLKey);
    

    Example export:

    this.RSAKey_XMLString = RSA.ToXmlString(includePrivateParameters: false);
    

提交回复
热议问题