cryptoapi

Do any replacements for CryptoAPI exist for Windows?

I am having major problems with cryptoAPI, and was wondering do you get any 3rd party / better solutions for windows? Main problem I have with CryptoAPI is that its not OS independent enough. I can't find the right balance in my code to get stuff to work on Windows 2003 and Windows 2008+. What I essentially want to achieve can be read...

EMail Signing (Outlook) Using Smartcard Minidriver [Windows]

Hi I'm developing a Smart card Minidriver and I'm trying to Sign an Email using Outlook 2007. I have implemented all of the necessary functions in the minidriver. I'm able to create a "Smartcard User" certificate and save it and it's private key on the smartcard (using Microsoft Certificate Services via the Minidriver). When I try to...

How Can I Generate Equivalent Output Using the CryptoAPI and the .NET Encryption (TripleDESCryptoServiceProvider)?

I have some C#/.NET code that encrypts and decrypts data using TripleDES encryption. It sticks to the sample code provided at MSDN pretty closely. The encryption piece looks like the following: TripleDESCryptoServiceProvider _desProvider = new TripleDESCryptoServiceProvider(); //bytes for key and initialization vector //ke...

Using an SHA1 with Microsoft CAPI

I have an SHA1 hash and I need to sign it. The CryptSignHash() method requires a HCRYPTHASH handle for signing. I create it and as I have the actual hash value already then set it: CryptCreateHash(cryptoProvider, CALG_SHA1, 0, 0, &hash); CryptSetHashParam(hash, HP_HASHVAL, hashBytes, 0); The hashBytes is an array of 20 bytes. However...

Howto take a glimpse into mscorlib?

Hi all! I want to read data into RSAParameters structure ( RSAParameters ) and did check twice, that the data is correct. But still, I get an error "invalid data" exception for this: bei System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) bei System.Security.Cryptography.Utils._ImportKey(SafeP...

CryptStringToBinary not working with a NULL terminated string. Why?

Hello everybody, does anyone know why this code is not working? #include "stdafx.h" #include <windows.h> #include <WinCrypt.h> int _tmain(int argc, _TCHAR* argv[]) { wchar_t *bin = TEXT("ProductID:1233===>55555"); BYTE out2[1000]; DWORD olen; olen = 1000; if (CryptStringToBinary(bin, 0, 1, out2, &olen, 0, 0) == 0) { wprintf(TEXT...

assigning / validation of signature using RSA (PKCS 7)

Any suggestions for simple and fast library for assigning / validation of signature using RSA Cryptographic Messaging Operations (PKCS#7)? ...

How to generate an HMAC in Java equivalent to a Python example?

I'm looking at implementing an app getting Twitter authorization via Oauth in Java. The first step is getting a request token. Here is a Python example for app engine. To test my code, I am running Python and checking output with Java. Here is an example of Python generating a Hash-Based Message Authentication Code (HMAC): #!/usr/bin...

Trying to perform a Diffie Hellman Key exchange, using Win32 CAPI, in C#; can anyone provide a step-by-step guide

Hi, I'm trying to build some code that will switch between the old CAPI or the new CNG-based Diffie-Hellman algorithms. (Despite documentation, the new ECC-based DH algorithm, as part of CNG, is not supported on Windows XP). Anyway, I've begun exposing the Win32 CAPI, as follows: public static class CAPI { private static int ALG_...

SUBMIT certificate request - outside domain

Hello I need to submit a PKCS#10 certificate request to a certificate authority who is outside my domain. This article in MSDN shows a way to submit certificate requests within a network using ICertRequest2 COM object. hr = CertRequest->Submit( CR_IN_ENCODEANY | CR_IN_FORMATANY, RequestStr, AttributesStr, CANa...

Getting exception when calling CryptGetKeyParam

I'm trying to use the CryptoAPI (CAPI) to perform a Diffie Hellman Key Exchange. I'm using the MSDN documentation. // Step 0) Acquire context if (!CAPI.CryptAcquireContext(ref this._cryptographicProvider, null, null, CAPI.PROV_DSS_DH, CAPI.CRYPT_VERIFYCONTEXT)) HandleWin32Error("Unable to acquire cryptographi...

Need help wih CryptDecrypt function...

I've created this program that can encrypt a found file and then it can be decrypted later via the CryptDecrypt function. The function succeeds but instead of decrypting the file back to plain text it makes the file look even more encrypted. I've put both the CryptEncrypt function and CryptDecrypt function so you can have a more less vie...

MS CSP: Difference between AT_SIGNATURE and RSA_KEY_SIGN (and also AT_KEYEXCHANGE and CALG_RSA_KEYX)

I'm writing CSP library (for CryptoAPI) for smartcards my company sells. I have question about difference between AT_SIGNATURE key type and CALG_RSA_SIGN algorithm for private key (the same also for AT_KEYEXCHANGE and CALG_RSA_KEYX). I know what is written on MSDN site, but how specifically CSP DLL should work if either of CALG_RSA......

Get access to specific ADPU functions from cryptoApi or CAPICOM using 3rd party CSP

I have tried for the last 2 months without success and I think it's time I ask here. I have a smart card and got a CSP from my client. I have documents that describe APDU commands that I can (and know how to) run. I need to save small files (data) to the card like name, address, photo etc. And later on save certificates. In the docume...

How do I force makecert to output the private key to a file (not the Crypto store)?

I want to generate a key pair for use within my applications, but exporting them manually from the mmc is a pain. How can I use commandline parameters, or otherwise end up with a private certificate that resides on the hard drive, suitable for later distribution? ...

how to use CryptoAPI in the linux kernel 2.6

I have been looking for some time but have not found anywhere near sufficient documentation / examples on how to use the CryptoAPI that comes with linux in the creation of syscalls / in kernel land. If anyone knows of a good source please let me know, I would like to know how to do SHA1 / MD5 and Blowfish / AES within the kernel space o...

How can I import an RSA public key from either XML or modulus/exponent in native code for use with Windows CAPI's CryptVerifySignature?

In C#, I am able to validate a hash against a public key in either of the following ways: // Import from raw modulus and exponent using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider()) { RSAParameters rsaKeyInfo = new RSAParameters {Modulus = modulus, Exponent = exponent}; rsa.ImportParameters(rsaKeyInfo); ret...

Best way to create a cryptographic API key

Hi, I have an open API in my application that I'd like to provide access key's for. The incoming info will be a user id, resource id and a value to update with. I'd like one API key per resource. Preferably I would like to be able to validate the authenticity of an incoming request using only the supplied data and not checking against...