1NE_SSL_CERT_IDENTITY(3)       neon API reference       NE_SSL_CERT_IDENTITY(3)
2
3
4

NAME

6       ne_ssl_cert_identity, ne_ssl_cert_signedby, ne_ssl_cert_issuer,
7       ne_ssl_cert_subject - functions to access certificate properties
8

SYNOPSIS

10       #include <ne_ssl.h>
11
12       const char *ne_ssl_cert_identity(const ne_ssl_certificate *cert);
13
14       const ne_ssl_certificate
15                                                      *ne_ssl_cert_signedby(const ne_ssl_certificate *cert);
16
17       const ne_ssl_dname
18                                               *ne_ssl_cert_subject(const ne_ssl_certificate *cert);
19
20       const ne_ssl_dname *ne_ssl_cert_issuer(const ne_ssl_certificate *cert);
21

DESCRIPTION

23       The function ne_ssl_cert_identity retrieves the “identity” of a
24       certificate; for an SSL server certificate, this will be the hostname
25       for which the certificate was issued. In PKI parlance, the identity is
26       the common name attribute of the distinguished name of the certificate
27       subject.
28
29       The functions ne_ssl_cert_subject and ne_ssl_cert_issuer can be used to
30       access the objects representing the distinguished name of the subject
31       and of the issuer of a certificate, respectively.
32
33       If a certificate object is part of a certificate chain, then
34       ne_ssl_cert_signedby can be used to find the certificate which signed a
35       particular certificate. For a self-signed certificate or a certificate
36       for which the full chain is not available, this function will return
37       NULL.
38

RETURN VALUE

40       ne_ssl_cert_issuer and ne_ssl_cert_subject are guaranteed to never
41       return NULL.  ne_ssl_cert_identity may return NULL if the certificate
42       has no specific “identity”.  ne_ssl_cert_signedby may return NULL as
43       covered above.
44

EXAMPLES

46       The following function could be used to display information about a
47       given certificate:
48
49           void dump_cert(const ne_ssl_certificate *cert) {
50             const char *id = ne_ssl_cert_identity(cert);
51             char *dn;
52
53             if (id)
54               printf("Certificate was issued for ´%s´.\n", id);
55
56             dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert));
57             printf("Subject: %s\n", dn);
58             free(dn);
59
60             dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert));
61             printf("Issuer: %s\n", dn);
62             free(dn);
63           }
64

SEE ALSO

66       ne_ssl_cert_cmp, ne_ssl_readable_dname
67

AUTHOR

69       Joe Orton <neon@lists.manyfish.co.uk>
70           Author.
71
73neon 0.29.3                     11 January 2010        NE_SSL_CERT_IDENTITY(3)
Impressum