共用方式為


IX509EnrollmentHelper::AddEnrollmentServer 方法 (certenroll.h)

AddEnrollmentServer方法會將憑證註冊伺服器 (CES) 存取認證儲存在認證快取中。 此方法已啟用 Web。

語法

HRESULT AddEnrollmentServer(
  [in] BSTR                    strEnrollmentServerURI,
  [in] X509EnrollmentAuthFlags authFlags,
  [in] BSTR                    strCredential,
  [in] BSTR                    strPassword
);

參數

[in] strEnrollmentServerURI

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

[in] authFlags

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

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

[in] strCredential

包含認證的 BSTR

[in] strPassword

包含純文字密碼的 BSTR

傳回值

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

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

傳回碼 Description
E_INVALIDARG
strEnrollmentServerURI參數不可為Null或空白。

如果在 authFlags 參數中指定 X509AuthAnonymous 或 X509AuthKerberos, strCredential 參數不得為 Null

如果在 authFlags 參數中指定 X509AuthCertificate, strCredential 參數必須是 Null

如果在 authFlags 參數中指定的 X509AuthCertificateis, strPassword 參數必須是 Null,但 strCredential 參數不得為 。

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