Platform SDK: Certificate Enrollment Control |
The getCertFromPKCS7 method is used to retrieve from a PKCS #7 just the single certificate that was issued. (The PKCS #7 may contain many certificates specifying the certification chain of authority that issued the certificate.)
[Visual Basic] objEnroll.getCertFromPKCS7( _ wszPKCS7 As String ) As String [C++] HRESULT getCertFromPKCS7( BSTR wszPKCS7, // in BSTR *pbstrCert // out );
[Visual Basic] None.
[C++] The return value is an HRESULT. A value of S_OK indicates success. Upon successful completion of this function, *pbstrCert will contain the certificate that was issued.
BSTR bstrCert = NULL; HRESULT hr; // pEnroll is previously instantiated ICEnroll interface pointer // bstrPKCS7 is previously created BSTR containing PCKS7 hr = pEnroll->getCertFromPKCS7( bstrPKCS7, &bstrCert ); if (FAILED(hr)) printf("Failed getCertFromPKCS7 - %x\n", hr ); else { printf("Successfully called getCertFromPKCS7\n"); // do something with the certificate } // free BSTR when done if ( NULL != bstrCert ) SysFreeString( bstrCert );
On Error GoTo Err_GetCert ' strPKCS7 is a String variable containing PKCS7 strCert = objEnroll.getCertFromPKCS7(strPKCS7) MsgBox ("Retrieved certificate: " & _ strCert) Exit Sub Err_GetCert: MsgBox ("Failed getCertFromPKCS7") End Sub
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with the Windows NT 4.0 Option Pack).
Header: Declared in Xenroll.h.
Library: Use Uuid.lib.