SOL9 2.0 Sample: CertInfo

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * CertInfo.cpp 
 * Copyright (c) 2009 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/Locale.h>

void _tmain(int argc, TCHAR**)
{
    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 certContext(pContext);

            CertInfo certInfo;

            certContext.getCertInfo(certInfo);

            certInfo.dump();

        } else {
            _tprintf(_T("Failed, CertSelectionDialog.show()\n"));
        }

    } catch (...) {

        printf("Exception: %x\n", GetLastError());
    }

}

Last modified: 11 Nov 2009

Copyright (c) 2009 Antillia.com ALL RIGHTS RESERVED.