diff options
Diffstat (limited to 'tests/openssl_get_subj_alt_dns.c')
-rw-r--r-- | tests/openssl_get_subj_alt_dns.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/openssl_get_subj_alt_dns.c b/tests/openssl_get_subj_alt_dns.c index 29cd111..00969aa 100644 --- a/tests/openssl_get_subj_alt_dns.c +++ b/tests/openssl_get_subj_alt_dns.c @@ -33,25 +33,26 @@ int main() const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san, i); switch (current_name->type) { - case GEN_DNS: - printf("DNS: %s\n", ASN1_STRING_get0_data(current_name->d.dNSName)); - break; - case GEN_EMAIL: - printf("Email: %s\n", ASN1_STRING_get0_data(current_name->d.rfc822Name)); - break; - case GEN_URI: - printf("URI: %s\n", ASN1_STRING_get0_data(current_name->d.uniformResourceIdentifier)); - break; - case GEN_IPADD: - int len = ASN1_STRING_length(current_name->d.iPAddress); - if (len != 4) { - fprintf(stderr, "Length mismatch in ip\n"); - return 1; - } - const unsigned char *data = ASN1_STRING_get0_data(current_name->d.iPAddress); - printf("IP Address: %d.%d.%d.%d\n", data[0], data[1], data[2], data[3]); - break; - // Add more types if needed + case GEN_DNS: + // these are alternative host names + printf("DNS: %s\n", ASN1_STRING_get0_data(current_name->d.dNSName)); + break; + case GEN_EMAIL: + printf("Email: %s\n", ASN1_STRING_get0_data(current_name->d.rfc822Name)); + break; + case GEN_URI: + printf("URI: %s\n", ASN1_STRING_get0_data(current_name->d.uniformResourceIdentifier)); + break; + case GEN_IPADD: + int len = ASN1_STRING_length(current_name->d.iPAddress); + if (len != 4) { + fprintf(stderr, "Length mismatch in ip\n"); + return 1; + } + const unsigned char *data = ASN1_STRING_get0_data(current_name->d.iPAddress); + printf("IP Address: %d.%d.%d.%d\n", data[0], data[1], data[2], data[3]); + break; + // Add more types if needed } } GENERAL_NAMES_free(san); |