SOL9 Sample: CertContextDialog
|
1 Screenshot
2 Source code
/*
* CertContextDialog.cpp
* Copyright (c) 2015 Antillia.com TOSHIYUKI ARAI. ALL RIGHTS RESERVED.
*/
#include <sol/crypt/CryptServiceProvider.h>
#include <sol/crypt/CertSystemStore.h>
#include <sol/crypt/CertContext.h>
#include <sol/crypt/CertSelectionDialog.h>
#include <sol/crypt/CertContextDialog.h>
#include <sol/Locale.h>
void _tmain(int argc, TCHAR** argv)
{
try {
Locale locale;
CryptServiceProvider csp;
CertSystemStore ca(csp, _T("CA"));
CertSelectionDialog certSelDlg(ca);
PCCERT_CONTEXT pContext = certSelDlg.show();
if (pContext) {
_tprintf(_T("OK, CertSelectionDialog.show(), got a certificate\n"));
CertContext cert(pContext);
CertContextDialog contextDialog;
if (contextDialog.show(pContext) ==NO_ERROR) {
_tprintf(_T("OK, CertContextDialog.show()\n"));
} else {
_tprintf(_T("Failed, CertContextDialog.show()\n"));
}
} else {
_tprintf(_T("Failed, CertSelectionDialog.show()\n"));
}
} catch (...) {
printf("Exception: %x\n", GetLastError());
}
}
Last modified: 2 May 2016
Copyright (c) 2016 Antillia.com ALL RIGHTS RESERVED.