Platform SDK: Certificate Enrollment Control

ICEnroll2::addNameValuePairToSignature [C++]

CEnroll.addNameValuePairToSignature [Visual Basic]

This method adds the name and value pair of an attribute to the request. It is up to the CA to interpret the meaning of the name/value pair.

[Visual Basic]
objEnroll.addNameValuePairToSignature( _
            Name As String, _
            Value As String)
[C++]
HRESULT addNameValuePairToSignature(
  BSTR Name,   // in
  BSTR Value   // in
);

Parameters

[Visual Basic] objEnroll
Object expression that resolves to a CEnroll object.
[Visual Basic,C++] Name
The name of the attribute, such as "2.5.4.6" for the country/region name.
[Visual Basic,C++] Value
The value of the attribute, such as "US".

Return Values

[Visual Basic] None.

[C++] The return value is an HRESULT, with S_OK returned if the call is successful.

Remarks

Use this function to add attributes to the request.

Example Code [C++]

BSTR    bstrName = NULL;
BSTR    bstrValue = NULL;
HRESULT hr;

// allocate BSTR for the name
bstrName = SysAllocString(TEXT(szOID_COUNTRY_NAME));
// alternatively,bstrName = SysAllocString(L"2.5.4.6");
// allocate BSTR for the value
bstrValue = SysAllocString(L"US");

// add the Name/Value pair to the signature
// pEnroll is previously instantiated ICEnroll2 interface pointer
hr = pEnroll->addNameValuePairToSignature( bstrName, bstrValue );

if ( FAILED( hr ) )
    printf("Failed addNameValuePairToSignature - %x\n", hr );
else
    printf("addNameValuePairToSignature(%ws, %ws) succeeded\n",
            bstrName, 
            bstrValue );

// free BSTRs
if ( NULL != bstrName )
    SysFreeString( bstrName );
if ( NULL != bstrValue )
    SysFreeString( bstrValue );

Example Code [Visual Basic]

' declare Certificate Enrollment Control object
Dim objXen As Object

' variables for Name and Value
Dim strName As String
Dim strValue As String

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

' add the name/value pair to the signature
' in this case, for the Country/Region name
strName = "2.5.4.6"
strValue = "US"
objXen.addNameValuePairToSignature strName, strValue

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Xenroll.h.
  Library: Use Uuid.lib.