これは C# の方法です。C で役立つ可能性があります。私は C コードにあまり詳しくありません。
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
private static X509Certificate GetClientCert()
{
X509Store store = null;
try
{
store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadOnly);
var certs = store.Certificates.Find(X509FindType.FindBySubjectName, "Integration Client Certificate", true);
if (certs.Count == 1)
{
var cert = certs[0];
return cert;
}
}
finally
{
if (store != null)
store.Close();
}
return null;
}
証明書を取得してエクスポートするコードは次のとおりです。
//This will bring up the selection prompt to select your cert
X509Certificate c = GetClientCert();
//The password should be the pin converted to a secure string variable.
//note the code above will not prompt for a pin if you want this you will have to build the prompt yourself. It will only select the certificate.
c.Export(X509ContentType.Cert, securestring password);
エクスポート方法には、エクスポートするさまざまなタイプがあります。あなたが参照しているフォーマットになるかどうかはわかりません。これはあなたが遊ぶ必要があるものです。これらのライブラリを C で使用できるかどうかさえわかりませんが、投稿していただければ幸いです。