/*
* CertSelectionDialog.cpp
* Copyright (c) 2009 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
// SOL9
// 2009/03/18
#include <sol/crypt/CryptServiceProvider.h>
#include <sol/crypt/CertSystemStore.h>
#include <sol/crypt/CertContext.h>
#include <sol/crypt/CertSelectionDialog.h>
#include <sol/Locale.h>
void _tmain(int argc, TCHAR** argv)
{
try {
CryptServiceProvider csp;
CertSystemStore ca(csp, _T("CA"));
CertSelectionDialog certSelDlg(ca);
PCCERT_CONTEXT pContext = certSelDlg.show();
if (pContext) {
_tprintf(_T("OK, selection a certificate\n"));
CertContext cert(pContext);
TCHAR name[MAX_PATH];
cert.getName(name, sizeof(name));
_tprintf(_T("Name:\n\t%s\n"), name);
TCHAR issuer[MAX_PATH];
cert.getIssuerName(issuer, sizeof(issuer));
_tprintf(_T("Issuer:\n\t%s\n"), issuer);
TCHAR friendlyName[MAX_PATH];
cert.getFriendlyName(friendlyName, sizeof(friendlyName));
_tprintf(_T("FriendlyName:\n\t%s\n"), friendlyName);
TCHAR rdnName[MAX_PATH];
cert.getRDNName(rdnName, sizeof(rdnName));
_tprintf(_T("RDNName:\n\t%s\n"), rdnName);
TCHAR email[MAX_PATH];
cert.getEMail(email, sizeof(email));
_tprintf(_T("Email:\n\t%s\n"), email);
TCHAR cn[MAX_PATH];
cert.getCNName(cn, sizeof(cn));
_tprintf(_T("CN:\n\t%s\n"), cn);
} else {
_tprintf(_T("NG, Canceled a selection\n"));
}
} catch (...) {
}
}
|