PresentationSession.GetCredentialData(String, CredentialDataRequest) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從當前簡報會話中命名憑證中擷取資料。
[Android.Runtime.Register("getCredentialData", "(Ljava/lang/String;Landroid/security/identity/CredentialDataRequest;)Landroid/security/identity/CredentialDataResult;", "GetGetCredentialData_Ljava_lang_String_Landroid_security_identity_CredentialDataRequest_Handler", ApiSince=33)]
public abstract Android.Security.Identity.CredentialDataResult? GetCredentialData(string credentialName, Android.Security.Identity.CredentialDataRequest request);
[<Android.Runtime.Register("getCredentialData", "(Ljava/lang/String;Landroid/security/identity/CredentialDataRequest;)Landroid/security/identity/CredentialDataResult;", "GetGetCredentialData_Ljava_lang_String_Landroid_security_identity_CredentialDataRequest_Handler", ApiSince=33)>]
abstract member GetCredentialData : string * Android.Security.Identity.CredentialDataRequest -> Android.Security.Identity.CredentialDataResult
參數
- credentialName
- String
要取回的憑證名稱。
- request
- CredentialDataRequest
從憑證中取得的資料
傳回
如果找不到憑證,則會回傳 null。 否則,包含 CredentialDataResult 依命名空間組織的入口資料及加密認證的相同資料表示,綁定於當前會話。
- 屬性
備註
從當前簡報會話中命名憑證中擷取資料。
如果存取控制檢查失敗,或該條目不存在,該條目就不會被回傳。 應用程式可以透過對每個請求的項目使用該 CredentialDataResult.Entries#getStatus(String, String) 方法來偵測此現象。
應用程式不應對是否需要使用者認證做出任何假設。 應用程式應先請求資料元素的值,然後檢查回傳 CredentialDataResult.Entries的 。 如果 CredentialDataResult.Entries#STATUS_USER_AUTHENTICATION_FAILED 回傳 ,應用程式應該會取得 ,該 該 android.hardware.biometrics.BiometricPrompt.CryptoObject 物件參考此物件,並搭配 android.hardware.biometrics.BiometricPrompt。 成功驗證後,應用程式可再次呼叫 #getCredentialData(String, CredentialDataRequest) 。
允許使用相同的憑證名稱多次呼叫此方法。 如果這麼做,會使用相同的認證金鑰。
若讀取器簽章已設定在請求參數(透過方法), CredentialDataRequest.Builder#setReaderSignature(byte[]) 則必須包含 RFC 8152 定義結構的位元組 COSE_Sign1 。 因為有效載 nil 荷應使用,分離有效載荷即為 ReaderAuthenticationBytes 下述的CBOR。
ReaderAuthentication = [
"ReaderAuthentication",
SessionTranscript,
ItemsRequestBytes
]
ItemsRequestBytes = #6.24(bstr .cbor ItemsRequest)
ReaderAuthenticationBytes = #6.24(bstr .cbor ReaderAuthentication)
其中 ItemsRequestBytes 是請求參數中請求訊息的位元組(透過 方法 CredentialDataRequest.Builder#setRequestMessage(byte[]) )。
用於簽章的公鑰可在結構的COSE_Sign1未保護標頭元素中找到x5chain(如 draft-ietf-cose-x509-08 所述)。 該元素中至少會有一份證書,且可能還有更多(如果有,每份證書都必須由其後繼者簽署)。
受讀取器認證保護的資料元素,當且僅當該 requestMessage 資料元素由讀取器憑證鏈中最頂端的憑證簽署,且該資料元素配置 AccessControlProfile 為 X.509 憑證,且該金鑰出現在憑證鏈中時,才會回傳資料元素。
請注意,請求訊息 CBOR 僅用於強制讀取器驗證,並不用於判斷此 API 會回傳哪些條目。 應用程式預期已解析請求訊息,並依使用者偏好及/或同意進行過濾。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。