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
0
votes
1 answer
Signing with CMS and RSACng in .NET Core
It seems that CNG replaces CSP in .NET Core
As stated here:
This method is only supported on .NET Framework. Its use on .NET Core
throws a PlatformNotSupportedException.
But CmsSigner doesn't expose any API to support CNG keys, for example, there…

mshwf
- 7,009
- 12
- 59
- 133
0
votes
1 answer
Create RSA key from RSACryptoServiceProvider?
I want to use the key I created via CSP (I use Utimaco interface 'CSP Tool'),
to generate the CA certificate, I use this code (based on this answer):
var csp = new CspParameters()
{
ProviderName = "Utimaco CryptoServer CSP",
ProviderType =…

mshwf
- 7,009
- 12
- 59
- 133
0
votes
1 answer
Open a certificate store (program only)
I'm implementing a program that involves saving and reading certificates in the certificate store.
The certificate opening and reading is done through the following 2 APIs:
CertOpenStore()
CertFindCertificateInStore()
For example,…

sliva
- 11
- 4
0
votes
1 answer
How can I get CSR from signature key pair
Based on this tutorial, I have successfully created the signature key pair and Key Container.
The key container after creation will be stored in %AppData%\Roaming\Microsoft\Crypto\RSA folder.
Next, I want to use signature key pair to get…

sliva
- 11
- 4
0
votes
1 answer
Sign certificate with private key and logon domain
I'm implementing the program related to logon domain with certificate by custom KSP and my credential provider. I have successfully interacted from my credential provider to custom KSP. I'm in the process of implementing custom KSP. The steps I…

sliva
- 11
- 4
0
votes
0 answers
How to export private key by wrapping (encryption) using NCrypt
I am trying to export private key from smart card, the key can be exported only by wrapping (encrypted) and not as plaintext.
In Pkcs11 there are Wrap and Unwrap functions that can by used to wrap private key with symmetric temporary key.
So I want…

Sagir
- 3
- 2
0
votes
0 answers
Delete certificate object from smart card with NCRYPT_CERTIFICATE_PROPERTY
I am trying to use NCRYPT_CERTIFICATE_PROPERTY (flag for NCryptSetProperty) to create and delete certificate object on smartcard.
There is a way to delete only the certificate object with NCryptSetProperty and NCRYPT_CERTIFICATE_PROPERTY and not…

Sagir
- 3
- 2
0
votes
1 answer
Replacement of PKCS #11 Smart Card Data Object in CAPI/CNG
There are 3 main PKCS #11 objects (Key, Certificate, Data), I found replacement for key and certificate objects in CAPI/CNG, but I didn't found replacement for creating data object on smart card using CAPI/CNG
PKCS #11 Data Object documentation…

Sagir
- 3
- 2
0
votes
1 answer
How can I test a CNG key for exchangeable?
I have taken a certificate:
X509Certificate2 x509 = store.Certificates.Find(X509FindType.FindBySubjectName, "CNGTestCert", false)[0];
and now I want to get the providertype parameter. But I cant do x509.PrivateKey.
In result of this I used var key…

Christian Meißner
- 81
- 5
0
votes
2 answers
Why cert in certificate store doesn't have private key property
I tried to get EC private key from cert which in certificate store by CNG API. First, I call CertGetCertificateContextProperty() to get private key handle with CERT_KEY_CONTEXT_PROP_ID property, but it always return false. I'm sure that the cert has…

Assam
- 179
- 1
- 13
0
votes
1 answer
Unable to create a CngKey from a PEM file in C#
I'm trying to create a CngKey in .NET 4.7.2 from a PEM file so I can sign an Apple auth JWT token.
It all worked fine in dev, but when I deployed to staging I was met with a "file not found error" from calling CngKey.Import(). Of course. The app is…

Benjineer
- 1,530
- 18
- 22
0
votes
1 answer
How to create RSACng from a public key in GenericPublicBlob format?
I am using System.Security.Cryptography.Cng (4.7.0).
I have exported a public key from a CngKey object using
byte[] publicKey = cngKey.Export(CngKeyBlobFormat.GenericPublicBlob);
How can I use this at a later time to create an RSACng object for…

Mo B.
- 5,307
- 3
- 25
- 42
0
votes
1 answer
Sign in java using KSP/CNG
How to sign data using the Windows KeyStore?
If there is a key stored in Windows KeyStore, using KeyStore keyStore = KeyStore.getInstance("Windows-MY"); I can get access to Windows KeyStore and then obtain the key reference for given alias. Or I…

Traveler
- 143
- 1
- 2
- 14
0
votes
1 answer
Use RSACng to SignData that's compatible with RSACryptoServiceProvider
I'm trying to convert some older CAPI code to use CNG, specifically with the goal of hydrating certificates with ephemeral private keys. (Not supported by CAPI, as I understand it.)
We use a certificate's private key (PK) to sign data. I expected…

Keith Robertson
- 791
- 7
- 13
0
votes
1 answer
Is it possible to develop a baseCSP card minidriver over PKCS#11?
in the past we developed a pkcs#11 module to be used for web authentication and digital signature. Now we are asked to develop a card minidriver for windows to achieve the same functionalities. It it possible to implement the cardmod.h interface on…

Indio
- 337
- 1
- 3
- 12