[riot-notifications] [RIOT-OS/RIOT] sys/credman: add key load functions (#16263)

Leandro Lanzieri notifications at github.com
Sun Apr 4 19:25:14 CEST 2021


@leandrolanzieri commented on this pull request.



> +
+    /* point to privateKey */
+    node = node->next;
+    if (!node || node->type != ASN1_TYPE_OCTET_STRING || !node->data || !node->length) {
+        DEBUG("credman: invalid private key\n");
+        return CREDMAN_INVALID;
+    }
+
+    cred->type = CREDMAN_TYPE_ECDSA;
+    cred->params.ecdsa.public_key.x = NULL;
+    cred->params.ecdsa.public_key.y = NULL;
+
+    cred->params.ecdsa.private_key = node->data;
+
+    /* try to find a publicKey by tag */
+    while (node && node->type != 0xA1) {

It is a context-specific tag value in DER. It is formed by `0xA0` which denotes context-specific class ORed with the tag number (the `[1]` in the `ECPrivateKey` structure. Info about this can be found in section 8.1.2.2 of [ITU-T X.690](https://www.itu.int/itu-t/recommendations/rec.aspx?rec=12483&lang=en).
I can make it a macro to document it.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16263#discussion_r606830234
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210404/f2f032ea/attachment.htm>


More information about the notifications mailing list