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

When can CertGetCertificateChain return multiple simple certificate chains?

Why does CertGetCertificateChain have a facility to return more than one"simple chain"? What are simple chains and what other type of chains should I expect? On a test run passing a certificate such as the following... root |- parent |- my…
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217
4
votes
1 answer

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…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
4
votes
2 answers

how to create pkcs11 library in windows

I have been using the library pkcs11Interop and I would like to know how could I create a pkcs11 library dll. I've been searching a lot but I didnt understand it, I want to create a pkcs11 library because i would like to specify where are stored my…
user3789330
  • 41
  • 1
  • 4
4
votes
1 answer

Cross platform (including Windows) way to use OS trusted certificates with nodejs

Is there a node module available or code that can read trusted certificates from the OS in a cross platform way? Others answers cover how to use ubuntus which I could adapt for MacOS X, but I have not been able to find any code that can easily read…
Ransom Briggs
  • 3,025
  • 3
  • 32
  • 46
4
votes
1 answer

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…
4
votes
0 answers

SSL Connection, Windows Certificate Store and CAPI engine

I am creating an SSL connection using OpenSSL API. As we know in a SSL handshake, series of Certificate Authentication occurs for Server or Client. Now for client certificate authentication, the client's certificate and associated private key are…
User1234
  • 1,543
  • 4
  • 22
  • 32
4
votes
3 answers

Crypto API RSA public key can decrypt data, is not asymmetric as expected

The problem I am encountering is that I am able to decrypt data using the same RSA 2048-bit public key that was used to encrypt the data. It seems to me that this defeats the entire purpose of encrypting the data in the first place, if a public key…
RyanH
  • 121
  • 1
  • 10
4
votes
0 answers

Create HMAC SHA1 in C using pure linux crypto api

I need to apply HMAC SHA1 on some scatterlists in a C program. I have a sample code written for kernel 2.4 hmac crypto api, that uses this function: void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, struct scatterlist *sg,…
Steve
  • 41
  • 3
4
votes
1 answer

Apparently (!) inconsistent signing between .NET and Mono; Mono signing is not idempotent

Google Cloud Storage provides Java, C# code samples for generating signed URLs: https://cloud.google.com/storage/docs/access-control?hl=en#signing-code-csharp I'm using the code sample. With the same service account|key, bucket and object, the Java…
DazWilkin
  • 32,823
  • 5
  • 47
  • 88
4
votes
0 answers

Am I allowed to treat HCRYPTPROV returned by CryptAcquireContext as a singleton?

Is it acceptable that I cache HCRYPTPROV returned by CryptAcquireContext when my app starts and reuse it for later cryptographic calls (i.e. calculating HMACs and encrypting/AES) in a form as such: HCRYPTPROV global_hProvSingleton =…
c00000fd
  • 20,994
  • 29
  • 177
  • 400
4
votes
2 answers

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,…
Erik Jõgi
  • 41
  • 1
  • 2
4
votes
1 answer

Reading Certificate Data from Signed Executables with Multiple Signatures

Microsoft is moving away from SHA1. As a result many executables now have two or more signatures; one using a SHA1 digest for backward compatibility and one using a SHA256. For example if you look at the properties of vstest.executionengine.exe from…
Scott
  • 101
  • 1
  • 4
4
votes
0 answers

How to import an X509 certificate into a smartcard csp in C++ using MS CAPI?

I've generated a signature key pair on a smart card using windows Smartcard CSP & Crypto API with C++. Now I need to import a X509 certificate which is related to the same public key into the smart card, but I don't know which function should I use…
Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87
4
votes
1 answer

Cryptoapi sign/verify not working on Windows 8.1

We have an application that signs and verifies messages with SHA1 hashes using CryptoApi. It has worked perfectly for many years under WindowsXP up to Windows 8. It no longer works on Windows 8.1. CryptSignHash fails with error code 87 (Invalid…
Alexander233
  • 390
  • 3
  • 12
4
votes
2 answers

CryptoAPI's SignerTimeStampEx2 using PInvoke

I'm trying to use CryptoAPI from C# code to add SHA256 timestamps to signed assemblies. Here is the code I'm using: Signer.TimestampSignedAssembly("MyAssembly.exe", "http://tsa.starfieldtech.com"); Signer class: public static class Signer { …
Ruslan Gilmutdinov
  • 1,217
  • 2
  • 9
  • 20