|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | + |
| 4 | +namespace KeyGuard.Attestation |
| 5 | +{ |
| 6 | + /// <summary> |
| 7 | + /// Error codes returned by <c>AttestationClientLib.dll</c>. |
| 8 | + /// A value of <see cref="SUCCESS"/> (0) indicates success; all other |
| 9 | + /// values are negative and represent specific failure categories. |
| 10 | + /// </summary> |
| 11 | + public enum AttestationResultErrorCode |
| 12 | + { |
| 13 | + /// <summary>The operation completed successfully.</summary> |
| 14 | + SUCCESS = 0, |
| 15 | + |
| 16 | + /// <summary>libcurl could not be initialized inside the native library.</summary> |
| 17 | + ERRORCURLINITIALIZATION = -1, |
| 18 | + |
| 19 | + /// <summary>The HTTP response body could not be parsed (malformed JSON, invalid JWT, etc.).</summary> |
| 20 | + ERRORRESPONSEPARSING = -2, |
| 21 | + |
| 22 | + /// <summary>Managed-Identity (MSI) access token could not be obtained.</summary> |
| 23 | + ERRORMSITOKENNOTFOUND = -3, |
| 24 | + |
| 25 | + /// <summary>The HTTP request exceeded the maximum retry count configured by the native client.</summary> |
| 26 | + ERRORHTTPREQUESTEXCEEDEDRETRIES = -4, |
| 27 | + |
| 28 | + /// <summary>An HTTP request to the attestation service failed (network error, non-200 status, timeout, etc.).</summary> |
| 29 | + ERRORHTTPREQUESTFAILED = -5, |
| 30 | + |
| 31 | + /// <summary>The attestation enclave rejected the supplied evidence (policy or signature failure).</summary> |
| 32 | + ERRORATTESTATIONFAILED = -6, |
| 33 | + |
| 34 | + /// <summary>libcurl reported “couldn’t send” (DNS resolution, TLS handshake, or socket error).</summary> |
| 35 | + ERRORSENDINGCURLREQUESTFAILED = -7, |
| 36 | + |
| 37 | + /// <summary>One or more input parameters passed to the native API were invalid or null.</summary> |
| 38 | + ERRORINVALIDINPUTPARAMETER = -8, |
| 39 | + |
| 40 | + /// <summary>Validation of the attestation parameters failed on the client side.</summary> |
| 41 | + ERRORATTESTATIONPARAMETERSVALIDATIONFAILED = -9, |
| 42 | + |
| 43 | + /// <summary>Native client failed to allocate heap memory.</summary> |
| 44 | + ERRORFAILEDMEMORYALLOCATION = -10, |
| 45 | + |
| 46 | + /// <summary>Could not retrieve OS build / version information required for the attestation payload.</summary> |
| 47 | + ERRORFAILEDTOGETOSINFO = -11, |
| 48 | + |
| 49 | + /// <summary>Internal TPM failure while gathering quotes or PCR values.</summary> |
| 50 | + ERRORTPMINTERNALFAILURE = -12, |
| 51 | + |
| 52 | + /// <summary>TPM operation (e.g., signing the quote) failed.</summary> |
| 53 | + ERRORTPMOPERATIONFAILURE = -13, |
| 54 | + |
| 55 | + /// <summary>The returned JWT could not be decrypted on the client.</summary> |
| 56 | + ERRORJWTDECRYPTIONFAILED = -14, |
| 57 | + |
| 58 | + /// <summary>JWT decryption failed due to a TPM error.</summary> |
| 59 | + ERRORJWTDECRYPTIONTPMERROR = -15, |
| 60 | + |
| 61 | + /// <summary>JSON in the service response was invalid or lacked required fields.</summary> |
| 62 | + ERRORINVALIDJSONRESPONSE = -16, |
| 63 | + |
| 64 | + /// <summary>The VCEK certificate blob returned from the service was empty.</summary> |
| 65 | + ERROREMPTYVCEKCERT = -17, |
| 66 | + |
| 67 | + /// <summary>The service response body was empty.</summary> |
| 68 | + ERROREMPTYRESPONSE = -18, |
| 69 | + |
| 70 | + /// <summary>The HTTP request body generated by the client was empty.</summary> |
| 71 | + ERROREMPTYREQUESTBODY = -19, |
| 72 | + |
| 73 | + /// <summary>Failed to parse the host-configuration-level (HCL) report.</summary> |
| 74 | + ERRORHCLREPORTPARSINGFAILURE = -20, |
| 75 | + |
| 76 | + /// <summary>The retrieved HCL report was empty.</summary> |
| 77 | + ERRORHCLREPORTEMPTY = -21, |
| 78 | + |
| 79 | + /// <summary>Could not extract JWK information from the attestation evidence.</summary> |
| 80 | + ERROREXTRACTINGJWKINFO = -22, |
| 81 | + |
| 82 | + /// <summary>Failed converting a JWK structure to an RSA public key.</summary> |
| 83 | + ERRORCONVERTINGJWKTORSAPUB = -23, |
| 84 | + |
| 85 | + /// <summary>EVP initialization for RSA encryption failed (OpenSSL).</summary> |
| 86 | + ERROREVPPKEYENCRYPTINITFAILED = -24, |
| 87 | + |
| 88 | + /// <summary>EVP encryption failed when building the attestation claim.</summary> |
| 89 | + ERROREVPPKEYENCRYPTFAILED = -25, |
| 90 | + |
| 91 | + /// <summary>Failed to decrypt data due to a TPM error.</summary> |
| 92 | + ERRORDATADECRYPTIONTPMERROR = -26, |
| 93 | + |
| 94 | + /// <summary>Parsing DNS information for the attestation service endpoint failed.</summary> |
| 95 | + ERRORPARSINGDNSINFO = -27, |
| 96 | + |
| 97 | + /// <summary>Failed to parse the attestation response envelope.</summary> |
| 98 | + ERRORPARSINGATTESTATIONRESPONSE = -28, |
| 99 | + |
| 100 | + /// <summary>Provisioning of the Attestation Key (AK) certificate failed.</summary> |
| 101 | + ERRORAKCERTPROVISIONINGFAILED = -29, |
| 102 | + |
| 103 | + /// <summary>Initialising the native attestation client failed.</summary> |
| 104 | + ERRORCLIENTINITFAILED = -30, |
| 105 | + |
| 106 | + /// <summary>The service returned an empty JWT.</summary> |
| 107 | + ERROREMPTYJWTRESPONSE = -31, |
| 108 | + |
| 109 | + /// <summary>Creating the KeyGuard attestation report failed on the client.</summary> |
| 110 | + ERRORCREATEKGATTESTATIONREPORT = -32, |
| 111 | + |
| 112 | + /// <summary>Failed to extract the public key from the import-only key.</summary> |
| 113 | + ERROREXTRACTIMPORTKEYPUB = -33, |
| 114 | + |
| 115 | + /// <summary>An unexpected C++ exception occurred inside the native client.</summary> |
| 116 | + ERRORUNEXPECTEDEXCEPTION = -34, |
| 117 | + |
| 118 | + /// <summary>Initialising the native logger failed (file I/O / permissions / path issues).</summary> |
| 119 | + ERRORLOGGERINITIALIZATION = -35 |
| 120 | + } |
| 121 | +} |
0 commit comments