A group of functions for verifying New Zealand COVID Passes.
More...
|
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
} |
| The nzcp_error enum used for verfication errors. More...
|
|
A group of functions for verifying New Zealand COVID Passes.
Example Usage
#include <nzcp.h>
printf(
"jti: %s\n", verification_result.
jti);
printf(
"iss: %s\n", verification_result.
iss);
printf(
"nbf: %d\n", verification_result.
nbf);
printf(
"exp: %d\n", verification_result.
exp);
printf(
"given_name: %s\n", verification_result.
given_name);
printf(
"family_name: %s\n", verification_result.
family_name);
printf(
"dob: %s\n", verification_result.
dob);
}
else {
}
◆ nzcp_error
The nzcp_error enum used for verfication errors.
This is the type used to represent NZCP errors in the nzcp_verify_pass_uri function.
◆ nzcp_error
The nzcp_error enum used for verfication errors.
This is the type used to represent NZCP errors in the nzcp_verify_pass_uri function.
Enumerator |
---|
NZCP_E_SUCCESS | Success
|
NZCP_E_EMPTY_URI | Empty URI
|
NZCP_E_BAD_URI_PREFIX | Bad URI prefix
|
NZCP_E_BAD_VERSION_IDENTIFIER | Bad version identifier
|
NZCP_E_CBOR_ERROR | CBOR error
|
NZCP_E_BAD_TAG | Bad tag
|
NZCP_E_MALFORMED_CWT | Malformed CWT
|
NZCP_E_MALFORMED_CWT_HEADER | Malformed CWT header
|
NZCP_E_WRONG_KID | Wrong kid
|
NZCP_E_WRONG_ALG | Wrong alg
|
NZCP_E_MALFORMED_CWT_CLAIMS | Malformed CWT claims
|
NZCP_E_MALFORMED_CWT_ISSUER | Malformed CWT issuer
|
NZCP_E_MALFORMED_CWT_NBF | Malformed CWT nbf
|
NZCP_E_MALFORMED_CWT_EXP | Malformed CWT exp
|
NZCP_E_MALFORMED_CWT_CTI | Malformed CWT cti
|
NZCP_E_MALFORMED_CWT_VC | Malformed CWT VC
|
NZCP_E_MALFORMED_VC_CONTEXT | Malformed VC context
|
NZCP_E_MALFORMED_VC_VERSION | Malformed VC version
|
NZCP_E_MALFORMED_VC_TYPE | Malformed VC type
|
NZCP_E_MALFORMED_CREDENTIAL_SUBJECT | Malformed credential subject
|
NZCP_E_MALFORMED_GIVEN_NAME | Malformed given name
|
NZCP_E_MALFORMED_FAMILY_NAME | Malformed family name
|
NZCP_E_MALFORMED_DOB | Malformed DOB
|
NZCP_E_WRONG_TRUSTED_ISSUER | Wrong trusted issuer
|
NZCP_E_BAD_CTI | Bad cti
|
NZCP_E_BAD_ISS | Bad iss
|
NZCP_E_BAD_NBF | Bad nbf
|
NZCP_E_BAD_EXP | Bad exp
|
NZCP_E_PASS_NOT_ACTIVE | Pass not active
|
NZCP_E_PASS_EXPIRED | Pass expired
|
NZCP_E_BAD_VC_CONTEXT | Bad VC context
|
NZCP_E_BAD_VC_TYPE | Bad VC type
|
NZCP_E_BAD_VC_VERSION | Bad VC version
|
NZCP_E_BAD_GIVEN_NAME | Bad given name
|
NZCP_E_BAD_DOB | Bad DOB
|
NZCP_E_FAILED_SIGNATURE_VERIFICATION | Failed signature verification
|
NZCP_E_UNKNOWN | Unknown
|
NZCP_E_BAD_INTEGRATION | Bad integration
|
◆ nzcp_error_string()
Returns the error description for the given error code.
- Parameters
-
- Returns
- const char*
◆ nzcp_free_verification_result()
Frees nzcp_verification_result struct. Run this after you're done with the result.
- Parameters
-
[in] | verification_result | Pointer to verification result struct |
◆ nzcp_verify_pass_uri()
Verifies New Zealand COVID Pass URI.
- Parameters
-
[in] | pass_uri | Null-terminted buffer with the URI |
[out] | verification_result | Pointer to verification result struct |
[in] | is_example | Whether the pass_uri uses example or live MOH DID document |
- Returns
- nzcp_error
nzcp_error nzcp_verify_pass_uri(uint8_t *pass_uri, nzcp_verification_result *verification_result, bool is_example)
Verifies New Zealand COVID Pass URI.