Sign in
Decrypt my World
Cryptography, Security, Debugging and more!
MSDN Blogs
>
Decrypt my World
Search
Options
About
RSS for posts
Atom
RSS for comments
OK
Disclaimer, Maps & Favorite Posts
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?
Favorite Posts
Do you need help right now?
CryptoAPI Tracer script
MANAGED DEBUGGING with WINDBG. Introduction and Index
Tags
ADSI
CAPICOM
CertEnroll
CNG
CryptAcquireContext
CryptoAPI
Debugger scripts
Debugging
NT Services
P/Invoke
PowerShell
RSACryptoServiceProvider
SCard API
Smart Card
System.DirectoryServices
System.Security
VBScript
WinDbg
Windows 7
Windows SDK
Windows Server 2003
Windows Server 2008
Windows Vista
Windows XP
WMI
Archive
Archives
July 2012
(1)
May 2012
(1)
April 2012
(6)
March 2012
(2)
January 2012
(1)
November 2011
(12)
September 2011
(5)
June 2011
(1)
May 2011
(2)
April 2011
(1)
March 2011
(3)
February 2011
(6)
January 2011
(2)
December 2010
(5)
October 2010
(8)
September 2010
(1)
August 2010
(8)
July 2010
(3)
June 2010
(2)
May 2010
(4)
April 2010
(3)
March 2010
(4)
February 2010
(2)
January 2010
(5)
December 2009
(6)
November 2009
(2)
October 2009
(3)
September 2009
(5)
August 2009
(13)
July 2009
(8)
June 2009
(2)
May 2009
(7)
April 2009
(3)
March 2009
(2)
February 2009
(3)
January 2009
(3)
December 2008
(3)
November 2008
(2)
October 2008
(4)
September 2008
(4)
August 2008
(3)
July 2008
(3)
June 2008
(7)
May 2008
(6)
April 2008
(7)
March 2008
(10)
February 2008
(3)
January 2008
(4)
December 2007
(6)
November 2007
(4)
October 2007
(4)
Share this blog with others!!!
My Twitter (http://twitter.com/alejacma)
RSS
http://twitter.com/statuses/user_timeline/174391821.rss
Posts
Subscribe via RSS
Sort by:
Most Recent
|
Most Views
|
Most Comments
Excerpt View
|
Full Post View
Decrypt my World
How to clean up expired certs on your smart card
Posted
over 5 years ago
by
Alejandro Campos Magencio
1
Comments
Hi all, The other day a colleague of mine was trying to renew his smart card certificate, but he got an error telling him that there was not enough space in the card to store the new cert. So he asked me: Alex, how can I delete a certificate from my...
Decrypt my World
RSACryptoServiceProvider.Encrypt returns "Key not valid for use in specified state" error
Posted
over 5 years ago
by
Alejandro Campos Magencio
2
Comments
Hi all, When executing RSACryptoServiceProvider.Encrypt method (see How to generate key pairs, encrypt and decrypt data with .NET (C#) for an example), you may get a System.Security.Cryptography.CryptographicException . According to MSDN , this is...
Decrypt my World
How to generate key pairs, encrypt and decrypt data with .NET (C#)
Posted
over 5 years ago
by
Alejandro Campos Magencio
7
Comments
Hi all, The other day a colleague of mine asked me if I had a .NET version of the C++ sample in How to generate key pairs, encrypt and decrypt data with CryptoAPI post. C++ sample calls CryptoAPI directly (and you know we can do the same thing in ...
Decrypt my World
Something has changed in my life
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, Sorry I haven't been able to write anything for a few weeks. I've been on vacation + paternity leave... Paternity leave! Yes, I'm a father now! My son Nicolas was born on Sept 11th, 2008, and he's taken pretty much all my free time since. WELCOME...
Decrypt my World
The use of MSXML is not supported in .NET applications
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, The other day I was working with a customer of mine on a .NET application which was suffering from a memory leak . The weird thing was that the application could run just fine for 10 days in a row before the memory began growing and growing...
Decrypt my World
How to get assembly version without loading it
Posted
over 5 years ago
by
Alejandro Campos Magencio
11
Comments
Hi all, The other day I was trying to add a simple autoupdate functionality to a little tool I developed, and I needed to check the version of current assembly against the udpated one. If current assembly was older than the updated one, I needed to...
Decrypt my World
How to create a certificate request with CertEnroll and .NET (C#)
Posted
over 5 years ago
by
Alejandro Campos Magencio
86
Comments
Hi all, The following C# sample shows how to use CertEnroll COM component to create a certificate request , send the request to the CA , get the response from the CA , and install the new certificate in the machine: (Note that this sample is a WinForms...
Decrypt my World
FileNotFoundException when using XEnroll in ASP.NET
Posted
over 5 years ago
by
Alejandro Campos Magencio
3
Comments
Hi all, If you ever try to use XEnroll.dll in your ASP.NET application (through Interop.XENROLLLib.dll , of course), you may face an issue like the following: Your ASP.NET app impersonates the client user and tries to make a certificate request...
Decrypt my World
How to debug Windows services with Windbg
Posted
over 5 years ago
by
Alejandro Campos Magencio
1
Comments
Hi all, If you want to know how to debug a Windows service , the following article will be of great assistance: How to debug Windows services . I suggest you read this article before you continue reading this post. Also, you should have Debugging Tools...
Decrypt my World
How to get more than 1000 group members including foreign SAMs (VBScript)
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, We may have a group in our Active Directory with members from a foreign domain . We may try to retrieve all those members with ADSI and a code like this: Using IADs::GetInfoEx for Range Retrieval . The issue with this code is that we will only...
Decrypt my World
How to modify an Interop assembly to change the return type of a method (VB.NET)
Posted
over 5 years ago
by
Alejandro Campos Magencio
3
Comments
Hi all, In some situations we may need to reference a COM dll in our Visual Studio project in order to use a specific COM object within our .NET application, and thanks to COM Interop we can do it. When we add a reference to a COM dll in our project...
Decrypt my World
CryptographicException: Unable to open the access token of the current thread
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
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...
Decrypt my World
How to use DHeapMon.exe to troubleshoot Desktop Heap issues
Posted
over 5 years ago
by
Alejandro Campos Magencio
10
Comments
Hi all, The other day I had to troubleshoot an issue with a process that a specific Windows service was trying to launch without success. We could see with a debugger (i.e. WinDbg) that the new process was actually being created but it exited before...
Decrypt my World
How to use Windbg to debug a dump of a 32bit .NET app running on a x64 machine
Posted
over 5 years ago
by
Alejandro Campos Magencio
7
Comments
Hi all, Imagine we are running a 32bit .NET app in a x64 machine . This app is failing so we have taken a memory dump of the app when a specific CLR exception gets raised. We open the dump with our 64bit version of Windbg ( Windbg x64 ), and we...
Decrypt my World
Threading issues with RSACryptoServiceProvider
Posted
over 5 years ago
by
Alejandro Campos Magencio
2
Comments
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...
Decrypt my World
Threading issues with CryptoAPI
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
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...
Decrypt my World
Security Warning dialog box is displayed when you try to silently install a hotfix or an update
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, You may be trying to install a hotfix or update silently , but you keep getting a security warning dialog because the file was downloaded from the Internet . The following article explains this situation: 889815 The Open File - Security Warning...
Decrypt my World
How to Sign and Verify the signature with .NET and a certificate (C#)
Posted
over 5 years ago
by
Alejandro Campos Magencio
17
Comments
Hi all, Today I'm posting a sample which shows how to sign a text with a certificate in my Personal store (this cert will have public and private key associated to it) and how to verify that signature with a .cer file (for i.e. WinForms) applications...
Decrypt my World
System.DirectoryServices.DirectorySynchronization returns access denied with non-admin users
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, You may get an Access Denied error ( COMException 0x80070005 ) when using System.DirectoryServices.DirectorySynchronization in your .NET application with a non-admin user , but everything works fine with a domain administrator. This issue...
Decrypt my World
WMI Diag won't work well in non-English Windows
Posted
over 5 years ago
by
Alejandro Campos Magencio
2
Comments
Hi all, If you ever use WMI Diag script ( The WMI Diagnosis Utility -- Version 2.0 ) on a non-English version of Windows (i.e. Spanish , French, Italian, German...), you will get tons of errors when the script checks out default permissions on WMI...
Decrypt my World
How to verify if password meets complexity requirements programmatically
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
Hi all, Some customers asked me in the past if there was any API to verify if a password meets Windows complexity requirements . Unfortunately there is no such API. We could implement our own if we know the requirements of the password filter used...
Decrypt my World
Don't use default key containers if possible
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
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...
Decrypt my World
CryptAcquireContext fails with NTE_BAD_KEYSET
Posted
over 5 years ago
by
Alejandro Campos Magencio
2
Comments
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...
Decrypt my World
Who has access to a folder? (C#)
Posted
over 5 years ago
by
Alejandro Campos Magencio
3
Comments
Hi all, welcome back, The following .NET 2.0 sample shows how to get security info from a folder to find out the permissions for users/groups on it: using System; using System.IO; using System.Security.AccessControl; using System.Security.Principal;...
Decrypt my World
CryptAcquireContext fails with ERROR_FILE_NOT_FOUND
Posted
over 5 years ago
by
Alejandro Campos Magencio
0
Comments
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...
Page 7 of 9 (215 items)
«
5
6
7
8
9
Translate This Page
Translate this page
Powered by
Microsoft® Translator