本文介紹了從 x509Certificate2 啟動 RSACryptoServiceProvider 的最佳方式?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
從我從密鑰庫中取出的 X509Certificate2
啟動新的 RSACryptoServiceProvider
對象的最佳方法是什么?證書與公共(用于加密)和私有(用于解密)密鑰相關聯.
What is the best way to initate a new RSACryptoServiceProvider
object from an X509Certificate2
I pulled out of a key store? The certificate is associated with both public (for encryption) and private (for decryption) keys.
我目前正在使用 FromXmlString
方法,但一定有更好的方法.
I'm current using the FromXmlString
method but there must be a better way.
謝謝
推薦答案
RSACryptoServiceProvider publicKeyProvider =
(RSACryptoServiceProvider)certificate.PublicKey.Key;
和
RSACryptoServiceProvider privateKeyProvider =
(RSACryptoServiceProvider)certificate.PrivateKey;
證書的公鑰或私鑰屬性的密鑰屬性是 AsymmetricAlgorithm 類型.
The key property on the public or private key property of the certificate is of type AsymmetricAlgorithm.
這篇關于從 x509Certificate2 啟動 RSACryptoServiceProvider 的最佳方式?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!