How to call CreateProcessWithLogonW & CreateProcessAsUser in .NET

Hi, welcome back, Sometimes .NET‘s System.Diagnostics.Process class and its Start method are not enough for our purposes and we need to call Win32 API directly from .NET (P/Invoke mechanism) to be able to create a process the way we need. Here you have a sample you might find useful. It includes P/Invoke declarations and usage samples…


SCardGetStatusChange fails with SCARD_E_NO_SERVICE error

Hi, welcome back,   Smart Card Redirection on Microsoft Remote Desktop Protocol (RDP) client 6.0 may cause SCardGetStatusChange to fail with error 0x8010001d – SCARD_E_NO_SERVICE – “The Smart card resource manager is not running.”.   When a user connects from her machine A (i.e. Windows XP SP2) to a remote machine B (i.e. Windows Vista) using Microsoft RDP client,…


Key Containers: Basics

Hi, welcome back, Let’s talk today a bit about Key Containers in CryptoAPI. Key containers can be created in user’s profile or machine’s. User-level key containers can only be used by the user in which profile they’ve been created, and machine-level key containers can be used by anyone with access to them. Keys are usually in…


Smart Card’s PIN gets cached

Hi, welcome back, When we use a Smart Card with any application (i.e. Internet Explorer), the PIN that user inserted to access the card the first time may get cached and not requested again during the live of the application. But what if we need the PIN to be requested everytime we use the card with that application? The Smart…


XmlDsigC14NTransform normalization behavior depends on input type

Hi, welcome back,  When using System.Security.Cryptography.Xml.XmlDsigC14NTransform, depending on the input type (XmlDsigC14NTransform.InputTypes) being passed to its LoadInput method, the result of its GetOutput method could be different: – If we pass a Stream to XmlDsigC14NTransform, it will normalize line feeds from 0xd 0xa (“\r\n”) to 0xa (“\n”) before canonicalization. After canonicalization, we will only see 0xa…


RSACryptoServiceProvider fails when used with ASP.NET

Hi, welcome back, I will talk today about a very common issue we face when we try to use .NET’s RSACryptoServiceProvider class in ASP.NET. When we try to create a new RSACryptoServiceProvider object in this scenario, we may get the following exception: “System.Security.Cryptography.CryptographicException: The system cannot find the file specified”.   By using my CryptoAPI Tracer…