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
3
votes
0 answers

CertFindCertificateInStore fails with Oject or property not found

Actually i am searching certificate on the basis of common name. For that we have done :- PSTR pszCommonName = "cn.com"; CERT_RDN_ATTR certRDNAttr[1]; certRDNAttr[0].pszObjId = szOID_COMMON_NAME; certRDNAttr[0].dwValueType =…
User1234
  • 1,543
  • 4
  • 22
  • 32
3
votes
1 answer

CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b

I realize this is a very similar post to others (e.g. this one), but there are details missing from the posts which might be significant for my case. To start with, here's my simplified program: #include "stdafx.h" #include #include…
rguilbault
  • 553
  • 1
  • 5
  • 17
3
votes
1 answer

Trying to perform a Diffie Hellman Key exchange, using Win32 API in C#

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…
CPKB
  • 31
  • 2
3
votes
1 answer

MSDN C example program for signing a hash and verifying the hash signature doesn't work

I've tried out the sample program at MSDN that demonstrates how a hash can be signed and a hash signature verified. But when I execute the program, I get the following output: CSP context acquired. An error occurred in running the program. Error…
3
votes
1 answer

How do I load an OpenSSL-generated RSA1024 plaintext public key with the CryptoAPI?

I generated a public key using OpenSSL with the following commands to create a 1024bit RSA key, and then export the public key, giving me the public key in a .pem file. > openssl genrsa -out private_key.pem 1024 > openssl rsa -pubout -in…
David
  • 13,360
  • 7
  • 66
  • 130
3
votes
0 answers

"Windows-MY" Keystore won't list all available aliases

I have a problem listing all available certificates installed in my personal (windows) keystore. I use following code to get a list of all certificate aliases: public static void main(String[] args) { try { KeyStore ks =…
The Raven
  • 527
  • 1
  • 6
  • 31
3
votes
0 answers

How do I generate a SHA256withRSA signature with the Windows CryptoAPI?

I need to sign some data with the SHA256withRSA algorithm (RSASSA-PKCS1-V1_5-SIGN with SHA-256 hash function) in Windows, and I'm having some validation errors. I was wondering if anyone has experience trying to do it. The summary of what I'm…
Kian
  • 1,654
  • 1
  • 14
  • 22
3
votes
2 answers

Unable to sign with RSA-Sha256. Is the WatchData CSP not a CNG (Cryptography API: Next Generation) Provider?

I am trying to sign using a certificate in a WatchData USB token. I use the Microsoft CryptoAPI function CryptSignMessage. If I specifiy sha1 as the Hashing Algorithm for the signing, then it succeeds. However this fails with an "Internal Error has…
user93353
  • 13,733
  • 8
  • 60
  • 122
3
votes
0 answers

CryptAcquireContext failing with ERROR_FILE_NOT_FOUND (2L) when user not logged on Windows 8.1

I am having a hard time migrating a C++ CryptoAPI-based application that currently runs on Windows Server 2008 to Windows 8.1. The scenario is: This application is eventually triggered by WatchDog.exe, which in its turn is triggered when the…
Dan
  • 51
  • 4
3
votes
1 answer

Testing MS-CAPI CSP, signature fails even with WinDbg kernel debugging

Trying to test a new CSP under Win 7. Set the boot config to allow kernel debug, run WndDbg and select file:kernel debug and set to local. Attempting to use signtool with my new CSP still results in signature failure check. Environment is: OS…
3
votes
5 answers

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…
JL.
  • 78,954
  • 126
  • 311
  • 459
3
votes
3 answers

CryptoAPI returns incorrect result for HMAC_SHA1

I'm using the code below with the Crypto API and I'm not getting the results I would expect based on testing with other API's and libraries. I'm using the key, "key" and the data is "message" For example, using Indy's TidHMACSHA1, I get…
DFriend
  • 237
  • 2
  • 9
3
votes
0 answers

How to set CFB-128 using Microsoft CryptoAPI?

I am using MS_ENH_RSA_AES_PROV provider with PROV_RSA_AES provider type. I have selected CALG_AES_128 block cipher algorithm with CRYPT_MODE_CFB cipher mode. I would like to set KP_MODE_BITS key parameter to 128, but calling CryptSetKeyParam() by…
kakulaze
  • 31
  • 1
3
votes
2 answers

Javascript digital signatures

To create a digital signature with the client certificate in javascript, there was a function: crypto.signtext() that doesn't work anymore What is the easiest way to do this now?
user294516
3
votes
3 answers

Converting text to image in Java

I am writing code for a Visual Cryptography project in Java. We want to create two share images for a random token (alphanumeric string), so that when the two images are overlayed the token will be revealed. Now - even before the visual crypto part…
Luxuser
  • 33
  • 1
  • 4