|
| 1 | +#pragma once |
| 2 | + |
| 3 | +// Default Status Word (ISO7816) |
| 4 | +// refer to https://www.eftlab.com/knowledge-base/complete-list-of-apdu-responses |
| 5 | + |
| 6 | +// Proprietary error codes |
| 7 | +#define SWO_SEC_PIN_15 0x5515 |
| 8 | + |
| 9 | +// 61 -- Normal processing, lower byte indicates the amount of data to be retrieved |
| 10 | +#define SWO_RESPONSE_BYTES_AVAILABLE 0x6100 |
| 11 | +// 62 -- Warning, the state of persistent memory is unchanged. The command succeeded, possibly with |
| 12 | +// restrictions. Typically used to signal blocked applications |
| 13 | +#define SWO_EOF_REACHED_BRFORE_LE 0x6282 |
| 14 | +#define SWO_SELECTED_FILE_INVALID 0x6284 |
| 15 | +#define SWO_NO_INPUT_DATA_AVAILABLE 0x6285 |
| 16 | +// 63 -- Warning, the state of persistent memory is changed. Typically used to indicate the number |
| 17 | +// of attempts left on a PIN code after a failure |
| 18 | +#define SWO_KEY_NUMBER_INVALID 0x6388 |
| 19 | +#define SWO_KEY_LENGTH_INCORRECT 0x6389 |
| 20 | +#define SWO_VERIFY_FAILED 0x63c0 // lower 4-bits indicates the number of attempts left |
| 21 | +#define SWO_MORE_DATA_EXPECTED 0x63f1 |
| 22 | +// 64 -- Execution error, the state of persistent memory is unchanged |
| 23 | +#define SWO_EXECUTION_ERROR 0x6400 |
| 24 | +#define SWO_COMMAND_TIMEOUT 0x6401 |
| 25 | +// 65 -- Execution error, the state of persistent memory is changed |
| 26 | +#define SWO_MEMORY_WRITE_ERROR 0x6501 |
| 27 | +#define SWO_MEMORY_FAILURE 0x6581 |
| 28 | +// 66 -- Security-related issues |
| 29 | +#define SWO_SECURITY_ISSUE 0x6600 |
| 30 | +// 67 -- Transport error. The length is incorrect |
| 31 | +#define SWO_WRONG_LENGTH 0x6700 |
| 32 | +// 68 -- Functions in CLA not supported |
| 33 | +#define SWO_NOT_SUPPORTED_ERROR_NO_INFO 0x6800 |
| 34 | +#define SWO_LOGICAL_CHANNEL_NOT_SUPPORTED 0x6881 |
| 35 | +#define SWO_SECURE_MESSAGING_NOT_SUPPORTED 0x6882 |
| 36 | +#define SWO_LAST_COMMAND_OF_CHAIN_EXPECTED 0x6883 |
| 37 | +#define SWO_COMMAND_CHAINING_NOT_SUPPORTED 0x6883 |
| 38 | +// 69 -- Command not allowed |
| 39 | +#define SWO_COMMAND_ERROR_NO_INFO 0x6900 |
| 40 | +#define SWO_COMMAND_NOT_ACCEPTED 0x6901 |
| 41 | +#define SWO_COMMAND_NOT_ALLOWED 0x6980 |
| 42 | +#define SWO_SUBCOMMAND_NOT_ALLOWED 0x6981 |
| 43 | +#define SWO_SECURITY_CONDITION_NOT_SATISFIED 0x6982 |
| 44 | +#define SWO_AUTH_METHOD_BLOCKED 0x6983 |
| 45 | +#define SWO_REFERENCED_DATA_BLOCKED 0x6984 |
| 46 | +#define SWO_CONDITIONS_NOT_SATISFIED 0x6985 |
| 47 | +#define SWO_COMMAND_NOT_ALLOWED_EF 0x6986 |
| 48 | +#define SWO_EXPECTED_SECURE_MSG_OBJ_MISSING 0x6987 |
| 49 | +#define SWO_INCORRECT_SECURE_MSG_DATA_OBJ 0x6988 |
| 50 | +#define SWO_IPERMISSION_DENIED 0x69f0 |
| 51 | +// 6A -- Wrong parameters (with details) |
| 52 | +#define SWO_PARAMETER_ERROR_NO_INFO 0x6a00 |
| 53 | +#define SWO_INCORRECT_DATA 0x6a80 |
| 54 | +#define SWO_FUNCTION_NOT_SUPPORTED 0x6a81 |
| 55 | +#define SWO_FILE_NOT_FOUND 0x6a82 |
| 56 | +#define SWO_RECORD_NOT_FOUND 0x6a83 |
| 57 | +#define SWO_INSUFFICIENT_MEMORY 0x6a84 |
| 58 | +#define SWO_INCONSISTENT_TLV_STRUCT 0x6a85 |
| 59 | +#define SWO_INCORRECT_P1_P2 0x6a86 |
| 60 | +#define SWO_WRONG_DATA_LENGTH 0x6a87 |
| 61 | +#define SWO_REFERENCED_DATA_NOT_FOUND 0x6a88 |
| 62 | +#define SWO_FILE_ALREADY_EXISTS 0x6a89 |
| 63 | +#define SWO_DF_NAME_ALREADY_EXISTS 0x6a8a |
| 64 | +#define SWO_WRONG_PARAMETER_VALUE 0x6af0 |
| 65 | +// 6B -- Wrong parameters P1-P2 |
| 66 | +#define SWO_WRONG_P1_P2 0x6b00 |
| 67 | +// 6C -- Wrong Le field. lower byte indicates the appropriate length |
| 68 | +#define SWO_INCORRECT_P3_LENGTH 0x6c00 |
| 69 | +// 6D -- The instruction code is not supported |
| 70 | +#define SWO_INVALID_INS 0x6d00 |
| 71 | +// 6E -- The instruction class is not supported |
| 72 | +#define SWO_INVALID_CLA 0x6e00 |
| 73 | +// 6F -- No precise diagnosis is given |
| 74 | +#define SWO_UNKNOWN 0x6f00 |
| 75 | +// 9- -- |
| 76 | +#define SWO_SUCCESS 0x9000 |
| 77 | +#define SWO_PIN_SUCCESFULLY_VERIFIED 0x9004 |
| 78 | +#define SWO_OK 0x9100 |
| 79 | +#define SWO_STATES_STATUS_WRONG 0x9101 |
| 80 | +#define SWO_COMMAND_CODE_NOT_SUPPORTED 0x911c |
| 81 | +#define SWO_WRONG_LENGTH_FOR_INS 0x917e |
| 82 | +#define SWO_NO_EF_SELECTED 0x9400 |
| 83 | +#define SWO_INVALID_OFFSET 0x9402 |
| 84 | +#define SWO_FID_NOT_FOUND 0x9404 |
| 85 | +#define SWO_PARSE_ERROR 0x9405 |
| 86 | +#define SWO_NO_PIN_DEFINED 0x9802 |
| 87 | +#define SWO_ACCESS_CONDITION_NOT_FULFILLED 0x9804 |
| 88 | + |
| 89 | +// Notes: |
| 90 | +// - The SWO codes are defined based on the ISO/IEC 7816-4 standard for smart cards. |
| 91 | +// |
| 92 | +// - 61XX and 6CXX are different. |
| 93 | +// When a command returns 61XX, its process is normally completed, |
| 94 | +// and it indicates the number of available bytes; |
| 95 | +// it then expects a GET RESPONSE command with the appropriate length. |
| 96 | +// When a command returns 6CXX, its process has been aborted, |
| 97 | +// and it expects the command to be reissued. |
| 98 | +// As mentioned above, 61XX indicates a normal completion, |
| 99 | +// and 6CXX is considered as a transport error (defined in ISO7817-3). |
| 100 | +// |
| 101 | +// - Except for 63XX and 65XX, which warn that the persistent content has been changed, |
| 102 | +// other status word should be used when the persistent content of the application is unchanged. |
| 103 | +// |
| 104 | +// - Status words 67XX, 6BXX, 6DXX, 6EXX, and 6FXX, where XX is not 0, are proprietary status words, |
| 105 | +// as well as 9YYY, where YYY is not 000. |
0 commit comments