Recent Changes - Search:

Accueil

OpenSSL

SyncML

Apache Portable Runtime

Libxml2

Net-snmp

CUrl

Boost

Perl

ZLib

Samba

VPN

Serveurs de messagerie

edit

OpenSSL/Cryptoapi-DN


TCHAR szCERT[]=_T("MIICuDCCAiGgAwIBAgICAR4wDQYJKoZIhvcNAQEFBQAwVDELMAkGA1UEBhMCRlIx\
GTAXBgNVBAgMEE1BUkNRIEVOIEJBUk9FVUwxGDAWBgNVBAoMD05PUkRORVQgUk9P\
VCBDQTEQMA4GA1UEAwwHUk9PVCBDQTAeFw0xMDA3MDIxMDI2MzZaFw0xMTA3MDIx\
MDI2MzZaMHIxCzAJBgNVBAYTAkZSMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYD\
VQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxGTAXBgNVBAsMEGRldmVsb3Bt\
ZW50IHRlYW0xEDAOBgNVBAMMB05PUkRORVQwgZ8wDQYJKoZIhvcNAQEBBQADgY0A\
MIGJAoGBALzRegKWgVvONaKZGT1ScO6BWnPGEHzMFkbaa/CjUa0pR+NPaq5FsKWk\
+G5NVJtf6HbMcj1L0uVHrnM0HltVENQHbg9/qp8+BNKI70tb4ROVSQgoZX+D9Vfx\
79MGXms2fRTpw6zxApiSQnozUmLadfcORXO29/wpJPYMn+e+w/uLAgMBAAGjezB5\
MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENl\
cnRpZmljYXRlMB0GA1UdDgQWBBQVdJiGBHGKQL1HEJy8Lrcwzu8/cjAfBgNVHSME\
GDAWgBT3kqeC+WF+2ZncQDcXrvoJD3XjZTANBgkqhkiG9w0BAQUFAAOBgQAhwLq8\
jefEqL6SAN/N+dHcARibuxR8+Bv0KD0wPr3GpGil0iWZ4DyEEJdmTpcBawZ0SJGB\
NDWTIDOt3p0+UDZEp+JrH2C7FpGOOR6MPDZmW4prxlTRH3GMUggt7anth+rqj7hp\
IDNXJnSvBtleTTVDa3ZzCjvazyDVz3BYqwygpQ=="
);

int _tmain(int argc, _TCHAR* argv[])
{
        BYTE *pbEncoded;
        DWORD cbEncoded;
        PCCERT_CONTEXT pCertContext;
        TCHAR* pszString;
        DWORD dwString;

        CryptStringToBinary(szCERT,0,CRYPT_STRING_BASE64,NULL,&cbEncoded,0,0);
        pbEncoded = (BYTE*)malloc(cbEncoded);
        CryptStringToBinary(szCERT,0,CRYPT_STRING_BASE64,pbEncoded,&cbEncoded,0,0);

        pCertContext = CertCreateCertificateContext(X509_ASN_ENCODING,pbEncoded,cbEncoded);

        dwString = CertGetNameString(pCertContext,CERT_NAME_ATTR_TYPE, NULL, &szOID_COMMON_NAME,NULL,0);
        pszString = (TCHAR*)malloc(dwString*sizeof(TCHAR));
        CertGetNameString(pCertContext,CERT_NAME_ATTR_TYPE, NULL, &szOID_COMMON_NAME,pszString,dwString);


        CertFreeCertificateContext(pCertContext);
        free(pbEncoded);
        free(pszString);

        return 0;
}

 
Edit - History - Print - Recent Changes - Search
Page last modified on July 16, 2010, at 12:28 PM