以下是关于 IX509EnrollmentPolicyServer 接口的一些基本信息:
1. 文件包含:
#include <certenroll.h>
2. 接口定义:
interface IX509EnrollmentPolicyServer : public IDispatch
{
public:
virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_PolicyServerUrl(
/* [retval][out] */ BSTR *pValue) = 0;
virtual /* [helpstring][id][propput] */ HRESULT STDMETHODCALLTYPE put_PolicyServerUrl(
/* [in] */ BSTR Value) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE Initialize(
/* [in] */ X509CertificateEnrollmentContext context) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE GetProperty(
/* [in] */ BSTR strPropertyName,
/* [retval][out] */ VARIANT *pValue) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE SetProperty(
/* [in] */ BSTR strPropertyName,
/* [in] */ VARIANT Value) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE InitializeFromCertificate(
/* [in] */ IX509Certificate *pCertificate) = 0;
virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE InitializeFromCertificateFile(
/* [in] */ BSTR strFileName,
/* [in] */ EncodingType Encoding) = 0;
};
3. 使用示例:
// 创建对象
CComPtr<IX509EnrollmentPolicyServer> pPolicyServer;
HRESULT hr = CoCreateInstance(
__uuidof(CX509EnrollmentPolicyServer),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IX509EnrollmentPolicyServer),
(void**)&pPolicyServer);
if (SUCCEEDED(hr))
{
// 初始化
hr = pPolicyServer->Initialize(context);
if (SUCCEEDED(hr))
{
// 获取属性
BSTR policyServerUrl;
hr = pPolicyServer->get_PolicyServerUrl(&policyServerUrl);
// 在这里可以使用 policyServerUrl 和其他属性进行操作
// 释放资源
SysFreeString(policyServerUrl);
}
}
请注意,上述代码中的 CX509EnrollmentPolicyServer 类是 IX509EnrollmentPolicyServer 接口的默认实现之一。具体的操作和属性可能根据你的实际需求而有所不同。确保在使用这些接口时参考相关的官方文档和示例代码。
转载请注明出处:http://www.zyzy.cn/article/detail/24222/Win32 API/Certenroll.h/IX509EnrollmentPolicyServer