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

Leandro Lanzieri notifications at github.com
Sun Apr 4 19:13:02 CEST 2021


@leandrolanzieri commented on this pull request.



> +
+    /* point to version, it SHALL be 1 */
+    asn1_tree *node = priv_key.child;
+    if (!node || node->type != ASN1_TYPE_INTEGER || node->data[0] != 0x01) {
+        DEBUG("credman: invalid private key version\n");
+        return CREDMAN_INVALID;
+    }
+
+    /* 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;

As you can see in the commented lines above, there is no OID identifier in the `ECPrivateKey` structure, so no way to check this. The user needs to know that the key is ECC, we can at most check for a version and that the structure follows the expected format, which is done.

-- 
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_r606828982
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210404/3e44a0c3/attachment.htm>


More information about the notifications mailing list