25 size_t octets = (**ptr) & 0x7f;
31 len = (len << 8) + (**ptr);
49asn1_tag_c(
const uint8_t **ptr,
size_t *plen,
int *constructed,
int *cls) {
59 *constructed = (
byte & 0x20) ? 1 : 0;
72 tag = (tag << 7) + (
byte & 0x7F);
80 tag = (tag << 7) + (
byte & 0x7F);
100 while (tlen > 0 && len <= tlen) {
101 if (
class == 2 && constructed == 1) {
103 tag =
asn1_tag_c(&ptr, &tlen, &constructed, &
class);
109 if (!validate || validate(ptr, len)) {
111 if (tag_data ==
NULL)
114 memcpy(tag_data->
s, ptr, len);
118 if (tag == 0x10 && constructed == 1) {
127 tag =
asn1_tag_c(&ptr, &tlen, &constructed, &
class);
140 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01,
145 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07,
158 if (pub_key && prime) {
165 memcpy(&spki->
s[header_size], pub_key->
s, pub_key->
length);
static const unsigned char cert_asn1_header2[]
static const unsigned char cert_asn1_header1[]
Library specific build wrapper for coap_internal.h.
size_t asn1_len(const uint8_t **ptr, size_t *plen)
Get the asn1 length from the current ptr.
coap_binary_t * get_asn1_tag(coap_asn1_tag_t ltag, const uint8_t *ptr, size_t tlen, asn1_validate validate)
Get the asn1 tag and data from the current ptr.
coap_binary_t * get_asn1_spki(const uint8_t *data, size_t size)
Abstract SPKI public key from the ASN1.
int(* asn1_validate)(const uint8_t *data, size_t size)
Callback to validate the asn1 tag and data.
coap_asn1_tag_t asn1_tag_c(const uint8_t **ptr, size_t *plen, int *constructed, int *cls)
Get the asn1 tag from the current ptr.
coap_binary_t * coap_new_binary(size_t size)
Returns a new binary object with at least size bytes storage allocated.
void coap_delete_binary(coap_binary_t *s)
Deletes the given coap_binary_t object and releases any memory allocated.
CoAP binary data definition.
size_t length
length of binary data