<tfoot id='wJxRu'></tfoot>
  • <small id='wJxRu'></small><noframes id='wJxRu'>

      • <bdo id='wJxRu'></bdo><ul id='wJxRu'></ul>
    1. <i id='wJxRu'><tr id='wJxRu'><dt id='wJxRu'><q id='wJxRu'><span id='wJxRu'><b id='wJxRu'><form id='wJxRu'><ins id='wJxRu'></ins><ul id='wJxRu'></ul><sub id='wJxRu'></sub></form><legend id='wJxRu'></legend><bdo id='wJxRu'><pre id='wJxRu'><center id='wJxRu'></center></pre></bdo></b><th id='wJxRu'></th></span></q></dt></tr></i><div id='wJxRu'><tfoot id='wJxRu'></tfoot><dl id='wJxRu'><fieldset id='wJxRu'></fieldset></dl></div>

      <legend id='wJxRu'><style id='wJxRu'><dir id='wJxRu'><q id='wJxRu'></q></dir></style></legend>

        rsacryptoserviceprovider 使用 x509 证书 c#

        时间:2023-06-02
          <tbody id='FkRgw'></tbody>

        • <bdo id='FkRgw'></bdo><ul id='FkRgw'></ul>
          1. <small id='FkRgw'></small><noframes id='FkRgw'>

              <tfoot id='FkRgw'></tfoot>
              • <i id='FkRgw'><tr id='FkRgw'><dt id='FkRgw'><q id='FkRgw'><span id='FkRgw'><b id='FkRgw'><form id='FkRgw'><ins id='FkRgw'></ins><ul id='FkRgw'></ul><sub id='FkRgw'></sub></form><legend id='FkRgw'></legend><bdo id='FkRgw'><pre id='FkRgw'><center id='FkRgw'></center></pre></bdo></b><th id='FkRgw'></th></span></q></dt></tr></i><div id='FkRgw'><tfoot id='FkRgw'></tfoot><dl id='FkRgw'><fieldset id='FkRgw'></fieldset></dl></div>
                  <legend id='FkRgw'><style id='FkRgw'><dir id='FkRgw'><q id='FkRgw'></q></dir></style></legend>
                  本文介绍了rsacryptoserviceprovider 使用 x509 证书 c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用由 makecert 生成的证书,该证书具有私钥和公钥.Java 端使用此公钥加密数据,.net 将其解密.

                  i am using a certificate generated by makecert which has both private and public key. The java side uses this public key to encrypt the data and .net decrypts it back.

                  我正在尝试解密 Java 的加密 64 位编码字符串并获取错误数据.

                  I am trying to decrypt Java's encrypted 64 bit encoded string and getting bad data.

                  为了查看.Net 端是否一切正常,我首先尝试使用公钥加密,然后使用相同的证书使用私钥解密.我的代码如下所示.

                  To see if all is good on.Net end, I frist tried to encrypt with the public key and then decrypt with private using the same certificate. My code looks like this.

                  X509Certificate2 cert = GetCert(key, StoreName.My, StoreLocation.LocalMachine);
                  RSACryptoServiceProvider provider =  (RSACryptoServiceProvider)cert.PrivateKey;
                  
                  RSACryptoServiceProvider publicprovider = (RSACryptoServiceProvider)cert.PublicKey.Key;
                  
                  if (cert.HasPrivateKey)
                      MessageBox.Show("Got private key");
                  
                  byte[] encrypted = publicprovider.Encrypt(Encoding.UTF8.GetBytes(text), false);
                  byte[] decryptedBytes = provider.Decrypt(encrypted, false); 
                  

                  即使在这里我也遇到了错误.我错过了什么吗?

                  Even here I am getting the error. Am i Missing something?

                  证书看起来对公钥和私钥都有效.

                  The certificate looks valid with both public and private key.

                  推荐答案

                  我终于找到了问题所在.我没有把 makecert 的密钥定义为 RSA 加密密钥.

                  I finally found the problem. I wasn't putting the key to makecert to define it as RSA Crypto key.

                  这篇关于rsacryptoserviceprovider 使用 x509 证书 c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 C# 中获得与 PHP 单元测试相同的 HMAC256 结 下一篇:TripleDES:指定的密钥是“TripleDES"的已知弱密钥

                  相关文章

                  最新文章

                  • <bdo id='lv2yc'></bdo><ul id='lv2yc'></ul>
                • <tfoot id='lv2yc'></tfoot>

                • <i id='lv2yc'><tr id='lv2yc'><dt id='lv2yc'><q id='lv2yc'><span id='lv2yc'><b id='lv2yc'><form id='lv2yc'><ins id='lv2yc'></ins><ul id='lv2yc'></ul><sub id='lv2yc'></sub></form><legend id='lv2yc'></legend><bdo id='lv2yc'><pre id='lv2yc'><center id='lv2yc'></center></pre></bdo></b><th id='lv2yc'></th></span></q></dt></tr></i><div id='lv2yc'><tfoot id='lv2yc'></tfoot><dl id='lv2yc'><fieldset id='lv2yc'></fieldset></dl></div>
                • <legend id='lv2yc'><style id='lv2yc'><dir id='lv2yc'><q id='lv2yc'></q></dir></style></legend>

                  <small id='lv2yc'></small><noframes id='lv2yc'>