-
Notifications
You must be signed in to change notification settings - Fork 55
Home
Most of the API is modeled after the WinRT crypto API. If you're familiar with that, you'll immediately feel at home with PCLCrypto. Instead of reusing the Windows.Security.Cryptography
namespace, PCLCrypto functionality is available through the PCLCrypto.WinRTCrypto
class.
In some cases, a .NET Framework API is emulated, which is available under the PCLCrypto.NetFxCrypto
class.
API documentation: C# recipes
Crypto is hard to ramp up to. If your code isn't "just right" you often get useless or (worse) misleading error messages from the crypto APIs. The docs you find in this wiki are not meant to be complete copy-and-paste samples. They are only meant to illustrate what is unique about calling crypto when using this library. To learn how to write crypto code (pick algorithms, key sizes, store keys safely, and general security guidance), look elsewhere. There are many web sites that offer guidance and documentation for how to make these decisions.
One technique that can often be useful if you're struggling with PCLCrypto: write your crypto against WinRT directly first. Just spin up a WinRT app, use Microsoft's WinRT crypto documentation to help you. When you have it working, copy and paste the code into your PCL library that references PCLCrypto. It should very nearly "just work" (particularly if you follow the guidance in the project readme regarding the c# 6 using
statement).