Skip to content

Commit

Permalink
Support ECDSA in cert pubkey algo detection
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Feb 6, 2023
1 parent e25d74f commit 971103e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static const byte oid_rsa_encryption[] = { 0x0b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0
static const byte oid_dsa_encryption[] = { 0x09, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x38, 0x04, 0x01 };
static const byte oid_ed25519[] = { 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70 };
static const byte oid_ec_public_key[] = { 0x09, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01 };

static const byte oid_prime256v1[] = { 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07 };
static const byte oid_secp384r1[] = { 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x22 };

Expand Down Expand Up @@ -832,6 +833,8 @@ x509_cert2pubalgo(struct x509 *cert)
return PUB_RSA;
if (l == 7 && !memcmp(b, oid_dsa_encryption + 3, 7))
return PUB_DSA;
if (l == 7 && !memcmp(b, oid_ec_public_key + 3, 7))
return PUB_ECDSA;
if (l == 3 && !memcmp(b, oid_ed25519 + 3, 3))
return PUB_EDDSA; /* Ed25519 */
return -1;
Expand Down

0 comments on commit 971103e

Please sign in to comment.