SOL9 Sample: CertInfo

SOL9 2.0 Samples

1 Screenshot


2 Source code

/*
 * CertInfo.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/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: 2 May 2016

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