Platform SDK: Certificate Enrollment Control

ICEnroll::ContainerName [C++]

CEnroll.ContainerName [Visual Basic]

The ContainerName property specifies the name of the key container to use.

[Visual Basic]
objEnroll.ContainerName [ = Name ]
[C++]
HRESULT put_ContainerName(BSTR Name);
HRESULT get_ContainerName(BSTR * pName);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] Name
The string value assigned to the ContainerName property. If the using application has not assigned a value to this property, by default a generated GUID is used for its value.
[C++] pName
Pointer to retrieved property value.

Remarks

The container specified may be an existing container or a new one. It may only be an existing container if the UseExistingKeySet property is set, as long as the key set has not been generated yet. For example, if only an exchange key set has been generated for a container, it is still possible to perform a certificate enrollment using the signature key set without setting UseExistingKeySet. The exchange key set could be used if UseExistingKeySet is set beforehand.

By default, a new container is selected each time the ICEnroll control is run. This ensures that a new key set is generated. If this property is not explicitly set, a generated GUID is used as the container name.

ContainerName affects the behavior of the following methods:

Example Code [C++]

BSTR     bstrContainerName = NULL;
HRESULT  hr;

// pEnroll is previously instantiated ICEnroll interface pointer

// get the container name
hr = pEnroll->get_ContainerName( &bstrContainerName );
if ( FAILED ( hr ) )
    printf("Failed getting ContainerName - %x\n", hr );
else
    printf( "ContainerName: %ws\n", bstrContainerName );
// free BSTR when done
if ( NULL != bstrContainerName )
    SysFreeString( bstrContainerName );

// set the container name
// bstrMyName previously set to a valid name
hr = pEnroll->put_ContainerName( bstrMyName );
if ( FAILED ( hr ) )
    printf("Failed setting ContainerName - %x\n", hr );
else
    printf( "ContainerName was set to %ws\n", bstrMyName ); 

Example Code [Visual Basic]

' declare Certificate Enrollment Control object
Dim objXen As Object

Dim strContainerName As String

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

' retrieve and display the ContainerName
strContainerName = objXen.ContainerName
MsgBox strContainerName, vbOKOnly, "ContainerName"

' set the ContainerName
' strMyName previously set to a valid name
objXen.ContainerName = strMyName

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.