The following data types are used by Microsoft® Certificate Server interface methods.
Microsoft Visual Basic® |
Java |
C++ |
---|---|---|
int | short | --- |
long | int | LONG |
BSTR | java.lang.String | BSTR |
DATE | double | DATE |
VARIANT | com.ms.Variant | VARIANT |
VARIANT type variables have a type tag field vt that indicates the data type of the data. VARIANT type return values are returned by methods with the type tag field set to the data type of the return value. VARIANT type input parameters in a method call must have the type tag field set by the application to one of the supported values. The correspondence of parameter types to data types is as follows.
Parameter Type | Data Type |
---|---|
PROPTYPE_LONG | VT_I2 or VT_I4 |
PROPTYPE_DATE | VT_DATE |
PROPTYPE_BINARY | VT_BSTR or (VT_BSTR | VT_BYREF) |
PROPTYPE_STRING | VT_BSTR or (VT_BSTR | VT_BYREF) |
The following example written in C++ shows how the type tag field could be initialized for a call to the ICertServerPolicy::SetCertificateExtension method:
HRESULT hr;
BSTR strExtensionName = SysAllocString("2.29.38.4");
VARIANT varExt;
varExt.vt = VT_BSTR; // initialize type tag field
varExt.bstrVal = SysAllocString("http://UrlTest.htm");
hr = pICertServerPolicy->SetCertificateExtension(
strExtensionName, // extension name
PROPTYPE_STRING,
EXTENSION_CRITICAL_FLAG,
&varExt);
// Use the strAttributeValue ...
// free it when done
if (NULL != strExtensionName)
{
SysFreeString(strExtensionName);
}
VariantClear(&varExt);