Questions tagged [cryptoapi]

Cryptography API: Application programming interface that enables application developers to add authentication, encoding, and encryption to Windows-based applications. The API are oriented on the developer of unmanaged (native) applications in C/C++.

Cryptography API: Application programming interface that enables application developers to add authentication, encoding, and encryption to Windows-based applications. The API are oriented on the developer of unmanaged (native) applications in C/C++.

Microsoft cryptographic technologies include CryptoAPI, Next Generation (CNG), Cryptographic Service Providers (CSP), CryptoAPI Tools, CAPICOM, WinTrust, issuing and managing certificates, and developing customizable public key infrastructures. Certificate and smart card enrollment, certificate management, and custom module development are also described.

636 questions
4
votes
1 answer

Adding Response from TSA to CRYPT_SIGN_MESSAGE_PARA for CryptSignMessage (c++, Crypto Api)

I'm struggling how must I add the response from a TSA server to my CryptSignMessage? Using PKCS#7. I currently have my message digest and I successfully sign it with CryptSignMessage from crypto api. Like so: // Initialize the signature…
Magda
  • 201
  • 3
  • 10
4
votes
1 answer

Private key security in windows certificate store

When I import a public/private pair into windows certificate store, Windows does not require any password of any kind to encrypt the keys. From that I conclude that if it is a user's store, it uses the user's password (or probably the user's hashed…
TCS
  • 5,790
  • 5
  • 54
  • 86
4
votes
1 answer

WinHttp: How to use a temporary certificate store?

I have a C++ application that makes a HTTPS connection to one of our servers. In my ideal world, I would like the following to occur: App Starts App makes Windows trust the server's root CA (no GUI please, just system calls) App talks to server,…
j w
4
votes
1 answer

Difference between Exchange key and Signing key in Crypto API

In the .NET crypto API, I noticed that the CspParameters object has a KeyNumber property that can be used to specify if the key should be a signing key or an exchange key. Is there any real difference between the two as far as RSA keys are…
Eric Petroelje
  • 59,820
  • 9
  • 127
  • 177
4
votes
1 answer

How to export certificate from Windows certificate store via CryptoAPI as Base64 string

i've got following C# code for doing what i asked for in subject: public static void ExportCertificatesToFile(string FileName) { stringBuilder builder = new StringBuilder(); X509Store storeMy = new X509Store(StoreName.My); …
Action Heinz
  • 722
  • 10
  • 23
4
votes
1 answer

How do I export a HCRYPTKEY or PRIVATEKEYBLOB to a PFX file

I have a previously generated RSA private signing key, which is stored as a PRIVATEKEYBLOB. I am trying to move this into a new certificate for better management of the key. How do I take this blob and turn it into a .pfx certificate? I have a…
redwyre
  • 1,108
  • 10
  • 23
4
votes
2 answers

WinAPI -> CryptoAPI -> RSA, encrypt with private, decrypt with public

Good day. I need to teach Windows CryptoAPI to encrypt the message with private (not public) part of the key, and decrypt with public. This is necessary to give users information, that they can read, but can't change. How it works now: I get the…
TheHorse
  • 2,787
  • 1
  • 23
  • 32
4
votes
1 answer

Secure StringSinks

So it seems that the common way to use algorithms in Crypto++ is to use StringSinks, which are initiated by passing a reference to a std::string. But what if you don't want to use std::string because of security issues? Is it possible to get the…
kamziro
  • 7,882
  • 9
  • 55
  • 78
3
votes
1 answer

MS CryptoAPI doesn't work on Windows XP with CryptAcquireContext()

I wrote some code using the Microsoft CryptoAPI to calculate a SHA-1 and got the compiled exe working on Windows 7, Win Server 2008, Win Server 2003. However, when I run it under Windows XP SP3, it does not work. I narrowed down the failure to…
JasDev
  • 726
  • 6
  • 13
3
votes
1 answer

CSP Provider Name

how can I get CSP provider name of my connected smartcard? I couldn't access to registry windows so I'm find some way to achieve that information through win API. I've already seen something about SCardGetCardTypeProviderName but it seems…
bit
  • 934
  • 1
  • 11
  • 32
3
votes
7 answers

is cryptoapi good?

i'm writing a crypto program that does stuff like hashing (sha1), encryption, digital signatues for win32 in c++ is built in cryptoapi secure, or should i use some other library like crypto++ i need maximum security and works on all systems xp and…
Alie Komoc
3
votes
1 answer

Hard coded AES-256 key with WinCrypt & CryptImportKey

I need to have a Win32 application load a hard coded AES-256 key, ideally using the WinCrypt.h methods. I've got my key in an unsigned char[32] but I can't find the correct format of a key blob to pass to CryptImportKey. Everything seems to give me…
Trevor
  • 719
  • 1
  • 6
  • 15
3
votes
0 answers

Why does my CryptDecrypt fail with error code 0x80090005 (NTE_BAD_DATA)?

I wrote this piece of code to decrypt a given cipher using a given key and iv. It works fine until CryptDecrypt which returns false and GetLastError() returns 0x80090005 (which should be NTE_BAD_DATA). #include #include…
Francesco Boffa
  • 1,402
  • 1
  • 19
  • 35
3
votes
1 answer

How to create "Certificate Signing Request" run on all version of window using Xenroll and CertEnroll?

I have project must create Certificate Signing Request (CSR), then i use Xenroll api. But the problem is when i use Xenroll.dll (supported in Window XP) but when in window vista and new version of window, this DLL reconstructed and rename to…
tandaica0612
  • 369
  • 10
  • 23
3
votes
1 answer

Getting certificate chain to a private root

I'm trying to verify that the certificate from a signature chains back to a particular root certificate, which is not trusted by Windows (it's a private certificate for the app). My current attempt to do this involves creating a chaining engine…
Miral
  • 12,637
  • 4
  • 53
  • 93