static const char *Oid2ShortStr(const char *oid)
{
- if (strcmp(oid, "1.2.840.113549.1.9.1")==0)
+ if (strcmp(oid, "1.2.840.113549.1.9.1") == 0)
return "emailAddress";
- if (strcmp(oid, "2.5.4.3")==0)
+ if (strcmp(oid, "2.5.4.3") == 0)
return "CN";
- if (strcmp(oid, "2.5.4.5")==0)
+ if (strcmp(oid, "2.5.4.5") == 0)
return "serialNumber";
- if (strcmp(oid, "2.5.4.6")==0)
+ if (strcmp(oid, "2.5.4.6") == 0)
return "C";
- if (strcmp(oid, "2.5.4.7")==0)
+ if (strcmp(oid, "2.5.4.7") == 0)
return "L";
- if (strcmp(oid, "2.5.4.8")==0)
+ if (strcmp(oid, "2.5.4.8") == 0)
return "ST";
- if (strcmp(oid, "2.5.4.10")==0)
+ if (strcmp(oid, "2.5.4.10") == 0)
return "O";
- if (strcmp(oid, "2.5.4.11")==0)
+ if (strcmp(oid, "2.5.4.11") == 0)
return "OU";
- if (strcmp(oid, "0.9.2342.19200300.100.1.25")==0)
+ if (strcmp(oid, "0.9.2342.19200300.100.1.25") == 0)
return "DC";
return "unknown";
*
* \retval The matching node, or NULL
*/
-const Asn1Generic * Asn1DerGet(const Asn1Generic *top, const uint8_t *seq_index, const uint32_t seqsz, uint32_t *errcode)
+const Asn1Generic * Asn1DerGet(const Asn1Generic *top, const uint8_t *seq_index,
+ const uint32_t seqsz, uint32_t *errcode)
{
const Asn1Generic * node;
uint8_t idx, i;
return node;
}
-int Asn1DerGetIssuerDN(const Asn1Generic *cert, char *buffer, uint32_t length, uint32_t *errcode)
+int Asn1DerGetIssuerDN(const Asn1Generic *cert, char *buffer, uint32_t length,
+ uint32_t *errcode)
{
const Asn1Generic *node_oid;
- const Asn1Generic *node, *it;
+ const Asn1Generic *node;
+ const Asn1Generic *it;
const Asn1Generic *node_set;
const Asn1Generic *node_str;
const char *shortname;
if (length < 10)
goto issuer_dn_error;
+
buffer[0] = '\0';
node = Asn1DerGet(cert, SEQ_IDX_ISSUER, sizeof(SEQ_IDX_ISSUER), errcode);
goto issuer_dn_error;
}
- if (strcmp(shortname,"CN")==0)
+ if (strcmp(shortname,"CN") == 0)
separator = "/";
if (it->next != NULL)
strlcat(buffer, separator, length);
return rc;
}
-int Asn1DerGetSubjectDN(const Asn1Generic *cert, char *buffer, uint32_t length, uint32_t *errcode)
+int Asn1DerGetSubjectDN(const Asn1Generic *cert, char *buffer, uint32_t length,
+ uint32_t *errcode)
{
const Asn1Generic *node_oid;
- const Asn1Generic *node, *it;
+ const Asn1Generic *node;
+ const Asn1Generic *it;
const Asn1Generic *node_set;
const Asn1Generic *node_str;
const char *shortname;
if (length < 10)
goto subject_dn_error;
+
buffer[0] = '\0';
node = Asn1DerGet(cert, SEQ_IDX_SUBJECT, sizeof(SEQ_IDX_SUBJECT), errcode);
goto subject_dn_error;
}
- if (strcmp(shortname,"CN")==0)
+ if (strcmp(shortname,"CN") == 0)
separator = "/";
if (it->next != NULL)
strlcat(buffer, separator, length);
return rc;
}
-/* vim: set et ts=4 sw=4: */