Search code examples
c#bouncycastlepkiprivate-key

BouncyCastle create AsymmetricCipherKeyPair from existing keys?


I have two AssymetricAlgorithm RSA keys that I have pulled out of a certificate that was in my keystore. One is the Public Key and the other the Private. Is there a way of getting this keypair into a BouncyCastle AsymmetricCipherKeyPair? BouncyCastle's AsymmetricCipherKeyPair expects a public and private AsymmetricKeyParameter however I have no way of getting my Private key without it being an instance of AssymetricAlgorithm.


Solution

  • The answer to this lies here:

    Get Private Key from BouncyCastle X509 Certificate? C#