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
2 answers

Associate private key to certificate for PFXExportCertStoreEx

I'm trying to export certificate to pfx file. Here's what I do (simplified): h = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_CREATE_NEW_FLAG, NULL); p = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, …
galets
  • 17,802
  • 19
  • 72
  • 101
3
votes
1 answer

How to sign XML using xmlsec and CSP?

I need to sign XML using xmlsec and certificate provided by csp. (C++, Linux only) Here is the simplified code. HCERTSTORE hStore = NULL; hStore = CertOpenStore(); PCCERT_CONTEXT pContext = CertFindCertificateInStore(hStore...); //xml preparation…
Nem
  • 336
  • 3
  • 8
  • 22
3
votes
1 answer

How to import a PKCS#8 with CryptoApi

I Have a PKCS#8 Key and I desperately try to import in CryptoAPI without any success. I have : -----BEGIN PRIVATE KEY----- -----END PRIVATE KEY----- That contain this : Private Key algo RSA Private Format PKCS#8 ASN1 Dump RSA…
zeus
  • 12,173
  • 9
  • 63
  • 184
3
votes
1 answer

linux kernel crypto API for ECB AES

I am trying to write a sample code for using linux kernel crypto userspace interface. And I do found a example really helped me a lot, thanks to nibrunie: #include #include #include #include…
Wally
  • 37
  • 6
3
votes
1 answer

ECDSA signing in c# verify in c

I'm trying to sign data in C#, using ECDSA algorithm (this part looks OK) and to verify signature in C using Windows crypto API. Signature part: CngKeyCreationParameters keyCreationParameters = new…
Regis Portalez
  • 4,675
  • 1
  • 29
  • 41
3
votes
0 answers

Porting code from CryptoAPI to CNG

I started writing code in CryptoAPI in unmananaged C++ to: Create private keys Create self signed certificate (CA) Create CSRs Process CSRs and sign with private CA to make certificates So most of the PKI...CryptoAPI is being depreciated so now I…
Timothy John Laird
  • 1,101
  • 2
  • 13
  • 24
3
votes
1 answer

Restore RSA private key by modulus, public and private exponents using Java Security

I'm trying to find Java (native or BouncyCastle provider) implementation for generating a RSA private key in PKCS#1 using given params {e,n,d}. There is paper by Dan Boneh that describes an algorithm for doing so. The solution is available in…
Dima Svider
  • 377
  • 2
  • 15
3
votes
1 answer

CertCreateCertificateChainEngine throws an error in windows 7

ChainConfig.cbSize = sizeof(CERT_CHAIN_ENGINE_CONFIG); ChainConfig.hRestrictedRoot = NULL; ChainConfig.hRestrictedTrust = NULL; ChainConfig.hRestrictedOther = NULL; ChainConfig.cAdditionalStore = 0; ChainConfig.rghAdditionalStore =…
3
votes
1 answer

how to automaticaly export windows root certificates to a file?

On a windows machine, I want to create a c++ code that exports windows root certificates to .pem \ .crt file (just like certmgr.msc tool allows me to do manually). currently digging in windows' cryptoAPI docs but didn't find something. Edit: after…
3
votes
0 answers

Implementing CPAcquireContext in custom CSP

We want to develop custom Cryptographic Service Provider (CSP). For this we are referring following link https://msdn.microsoft.com/en-us/library/windows/desktop/aa380245%28v=vs.85%29.aspx From the documents, we understood that following…
Thirumal
  • 41
  • 3
3
votes
5 answers

Windows CryptoAPI: CryptSignHash with CALG_SHA_256 and private key from MY keystore

I am trying to generate digital signatures on Windows (from XP SP3, but currently testing with Windows 7) with CryptoAPI that will be compatible with the following openssl commands: openssl dgst -sha256 -sign (for signing) openssl dgst…
Dominique Eav
  • 195
  • 1
  • 1
  • 7
3
votes
1 answer

CryptographicException, provider type does not match registered value, when using iTextSharp and RSA and AES csp

I want to make a PADES signature a PDF using SHA-256 as hash algorithm. I'm using the following code: public static byte[] Sign( byte[] pdfIn, X509Certificate2 cert, string reason, string hashAlgorithm = DigestAlgorithms.SHA1 …
jruizaranguren
  • 12,679
  • 7
  • 55
  • 73
3
votes
1 answer

System.Security.Cryptography.Csp on Ubuntu 16.04

I have ASP.Net Core 1.0.0 app using cryptography. I need to decrypt keys using RSACryptoServiceProvider. Visual Studio suggested adding System.Security.Cryptography.Csp version 4.0.0 to my dependencies. I accept, and on Windows it all works just…
Slip
  • 593
  • 1
  • 7
  • 21
3
votes
1 answer

Writing my own CSP (cryptographic service provider)

I have to implement my own csp for signing. I have access to remote certificate storage, which implements functions for signing. Server API has call for listing all certificates. I want to add those certificates to containers. I read csp cookbook,…
3
votes
0 answers

Is there a cross-platform C/C++ equivalent to CertGetCertificateChain()?

I'm attempting to programmatically build and validate a certificate chain based on an in-memory X509 certificate object (received over a network connection), and a filesystem directory containing trusted root certificates. I'm familiar with how to…
anro
  • 195
  • 9