Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Pkcs11Interop code samples

Pkcs11Interop source code contains unit tests covering all methods of PKCS#11 API. Unit tests are documented and they also serve as official code samples.

WARNING: Our documentation and code samples do not cover the theory of security/cryptography or the strengths/weaknesses of specific algorithms. You should always understand what you are doing and why. Please do not simply copy our code samples and expect it to fully solve your usage scenario. Cryptography is an advanced topic and one should consult a solid and preferably recent reference in order to make the best of it.

Note: New objects/keys with "Pkcs11Interop" label are created/generated for every test method that needs to work with objects. They are always deleted at the end of the test method but they might not when the test fails. Any left-over objects with "Pkcs11Interop" label can be safely deleted e.g. with Pkcs11Admin application.

Following source files contains artifacts reused in all unit tests:

  • Source file: Settings.cs
    Static class with general test settings such as path to unmanaged PKCS#11 library, PINs etc.

  • Source file: HighLevelAPI/Helpers.cs
    Static class with utility methods that help to increase the readability of unit tests.

Following source files contain valuable code samples: