Browse by Tags
All Tags »
CryptoAPI (RSS)
Hi all, When working with RSACryptoServiceProvider , we may get an exception like the following: System.Security.Cryptography. CryptographicException : Unable to open the access token of the current thread at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32
Read More...
Hi all, When using RSACryptoServiceProvider in i.e. ASP.NET you may get the following exception under a heavy load scenario: "System.Security.Cryptography.CryptographicException: CryptoAPI cryptographic service provider (CSP) for this implementation could
Read More...
Hi all, Let's talk a bit about concurrency in CryptoAPI . When calling CryptoAPI from different threads , we have to take into consideration that key handles are not thread safe . The following document describes the threading issues when dealing with
Read More...
Hi all, If you read CryptAcquireContext documentation, you'll see that setting pszContainer to NULL allow us to use a default key container . Microsoft recommends that every application creates its own key container instead of the default one, because
Read More...
Hi all, When we try to access a key container, CryptAcquireContext may return NTE_BAD_KEYSET (or error # 0x80090016 or -2146893802 or "Keyset does not exist") for the following two reasons: 1) key container doesn't exist . You may repeat the call to CryptAcquireContext,
Read More...
Hi all, welcome back, CryptAcquireContext API will fail with error #2 or ERROR_FILE_NOT_FOUND if: 1) the user's profile is not loaded, as we saw in my post RSACryptoServiceProvider fails when used with ASP.NET . 2) AppData registry value in the following
Read More...
Hi all, welcome back, The other day we were using CAPICOM in a client script run in Internet Explorer . We were trying to sign some string with the private key of a certificate we previously installed in the client machine, but we kept getting the error
Read More...
Hi all, welcome back, The other day I had the pleasure to collaborate with my colleague Raffaele Limosani on a CryptoAPI case in Windows Mobile . I don't give technical support to Windows Mobile, and I don't know the specifics on mobile development. He
Read More...
Hi all, welcome back, I recently had some issues involving PKCS#11 interface on Windows, and it seems quite clear that we don't support it, at least on Windows 2000 & Server 2003, and as far as I know on any other version of Windows: Public Key Interoperability
Read More...
Hi all, welcome back, Most of the time we only have a smart card reader in our machine, and we only use one smart card to perform crypto operations. But what if we have several readers and cards , and those cards share the same CSP (Cryptographic Service
Read More...
Hi all, welcome back, Today we'll do some more P/Invoke with CryptoAPI and C# . The following sample is a conversion to C# of the C++ sample in Example C Program: Signing a Message and Verifying a Message Signature : <SAMPLE file="Class1.cs"> using
Read More...
Hi, welcome back, Sorry it took me so long to write a new post. I'm visiting my colleagues at Milano, and I'm horribly busy these days. For Windows platforms, below are the only supported methods we can use to digitally sign Authenticode executables:
Read More...
Hi, welcome back, Today I'm posting a CryptoAPI sample which uses CryptUIWizImport to import a certificate without any user interaction: <SAMPLE Language="C++"> CRYPTUI_WIZ_IMPORT_SRC_INFO importSrc; memset(&importSrc, 0, sizeof(CRYPTUI_WIZ_IMPORT_SRC_INFO));
Read More...
Hi, welcome back, Today I'm posting a sample I did some time ago which shows how to generate key pairs , encrypt and decrypt data with C++ and CryptoAPI . The comments in the code should be self-explanatory. <SAMPLE> // INCLUDES #include "stdio.h"
Read More...
Hi, welcome back, Today I will show how to sign data and verify that signature using CryptoAPI and a certificate from our Personal store. The comments in the code should help to understand it. Remember that this is just a sample, and some more cleanup
Read More...