CryptoAPI Next Generation (CNG) is the next version of the Windows CryptoAPI available since Vista. It adds NSA Suite B algoritms (including elliptic-curve cryptography) and is FIPS 140-2 certified.
Questions tagged [cng]
256 questions
1
vote
2 answers
CryptoAPI CNG and CMS functionality
I've got a question regarding Microsoft CNG which substitutes Crypto API. Since I have a project/assignment where I need to use CMS/PKCS#7 with RSA-OAEP encryption and RSASSA-PSS signatures.
But I am confused about whether CNG (not the legacy…

slb20
- 127
- 1
- 7
1
vote
1 answer
In minidriver, is the value of hSCardCtx and hScard in PCARD_DATA can be changed after called CardAcquireContext?
I am working on a project related minidriver to perform operations in smart card.
I have register smartcard in registry with proper ATR and minidriver information.
Now I am trying to generate keypair using CNG -> minidriver -> smart card.
To achieve…

iOS-Developer84
- 654
- 8
- 19
1
vote
0 answers
Using my own crypto provider for Windows without signing it
I am required to make my own realization of the crypto algorithm and make it available for Windows applications.I made a crypto provider library for working through CryptoAPI under the instruction (in the article Service Provider Cookbook), except…

Robert
- 11
- 3
1
vote
0 answers
AesCng persisted key export/import: Import fails with CryptographicException: The supplied handle is invalid
I need to securely persist AES key(s) to be used by the .NET AesCng algorithm. The idea is to use the CngKey class to persist the key(s) and leverage its export/import functionality to maintain the same key(s) across multiple servers.
I can create…

L_E_R
- 11
- 1
1
vote
2 answers
System.Security.Cryptography.CryptographicException: The requested operation is not supported. windows server 2012
I'm tiring to generate the jwt token for calling apns. here is my code:
var header = new Dictionary()
{
{ "kid" , keyID }
};
var payload = new Dictionary()
{
{ "iss", teamID },
…

Mohammad
- 2,724
- 6
- 29
- 55
1
vote
1 answer
c# JWT using ES256, load privateKey into CngKey to be validated in talkdesk (jose-jwt)
I am attempting to generate a JWT using a ES256 algorithm to be validated by talk desk (documentation: https://docs.talkdesk.com/docs/using-a-signed-jwt).
BUT I have an ADO.net project so I can't use any of the frameworks they sugested, so I thought…

André Moura
- 53
- 1
- 11
1
vote
0 answers
optimization options and usage of windows dll calls
I am building a dll for windows, using a Makefile, using cl.exe. I am using VS2015.. this dll uses CNG (bcrypt) for encryption operations, and bcryptr is loaded dynamically using loadlibrary call.
When i build with /Od option to disable…

scirdan
- 59
- 7
1
vote
0 answers
STATUS_INVALID_PARAMETER error import diffie hellman public key using BCryptImportKeyPair
I am trying to add a public key into diffie Hellman implementation of Bcrypt.
example suggested to create and export a public key. In my case I already got the public key from the client. I am trying to use that public key to generate shared…

Prakash N
- 1,020
- 1
- 8
- 20
1
vote
1 answer
Can Microsoft Cryptographic API allow creation of ECDSA keys from a stream of bytes?
So I am pondering which cryptographic C++ library to use (I already figured out how to do equivalent in C#) for the verification of a licence file signed hash.
Reading the Microsoft documentation for CNG it seems that it is not possible to…

S Meaden
- 8,050
- 3
- 34
- 65
1
vote
0 answers
EC private key to CngKey in C#
I need to convert a EC private key generated by BouncyCastle to a CngKey in C#. Ultimately, I'm trying to create a PKCS12 that can be imported into the Windows Key Store and am following the information and code example found here.
The EC key pair…

hyongsop
- 91
- 2
- 9
1
vote
0 answers
"Keyset does not exist" trying to create a CngKeyStore
Trying to call CngKeyStore.Open() with a non-admin account, and was initially getting an "Access denied" exception.
After granting the user account access to the c:\programdata\microsoft\crypto\keys folder, am now getting the above "Keyset does not…

gooram
- 89
- 2
- 16
1
vote
1 answer
.NET wrapper for DPAPI-NG and user group access configuration
I have a number of workstations which are part of my domain, each running some .NET application. One central server stores secrets which I would like to be encrypted by a key which is accessible to all users of the system which have the appropriate…

NLuburić
- 912
- 1
- 10
- 28
1
vote
2 answers
C++ Importing RSA public keys from modulus and exponent with CNG
I'm trying to use CNG to encrypt some data with a public key that is given as a parameter. When calling NCryptImportKey function, I get a NTE_BAD_DATA error which isn't listed in the msdn page.
My code:
#include
#include…

Orr Goldman
- 35
- 1
- 7
1
vote
0 answers
Suppress strong key protection UI
Is it possible to use Microsofts cryptography function CryptUIWizImport without getting a UI to enter the password during sign as well as during importing the pfx file in the local system? How?
Details:
I have developed an application to sign the…

Bala MIB
- 9
- 3
1
vote
2 answers
AES-CBC encrypted output in CNG is not matching with online tools
I am new to CNG. I am playing with the basic program from msdn site.
I have modified the input plain string and testing the output using other websites that provides the aes cbc encrypted output.
Unfortunately only first half matches and the next…

ABCDEFG
- 187
- 3
- 11