Search code examples
c#encryptioncryptographybouncycastlecryptoapi

When should I use CryptoAPI vs System.Security.Cryptography vs Bouncycastle?


From what I can tell BouncyCastle & System.Security.Cryptography provides ability to do high level tasks while CryptoAPI is somewhat lower level.

I'm told BouncyCastle is not FIPS compliant, while CryptoAPI allows for this. Is this true?

When should I use one over the other?


Solution

  • If you want access to platform services (like system trust settings and access to smart cards and other hardware crypto devices exposed via CryptoAPI) you should use CAPI or something that supports using CAPI keys (System.Security.Cryptography suggets it by name but I don't know much about C#/.NET)

    I don't know if BC provides access to CAPI keys or not. If you envision your solution would need it, use CAPI. I assume that your application will not be portable (because of c#) so I'd suggest you use CAPI (or System.Security.Cryptography if it relies on CAPI, which all microsoft provided API-s should do)