ICertAdmin2::GetCAProperty method (certadm.h)
The GetCAProperty method retrieves a property value for the certification authority (CA). This method was first defined in the ICertAdmin interface.
Syntax
HRESULT GetCAProperty(
[in] const BSTR strConfig,
[in] LONG PropId,
[in] LONG PropIndex,
[in] LONG PropType,
[in] LONG Flags,
[out] VARIANT *pvarPropertyValue
);
Parameters
[in] strConfig
Represents a valid configuration string for the CA in the form COMPUTERNAME\CANAME, where COMPUTERNAME is the Certificate Services server's network name, and CANAME is the common name of the CA, as entered during Certificate Services setup. For information about the configuration string name, see ICertConfig.
[in] PropId
Specifies one of the following property identifiers.
Value | Meaning |
---|---|
|
Data type of the property: Long
Specifies whether the CA is running Advanced Server. |
|
Data type of the property: Binary, indexed
The CA's full, or base, certificate revocation list (CRL). |
|
Data type of the property: Long, indexed
The base CRL publish status. For more details, see Remarks. |
|
Data type of the property: Binary, indexed
The backward cross certificate. A backward cross certificate is the certificate issued upon renewal from the CA to itself signed with CA's new key. The backward cross certificate has the authority key identifier of the new CA certificate and the subject key identifier of the old CA certificate. Applies to root CAs only. |
|
Data type of the property: Long, indexed
Whether the backward cross certificate is valid. Valid for root CAs only. |
|
Data type of the property: Long
State of the CA certificate. The values can be:
|
|
Data type of the property: Long, indexed
Status of the CA certificate, as an HRESULT. |
|
Data type of the property: Long, indexed
Version of the CA certificate, as a DWORD. The high-order word is the key index, and the low-order word is the CA certificate index. |
|
Data type of the property: Binary, indexed
The forward cross certificate. A forward cross certificate is a certificate issued upon renewal from the CA to itself signed with CA's previous key. The forward cross certificate has the authority key identifier of the previous CA certificate and the subject key identifier of the new CA certificate. Applies to root CAs only. |
|
Data type of the property: Long, indexed
Whether the forward cross certificate is valid. Valid for root CAs only. |
|
Data type of the property: String
Name of the CA. |
|
Data type of the property: Binary, indexed
CA signing certificate. |
|
Data type of the property: Binary, indexed
CA signing certificate chain. |
|
Data type of the property: Long
Number of signing certificates for the CA. |
|
Data type of the property: Binary, indexed
The CA's signing certificate CRL chain. |
|
Data type of the property: Long
Type of CA. This can be one of the following values (defined in Certsrv.h):
|
|
Data type of the property: Binary, indexed
CA exchange certificate. |
|
Data type of the property: Binary, indexed
CA exchange certificate chain. |
|
Data type of the property: Long
Number of exchange certificates for the CA. |
|
Data type of the property: Binary, indexed
The CA's exchange certificate CRL chain. |
|
Data type of the property: String, indexed
Specifies Authority Information Access URLs as the type of URL requested by a client. Windows Server 2003: This flag is not supported. |
|
Data type of the property: String, indexed
Specifies CRL Distribution Point URLs as the type of URL requested by a client. Windows Server 2003: This flag is not supported. |
|
Data type of the property: Long
State of the CA's CRL. The values can be:
|
|
Data type of the property: Binary, indexed
The CA's delta CRL. |
|
Data type of the property: Long, indexed
The delta CRL publish status. For more details, see Remarks. |
|
Data type of the property: String
The CA's DNS Name. |
|
Data type of the property: Long
Number of exit modules in use by the CA. |
|
Data type of the property: String
Description for the exit module. |
|
Data type of the property: String
The Certificate Services file version. |
|
Data type of the property: Binary, indexed
The CA's key recovery agent (KRA) certificate. |
|
Data type of the property: Long
Number of KRA certificates for the CA. |
|
Data type of the property: Long, indexed
The KRA's certificate state. The return value is one of the following:
|
|
Data type of the property: Long
Number of KRA certificates used by the CA. |
|
Data type of the property: String
The name of the CA's parent CA. |
|
Data type of the property: String
The description for the policy module. |
|
Data type of the property: String
The product version in which the file shipped. |
|
Data type of the property: Long
Value specifying whether role separation is enabled. |
|
Data type of the property: String
The sanitized name of the CA. For a definition of a sanitized CA name, see ICertConfig2::GetConfig. |
|
Data type of the property: String
The sanitized short name of the CA. For a definition of a sanitized CA short name, see ICertConfig2::GetConfig. |
|
Data type of the property: String
The name of the shared folder directory. |
|
Data type of the property: String
List of templates supported by the CA. |
[in] PropIndex
If the PropId parameter is indexed, the zero-based index to use when retrieving the property value. If PropId is not indexed, this value is ignored.
[in] PropType
Specifies the type of the property, indicated in the Meaning column of the PropId table. The type can be one of the following types.
Value | Meaning |
---|---|
|
Signed long data |
|
Date/time (reserved for future use) |
|
Binary data |
|
Unicode string data |
[in] Flags
The following flags can be used to specify the format of the returned property value; these flags have meaning only for binary data (such as certificates, certificate chains or certificate revocation lists) and is ignored otherwise.
[out] pvarPropertyValue
A pointer to a buffer that receives the requested property value. It is a caller's responsibility to free this resource when done by calling VariantClear.
Return value
C++
The return value is an HRESULT. A value of S_OK indicates the method was successful.VB
The requested property value.Remarks
The following values are returned when the property identifier is CR_PROP_BASECRLPUBLISHSTATUS or CR_PROP_DELTACRLPUBLISHSTATUS. These values can be combined.
Value | Description |
---|---|
CPF_BADURL_ERROR | A URL is not valid. |
CPF_BASE | A base CRL was published. |
CPF_CASTORE_ERROR | A CA store error prevented publication. |
CPF_COMPLETE | A complete CRL was published. |
CPF_DELTA | A delta CRL was published. |
CPF_FILE_ERROR | A file error prevented publication. |
CPF_FTP_ERROR | An FTP error prevented publication. |
CPF_HTTP_ERROR | An HTTP error prevented publication. |
CPF_LDAP_ERROR | An LDAP error prevented publication. |
CPF_MANUAL | A CRL was published manually. |
CPF_SHADOW | An empty delta CRL was published, along with a new BASE CRL. |
CPF_SIGNATURE_ERROR | A signature error prevented publication. |
For an example of retrieving a CRL, see Retrieving a Certificate Revocation List.
Examples
The following example shows retrieving the signature certificate of the CA. The example assumes the ICertAdmin2 interface pointer is valid.
BSTR bstrCA = NULL;
VARIANT var1;
HRESULT hr;
bstrCA = SysAllocString(L"<COMPUTERNAMEHERE>\\<CANAMEHERE>");
if (NULL == bstrCA)
{
printf("Failed to allocate memory for bstrCA\n");
exit(1);
}
VariantInit(&var1);
// Retrieve the CA signature certificate at index 0.
hr = pAdmin2->GetCAProperty(bstrCA,
CR_PROP_CASIGCERT,
0,
PROPTYPE_BINARY,
CV_OUT_BASE64HEADER,
&var1);
if (FAILED(hr))
{
printf("Failed GetCAProperty\n");
SysFreeString(bstrCA);
exit(1); // Or other error action.
}
// Use the property as needed.
// ...
// Clear the variant when finished.
VariantClear(&var1);
SysFreeString(bstrCA);
Requirements
Requirement | Value |
---|---|
Minimum supported client | None supported |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | certadm.h (include Certsrv.h) |
Library | Certidl.lib |
DLL | Certadm.dll |