「マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
ユーザー毎に別のキーストアを持つ。
さらにアプリ毎にコンテナが分割される。
if (await KeyCredentialManager.IsSupportedAsync() == false) { ・・・
当該ユーザ&アプリケーションのキーのストア&コンテナを開く。
// retrieve private key for sign KeyCredentialRetrievalResult res = await KeyCredentialManager.OpenAsync("keyName"); if (res.Status == KeyCredentialStatus.Success) { ・・・
上記の結果が、
if (res.Status == KeyCredentialStatus.NotFound) { ・・・
の場合、
// Create the credential // (Windows Hello is diplayed here !) KeyCredentialRetrievalResult createRes = await KeyCredentialManager.RequestCreateAsync("keyName", KeyCredentialCreationOption.ReplaceExisting); // if the status is success, retrieve the public key. if (createRes.Status == KeyCredentialStatus.Success) { ・・・
var userKey = keyCreationResult.Credential; var publicKey = userKey.RetrievePublicKey(); var keyAttestationResult = await userKey.GetAttestationAsync(); IBuffer keyAttestation = null; IBuffer certificateChain = null; bool keyAttesttionIncluded = false; bool keyAttestationCanBeRetrievedLAter = false; KeyCredentialAttestationResult keyAttestationResult = await userKey.GetAttestationAsync(); KeyCredentialAttestationStatus keyAttestationRetryType = 0; if (keyAttestationResult.Status == KeyCredentialAttestationStatus.Success) { keyAttestationIncluded = true; keyAttestation = keyAttestationResult.AttestationBuffer; certificateChain = keyAttestationResult.CertificateChainBuffer; } else if (keyAttestationResult.Status == KeyCredentialAttestationStatus.TemporaryFailure) { keyAttestationRetryType = KeyCredentialAttestationStatus.TemporaryFailure; keyAttestationCanBeRetrievedLater = true; } else if (keyAttestationResult.Status == KeyCredentialAttestationStatus.NotSupported) { keyAttestationRetryType = KeyCredentialAttestationStatus.NotSupported; keyAttestationCanBeRetrievedLAter = true; }
上記の結果が、
if (res.Status == KeyCredentialStatus.Success) { ・・・
の場合、
登録後、この App に SignIn? する際には、PIN の入力や biometrics 認証を使って、この登録された private key を使ったデジタル署名 (RequestSignAsync?) が可能です。
private keyを削除する。
await KeyCredentialManager.DeleteAsync("keyName");
Tags: :認証基盤