Share via


Decrypt my World

Cryptography, Security, Debugging and more!

How to clean up expired certs on your smart card

Hi all, The other day a colleague of mine was trying to renew his smart card certificate, but he got...

Author: Alejandro Campos Magencio Date: 10/30/2008

RSACryptoServiceProvider.Encrypt returns "Key not valid for use in specified state" error

Hi all, When executing RSACryptoServiceProvider.Encrypt method (see How to generate key pairs,...

Author: Alejandro Campos Magencio Date: 10/23/2008

How to generate key pairs, encrypt and decrypt data with .NET (C#)

Hi all, The other day a colleague of mine asked me if I had a .NET version of the C++ sample in How...

Author: Alejandro Campos Magencio Date: 10/23/2008

Something has changed in my life

Hi all, Sorry I haven't been able to write anything for a few weeks. I've been on vacation +...

Author: Alejandro Campos Magencio Date: 10/23/2008

How to get assembly version without loading it

Hi all, The other day I was trying to add a simple autoupdate functionality to a little tool I...

Author: Alejandro Campos Magencio Date: 09/05/2008

How to create a certificate request with CertEnroll and .NET (C#)

Hi all, The following C# sample shows how to use CertEnroll COM component to create a certificate...

Author: Alejandro Campos Magencio Date: 09/05/2008

FileNotFoundException when using XEnroll in ASP.NET

Hi all, If you ever try to use XEnroll.dll in your ASP.NET application (through...

Author: Alejandro Campos Magencio Date: 09/02/2008

How to debug Windows services with Windbg

Hi all, If you want to know how to debug a Windows service, the following article will be of great...

Author: Alejandro Campos Magencio Date: 08/19/2008

How to get more than 1000 group members including foreign SAMs (VBScript)

Hi all, We may have a group in our Active Directory with members from a foreign domain. We may try...

Author: Alejandro Campos Magencio Date: 08/05/2008

How to modify an Interop assembly to change the return type of a method (VB.NET)

Hi all, In some situations we may need to reference a COM dll in our Visual Studio project in order...

Author: Alejandro Campos Magencio Date: 08/04/2008

CryptographicException: Unable to open the access token of the current thread

Hi all, When working with RSACryptoServiceProvider, we may get an exception like the...

Author: Alejandro Campos Magencio Date: 07/30/2008

How to use DHeapMon.exe to troubleshoot Desktop Heap issues

Hi all, The other day I had to troubleshoot an issue with a process that a specific Windows service...

Author: Alejandro Campos Magencio Date: 07/29/2008

How to use Windbg to debug a dump of a 32bit .NET app running on a x64 machine

Hi all, Imagine we are running a 32bit .NET app in a x64 machine. This app is failing so we have...

Author: Alejandro Campos Magencio Date: 07/18/2008

Threading issues with RSACryptoServiceProvider

Hi all, When using RSACryptoServiceProvider in i.e. ASP.NET you may get the following exception...

Author: Alejandro Campos Magencio Date: 06/30/2008

Threading issues with CryptoAPI

Hi all, Let's talk a bit about concurrency in CryptoAPI. When calling CryptoAPI from different...

Author: Alejandro Campos Magencio Date: 06/30/2008

Security Warning dialog box is displayed when you try to silently install a hotfix or an update

Hi all, You may be trying to install a hotfix or update silently, but you keep getting a security...

Author: Alejandro Campos Magencio Date: 06/27/2008

How to Sign and Verify the signature with .NET and a certificate (C#)

Hi all, Today I'm posting a sample which shows how to sign a text with a certificate in my Personal...

Author: Alejandro Campos Magencio Date: 06/25/2008

System.DirectoryServices.DirectorySynchronization returns access denied with non-admin users

Hi all, You may get an Access Denied error (COMException 0x80070005) when using...

Author: Alejandro Campos Magencio Date: 06/20/2008

WMI Diag won't work well in non-English Windows

Hi all, If you ever use WMI Diag script (The WMI Diagnosis Utility -- Version 2.0) on a non-English...

Author: Alejandro Campos Magencio Date: 06/10/2008

How to verify if password meets complexity requirements programmatically

Hi all, Some customers asked me in the past if there was any API to verify if a password meets...

Author: Alejandro Campos Magencio Date: 06/09/2008

Don't use default key containers if possible

Hi all, If you read CryptAcquireContext documentation, you'll see that setting pszContainer to NULL...

Author: Alejandro Campos Magencio Date: 05/28/2008

CryptAcquireContext fails with NTE_BAD_KEYSET

Hi all, When we try to access a key container, CryptAcquireContext may return NTE_BAD_KEYSET (or...

Author: Alejandro Campos Magencio Date: 05/27/2008

Who has access to a folder? (C#)

Hi all, welcome back, The following .NET 2.0 sample shows how to get security info from a folder to...

Author: Alejandro Campos Magencio Date: 05/26/2008

CryptAcquireContext fails with ERROR_FILE_NOT_FOUND

Hi all, welcome back, CryptAcquireContext API will fail with error #2 or ERROR_FILE_NOT_FOUND if: 1)...

Author: Alejandro Campos Magencio Date: 05/22/2008

How to read certificate extensions with CAPICOM (C#)

Hi all, welcome back, I recently had a customer who needed to retrieve extensions from certificates...

Author: Alejandro Campos Magencio Date: 05/19/2008

How to get Antivirus information with WMI (VBScript)

Hi all, welcome back, As we read in Windows Security Center – Managing the State of Security, the...

Author: Alejandro Campos Magencio Date: 05/12/2008

ChangePassword method may fail with TargetInvocationException (.NET)

Hi all, welcome back, When working with System.DirectoryServices.DirectoryEntry in .NET, we may...

Author: Alejandro Campos Magencio Date: 04/29/2008

How to get a list of all users in an OU (VBScript)

Hi all, welcome back, Today I'll post a very straight forward sample which gets a list of all users...

Author: Alejandro Campos Magencio Date: 04/23/2008

DpapiProtectedConfigurationProvider fails while decrypting web.config (ASP.NET)

Hi, welcome back, The other day we faced a very similar issue to the one I commented on this post:...

Author: Alejandro Campos Magencio Date: 04/21/2008

Certificate has private key but we get "the keyset does not exist" error

Hi all, welcome back, The other day we were using CAPICOM in a client script run in Internet...

Author: Alejandro Campos Magencio Date: 04/18/2008

How to read a registry key and its values (VBScript)

Hi all, welcome back, Today I'll share with you a couple of VBScript samples I developed the other...

Author: Alejandro Campos Magencio Date: 04/11/2008

Win32_Process.Create fails if user profile is not loaded

Hi all, welcome back, The other day I worked on an issue which happened when using WMI method...

Author: Alejandro Campos Magencio Date: 04/09/2008

How to Encrypt and Decrypt with CryptoAPI and a user Certificate (Windows Mobile)

Hi all, welcome back, The other day I had the pleasure to collaborate with my colleague Raffaele...

Author: Alejandro Campos Magencio Date: 04/04/2008

How to get ADs Providers list (C#)

Hi, welcome back, We may want to get the list of Active Directory Providers ("LDAP:", "WinNT:",...

Author: Alejandro Campos Magencio Date: 03/25/2008

How to get Password Expiration Date with System.DirectoryServices (C#)

Hi, welcome back, You may want to get Password Expiration Date for a given user with...

Author: Alejandro Campos Magencio Date: 03/25/2008

CAPICOM Security Alerts are not localized

Hi all, welcome back, When we use CAPICOM, we may get some messages like the following: Security...

Author: Alejandro Campos Magencio Date: 03/24/2008

How to change the Security Descriptor of WMI objects

Hi all, welcome back, You may want to give users or groups access to perform read/modify WMI...

Author: Alejandro Campos Magencio Date: 03/13/2008

How to change Registry Permissions with RegIni.exe (VBScript)

Hi all, welcome back, Today I'll show how we can set the following permissions on a registry key...

Author: Alejandro Campos Magencio Date: 03/11/2008

How to get the user running a VBScript

Hi all, welcome back, It's very easy to find out the user name and the domain name of the user...

Author: Alejandro Campos Magencio Date: 03/11/2008

CAPICOM support on Windows Server 2008

Hi all, welcome back, If you remember all the confusion there was regarding CAPICOM support on...

Author: Alejandro Campos Magencio Date: 03/06/2008

PKCS#11 interface support on Windows 2000/Server 2003

Hi all, welcome back, I recently had some issues involving PKCS#11 interface on Windows, and it...

Author: Alejandro Campos Magencio Date: 03/06/2008

How to get the logged on user with WMI (VBScript)

Hi all, welcome back, From time to time I get to do some scripting, play with LDAP/ADSI, WMI, etc....

Author: Alejandro Campos Magencio Date: 03/04/2008

How to select which Smart Card reader to perform actions on

Hi all, welcome back, Most of the time we only have a smart card reader in our machine, and we only...

Author: Alejandro Campos Magencio Date: 03/03/2008

How to sign a message and verify a message signature (C#)

Hi all, welcome back, Today we'll do some more P/Invoke with CryptoAPI and C#. The following sample...

Author: Alejandro Campos Magencio Date: 02/21/2008

How to sign EXE files with an Authenticode certificate (VB.NET)

Hi, welcome back, Sorry it took me so long to write a new post. I'm visiting my colleagues at...

Author: Alejandro Campos Magencio Date: 02/20/2008

How to sign an XML and verify the signature with .NET (VB.NET)

Hi all, Today I'm posting a sample which signs an XML with or without a certificate (PFX file) and...

Author: Alejandro Campos Magencio Date: 02/07/2008

How to import a certificate without user interaction (C++ & C#)

Hi, welcome back, Today I'm posting a CryptoAPI sample which uses CryptUIWizImport to import a...

Author: Alejandro Campos Magencio Date: 01/31/2008

How to generate key pairs, encrypt and decrypt data with CryptoAPI

Hi, welcome back, Today I'm posting a sample I did some time ago which shows how to generate key...

Author: Alejandro Campos Magencio Date: 01/28/2008

How to sign and verify with CryptoAPI and a user certificate

Hi, welcome back, Today I will show how to sign data and verify that signature using CryptoAPI and a...

Author: Alejandro Campos Magencio Date: 01/23/2008

<Previous Next>