Platform SDK: Certificate Enrollment Control

ICEnroll::acceptFilePKCS7 [C++]

CEnroll.acceptFilePKCS7 [Visual Basic]

The acceptFilePKCS7 method accepts and processes a PKCS #7 containing a certificate. The PKCS #7 is stored in a file, whose name is the parameter to this method. This method differs from acceptPKCS7 only in using a file as a container for the certificate.

[Visual Basic]
objEnroll.acceptFilePKCS7( wszPKCS7FileName As String )
[C++]
HRESULT acceptFilePKCS7 (
  BSTR wszPKCS7FileName    // in
);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] wszPKCS7FileName
Specifies the name of the file containing the PKCS #7.

Return Values

[Visual Basic] None.

[C++] The return value is an HRESULT. A value of S_OK indicates success. Upon successful completion of this function, the PKCS7 in the file will be accepted.

Remarks

By default, the system stores MY, CA, ROOT, and REQUEST are used to store the certificates. However, you can specify other stores by assigning the following properties before calling this method:

Example Code [C++]

HRESULT  hr;
BSTR     bstrFileName;

// Allocate a BSTR referencing an existing file.
bstrFileName = SysAllocString(TEXT("myPKCS7.fil"));
// pEnroll is a previously instantiated ICEnroll interface pointer.
hr = pEnroll->acceptFilePKCS7( bstrFileName );
if (FAILED(hr))
    printf("Failed acceptFilePKCS7 - %x\n", hr );
else
    printf("Accepted PKCS7 from file %ws successfully\n", bstrFileName );

// Free BSTR when done.
if ( NULL != bstrFileName )
    SysFreeString(bstrFileName);

Example Code [Visual Basic]

    Dim strFileName As String
    strFileName = "myPKCS7.fil"
   
    On Error GoTo Err_Accept
    objEnroll.acceptFilePKCS7 (strFileName)
    MsgBox ("Accepted PKCS7 from " & _
            strFileName & _
            " successfully")
    
    Exit Sub

Err_Accept:
    
    MsgBox ("Failed acceptFilePKCS7" & _
            " from file " & _
            strFileName)
    

    End Sub

Requirements

  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.

See Also

acceptPKCS7, CAStoreName, MyStoreName, RootStoreName, RequestStoreName