简体   繁体   中英

c# Get algorithm name / oid from certificate template

Using C#, .NET.

Is it possible to get the Algorithm name in the following 2 scenarios please:

A. Provider Category is "Legacy Cryptographic Service Provider" and the Algorithm name is "Determined by CSP"?

在此处输入图像描述

B. Provider Category is "Key Storage Provider" and Algorithm has been specified eg "ECDH_P256"

在此处输入图像描述

I am able to query a limited amount of information using the following approach but nothing to figure out the algorithm name, or crypto algorithm oid

DirectoryEntry dEntry = new DirectoryEntry("LDAP://CN=customerAxForbeTemplate,CN=Certificate Templates,CN=Public Key Services,CN=Services,CN=Configuration");

// Example properties I can access:
dEntry.Properties["name"].Value.ToString();
dEntry.Properties["msPKI-RA-Application-Policies"].Value.ToString();
// ...

The latter property "msPKI-RA-Application-Policies" does return something possibly useful for scenario B (I am bit hesitant as I am not familiar with templates so I am not sure if that IS representative of the same field - the naming of keys is not clear for me). This field is not present in scenario A.

"msPKI-Asymmetric-Algorithm PZPWSTR ECDH_P512` ..."

For scenario A you can read the DefaultCSPs (The list of providers that are checked). But there are some which allow more than one algorithm (like the smart card provider). Most of them have DSA, DH, RSA, etc in their names and ADCS only supports RSA, DSA and the 3 NISP P-Curves.

For scenario B you are on the right path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM