NZCP.c
0.0.5
An implementation of the New Zealand COVID Pass specification in C
|
41 #define NZCP_VERSION_MAJOR 0
42 #define NZCP_VERSION_MINOR 0
43 #define NZCP_VERSION_PATCH 5
105 typedef enum nzcp_error {
NZCP_E_SUCCESS = 0,
NZCP_E_EMPTY_URI = 1,
NZCP_E_BAD_URI_PREFIX = 2,
NZCP_E_BAD_VERSION_IDENTIFIER = 3,
NZCP_E_CBOR_ERROR = 4,
NZCP_E_BAD_TAG = 5,
NZCP_E_MALFORMED_CWT = 6,
NZCP_E_MALFORMED_CWT_HEADER = 7,
NZCP_E_WRONG_KID = 8,
NZCP_E_WRONG_ALG = 9,
NZCP_E_MALFORMED_CWT_CLAIMS = 10,
NZCP_E_MALFORMED_CWT_ISSUER = 11,
NZCP_E_MALFORMED_CWT_NBF = 12,
NZCP_E_MALFORMED_CWT_EXP = 13,
NZCP_E_MALFORMED_CWT_CTI = 14,
NZCP_E_MALFORMED_CWT_VC = 15,
NZCP_E_MALFORMED_VC_CONTEXT = 16,
NZCP_E_MALFORMED_VC_VERSION = 17,
NZCP_E_MALFORMED_VC_TYPE = 18,
NZCP_E_MALFORMED_CREDENTIAL_SUBJECT = 19,
NZCP_E_MALFORMED_GIVEN_NAME = 20,
NZCP_E_MALFORMED_FAMILY_NAME = 21,
NZCP_E_MALFORMED_DOB = 22,
NZCP_E_WRONG_TRUSTED_ISSUER = 23,
NZCP_E_BAD_CTI = 24,
NZCP_E_BAD_ISS = 25,
NZCP_E_BAD_NBF = 26,
NZCP_E_BAD_EXP = 27,
NZCP_E_PASS_NOT_ACTIVE = 28,
NZCP_E_PASS_EXPIRED = 29,
NZCP_E_BAD_VC_CONTEXT = 30,
NZCP_E_BAD_VC_TYPE = 31,
NZCP_E_BAD_VC_VERSION = 32,
NZCP_E_BAD_GIVEN_NAME = 33,
NZCP_E_BAD_DOB = 34,
NZCP_E_FAILED_SIGNATURE_VERIFICATION = 35,
NZCP_E_UNKNOWN = 36,
NZCP_E_BAD_INTEGRATION = 37,
@ NZCP_E_BAD_VC_CONTEXT
Definition: nzcp.h:136
@ NZCP_E_EMPTY_URI
Definition: nzcp.h:107
@ NZCP_E_MALFORMED_CREDENTIAL_SUBJECT
Definition: nzcp.h:125
@ NZCP_E_BAD_ISS
Definition: nzcp.h:131
@ NZCP_E_MALFORMED_CWT
Definition: nzcp.h:112
@ NZCP_E_BAD_VERSION_IDENTIFIER
Definition: nzcp.h:109
char * family_name
Definition: nzcp.h:61
nzcp_error
The nzcp_error enum used for verfication errors.
Definition: nzcp.h:105
@ NZCP_E_BAD_VC_TYPE
Definition: nzcp.h:137
@ NZCP_E_BAD_NBF
Definition: nzcp.h:132
int exp
Definition: nzcp.h:59
@ NZCP_E_MALFORMED_VC_VERSION
Definition: nzcp.h:123
@ NZCP_E_BAD_VC_VERSION
Definition: nzcp.h:138
@ NZCP_E_SUCCESS
Definition: nzcp.h:106
@ NZCP_E_MALFORMED_GIVEN_NAME
Definition: nzcp.h:126
char * iss
Definition: nzcp.h:57
@ NZCP_E_UNKNOWN
Definition: nzcp.h:142
@ NZCP_E_MALFORMED_CWT_CLAIMS
Definition: nzcp.h:116
@ NZCP_E_MALFORMED_DOB
Definition: nzcp.h:128
@ NZCP_E_MALFORMED_CWT_NBF
Definition: nzcp.h:118
@ NZCP_E_MALFORMED_CWT_CTI
Definition: nzcp.h:120
@ NZCP_E_FAILED_SIGNATURE_VERIFICATION
Definition: nzcp.h:141
@ NZCP_E_MALFORMED_CWT_EXP
Definition: nzcp.h:119
@ NZCP_E_PASS_NOT_ACTIVE
Definition: nzcp.h:134
char * given_name
Definition: nzcp.h:60
@ NZCP_E_BAD_DOB
Definition: nzcp.h:140
@ NZCP_E_BAD_CTI
Definition: nzcp.h:130
@ NZCP_E_BAD_INTEGRATION
Definition: nzcp.h:143
@ NZCP_E_WRONG_KID
Definition: nzcp.h:114
@ NZCP_E_WRONG_ALG
Definition: nzcp.h:115
@ NZCP_E_WRONG_TRUSTED_ISSUER
Definition: nzcp.h:129
char * jti
Definition: nzcp.h:56
@ NZCP_E_MALFORMED_CWT_VC
Definition: nzcp.h:121
@ NZCP_E_MALFORMED_VC_CONTEXT
Definition: nzcp.h:122
@ NZCP_E_PASS_EXPIRED
Definition: nzcp.h:135
const char * nzcp_error_string(nzcp_error error)
Returns the error description for the given error code.
@ NZCP_E_CBOR_ERROR
Definition: nzcp.h:110
@ NZCP_E_BAD_URI_PREFIX
Definition: nzcp.h:108
int nbf
Definition: nzcp.h:58
The nzcp_verification_result structure.
Definition: nzcp.h:55
@ NZCP_E_BAD_TAG
Definition: nzcp.h:111
@ NZCP_E_BAD_EXP
Definition: nzcp.h:133
@ NZCP_E_MALFORMED_CWT_HEADER
Definition: nzcp.h:113
@ NZCP_E_MALFORMED_FAMILY_NAME
Definition: nzcp.h:127
char * dob
Definition: nzcp.h:62
void nzcp_free_verification_result(nzcp_verification_result *verification_result)
Frees nzcp_verification_result struct. Run this after you're done with the result.
@ NZCP_E_MALFORMED_CWT_ISSUER
Definition: nzcp.h:117
@ NZCP_E_MALFORMED_VC_TYPE
Definition: nzcp.h:124
@ NZCP_E_BAD_GIVEN_NAME
Definition: nzcp.h:139
nzcp_error nzcp_verify_pass_uri(uint8_t *pass_uri, nzcp_verification_result *verification_result, bool is_example)
Verifies New Zealand COVID Pass URI.