Welcome to MSDN Blogs Sign in | Join | Help

Decrypt my World

Cryptography, Security, Debugging and more!

News

  • Any of my posts is supported under any Microsoft standard support program or service. They are provided "AS IS" without warranty of any kind, and confer no rights.

Where are my readers?

Locations of visitors to this page

Favorite Posts

Browse by Tags

All Tags » CryptoAPI   (RSS)
Access Violation exception when loading a certificate in .NET (Windows Server 2003)
Hi all You may get an Access Violation exception when loading a certificate into a X509Certificate2 object, only after installing KB 938397 hotfix ( crypt32.dll v5.131.3790.4095 ) at Applications that use the Cryptography API cannot validate an X.509 Read More...
Working with CNG in .NET 3.5
Hi all, Do you want to work with CNG and .NET 3.5 and don't want to P/Invoke into CryptoAPI & CNG API ? Check out Security.Cryptography.dll library at CLR Security : " Security.Cryptography.dll provides a new set of algorithm implementations to augment Read More...
CryptographicException: The data to be decrypted exceeds the maximum for this modulus of 0 bytes
Hi all, Some time ago a customer of mine was getting the following CryptographicException when calling EncryptedXml.DecryptDocument method to decrypt an XmlDocument in their .NET app: [System.Security.Cryptography.CryptographicException] = {" The data Read More...
X509Certificate creates temporary files which are never deleted
Hi all, When creating an X509Certificate object in your .NET application (" X509Certificate cert = new X509Certificate(certBytes); ") you may see that two 0kb files are created in the Temp folder of your Windows Server 2003 , and are never deleted . After Read More...
How to timestamp Authenticode signatures when our proxy requires authentication
Hi all, The other day a customer of mine was trying to add an Authenticode signature with timestamp to their PowerShell scripts with PowerShell itself and its Set-AuthenticodeSignature cmdlet . He was able to sign the scripts just fine, but when using Read More...
How to get information from a CRL (.NET)
Hi all, The following C# sample uses CryptoAPI to read the info of a CRL ( Certificate Revocation List ) stored in a file: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; Read More...
How to create a self-signed certificate with CryptoAPI (C++)
Hi all, The following C++ sample shows how to use CertCreateSelfSignCertificate API to create a self-signed certificate . The private/public key pair will be created in the machine profile and the certificate will be stored in the Trusted Root CA store Read More...
CryptUIDlgViewCertificate installs a CA certificate without my consent
Hi all The other day I posted How to view a certificate programatically (C#) which includes a C# sample that we can use to view a certificate with CryptUIDlgViewCertificate API. This API shows the same dialog that appears when we double-click on the cert Read More...
How to view a certificate programatically (C#)
Hi all, The following C# sample shows a dialog to view a certificate and its properties . This is the same dialog that appears when we double-click on the cert file in Explorer. I'll use CryptUIDlgViewCertificate API and its CRYPTUI_VIEWCERTIFICATE_STRUCT Read More...
SHA-2 support on Windows XP
Hi all, If you try to use any SHA-2 algorithm ( SHA-256, SHA-384 and SHA-512 ) on Windows XP , you may get the following error when using i.e. CryptCreateHash : NTE_BAD_ALGID or -2146893816 or 0x80090008 or "Invalid algorithm specified" . Same algorithms Read More...
CryptSignHash fails with NTE_BAD_KEYSET
Hi all, The other day I worked on the following issue: a customer of mine had developed an ActiveX which they used to sign some data in Internet Explorer . Their signing code was based on CryptoAPI and worked just fine with some certs, but failed with Read More...
How to sign EXE files with an Authenticode certificate (part 2)
Hi all, welcome back, The other day a customer of mine was having an issue with SignTool.exe when signing an EXE file. The EXE file was getting corrupted /unusable after signing it. When troubleshooting this issue, I had the chance to play a bit more Read More...
CryptographicException: Unable to open the access token of the current thread
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...
Threading issues with RSACryptoServiceProvider
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...
Threading issues with CryptoAPI
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...
More Posts Next page »
Page view tracker