IX509EnrollmentHelper::AddPolicyServer 方法 (certenroll.h)

AddPolicyServer 方法會在 CEP) 伺服器 (註冊憑證原則,並將 CEP 存取認證儲存在認證快取中。 此方法已啟用 Web。

語法

HRESULT AddPolicyServer(
  [in] BSTR                    strEnrollmentPolicyServerURI,
  [in] BSTR                    strEnrollmentPolicyID,
  [in] PolicyServerUrlFlags    EnrollmentPolicyServerFlags,
  [in] X509EnrollmentAuthFlags authFlags,
  [in] BSTR                    strCredential,
  [in] BSTR                    strPassword
);

參數

[in] strEnrollmentPolicyServerURI

包含憑證註冊原則伺服器 URL 的 BSTR

[in] strEnrollmentPolicyID

包含憑證註冊原則伺服器標識碼的 BSTR 。 標識碼可以是任何字串。 這是由安裝 CEP 伺服器的系統管理員所設定。

[in] EnrollmentPolicyServerFlags

PolicyServerUrlFlags 列舉值。 針對 AddPolicyServer 函式,您可以指定下列值的位 OR

意義
PsfAutoEnrollmentEnabled
已啟用自動憑證註冊。
PsfAllowUnTrustedCA
指定用戶端不需要信任發行 CA 的憑證,才能安裝由 CA 簽署的憑證。

[in] authFlags

指定客戶端驗證類型的 X509EnrollmentAuthFlags 列舉值。 這可以是下列其中一個值。

意義
X509AuthAnonymous
匿名驗證。 將 strCredentialstrPassword 參數設定為 NULL
X509AuthKerberos
Kerberos 驗證。 將 strCredentialstrPassword 參數設定為 NULL
X509AuthUsername
純文字用戶名稱和密碼驗證。 將 strCredentialstrPassword 參數設定為使用者名稱和相關聯的密碼。 這些字串會在傳輸之前加密,並安全地儲存在 CEP 伺服器上的認證保存庫中。
X509AuthCertificate
安裝在本機電腦上的用戶端驗證憑證,並由伺服器用來驗證用戶端的身分識別。 將 strPassword 參數設定為 NULL ,並在 strCredential 參數中設定憑證指紋,這是憑證的 20 位元組 SHA1 哈希。

[in] strCredential

包含認證的 BSTR

[in] strPassword

包含純文字密碼的 BSTR

傳回值

如果函式成功,函式會傳回 S_OK

如果函式失敗,它會傳回 指出錯誤的 HRESULT 值。 可能的值包括 (但不限於) 下表中的這些值。 如需常見錯誤碼的清單,請參閱 一般 HRESULT 值

傳回碼 Description
E_INVALIDARG
strEnrollmentPolicyServerURIstrCredentialstrPassword 參數不可為 NULL 或空白。
HRESULT_FROM_WIN32 (ERROR_ARITHMETIC_OVERFLOW)
strPasswordstrCredentialstrEnrollmentServerURI 參數超過 64,000 個字元,或包含內嵌的 Null 字元。

備註

strCredentialstrPassword 自變數會根據 authFlags 自變數中指定的值而變更,如下表所示。

flag 參數 strCredential 參數 strPassword 參數
X509AuthAnonymous NULL NULL
X509AuthKerberos NULL NULL
X509AuthUsername CEP 伺服器可辨識的純文本用戶名稱。 與使用者名稱相關聯的純文本密碼。
X509AuthCertificate 包含憑證的 20 位元組 SHA-1 哈希 (指紋) 。 NULL

規格需求

需求
最低支援的用戶端 Windows 7 [僅限傳統型應用程式]
最低支援的伺服器 Windows Server 2008 R2 [僅限桌面應用程式]
目標平台 Windows
標頭 certenroll.h

另請參閱

IX509EnrollmentHelper