Platform SDK: Certificate Enrollment Control

ICEnroll::SPCFileName [C++]

CEnroll.SPCFileName [Visual Basic]

The SPCFileName property specifies a file to write the resulting base64-encoded PKCS #7 (in BSTR form) as returned from the certification authority. The file is written as a binary PKCS #7. Specifying this file does not affect the acceptance of the certificates into any of the user's stores.

If the file already exists, the user is notified, and prompted for permission to overwrite.

[Visual Basic]
objEnroll.SPCFileName [ = FileName ]
[C++]
HRESULT put_SPCFileName(BSTR FileName);
HRESULT get_SPCFileName(BSTR * pFileName);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] FileName
The string value assigned to the SPCFileName property. It can be any valid filename supported by your operating system.
[C++] pFileName
Pointer to retrieved property value.

Remarks

SPCFileName affects the behavior of the following methods:

Example Code [C++]

BSTR     bstrSPCFile = NULL;
BSTR     bstrNewSPCFile = NULL;
HRESULT  hr;

// pEnroll is previously instantiated ICEnroll interface pointer

// get the SPCFileName
hr = pEnroll->get_SPCFileName( &bstrSPCFile );
if (FAILED( hr ))
    printf("Failed get_SPCFileName - %x\n", hr );
else
    printf( "SPCFileName: %ws\n", bstrSPCFile );
// free BSTR when done
if ( NULL != bstrSPCFile )
    SysFreeString( bstrSPCFile );

// set the SPCFileName
bstrNewSPCFile = SysAllocString(TEXT("MyFile.SPC"));

hr = pEnroll->put_SPCFileName( bstrNewSPCFile );
if (FAILED( hr ))
    printf("Failed put_SPCFileName - %x\n", hr );
else
    printf( "SPCFileName set to %ws\n", bstrNewSPCFile );
// free BSTR when done
if ( NULL != bstrNewSPCFile )
    SysFreeString( bstrNewSPCFile ); 

Example Code [Visual Basic]

' declare Certificate Enrollment Control object
Dim objXen As Object

Dim strSPCFile As String

' instantiate the object
Set objXen = CreateObject("CEnroll.CEnroll.1")

' retrieve and display the SPCFileName
strSPCFile = objXen.SPCFileName
MsgBox strSPCFile, vbOKOnly, "SPCFileName"

' set the SPCFileName
objXen.SPCFileName = "MyFile.SPC"

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.