| 1 |
// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 |
// Licensed under the MIT License. |
| 3 |
|
| 4 |
#ifndef __WEBAUTHN_H_ |
| 5 |
#define __WEBAUTHN_H_ |
| 6 |
|
| 7 |
#pragma once |
| 8 |
|
| 9 |
#include <winapifamily.h> |
| 10 |
|
| 11 |
#ifdef _MSC_VER |
| 12 |
#pragma region Desktop Family or OneCore Family |
| 13 |
#endif |
| 14 |
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP | WINAPI_PARTITION_SYSTEM) |
| 15 |
|
| 16 |
#ifdef __cplusplus |
| 17 |
extern "C" { |
| 18 |
#endif |
| 19 |
|
| 20 |
#ifndef WINAPI |
| 21 |
#define WINAPI __stdcall |
| 22 |
#endif |
| 23 |
|
| 24 |
#ifndef INITGUID |
| 25 |
#define INITGUID |
| 26 |
#include <guiddef.h> |
| 27 |
#undef INITGUID |
| 28 |
#else |
| 29 |
#include <guiddef.h> |
| 30 |
#endif |
| 31 |
|
| 32 |
//+------------------------------------------------------------------------------------------ |
| 33 |
// API Version Information. |
| 34 |
// Caller should check for WebAuthNGetApiVersionNumber to check the presence of relevant APIs |
| 35 |
// and features for their usage. |
| 36 |
//------------------------------------------------------------------------------------------- |
| 37 |
|
| 38 |
#define WEBAUTHN_API_VERSION_1 1 |
| 39 |
// WEBAUTHN_API_VERSION_1 : Baseline Version |
| 40 |
// Data Structures and their sub versions: |
| 41 |
// - WEBAUTHN_RP_ENTITY_INFORMATION : 1 |
| 42 |
// - WEBAUTHN_USER_ENTITY_INFORMATION : 1 |
| 43 |
// - WEBAUTHN_CLIENT_DATA : 1 |
| 44 |
// - WEBAUTHN_COSE_CREDENTIAL_PARAMETER : 1 |
| 45 |
// - WEBAUTHN_COSE_CREDENTIAL_PARAMETERS : Not Applicable |
| 46 |
// - WEBAUTHN_CREDENTIAL : 1 |
| 47 |
// - WEBAUTHN_CREDENTIALS : Not Applicable |
| 48 |
// - WEBAUTHN_CREDENTIAL_EX : 1 |
| 49 |
// - WEBAUTHN_CREDENTIAL_LIST : Not Applicable |
| 50 |
// - WEBAUTHN_EXTENSION : Not Applicable |
| 51 |
// - WEBAUTHN_EXTENSIONS : Not Applicable |
| 52 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 3 |
| 53 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 4 |
| 54 |
// - WEBAUTHN_COMMON_ATTESTATION : 1 |
| 55 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 3 |
| 56 |
// - WEBAUTHN_ASSERTION : 1 |
| 57 |
// Extensions: |
| 58 |
// - WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET |
| 59 |
// APIs: |
| 60 |
// - WebAuthNGetApiVersionNumber |
| 61 |
// - WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable |
| 62 |
// - WebAuthNAuthenticatorMakeCredential |
| 63 |
// - WebAuthNAuthenticatorGetAssertion |
| 64 |
// - WebAuthNFreeCredentialAttestation |
| 65 |
// - WebAuthNFreeAssertion |
| 66 |
// - WebAuthNGetCancellationId |
| 67 |
// - WebAuthNCancelCurrentOperation |
| 68 |
// - WebAuthNGetErrorName |
| 69 |
// - WebAuthNGetW3CExceptionDOMError |
| 70 |
// Transports: |
| 71 |
// - WEBAUTHN_CTAP_TRANSPORT_USB |
| 72 |
// - WEBAUTHN_CTAP_TRANSPORT_NFC |
| 73 |
// - WEBAUTHN_CTAP_TRANSPORT_BLE |
| 74 |
// - WEBAUTHN_CTAP_TRANSPORT_INTERNAL |
| 75 |
|
| 76 |
#define WEBAUTHN_API_VERSION_2 2 |
| 77 |
// WEBAUTHN_API_VERSION_2 : Delta From WEBAUTHN_API_VERSION_1 |
| 78 |
// Added Extensions: |
| 79 |
// - WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT |
| 80 |
// |
| 81 |
|
| 82 |
#define WEBAUTHN_API_VERSION_3 3 |
| 83 |
// WEBAUTHN_API_VERSION_3 : Delta From WEBAUTHN_API_VERSION_2 |
| 84 |
// Data Structures and their sub versions: |
| 85 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 4 |
| 86 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 5 |
| 87 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 4 |
| 88 |
// - WEBAUTHN_ASSERTION : 2 |
| 89 |
// Added Extensions: |
| 90 |
// - WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB |
| 91 |
// - WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH |
| 92 |
// |
| 93 |
|
| 94 |
#define WEBAUTHN_API_VERSION_4 4 |
| 95 |
// WEBAUTHN_API_VERSION_4 : Delta From WEBAUTHN_API_VERSION_3 |
| 96 |
// Data Structures and their sub versions: |
| 97 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 5 |
| 98 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 6 |
| 99 |
// - WEBAUTHN_ASSERTION : 3 |
| 100 |
// - WEBAUTHN_GET_CREDENTIALS_OPTIONS : 1 |
| 101 |
// - WEBAUTHN_CREDENTIAL_DETAILS : 1 |
| 102 |
// APIs: |
| 103 |
// - WebAuthNGetPlatformCredentialList |
| 104 |
// - WebAuthNFreePlatformCredentialList |
| 105 |
// - WebAuthNDeletePlatformCredential |
| 106 |
// |
| 107 |
|
| 108 |
#define WEBAUTHN_API_VERSION_5 5 |
| 109 |
// WEBAUTHN_API_VERSION_5 : Delta From WEBAUTHN_API_VERSION_4 |
| 110 |
// Data Structures and their sub versions: |
| 111 |
// - WEBAUTHN_CREDENTIAL_DETAILS : 2 |
| 112 |
// Extension Changes: |
| 113 |
// - Enabled LARGE_BLOB Support |
| 114 |
// |
| 115 |
|
| 116 |
#define WEBAUTHN_API_VERSION_6 6 |
| 117 |
// WEBAUTHN_API_VERSION_6 : Delta From WEBAUTHN_API_VERSION_5 |
| 118 |
// Data Structures and their sub versions: |
| 119 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 6 |
| 120 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 5 |
| 121 |
// - WEBAUTHN_ASSERTION : 4 |
| 122 |
// Transports: |
| 123 |
// - WEBAUTHN_CTAP_TRANSPORT_HYBRID |
| 124 |
|
| 125 |
#define WEBAUTHN_API_VERSION_7 7 |
| 126 |
// WEBAUTHN_API_VERSION_7 : Delta From WEBAUTHN_API_VERSION_6 |
| 127 |
// Data Structures and their sub versions: |
| 128 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 7 |
| 129 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 7 |
| 130 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 6 |
| 131 |
// - WEBAUTHN_ASSERTION : 5 |
| 132 |
|
| 133 |
#define WEBAUTHN_API_VERSION_8 8 |
| 134 |
// WEBAUTHN_API_VERSION_8 : Delta From WEBAUTHN_API_VERSION_7 |
| 135 |
// Data Structures and their sub versions: |
| 136 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 8 |
| 137 |
// - WEBAUTHN_CREDENTIAL_DETAILS : 3 |
| 138 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 7 |
| 139 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 8 |
| 140 |
// |
| 141 |
|
| 142 |
#define WEBAUTHN_API_VERSION_9 9 |
| 143 |
// WEBAUTHN_API_VERSION_9 : Delta From WEBAUTHN_API_VERSION_8 |
| 144 |
// Data Structures and their sub versions: |
| 145 |
// - WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS : 9 |
| 146 |
// - WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS : 9 |
| 147 |
// - WEBAUTHN_ASSERTION : 6 |
| 148 |
// - WEBAUTHN_CREDENTIAL_DETAILS : 4 |
| 149 |
// - WEBAUTHN_CREDENTIAL_ATTESTATION : 8 |
| 150 |
// - WEBAUTHN_AUTHENTICATOR_DETAILS : 1 |
| 151 |
// - WEBAUTHN_AUTHENTICATOR_DETAILS_LIST : Not Applicable |
| 152 |
// APIs: |
| 153 |
// - WebAuthNGetAuthenticatorList |
| 154 |
// - WebAuthNFreeAuthenticatorList |
| 155 |
|
| 156 |
#define WEBAUTHN_API_CURRENT_VERSION WEBAUTHN_API_VERSION_9 |
| 157 |
|
| 158 |
//+------------------------------------------------------------------------------------------ |
| 159 |
// Information about an RP Entity |
| 160 |
//------------------------------------------------------------------------------------------- |
| 161 |
|
| 162 |
#define WEBAUTHN_RP_ENTITY_INFORMATION_CURRENT_VERSION 1 |
| 163 |
|
| 164 |
typedef struct _WEBAUTHN_RP_ENTITY_INFORMATION { |
| 165 |
// Version of this structure, to allow for modifications in the future. |
| 166 |
// This field is required and should be set to CURRENT_VERSION above. |
| 167 |
DWORD dwVersion; |
| 168 |
|
| 169 |
// Identifier for the RP. This field is required. |
| 170 |
PCWSTR pwszId; |
| 171 |
|
| 172 |
// Contains the friendly name of the Relying Party, such as "Acme Corporation", "Widgets Inc" or "Awesome Site". |
| 173 |
// This field is required. |
| 174 |
PCWSTR pwszName; |
| 175 |
|
| 176 |
// Optional URL pointing to RP's logo. |
| 177 |
PCWSTR pwszIcon; |
| 178 |
} WEBAUTHN_RP_ENTITY_INFORMATION, *PWEBAUTHN_RP_ENTITY_INFORMATION; |
| 179 |
typedef const WEBAUTHN_RP_ENTITY_INFORMATION *PCWEBAUTHN_RP_ENTITY_INFORMATION; |
| 180 |
|
| 181 |
//+------------------------------------------------------------------------------------------ |
| 182 |
// Information about an User Entity |
| 183 |
//------------------------------------------------------------------------------------------- |
| 184 |
#define WEBAUTHN_MAX_USER_ID_LENGTH 64 |
| 185 |
|
| 186 |
#define WEBAUTHN_USER_ENTITY_INFORMATION_CURRENT_VERSION 1 |
| 187 |
|
| 188 |
typedef struct _WEBAUTHN_USER_ENTITY_INFORMATION { |
| 189 |
// Version of this structure, to allow for modifications in the future. |
| 190 |
// This field is required and should be set to CURRENT_VERSION above. |
| 191 |
DWORD dwVersion; |
| 192 |
|
| 193 |
// Identifier for the User. This field is required. |
| 194 |
DWORD cbId; |
| 195 |
_Field_size_bytes_(cbId) |
| 196 |
PBYTE pbId; |
| 197 |
|
| 198 |
// Contains a detailed name for this account, such as "[email protected]". |
| 199 |
PCWSTR pwszName; |
| 200 |
|
| 201 |
// Optional URL that can be used to retrieve an image containing the user's current avatar, |
| 202 |
// or a data URI that contains the image data. |
| 203 |
PCWSTR pwszIcon; |
| 204 |
|
| 205 |
// For User: Contains the friendly name associated with the user account by the Relying Party, such as "John P. Smith". |
| 206 |
PCWSTR pwszDisplayName; |
| 207 |
} WEBAUTHN_USER_ENTITY_INFORMATION, *PWEBAUTHN_USER_ENTITY_INFORMATION; |
| 208 |
typedef const WEBAUTHN_USER_ENTITY_INFORMATION *PCWEBAUTHN_USER_ENTITY_INFORMATION; |
| 209 |
|
| 210 |
//+------------------------------------------------------------------------------------------ |
| 211 |
// Information about client data. |
| 212 |
//------------------------------------------------------------------------------------------- |
| 213 |
|
| 214 |
#define WEBAUTHN_HASH_ALGORITHM_SHA_256 L"SHA-256" |
| 215 |
#define WEBAUTHN_HASH_ALGORITHM_SHA_384 L"SHA-384" |
| 216 |
#define WEBAUTHN_HASH_ALGORITHM_SHA_512 L"SHA-512" |
| 217 |
|
| 218 |
#define WEBAUTHN_CLIENT_DATA_CURRENT_VERSION 1 |
| 219 |
|
| 220 |
typedef struct _WEBAUTHN_CLIENT_DATA { |
| 221 |
// Version of this structure, to allow for modifications in the future. |
| 222 |
// This field is required and should be set to CURRENT_VERSION above. |
| 223 |
DWORD dwVersion; |
| 224 |
|
| 225 |
// Size of the pbClientDataJSON field. |
| 226 |
DWORD cbClientDataJSON; |
| 227 |
// UTF-8 encoded JSON serialization of the client data. |
| 228 |
_Field_size_bytes_(cbClientDataJSON) |
| 229 |
PBYTE pbClientDataJSON; |
| 230 |
|
| 231 |
// Hash algorithm ID used to hash the pbClientDataJSON field. |
| 232 |
LPCWSTR pwszHashAlgId; |
| 233 |
} WEBAUTHN_CLIENT_DATA, *PWEBAUTHN_CLIENT_DATA; |
| 234 |
typedef const WEBAUTHN_CLIENT_DATA *PCWEBAUTHN_CLIENT_DATA; |
| 235 |
|
| 236 |
//+------------------------------------------------------------------------------------------ |
| 237 |
// Information about credential parameters. |
| 238 |
//------------------------------------------------------------------------------------------- |
| 239 |
|
| 240 |
#define WEBAUTHN_CREDENTIAL_TYPE_PUBLIC_KEY L"public-key" |
| 241 |
|
| 242 |
#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256 -7 |
| 243 |
#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P384_WITH_SHA384 -35 |
| 244 |
#define WEBAUTHN_COSE_ALGORITHM_ECDSA_P521_WITH_SHA512 -36 |
| 245 |
|
| 246 |
#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256 -257 |
| 247 |
#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA384 -258 |
| 248 |
#define WEBAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA512 -259 |
| 249 |
|
| 250 |
#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA256 -37 |
| 251 |
#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA384 -38 |
| 252 |
#define WEBAUTHN_COSE_ALGORITHM_RSA_PSS_WITH_SHA512 -39 |
| 253 |
|
| 254 |
#define WEBAUTHN_COSE_CREDENTIAL_PARAMETER_CURRENT_VERSION 1 |
| 255 |
|
| 256 |
typedef struct _WEBAUTHN_COSE_CREDENTIAL_PARAMETER { |
| 257 |
// Version of this structure, to allow for modifications in the future. |
| 258 |
DWORD dwVersion; |
| 259 |
|
| 260 |
// Well-known credential type specifying a credential to create. |
| 261 |
LPCWSTR pwszCredentialType; |
| 262 |
|
| 263 |
// Well-known COSE algorithm specifying the algorithm to use for the credential. |
| 264 |
LONG lAlg; |
| 265 |
} WEBAUTHN_COSE_CREDENTIAL_PARAMETER, *PWEBAUTHN_COSE_CREDENTIAL_PARAMETER; |
| 266 |
typedef const WEBAUTHN_COSE_CREDENTIAL_PARAMETER *PCWEBAUTHN_COSE_CREDENTIAL_PARAMETER; |
| 267 |
|
| 268 |
typedef struct _WEBAUTHN_COSE_CREDENTIAL_PARAMETERS { |
| 269 |
DWORD cCredentialParameters; |
| 270 |
_Field_size_(cCredentialParameters) |
| 271 |
PWEBAUTHN_COSE_CREDENTIAL_PARAMETER pCredentialParameters; |
| 272 |
} WEBAUTHN_COSE_CREDENTIAL_PARAMETERS, *PWEBAUTHN_COSE_CREDENTIAL_PARAMETERS; |
| 273 |
typedef const WEBAUTHN_COSE_CREDENTIAL_PARAMETERS *PCWEBAUTHN_COSE_CREDENTIAL_PARAMETERS; |
| 274 |
|
| 275 |
//+------------------------------------------------------------------------------------------ |
| 276 |
// Information about credential. |
| 277 |
//------------------------------------------------------------------------------------------- |
| 278 |
#define WEBAUTHN_CREDENTIAL_CURRENT_VERSION 1 |
| 279 |
|
| 280 |
typedef struct _WEBAUTHN_CREDENTIAL { |
| 281 |
// Version of this structure, to allow for modifications in the future. |
| 282 |
DWORD dwVersion; |
| 283 |
|
| 284 |
// Size of pbID. |
| 285 |
DWORD cbId; |
| 286 |
// Unique ID for this particular credential. |
| 287 |
_Field_size_bytes_(cbId) |
| 288 |
PBYTE pbId; |
| 289 |
|
| 290 |
// Well-known credential type specifying what this particular credential is. |
| 291 |
LPCWSTR pwszCredentialType; |
| 292 |
} WEBAUTHN_CREDENTIAL, *PWEBAUTHN_CREDENTIAL; |
| 293 |
typedef const WEBAUTHN_CREDENTIAL *PCWEBAUTHN_CREDENTIAL; |
| 294 |
|
| 295 |
typedef struct _WEBAUTHN_CREDENTIALS { |
| 296 |
DWORD cCredentials; |
| 297 |
_Field_size_(cCredentials) |
| 298 |
PWEBAUTHN_CREDENTIAL pCredentials; |
| 299 |
} WEBAUTHN_CREDENTIALS, *PWEBAUTHN_CREDENTIALS; |
| 300 |
typedef const WEBAUTHN_CREDENTIALS *PCWEBAUTHN_CREDENTIALS; |
| 301 |
|
| 302 |
//+------------------------------------------------------------------------------------------ |
| 303 |
// Information about credential with extra information, such as, dwTransports |
| 304 |
//------------------------------------------------------------------------------------------- |
| 305 |
|
| 306 |
#define WEBAUTHN_CTAP_TRANSPORT_USB 0x00000001 |
| 307 |
#define WEBAUTHN_CTAP_TRANSPORT_NFC 0x00000002 |
| 308 |
#define WEBAUTHN_CTAP_TRANSPORT_BLE 0x00000004 |
| 309 |
#define WEBAUTHN_CTAP_TRANSPORT_TEST 0x00000008 |
| 310 |
#define WEBAUTHN_CTAP_TRANSPORT_INTERNAL 0x00000010 |
| 311 |
#define WEBAUTHN_CTAP_TRANSPORT_HYBRID 0x00000020 |
| 312 |
#define WEBAUTHN_CTAP_TRANSPORT_SMART_CARD 0x00000040 |
| 313 |
#define WEBAUTHN_CTAP_TRANSPORT_FLAGS_MASK 0x0000007F |
| 314 |
|
| 315 |
#define WEBAUTHN_CTAP_TRANSPORT_USB_STRING "usb" |
| 316 |
#define WEBAUTHN_CTAP_TRANSPORT_NFC_STRING "nfc" |
| 317 |
#define WEBAUTHN_CTAP_TRANSPORT_BLE_STRING "ble" |
| 318 |
#define WEBAUTHN_CTAP_TRANSPORT_SMART_CARD_STRING "smart-card" |
| 319 |
#define WEBAUTHN_CTAP_TRANSPORT_HYBRID_STRING "hybrid" |
| 320 |
#define WEBAUTHN_CTAP_TRANSPORT_INTERNAL_STRING "internal" |
| 321 |
|
| 322 |
#define WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION 1 |
| 323 |
|
| 324 |
typedef struct _WEBAUTHN_CREDENTIAL_EX { |
| 325 |
// Version of this structure, to allow for modifications in the future. |
| 326 |
DWORD dwVersion; |
| 327 |
|
| 328 |
// Size of pbID. |
| 329 |
DWORD cbId; |
| 330 |
// Unique ID for this particular credential. |
| 331 |
_Field_size_bytes_(cbId) |
| 332 |
PBYTE pbId; |
| 333 |
|
| 334 |
// Well-known credential type specifying what this particular credential is. |
| 335 |
LPCWSTR pwszCredentialType; |
| 336 |
|
| 337 |
// Transports. 0 implies no transport restrictions. |
| 338 |
DWORD dwTransports; |
| 339 |
} WEBAUTHN_CREDENTIAL_EX, *PWEBAUTHN_CREDENTIAL_EX; |
| 340 |
typedef const WEBAUTHN_CREDENTIAL_EX *PCWEBAUTHN_CREDENTIAL_EX; |
| 341 |
|
| 342 |
//+------------------------------------------------------------------------------------------ |
| 343 |
// Information about credential list with extra information |
| 344 |
//------------------------------------------------------------------------------------------- |
| 345 |
|
| 346 |
typedef struct _WEBAUTHN_CREDENTIAL_LIST { |
| 347 |
DWORD cCredentials; |
| 348 |
_Field_size_(cCredentials) |
| 349 |
PWEBAUTHN_CREDENTIAL_EX *ppCredentials; |
| 350 |
} WEBAUTHN_CREDENTIAL_LIST, *PWEBAUTHN_CREDENTIAL_LIST; |
| 351 |
typedef const WEBAUTHN_CREDENTIAL_LIST *PCWEBAUTHN_CREDENTIAL_LIST; |
| 352 |
|
| 353 |
//+------------------------------------------------------------------------------------------ |
| 354 |
// Information about linked devices |
| 355 |
//------------------------------------------------------------------------------------------- |
| 356 |
|
| 357 |
#define CTAPCBOR_HYBRID_STORAGE_LINKED_DATA_VERSION_1 1 |
| 358 |
#define CTAPCBOR_HYBRID_STORAGE_LINKED_DATA_CURRENT_VERSION CTAPCBOR_HYBRID_STORAGE_LINKED_DATA_VERSION_1 |
| 359 |
|
| 360 |
// Deprecated |
| 361 |
typedef struct _CTAPCBOR_HYBRID_STORAGE_LINKED_DATA |
| 362 |
{ |
| 363 |
// Version |
| 364 |
DWORD dwVersion; |
| 365 |
|
| 366 |
// Contact Id |
| 367 |
DWORD cbContactId; |
| 368 |
_Field_size_bytes_(cbContactId) |
| 369 |
PBYTE pbContactId; |
| 370 |
|
| 371 |
// Link Id |
| 372 |
DWORD cbLinkId; |
| 373 |
_Field_size_bytes_(cbLinkId) |
| 374 |
PBYTE pbLinkId; |
| 375 |
|
| 376 |
// Link secret |
| 377 |
DWORD cbLinkSecret; |
| 378 |
_Field_size_bytes_(cbLinkSecret) |
| 379 |
PBYTE pbLinkSecret; |
| 380 |
|
| 381 |
// Authenticator Public Key |
| 382 |
DWORD cbPublicKey; |
| 383 |
_Field_size_bytes_(cbPublicKey) |
| 384 |
PBYTE pbPublicKey; |
| 385 |
|
| 386 |
// Authenticator Name |
| 387 |
PCWSTR pwszAuthenticatorName; |
| 388 |
|
| 389 |
// Tunnel server domain |
| 390 |
WORD wEncodedTunnelServerDomain; |
| 391 |
} CTAPCBOR_HYBRID_STORAGE_LINKED_DATA, *PCTAPCBOR_HYBRID_STORAGE_LINKED_DATA; |
| 392 |
typedef const CTAPCBOR_HYBRID_STORAGE_LINKED_DATA *PCCTAPCBOR_HYBRID_STORAGE_LINKED_DATA; |
| 393 |
|
| 394 |
//+------------------------------------------------------------------------------------------ |
| 395 |
// Authenticator Information for WebAuthNGetAuthenticatorList API |
| 396 |
//------------------------------------------------------------------------------------------- |
| 397 |
|
| 398 |
#define WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS_VERSION_1 1 |
| 399 |
#define WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS_CURRENT_VERSION WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS_VERSION_1 |
| 400 |
|
| 401 |
typedef struct _WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS { |
| 402 |
// Version of this structure, to allow for modifications in the future. |
| 403 |
DWORD dwVersion; |
| 404 |
|
| 405 |
} WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS, *PWEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS; |
| 406 |
typedef const WEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS *PCWEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS; |
| 407 |
|
| 408 |
#define WEBAUTHN_AUTHENTICATOR_DETAILS_VERSION_1 1 |
| 409 |
#define WEBAUTHN_AUTHENTICATOR_DETAILS_CURRENT_VERSION WEBAUTHN_AUTHENTICATOR_DETAILS_VERSION_1 |
| 410 |
|
| 411 |
typedef struct _WEBAUTHN_AUTHENTICATOR_DETAILS { |
| 412 |
// Version of this structure, to allow for modifications in the future. |
| 413 |
DWORD dwVersion; |
| 414 |
|
| 415 |
// Authenticator ID |
| 416 |
DWORD cbAuthenticatorId; |
| 417 |
_Field_size_bytes_(cbAuthenticatorId) |
| 418 |
PBYTE pbAuthenticatorId; |
| 419 |
|
| 420 |
// Authenticator Name |
| 421 |
PCWSTR pwszAuthenticatorName; |
| 422 |
|
| 423 |
// Authenticator logo (expected to be in SVG format) |
| 424 |
DWORD cbAuthenticatorLogo; |
| 425 |
_Field_size_bytes_(cbAuthenticatorLogo) |
| 426 |
PBYTE pbAuthenticatorLogo; |
| 427 |
|
| 428 |
// Is the authenticator currently locked? When locked, this authenticator's credentials |
| 429 |
// might not be present or updated in WebAuthNGetPlatformCredentialList. |
| 430 |
BOOL bLocked; |
| 431 |
|
| 432 |
} WEBAUTHN_AUTHENTICATOR_DETAILS, *PWEBAUTHN_AUTHENTICATOR_DETAILS; |
| 433 |
typedef const WEBAUTHN_AUTHENTICATOR_DETAILS *PCWEBAUTHN_AUTHENTICATOR_DETAILS; |
| 434 |
|
| 435 |
typedef struct _WEBAUTHN_AUTHENTICATOR_DETAILS_LIST { |
| 436 |
// Authenticator Details |
| 437 |
DWORD cAuthenticatorDetails; |
| 438 |
_Field_size_(cAuthenticatorDetails) |
| 439 |
PWEBAUTHN_AUTHENTICATOR_DETAILS *ppAuthenticatorDetails; |
| 440 |
|
| 441 |
} WEBAUTHN_AUTHENTICATOR_DETAILS_LIST, *PWEBAUTHN_AUTHENTICATOR_DETAILS_LIST; |
| 442 |
typedef const WEBAUTHN_AUTHENTICATOR_DETAILS_LIST *PCWEBAUTHN_AUTHENTICATOR_DETAILS_LIST; |
| 443 |
|
| 444 |
//+------------------------------------------------------------------------------------------ |
| 445 |
// Credential Information for WebAuthNGetPlatformCredentialList API |
| 446 |
//------------------------------------------------------------------------------------------- |
| 447 |
|
| 448 |
#define WEBAUTHN_CREDENTIAL_DETAILS_VERSION_1 1 |
| 449 |
#define WEBAUTHN_CREDENTIAL_DETAILS_VERSION_2 2 |
| 450 |
#define WEBAUTHN_CREDENTIAL_DETAILS_VERSION_3 3 |
| 451 |
#define WEBAUTHN_CREDENTIAL_DETAILS_VERSION_4 4 |
| 452 |
#define WEBAUTHN_CREDENTIAL_DETAILS_CURRENT_VERSION WEBAUTHN_CREDENTIAL_DETAILS_VERSION_4 |
| 453 |
|
| 454 |
typedef struct _WEBAUTHN_CREDENTIAL_DETAILS { |
| 455 |
// Version of this structure, to allow for modifications in the future. |
| 456 |
DWORD dwVersion; |
| 457 |
|
| 458 |
// Size of pbCredentialID. |
| 459 |
DWORD cbCredentialID; |
| 460 |
_Field_size_bytes_(cbCredentialID) |
| 461 |
PBYTE pbCredentialID; |
| 462 |
|
| 463 |
// RP Info |
| 464 |
PWEBAUTHN_RP_ENTITY_INFORMATION pRpInformation; |
| 465 |
|
| 466 |
// User Info |
| 467 |
PWEBAUTHN_USER_ENTITY_INFORMATION pUserInformation; |
| 468 |
|
| 469 |
// Removable or not. |
| 470 |
BOOL bRemovable; |
| 471 |
|
| 472 |
// |
| 473 |
// The following fields have been added in WEBAUTHN_CREDENTIAL_DETAILS_VERSION_2 |
| 474 |
// |
| 475 |
|
| 476 |
// Backed Up or not. |
| 477 |
BOOL bBackedUp; |
| 478 |
|
| 479 |
// |
| 480 |
// The following fields have been added in WEBAUTHN_CREDENTIAL_DETAILS_VERSION_3 |
| 481 |
// |
| 482 |
PCWSTR pwszAuthenticatorName; |
| 483 |
|
| 484 |
// The logo is expected to be in the svg format |
| 485 |
DWORD cbAuthenticatorLogo; |
| 486 |
_Field_size_bytes_(cbAuthenticatorLogo) |
| 487 |
PBYTE pbAuthenticatorLogo; |
| 488 |
|
| 489 |
// ThirdPartyPayment Credential or not. |
| 490 |
BOOL bThirdPartyPayment; |
| 491 |
|
| 492 |
// |
| 493 |
// The following fields have been added in WEBAUTHN_CREDENTIAL_DETAILS_VERSION_4 |
| 494 |
// |
| 495 |
|
| 496 |
// Applicable Transports |
| 497 |
DWORD dwTransports; |
| 498 |
|
| 499 |
} WEBAUTHN_CREDENTIAL_DETAILS, *PWEBAUTHN_CREDENTIAL_DETAILS; |
| 500 |
typedef const WEBAUTHN_CREDENTIAL_DETAILS *PCWEBAUTHN_CREDENTIAL_DETAILS; |
| 501 |
|
| 502 |
typedef struct _WEBAUTHN_CREDENTIAL_DETAILS_LIST { |
| 503 |
DWORD cCredentialDetails; |
| 504 |
_Field_size_(cCredentialDetails) |
| 505 |
PWEBAUTHN_CREDENTIAL_DETAILS *ppCredentialDetails; |
| 506 |
} WEBAUTHN_CREDENTIAL_DETAILS_LIST, *PWEBAUTHN_CREDENTIAL_DETAILS_LIST; |
| 507 |
typedef const WEBAUTHN_CREDENTIAL_DETAILS_LIST *PCWEBAUTHN_CREDENTIAL_DETAILS_LIST; |
| 508 |
|
| 509 |
#define WEBAUTHN_GET_CREDENTIALS_OPTIONS_VERSION_1 1 |
| 510 |
#define WEBAUTHN_GET_CREDENTIALS_OPTIONS_CURRENT_VERSION WEBAUTHN_GET_CREDENTIALS_OPTIONS_VERSION_1 |
| 511 |
|
| 512 |
typedef struct _WEBAUTHN_GET_CREDENTIALS_OPTIONS { |
| 513 |
// Version of this structure, to allow for modifications in the future. |
| 514 |
DWORD dwVersion; |
| 515 |
|
| 516 |
// Optional. |
| 517 |
LPCWSTR pwszRpId; |
| 518 |
|
| 519 |
// Optional. BrowserInPrivate Mode. Defaulting to FALSE. |
| 520 |
BOOL bBrowserInPrivateMode; |
| 521 |
} WEBAUTHN_GET_CREDENTIALS_OPTIONS, *PWEBAUTHN_GET_CREDENTIALS_OPTIONS; |
| 522 |
typedef const WEBAUTHN_GET_CREDENTIALS_OPTIONS *PCWEBAUTHN_GET_CREDENTIALS_OPTIONS; |
| 523 |
|
| 524 |
//+------------------------------------------------------------------------------------------ |
| 525 |
// PRF values. |
| 526 |
//------------------------------------------------------------------------------------------- |
| 527 |
|
| 528 |
#define WEBAUTHN_CTAP_ONE_HMAC_SECRET_LENGTH 32 |
| 529 |
|
| 530 |
// SALT values below by default are converted into RAW Hmac-Secret values as per PRF extension. |
| 531 |
// - SHA-256(UTF8Encode("WebAuthn PRF") || 0x00 || Value) |
| 532 |
// |
| 533 |
// Set WEBAUTHN_AUTHENTICATOR_HMAC_SECRET_VALUES_FLAG in dwFlags in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS, |
| 534 |
// if caller wants to provide RAW Hmac-Secret SALT values directly. In that case, |
| 535 |
// values if provided MUST be of WEBAUTHN_CTAP_ONE_HMAC_SECRET_LENGTH size. |
| 536 |
|
| 537 |
typedef struct _WEBAUTHN_HMAC_SECRET_SALT { |
| 538 |
// Size of pbFirst. |
| 539 |
DWORD cbFirst; |
| 540 |
_Field_size_bytes_(cbFirst) |
| 541 |
PBYTE pbFirst; // Required |
| 542 |
|
| 543 |
// Size of pbSecond. |
| 544 |
DWORD cbSecond; |
| 545 |
_Field_size_bytes_(cbSecond) |
| 546 |
PBYTE pbSecond; |
| 547 |
} WEBAUTHN_HMAC_SECRET_SALT, *PWEBAUTHN_HMAC_SECRET_SALT; |
| 548 |
typedef const WEBAUTHN_HMAC_SECRET_SALT *PCWEBAUTHN_HMAC_SECRET_SALT; |
| 549 |
|
| 550 |
typedef struct _WEBAUTHN_CRED_WITH_HMAC_SECRET_SALT { |
| 551 |
// Size of pbCredID. |
| 552 |
DWORD cbCredID; |
| 553 |
_Field_size_bytes_(cbCredID) |
| 554 |
PBYTE pbCredID; // Required |
| 555 |
|
| 556 |
// PRF Values for above credential |
| 557 |
PWEBAUTHN_HMAC_SECRET_SALT pHmacSecretSalt; // Required |
| 558 |
} WEBAUTHN_CRED_WITH_HMAC_SECRET_SALT, *PWEBAUTHN_CRED_WITH_HMAC_SECRET_SALT; |
| 559 |
typedef const WEBAUTHN_CRED_WITH_HMAC_SECRET_SALT *PCWEBAUTHN_CRED_WITH_HMAC_SECRET_SALT; |
| 560 |
|
| 561 |
typedef struct _WEBAUTHN_HMAC_SECRET_SALT_VALUES { |
| 562 |
PWEBAUTHN_HMAC_SECRET_SALT pGlobalHmacSalt; |
| 563 |
|
| 564 |
DWORD cCredWithHmacSecretSaltList; |
| 565 |
_Field_size_(cCredWithHmacSecretSaltList) |
| 566 |
PWEBAUTHN_CRED_WITH_HMAC_SECRET_SALT pCredWithHmacSecretSaltList; |
| 567 |
} WEBAUTHN_HMAC_SECRET_SALT_VALUES, *PWEBAUTHN_HMAC_SECRET_SALT_VALUES; |
| 568 |
typedef const WEBAUTHN_HMAC_SECRET_SALT_VALUES *PCWEBAUTHN_HMAC_SECRET_SALT_VALUES; |
| 569 |
|
| 570 |
//+------------------------------------------------------------------------------------------ |
| 571 |
// Hmac-Secret extension |
| 572 |
//------------------------------------------------------------------------------------------- |
| 573 |
|
| 574 |
#define WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET L"hmac-secret" |
| 575 |
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_HMAC_SECRET |
| 576 |
// MakeCredential Input Type: BOOL. |
| 577 |
// - pvExtension must point to a BOOL with the value TRUE. |
| 578 |
// - cbExtension must contain the sizeof(BOOL). |
| 579 |
// MakeCredential Output Type: BOOL. |
| 580 |
// - pvExtension will point to a BOOL with the value TRUE if credential |
| 581 |
// was successfully created with HMAC_SECRET. |
| 582 |
// - cbExtension will contain the sizeof(BOOL). |
| 583 |
// GetAssertion Input Type: Not Supported |
| 584 |
// GetAssertion Output Type: Not Supported |
| 585 |
|
| 586 |
//+------------------------------------------------------------------------------------------ |
| 587 |
// credProtect extension |
| 588 |
//------------------------------------------------------------------------------------------- |
| 589 |
|
| 590 |
#define WEBAUTHN_USER_VERIFICATION_ANY 0 |
| 591 |
#define WEBAUTHN_USER_VERIFICATION_OPTIONAL 1 |
| 592 |
#define WEBAUTHN_USER_VERIFICATION_OPTIONAL_WITH_CREDENTIAL_ID_LIST 2 |
| 593 |
#define WEBAUTHN_USER_VERIFICATION_REQUIRED 3 |
| 594 |
|
| 595 |
typedef struct _WEBAUTHN_CRED_PROTECT_EXTENSION_IN { |
| 596 |
// One of the above WEBAUTHN_USER_VERIFICATION_* values |
| 597 |
DWORD dwCredProtect; |
| 598 |
// Set the following to TRUE to require authenticator support for the credProtect extension |
| 599 |
BOOL bRequireCredProtect; |
| 600 |
} WEBAUTHN_CRED_PROTECT_EXTENSION_IN, *PWEBAUTHN_CRED_PROTECT_EXTENSION_IN; |
| 601 |
typedef const WEBAUTHN_CRED_PROTECT_EXTENSION_IN *PCWEBAUTHN_CRED_PROTECT_EXTENSION_IN; |
| 602 |
|
| 603 |
|
| 604 |
#define WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT L"credProtect" |
| 605 |
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_PROTECT |
| 606 |
// MakeCredential Input Type: WEBAUTHN_CRED_PROTECT_EXTENSION_IN. |
| 607 |
// - pvExtension must point to a WEBAUTHN_CRED_PROTECT_EXTENSION_IN struct |
| 608 |
// - cbExtension will contain the sizeof(WEBAUTHN_CRED_PROTECT_EXTENSION_IN). |
| 609 |
// MakeCredential Output Type: DWORD. |
| 610 |
// - pvExtension will point to a DWORD with one of the above WEBAUTHN_USER_VERIFICATION_* values |
| 611 |
// if credential was successfully created with CRED_PROTECT. |
| 612 |
// - cbExtension will contain the sizeof(DWORD). |
| 613 |
// GetAssertion Input Type: Not Supported |
| 614 |
// GetAssertion Output Type: Not Supported |
| 615 |
|
| 616 |
//+------------------------------------------------------------------------------------------ |
| 617 |
// credBlob extension |
| 618 |
//------------------------------------------------------------------------------------------- |
| 619 |
|
| 620 |
typedef struct _WEBAUTHN_CRED_BLOB_EXTENSION { |
| 621 |
// Size of pbCredBlob. |
| 622 |
DWORD cbCredBlob; |
| 623 |
_Field_size_bytes_(cbCredBlob) |
| 624 |
PBYTE pbCredBlob; |
| 625 |
} WEBAUTHN_CRED_BLOB_EXTENSION, *PWEBAUTHN_CRED_BLOB_EXTENSION; |
| 626 |
typedef const WEBAUTHN_CRED_BLOB_EXTENSION *PCWEBAUTHN_CRED_BLOB_EXTENSION; |
| 627 |
|
| 628 |
|
| 629 |
#define WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB L"credBlob" |
| 630 |
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_CRED_BLOB |
| 631 |
// MakeCredential Input Type: WEBAUTHN_CRED_BLOB_EXTENSION. |
| 632 |
// - pvExtension must point to a WEBAUTHN_CRED_BLOB_EXTENSION struct |
| 633 |
// - cbExtension must contain the sizeof(WEBAUTHN_CRED_BLOB_EXTENSION). |
| 634 |
// MakeCredential Output Type: BOOL. |
| 635 |
// - pvExtension will point to a BOOL with the value TRUE if credBlob was successfully created |
| 636 |
// - cbExtension will contain the sizeof(BOOL). |
| 637 |
// GetAssertion Input Type: BOOL. |
| 638 |
// - pvExtension must point to a BOOL with the value TRUE to request the credBlob. |
| 639 |
// - cbExtension must contain the sizeof(BOOL). |
| 640 |
// GetAssertion Output Type: WEBAUTHN_CRED_BLOB_EXTENSION. |
| 641 |
// - pvExtension will point to a WEBAUTHN_CRED_BLOB_EXTENSION struct if the authenticator |
| 642 |
// returns the credBlob in the signed extensions |
| 643 |
// - cbExtension will contain the sizeof(WEBAUTHN_CRED_BLOB_EXTENSION). |
| 644 |
|
| 645 |
//+------------------------------------------------------------------------------------------ |
| 646 |
// minPinLength extension |
| 647 |
//------------------------------------------------------------------------------------------- |
| 648 |
|
| 649 |
#define WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH L"minPinLength" |
| 650 |
// Below type definitions is for WEBAUTHN_EXTENSIONS_IDENTIFIER_MIN_PIN_LENGTH |
| 651 |
// MakeCredential Input Type: BOOL. |
| 652 |
// - pvExtension must point to a BOOL with the value TRUE to request the minPinLength. |
| 653 |
// - cbExtension must contain the sizeof(BOOL). |
| 654 |
// MakeCredential Output Type: DWORD. |
| 655 |
// - pvExtension will point to a DWORD with the minimum pin length if returned by the authenticator |
| 656 |
// - cbExtension will contain the sizeof(DWORD). |
| 657 |
// GetAssertion Input Type: Not Supported |
| 658 |
// GetAssertion Output Type: Not Supported |
| 659 |
|
| 660 |
//+------------------------------------------------------------------------------------------ |
| 661 |
// Information about Extensions. |
| 662 |
//------------------------------------------------------------------------------------------- |
| 663 |
typedef struct _WEBAUTHN_EXTENSION { |
| 664 |
LPCWSTR pwszExtensionIdentifier; |
| 665 |
DWORD cbExtension; |
| 666 |
PVOID pvExtension; |
| 667 |
} WEBAUTHN_EXTENSION, *PWEBAUTHN_EXTENSION; |
| 668 |
typedef const WEBAUTHN_EXTENSION *PCWEBAUTHN_EXTENSION; |
| 669 |
|
| 670 |
typedef struct _WEBAUTHN_EXTENSIONS { |
| 671 |
DWORD cExtensions; |
| 672 |
_Field_size_(cExtensions) |
| 673 |
PWEBAUTHN_EXTENSION pExtensions; |
| 674 |
} WEBAUTHN_EXTENSIONS, *PWEBAUTHN_EXTENSIONS; |
| 675 |
typedef const WEBAUTHN_EXTENSIONS *PCWEBAUTHN_EXTENSIONS; |
| 676 |
|
| 677 |
//+------------------------------------------------------------------------------------------ |
| 678 |
// Options. |
| 679 |
//------------------------------------------------------------------------------------------- |
| 680 |
|
| 681 |
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_ANY 0 |
| 682 |
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_PLATFORM 1 |
| 683 |
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM 2 |
| 684 |
#define WEBAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM_U2F_V2 3 |
| 685 |
|
| 686 |
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_ANY 0 |
| 687 |
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED 1 |
| 688 |
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_PREFERRED 2 |
| 689 |
#define WEBAUTHN_USER_VERIFICATION_REQUIREMENT_DISCOURAGED 3 |
| 690 |
|
| 691 |
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_ANY 0 |
| 692 |
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_NONE 1 |
| 693 |
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_INDIRECT 2 |
| 694 |
#define WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_DIRECT 3 |
| 695 |
|
| 696 |
#define WEBAUTHN_ENTERPRISE_ATTESTATION_NONE 0 |
| 697 |
#define WEBAUTHN_ENTERPRISE_ATTESTATION_VENDOR_FACILITATED 1 |
| 698 |
#define WEBAUTHN_ENTERPRISE_ATTESTATION_PLATFORM_MANAGED 2 |
| 699 |
|
| 700 |
#define WEBAUTHN_LARGE_BLOB_SUPPORT_NONE 0 |
| 701 |
#define WEBAUTHN_LARGE_BLOB_SUPPORT_REQUIRED 1 |
| 702 |
#define WEBAUTHN_LARGE_BLOB_SUPPORT_PREFERRED 2 |
| 703 |
|
| 704 |
#define WEBAUTHN_CREDENTIAL_HINT_SECURITY_KEY L"security-key" |
| 705 |
#define WEBAUTHN_CREDENTIAL_HINT_CLIENT_DEVICE L"client-device" |
| 706 |
#define WEBAUTHN_CREDENTIAL_HINT_HYBRID L"hybrid" |
| 707 |
|
| 708 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_1 1 |
| 709 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_2 2 |
| 710 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_3 3 |
| 711 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_4 4 |
| 712 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_5 5 |
| 713 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_6 6 |
| 714 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_7 7 |
| 715 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_8 8 |
| 716 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_9 9 |
| 717 |
#define WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_CURRENT_VERSION WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_9 |
| 718 |
|
| 719 |
typedef struct _WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS { |
| 720 |
// Version of this structure, to allow for modifications in the future. |
| 721 |
DWORD dwVersion; |
| 722 |
|
| 723 |
// Time that the operation is expected to complete within. |
| 724 |
// This is used as guidance, and can be overridden by the platform. |
| 725 |
DWORD dwTimeoutMilliseconds; |
| 726 |
|
| 727 |
// Credentials used for exclusion. |
| 728 |
WEBAUTHN_CREDENTIALS CredentialList; |
| 729 |
|
| 730 |
// Optional extensions to parse when performing the operation. |
| 731 |
WEBAUTHN_EXTENSIONS Extensions; |
| 732 |
|
| 733 |
// Optional. Platform vs Cross-Platform Authenticators. |
| 734 |
DWORD dwAuthenticatorAttachment; |
| 735 |
|
| 736 |
// Optional. Require key to be resident or not. Defaulting to FALSE. |
| 737 |
BOOL bRequireResidentKey; |
| 738 |
|
| 739 |
// User Verification Requirement. |
| 740 |
DWORD dwUserVerificationRequirement; |
| 741 |
|
| 742 |
// Attestation Conveyance Preference. |
| 743 |
DWORD dwAttestationConveyancePreference; |
| 744 |
|
| 745 |
// Reserved for future Use |
| 746 |
DWORD dwFlags; |
| 747 |
|
| 748 |
// |
| 749 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_2 |
| 750 |
// |
| 751 |
|
| 752 |
// Cancellation Id - Optional - See WebAuthNGetCancellationId |
| 753 |
GUID *pCancellationId; |
| 754 |
|
| 755 |
// |
| 756 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_3 |
| 757 |
// |
| 758 |
|
| 759 |
// Exclude Credential List. If present, "CredentialList" will be ignored. |
| 760 |
PWEBAUTHN_CREDENTIAL_LIST pExcludeCredentialList; |
| 761 |
|
| 762 |
// |
| 763 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_4 |
| 764 |
// |
| 765 |
|
| 766 |
// Enterprise Attestation |
| 767 |
DWORD dwEnterpriseAttestation; |
| 768 |
|
| 769 |
// Large Blob Support: none, required or preferred |
| 770 |
// |
| 771 |
// NTE_INVALID_PARAMETER when large blob required or preferred and |
| 772 |
// bRequireResidentKey isn't set to TRUE |
| 773 |
DWORD dwLargeBlobSupport; |
| 774 |
|
| 775 |
// Optional. Prefer key to be resident. Defaulting to FALSE. When TRUE, |
| 776 |
// overrides the above bRequireResidentKey. |
| 777 |
BOOL bPreferResidentKey; |
| 778 |
|
| 779 |
// |
| 780 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_5 |
| 781 |
// |
| 782 |
|
| 783 |
// Optional. BrowserInPrivate Mode. Defaulting to FALSE. |
| 784 |
BOOL bBrowserInPrivateMode; |
| 785 |
|
| 786 |
// |
| 787 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_6 |
| 788 |
// |
| 789 |
|
| 790 |
// Enable PRF |
| 791 |
BOOL bEnablePrf; |
| 792 |
|
| 793 |
// |
| 794 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_7 |
| 795 |
// |
| 796 |
|
| 797 |
// Deprecated |
| 798 |
// Optional. Linked Device Connection Info. |
| 799 |
PCTAPCBOR_HYBRID_STORAGE_LINKED_DATA pLinkedDevice; |
| 800 |
|
| 801 |
// Size of pbJsonExt |
| 802 |
DWORD cbJsonExt; |
| 803 |
_Field_size_bytes_(cbJsonExt) |
| 804 |
PBYTE pbJsonExt; |
| 805 |
|
| 806 |
// |
| 807 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_8 |
| 808 |
// |
| 809 |
|
| 810 |
// PRF extension "eval" values which will be converted into HMAC-SECRET values according to WebAuthn Spec. |
| 811 |
// Set WEBAUTHN_AUTHENTICATOR_HMAC_SECRET_VALUES_FLAG in dwFlags above, if caller wants to provide RAW Hmac-Secret SALT values directly. |
| 812 |
// In that case, values provided MUST be of WEBAUTHN_CTAP_ONE_HMAC_SECRET_LENGTH size. |
| 813 |
PWEBAUTHN_HMAC_SECRET_SALT pPRFGlobalEval; |
| 814 |
|
| 815 |
// PublicKeyCredentialHints (https://w3c.github.io/webauthn/#enum-hints) |
| 816 |
DWORD cCredentialHints; |
| 817 |
_Field_size_(cCredentialHints) |
| 818 |
LPCWSTR *ppwszCredentialHints; |
| 819 |
|
| 820 |
// Enable ThirdPartyPayment |
| 821 |
BOOL bThirdPartyPayment; |
| 822 |
|
| 823 |
// |
| 824 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS_VERSION_9 |
| 825 |
// |
| 826 |
|
| 827 |
// Web Origin. For Remote Web App scenario. |
| 828 |
PCWSTR pwszRemoteWebOrigin; |
| 829 |
|
| 830 |
// UTF-8 encoded JSON serialization of the PublicKeyCredentialCreationOptions. |
| 831 |
DWORD cbPublicKeyCredentialCreationOptionsJSON; |
| 832 |
_Field_size_bytes_(cbPublicKeyCredentialCreationOptionsJSON) |
| 833 |
PBYTE pbPublicKeyCredentialCreationOptionsJSON; |
| 834 |
|
| 835 |
// Authenticator ID got from WebAuthNGetAuthenticatorList API. |
| 836 |
DWORD cbAuthenticatorId; |
| 837 |
_Field_size_bytes_(cbAuthenticatorId) |
| 838 |
PBYTE pbAuthenticatorId; |
| 839 |
|
| 840 |
} WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS, *PWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS; |
| 841 |
typedef const WEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS *PCWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS; |
| 842 |
|
| 843 |
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_NONE 0 |
| 844 |
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_GET 1 |
| 845 |
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_SET 2 |
| 846 |
#define WEBAUTHN_CRED_LARGE_BLOB_OPERATION_DELETE 3 |
| 847 |
|
| 848 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_1 1 |
| 849 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_2 2 |
| 850 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_3 3 |
| 851 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_4 4 |
| 852 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_5 5 |
| 853 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_6 6 |
| 854 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_7 7 |
| 855 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_8 8 |
| 856 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_9 9 |
| 857 |
#define WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_CURRENT_VERSION WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_9 |
| 858 |
|
| 859 |
/* |
| 860 |
Information about flags. |
| 861 |
*/ |
| 862 |
|
| 863 |
#define WEBAUTHN_AUTHENTICATOR_HMAC_SECRET_VALUES_FLAG 0x00100000 |
| 864 |
|
| 865 |
typedef struct _WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS { |
| 866 |
// Version of this structure, to allow for modifications in the future. |
| 867 |
DWORD dwVersion; |
| 868 |
|
| 869 |
// Time that the operation is expected to complete within. |
| 870 |
// This is used as guidance, and can be overridden by the platform. |
| 871 |
DWORD dwTimeoutMilliseconds; |
| 872 |
|
| 873 |
// Allowed Credentials List. |
| 874 |
WEBAUTHN_CREDENTIALS CredentialList; |
| 875 |
|
| 876 |
// Optional extensions to parse when performing the operation. |
| 877 |
WEBAUTHN_EXTENSIONS Extensions; |
| 878 |
|
| 879 |
// Optional. Platform vs Cross-Platform Authenticators. |
| 880 |
DWORD dwAuthenticatorAttachment; |
| 881 |
|
| 882 |
// User Verification Requirement. |
| 883 |
DWORD dwUserVerificationRequirement; |
| 884 |
|
| 885 |
// Flags |
| 886 |
DWORD dwFlags; |
| 887 |
|
| 888 |
// |
| 889 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_2 |
| 890 |
// |
| 891 |
|
| 892 |
// Optional identifier for the U2F AppId. Converted to UTF8 before being hashed. Not lower cased. |
| 893 |
PCWSTR pwszU2fAppId; |
| 894 |
|
| 895 |
// If the following is non-NULL, then, set to TRUE if the above pwszU2fAppid was used instead of |
| 896 |
// PCWSTR pwszRpId; |
| 897 |
BOOL *pbU2fAppId; |
| 898 |
|
| 899 |
// |
| 900 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_3 |
| 901 |
// |
| 902 |
|
| 903 |
// Cancellation Id - Optional - See WebAuthNGetCancellationId |
| 904 |
GUID *pCancellationId; |
| 905 |
|
| 906 |
// |
| 907 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_4 |
| 908 |
// |
| 909 |
|
| 910 |
// Allow Credential List. If present, "CredentialList" will be ignored. |
| 911 |
PWEBAUTHN_CREDENTIAL_LIST pAllowCredentialList; |
| 912 |
|
| 913 |
// |
| 914 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_5 |
| 915 |
// |
| 916 |
|
| 917 |
DWORD dwCredLargeBlobOperation; |
| 918 |
|
| 919 |
// Size of pbCredLargeBlob |
| 920 |
DWORD cbCredLargeBlob; |
| 921 |
_Field_size_bytes_(cbCredLargeBlob) |
| 922 |
PBYTE pbCredLargeBlob; |
| 923 |
|
| 924 |
// |
| 925 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_6 |
| 926 |
// |
| 927 |
|
| 928 |
// PRF values which will be converted into HMAC-SECRET values according to WebAuthn Spec. |
| 929 |
PWEBAUTHN_HMAC_SECRET_SALT_VALUES pHmacSecretSaltValues; |
| 930 |
|
| 931 |
// Optional. BrowserInPrivate Mode. Defaulting to FALSE. |
| 932 |
BOOL bBrowserInPrivateMode; |
| 933 |
|
| 934 |
// |
| 935 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_7 |
| 936 |
// |
| 937 |
|
| 938 |
// Deprecated |
| 939 |
// Optional. Linked Device Connection Info. |
| 940 |
PCTAPCBOR_HYBRID_STORAGE_LINKED_DATA pLinkedDevice; |
| 941 |
|
| 942 |
// Optional. Allowlist MUST contain 1 credential applicable for Hybrid transport. |
| 943 |
BOOL bAutoFill; |
| 944 |
|
| 945 |
// Size of pbJsonExt |
| 946 |
DWORD cbJsonExt; |
| 947 |
_Field_size_bytes_(cbJsonExt) |
| 948 |
PBYTE pbJsonExt; |
| 949 |
|
| 950 |
// |
| 951 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_8 |
| 952 |
// |
| 953 |
|
| 954 |
// PublicKeyCredentialHints (https://w3c.github.io/webauthn/#enum-hints) |
| 955 |
DWORD cCredentialHints; |
| 956 |
_Field_size_(cCredentialHints) |
| 957 |
LPCWSTR *ppwszCredentialHints; |
| 958 |
|
| 959 |
// |
| 960 |
// The following fields have been added in WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS_VERSION_9 |
| 961 |
// |
| 962 |
|
| 963 |
// Web Origin. For Remote Web App scenario. |
| 964 |
PCWSTR pwszRemoteWebOrigin; |
| 965 |
|
| 966 |
// UTF-8 encoded JSON serialization of the PublicKeyCredentialRequestOptions. |
| 967 |
DWORD cbPublicKeyCredentialRequestOptionsJSON; |
| 968 |
_Field_size_bytes_(cbPublicKeyCredentialRequestOptionsJSON) |
| 969 |
PBYTE pbPublicKeyCredentialRequestOptionsJSON; |
| 970 |
|
| 971 |
// Authenticator ID got from WebAuthNGetAuthenticatorList API. |
| 972 |
DWORD cbAuthenticatorId; |
| 973 |
_Field_size_bytes_(cbAuthenticatorId) |
| 974 |
PBYTE pbAuthenticatorId; |
| 975 |
|
| 976 |
} WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS, *PWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS; |
| 977 |
typedef const WEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS *PCWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS; |
| 978 |
|
| 979 |
|
| 980 |
//+------------------------------------------------------------------------------------------ |
| 981 |
// Attestation Info. |
| 982 |
// |
| 983 |
//------------------------------------------------------------------------------------------- |
| 984 |
#define WEBAUTHN_ATTESTATION_DECODE_NONE 0 |
| 985 |
#define WEBAUTHN_ATTESTATION_DECODE_COMMON 1 |
| 986 |
// WEBAUTHN_ATTESTATION_DECODE_COMMON supports format types |
| 987 |
// L"packed" |
| 988 |
// L"fido-u2f" |
| 989 |
|
| 990 |
#define WEBAUTHN_ATTESTATION_VER_TPM_2_0 L"2.0" |
| 991 |
|
| 992 |
typedef struct _WEBAUTHN_X5C { |
| 993 |
// Length of X.509 encoded certificate |
| 994 |
DWORD cbData; |
| 995 |
// X.509 encoded certificate bytes |
| 996 |
_Field_size_bytes_(cbData) |
| 997 |
PBYTE pbData; |
| 998 |
} WEBAUTHN_X5C, *PWEBAUTHN_X5C; |
| 999 |
|
| 1000 |
// Supports either Self or Full Basic Attestation |
| 1001 |
|
| 1002 |
// Note, new fields will be added to the following data structure to |
| 1003 |
// support additional attestation format types, such as, TPM. |
| 1004 |
// When fields are added, the dwVersion will be incremented. |
| 1005 |
// |
| 1006 |
// Therefore, your code must make the following check: |
| 1007 |
// "if (dwVersion >= WEBAUTHN_COMMON_ATTESTATION_CURRENT_VERSION)" |
| 1008 |
|
| 1009 |
#define WEBAUTHN_COMMON_ATTESTATION_CURRENT_VERSION 1 |
| 1010 |
|
| 1011 |
typedef struct _WEBAUTHN_COMMON_ATTESTATION { |
| 1012 |
// Version of this structure, to allow for modifications in the future. |
| 1013 |
DWORD dwVersion; |
| 1014 |
|
| 1015 |
// Hash and Padding Algorithm |
| 1016 |
// |
| 1017 |
// The following won't be set for "fido-u2f" which assumes "ES256". |
| 1018 |
PCWSTR pwszAlg; |
| 1019 |
LONG lAlg; // COSE algorithm |
| 1020 |
|
| 1021 |
// Signature that was generated for this attestation. |
| 1022 |
DWORD cbSignature; |
| 1023 |
_Field_size_bytes_(cbSignature) |
| 1024 |
PBYTE pbSignature; |
| 1025 |
|
| 1026 |
// Following is set for Full Basic Attestation. If not, set then, this is Self Attestation. |
| 1027 |
// Array of X.509 DER encoded certificates. The first certificate is the signer, leaf certificate. |
| 1028 |
DWORD cX5c; |
| 1029 |
_Field_size_(cX5c) |
| 1030 |
PWEBAUTHN_X5C pX5c; |
| 1031 |
|
| 1032 |
// Following are also set for tpm |
| 1033 |
PCWSTR pwszVer; // L"2.0" |
| 1034 |
DWORD cbCertInfo; |
| 1035 |
_Field_size_bytes_(cbCertInfo) |
| 1036 |
PBYTE pbCertInfo; |
| 1037 |
DWORD cbPubArea; |
| 1038 |
_Field_size_bytes_(cbPubArea) |
| 1039 |
PBYTE pbPubArea; |
| 1040 |
} WEBAUTHN_COMMON_ATTESTATION, *PWEBAUTHN_COMMON_ATTESTATION; |
| 1041 |
typedef const WEBAUTHN_COMMON_ATTESTATION *PCWEBAUTHN_COMMON_ATTESTATION; |
| 1042 |
|
| 1043 |
#define WEBAUTHN_ATTESTATION_TYPE_PACKED L"packed" |
| 1044 |
#define WEBAUTHN_ATTESTATION_TYPE_U2F L"fido-u2f" |
| 1045 |
#define WEBAUTHN_ATTESTATION_TYPE_TPM L"tpm" |
| 1046 |
#define WEBAUTHN_ATTESTATION_TYPE_NONE L"none" |
| 1047 |
|
| 1048 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_1 1 |
| 1049 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_2 2 |
| 1050 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_3 3 |
| 1051 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_4 4 |
| 1052 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_5 5 |
| 1053 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_6 6 |
| 1054 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_7 7 |
| 1055 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_8 8 |
| 1056 |
#define WEBAUTHN_CREDENTIAL_ATTESTATION_CURRENT_VERSION WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_8 |
| 1057 |
|
| 1058 |
typedef struct _WEBAUTHN_CREDENTIAL_ATTESTATION { |
| 1059 |
// Version of this structure, to allow for modifications in the future. |
| 1060 |
DWORD dwVersion; |
| 1061 |
|
| 1062 |
// Attestation format type |
| 1063 |
PCWSTR pwszFormatType; |
| 1064 |
|
| 1065 |
// Size of cbAuthenticatorData. |
| 1066 |
DWORD cbAuthenticatorData; |
| 1067 |
// Authenticator data that was created for this credential. |
| 1068 |
_Field_size_bytes_(cbAuthenticatorData) |
| 1069 |
PBYTE pbAuthenticatorData; |
| 1070 |
|
| 1071 |
// Size of CBOR encoded attestation information |
| 1072 |
//0 => encoded as CBOR null value. |
| 1073 |
DWORD cbAttestation; |
| 1074 |
//Encoded CBOR attestation information |
| 1075 |
_Field_size_bytes_(cbAttestation) |
| 1076 |
PBYTE pbAttestation; |
| 1077 |
|
| 1078 |
DWORD dwAttestationDecodeType; |
| 1079 |
// Following depends on the dwAttestationDecodeType |
| 1080 |
// WEBAUTHN_ATTESTATION_DECODE_NONE |
| 1081 |
// NULL - not able to decode the CBOR attestation information |
| 1082 |
// WEBAUTHN_ATTESTATION_DECODE_COMMON |
| 1083 |
// PWEBAUTHN_COMMON_ATTESTATION; |
| 1084 |
PVOID pvAttestationDecode; |
| 1085 |
|
| 1086 |
// The CBOR encoded Attestation Object to be returned to the RP. |
| 1087 |
DWORD cbAttestationObject; |
| 1088 |
_Field_size_bytes_(cbAttestationObject) |
| 1089 |
PBYTE pbAttestationObject; |
| 1090 |
|
| 1091 |
// The CredentialId bytes extracted from the Authenticator Data. |
| 1092 |
// Used by Edge to return to the RP. |
| 1093 |
DWORD cbCredentialId; |
| 1094 |
_Field_size_bytes_(cbCredentialId) |
| 1095 |
PBYTE pbCredentialId; |
| 1096 |
|
| 1097 |
// |
| 1098 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_2 |
| 1099 |
// |
| 1100 |
|
| 1101 |
WEBAUTHN_EXTENSIONS Extensions; |
| 1102 |
|
| 1103 |
// |
| 1104 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_3 |
| 1105 |
// |
| 1106 |
|
| 1107 |
// One of the WEBAUTHN_CTAP_TRANSPORT_* bits will be set corresponding to |
| 1108 |
// the transport that was used. |
| 1109 |
DWORD dwUsedTransport; |
| 1110 |
|
| 1111 |
// |
| 1112 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_4 |
| 1113 |
// |
| 1114 |
|
| 1115 |
BOOL bEpAtt; |
| 1116 |
BOOL bLargeBlobSupported; |
| 1117 |
BOOL bResidentKey; |
| 1118 |
|
| 1119 |
// |
| 1120 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_5 |
| 1121 |
// |
| 1122 |
|
| 1123 |
BOOL bPrfEnabled; |
| 1124 |
|
| 1125 |
// |
| 1126 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_6 |
| 1127 |
// |
| 1128 |
|
| 1129 |
DWORD cbUnsignedExtensionOutputs; |
| 1130 |
_Field_size_bytes_(cbUnsignedExtensionOutputs) |
| 1131 |
PBYTE pbUnsignedExtensionOutputs; |
| 1132 |
|
| 1133 |
// |
| 1134 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_7 |
| 1135 |
// |
| 1136 |
|
| 1137 |
PWEBAUTHN_HMAC_SECRET_SALT pHmacSecret; |
| 1138 |
|
| 1139 |
// ThirdPartyPayment Credential or not. |
| 1140 |
BOOL bThirdPartyPayment; |
| 1141 |
|
| 1142 |
// |
| 1143 |
// Following fields have been added in WEBAUTHN_CREDENTIAL_ATTESTATION_VERSION_8 |
| 1144 |
// |
| 1145 |
|
| 1146 |
// Multiple WEBAUTHN_CTAP_TRANSPORT_* bits will be set corresponding to |
| 1147 |
// the transports that are supported. |
| 1148 |
DWORD dwTransports; |
| 1149 |
|
| 1150 |
// UTF-8 encoded JSON serialization of the client data. |
| 1151 |
DWORD cbClientDataJSON; |
| 1152 |
_Field_size_bytes_(cbClientDataJSON) |
| 1153 |
PBYTE pbClientDataJSON; |
| 1154 |
|
| 1155 |
// UTF-8 encoded JSON serialization of the RegistrationResponse. |
| 1156 |
DWORD cbRegistrationResponseJSON; |
| 1157 |
_Field_size_bytes_(cbRegistrationResponseJSON) |
| 1158 |
PBYTE pbRegistrationResponseJSON; |
| 1159 |
|
| 1160 |
} WEBAUTHN_CREDENTIAL_ATTESTATION, *PWEBAUTHN_CREDENTIAL_ATTESTATION; |
| 1161 |
typedef const WEBAUTHN_CREDENTIAL_ATTESTATION *PCWEBAUTHN_CREDENTIAL_ATTESTATION; |
| 1162 |
|
| 1163 |
|
| 1164 |
//+------------------------------------------------------------------------------------------ |
| 1165 |
// authenticatorGetAssertion output. |
| 1166 |
//------------------------------------------------------------------------------------------- |
| 1167 |
|
| 1168 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NONE 0 |
| 1169 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_SUCCESS 1 |
| 1170 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NOT_SUPPORTED 2 |
| 1171 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_INVALID_DATA 3 |
| 1172 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_INVALID_PARAMETER 4 |
| 1173 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_NOT_FOUND 5 |
| 1174 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_MULTIPLE_CREDENTIALS 6 |
| 1175 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_LACK_OF_SPACE 7 |
| 1176 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_PLATFORM_ERROR 8 |
| 1177 |
#define WEBAUTHN_CRED_LARGE_BLOB_STATUS_AUTHENTICATOR_ERROR 9 |
| 1178 |
|
| 1179 |
#define WEBAUTHN_ASSERTION_VERSION_1 1 |
| 1180 |
#define WEBAUTHN_ASSERTION_VERSION_2 2 |
| 1181 |
#define WEBAUTHN_ASSERTION_VERSION_3 3 |
| 1182 |
#define WEBAUTHN_ASSERTION_VERSION_4 4 |
| 1183 |
#define WEBAUTHN_ASSERTION_VERSION_5 5 |
| 1184 |
#define WEBAUTHN_ASSERTION_VERSION_6 6 |
| 1185 |
#define WEBAUTHN_ASSERTION_CURRENT_VERSION WEBAUTHN_ASSERTION_VERSION_6 |
| 1186 |
|
| 1187 |
typedef struct _WEBAUTHN_ASSERTION { |
| 1188 |
// Version of this structure, to allow for modifications in the future. |
| 1189 |
DWORD dwVersion; |
| 1190 |
|
| 1191 |
// Size of cbAuthenticatorData. |
| 1192 |
DWORD cbAuthenticatorData; |
| 1193 |
// Authenticator data that was created for this assertion. |
| 1194 |
_Field_size_bytes_(cbAuthenticatorData) |
| 1195 |
PBYTE pbAuthenticatorData; |
| 1196 |
|
| 1197 |
// Size of pbSignature. |
| 1198 |
DWORD cbSignature; |
| 1199 |
// Signature that was generated for this assertion. |
| 1200 |
_Field_size_bytes_(cbSignature) |
| 1201 |
PBYTE pbSignature; |
| 1202 |
|
| 1203 |
// Credential that was used for this assertion. |
| 1204 |
WEBAUTHN_CREDENTIAL Credential; |
| 1205 |
|
| 1206 |
// Size of User Id |
| 1207 |
DWORD cbUserId; |
| 1208 |
// UserId |
| 1209 |
_Field_size_bytes_(cbUserId) |
| 1210 |
PBYTE pbUserId; |
| 1211 |
|
| 1212 |
// |
| 1213 |
// Following fields have been added in WEBAUTHN_ASSERTION_VERSION_2 |
| 1214 |
// |
| 1215 |
|
| 1216 |
WEBAUTHN_EXTENSIONS Extensions; |
| 1217 |
|
| 1218 |
// Size of pbCredLargeBlob |
| 1219 |
DWORD cbCredLargeBlob; |
| 1220 |
_Field_size_bytes_(cbCredLargeBlob) |
| 1221 |
PBYTE pbCredLargeBlob; |
| 1222 |
|
| 1223 |
DWORD dwCredLargeBlobStatus; |
| 1224 |
|
| 1225 |
// |
| 1226 |
// Following fields have been added in WEBAUTHN_ASSERTION_VERSION_3 |
| 1227 |
// |
| 1228 |
|
| 1229 |
PWEBAUTHN_HMAC_SECRET_SALT pHmacSecret; |
| 1230 |
|
| 1231 |
// |
| 1232 |
// Following fields have been added in WEBAUTHN_ASSERTION_VERSION_4 |
| 1233 |
// |
| 1234 |
|
| 1235 |
// One of the WEBAUTHN_CTAP_TRANSPORT_* bits will be set corresponding to |
| 1236 |
// the transport that was used. |
| 1237 |
DWORD dwUsedTransport; |
| 1238 |
|
| 1239 |
// |
| 1240 |
// Following fields have been added in WEBAUTHN_ASSERTION_VERSION_5 |
| 1241 |
// |
| 1242 |
|
| 1243 |
DWORD cbUnsignedExtensionOutputs; |
| 1244 |
_Field_size_bytes_(cbUnsignedExtensionOutputs) |
| 1245 |
PBYTE pbUnsignedExtensionOutputs; |
| 1246 |
|
| 1247 |
// |
| 1248 |
// Following fields have been added in WEBAUTHN_ASSERTION_VERSION_6 |
| 1249 |
// |
| 1250 |
|
| 1251 |
// UTF-8 encoded JSON serialization of the client data. |
| 1252 |
DWORD cbClientDataJSON; |
| 1253 |
_Field_size_bytes_(cbClientDataJSON) |
| 1254 |
PBYTE pbClientDataJSON; |
| 1255 |
|
| 1256 |
// UTF-8 encoded JSON serialization of the AuthenticationResponse. |
| 1257 |
DWORD cbAuthenticationResponseJSON; |
| 1258 |
_Field_size_bytes_(cbAuthenticationResponseJSON) |
| 1259 |
PBYTE pbAuthenticationResponseJSON; |
| 1260 |
|
| 1261 |
} WEBAUTHN_ASSERTION, *PWEBAUTHN_ASSERTION; |
| 1262 |
typedef const WEBAUTHN_ASSERTION *PCWEBAUTHN_ASSERTION; |
| 1263 |
|
| 1264 |
//+------------------------------------------------------------------------------------------ |
| 1265 |
// APIs. |
| 1266 |
//------------------------------------------------------------------------------------------- |
| 1267 |
|
| 1268 |
DWORD |
| 1269 |
WINAPI |
| 1270 |
WebAuthNGetApiVersionNumber(); |
| 1271 |
|
| 1272 |
HRESULT |
| 1273 |
WINAPI |
| 1274 |
WebAuthNIsUserVerifyingPlatformAuthenticatorAvailable( |
| 1275 |
_Out_ BOOL *pbIsUserVerifyingPlatformAuthenticatorAvailable); |
| 1276 |
|
| 1277 |
|
| 1278 |
HRESULT |
| 1279 |
WINAPI |
| 1280 |
WebAuthNAuthenticatorMakeCredential( |
| 1281 |
_In_ HWND hWnd, |
| 1282 |
_In_ PCWEBAUTHN_RP_ENTITY_INFORMATION pRpInformation, |
| 1283 |
_In_ PCWEBAUTHN_USER_ENTITY_INFORMATION pUserInformation, |
| 1284 |
_In_ PCWEBAUTHN_COSE_CREDENTIAL_PARAMETERS pPubKeyCredParams, |
| 1285 |
_In_ PCWEBAUTHN_CLIENT_DATA pWebAuthNClientData, |
| 1286 |
_In_opt_ PCWEBAUTHN_AUTHENTICATOR_MAKE_CREDENTIAL_OPTIONS pWebAuthNMakeCredentialOptions, |
| 1287 |
_Outptr_result_maybenull_ PWEBAUTHN_CREDENTIAL_ATTESTATION *ppWebAuthNCredentialAttestation); |
| 1288 |
|
| 1289 |
|
| 1290 |
HRESULT |
| 1291 |
WINAPI |
| 1292 |
WebAuthNAuthenticatorGetAssertion( |
| 1293 |
_In_ HWND hWnd, |
| 1294 |
_In_ LPCWSTR pwszRpId, |
| 1295 |
_In_ PCWEBAUTHN_CLIENT_DATA pWebAuthNClientData, |
| 1296 |
_In_opt_ PCWEBAUTHN_AUTHENTICATOR_GET_ASSERTION_OPTIONS pWebAuthNGetAssertionOptions, |
| 1297 |
_Outptr_result_maybenull_ PWEBAUTHN_ASSERTION *ppWebAuthNAssertion); |
| 1298 |
|
| 1299 |
void |
| 1300 |
WINAPI |
| 1301 |
WebAuthNFreeCredentialAttestation( |
| 1302 |
_In_opt_ PWEBAUTHN_CREDENTIAL_ATTESTATION pWebAuthNCredentialAttestation); |
| 1303 |
|
| 1304 |
void |
| 1305 |
WINAPI |
| 1306 |
WebAuthNFreeAssertion( |
| 1307 |
_In_ PWEBAUTHN_ASSERTION pWebAuthNAssertion); |
| 1308 |
|
| 1309 |
HRESULT |
| 1310 |
WINAPI |
| 1311 |
WebAuthNGetCancellationId( |
| 1312 |
_Out_ GUID* pCancellationId); |
| 1313 |
|
| 1314 |
HRESULT |
| 1315 |
WINAPI |
| 1316 |
WebAuthNCancelCurrentOperation( |
| 1317 |
_In_ const GUID* pCancellationId); |
| 1318 |
|
| 1319 |
// Returns NTE_NOT_FOUND when credentials are not found. |
| 1320 |
HRESULT |
| 1321 |
WINAPI |
| 1322 |
WebAuthNGetPlatformCredentialList( |
| 1323 |
_In_ PCWEBAUTHN_GET_CREDENTIALS_OPTIONS pGetCredentialsOptions, |
| 1324 |
_Outptr_result_maybenull_ PWEBAUTHN_CREDENTIAL_DETAILS_LIST *ppCredentialDetailsList); |
| 1325 |
|
| 1326 |
void |
| 1327 |
WINAPI |
| 1328 |
WebAuthNFreePlatformCredentialList( |
| 1329 |
_In_ PWEBAUTHN_CREDENTIAL_DETAILS_LIST pCredentialDetailsList); |
| 1330 |
|
| 1331 |
HRESULT |
| 1332 |
WINAPI |
| 1333 |
WebAuthNDeletePlatformCredential( |
| 1334 |
_In_ DWORD cbCredentialId, |
| 1335 |
_In_reads_bytes_(cbCredentialId) const BYTE *pbCredentialId |
| 1336 |
); |
| 1337 |
|
| 1338 |
// Returns NTE_NOT_FOUND when authenticator details are not found. |
| 1339 |
HRESULT |
| 1340 |
WINAPI |
| 1341 |
WebAuthNGetAuthenticatorList( |
| 1342 |
_In_opt_ PCWEBAUTHN_AUTHENTICATOR_DETAILS_OPTIONS pWebAuthNGetAuthenticatorListOptions, |
| 1343 |
_Outptr_result_maybenull_ PWEBAUTHN_AUTHENTICATOR_DETAILS_LIST* ppAuthenticatorDetailsList); |
| 1344 |
|
| 1345 |
void |
| 1346 |
WINAPI |
| 1347 |
WebAuthNFreeAuthenticatorList( |
| 1348 |
_In_ PWEBAUTHN_AUTHENTICATOR_DETAILS_LIST pAuthenticatorDetailsList); |
| 1349 |
|
| 1350 |
// |
| 1351 |
// Returns the following Error Names: |
| 1352 |
// L"Success" - S_OK |
| 1353 |
// L"InvalidStateError" - NTE_EXISTS |
| 1354 |
// L"ConstraintError" - HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), |
| 1355 |
// NTE_NOT_SUPPORTED, |
| 1356 |
// NTE_TOKEN_KEYSET_STORAGE_FULL |
| 1357 |
// L"NotSupportedError" - NTE_INVALID_PARAMETER |
| 1358 |
// L"NotAllowedError" - NTE_DEVICE_NOT_FOUND, |
| 1359 |
// NTE_NOT_FOUND, |
| 1360 |
// HRESULT_FROM_WIN32(ERROR_CANCELLED), |
| 1361 |
// NTE_USER_CANCELLED, |
| 1362 |
// HRESULT_FROM_WIN32(ERROR_TIMEOUT) |
| 1363 |
// L"UnknownError" - All other hr values |
| 1364 |
// |
| 1365 |
PCWSTR |
| 1366 |
WINAPI |
| 1367 |
WebAuthNGetErrorName( |
| 1368 |
_In_ HRESULT hr); |
| 1369 |
|
| 1370 |
HRESULT |
| 1371 |
WINAPI |
| 1372 |
WebAuthNGetW3CExceptionDOMError( |
| 1373 |
_In_ HRESULT hr); |
| 1374 |
|
| 1375 |
|
| 1376 |
#ifdef __cplusplus |
| 1377 |
} // Balance extern "C" above |
| 1378 |
#endif |
| 1379 |
|
| 1380 |
#endif // WINAPI_FAMILY_PARTITION |
| 1381 |
#ifdef _MSC_VER |
| 1382 |
#pragma endregion |
| 1383 |
#endif |
| 1384 |
|
| 1385 |
#endif // __WEBAUTHN_H_ |