ne_ssl_cert_identity.3 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. '\" t
  2. .\" Title: ne_ssl_cert_identity
  3. .\" Author:
  4. .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
  5. .\" Date: 21 January 2023
  6. .\" Manual: neon API reference
  7. .\" Source: neon 0.32.5
  8. .\" Language: English
  9. .\"
  10. .TH "NE_SSL_CERT_IDENTITY" "3" "21 January 2023" "neon 0.32.5" "neon API reference"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. ne_ssl_cert_identity, ne_ssl_cert_signedby, ne_ssl_cert_issuer, ne_ssl_cert_subject \- functions to access certificate properties
  32. .SH "SYNOPSIS"
  33. .sp
  34. .ft B
  35. .nf
  36. #include <ne_ssl\&.h>
  37. .fi
  38. .ft
  39. .HP \w'const\ char\ *ne_ssl_cert_identity('u
  40. .BI "const char *ne_ssl_cert_identity(const\ ne_ssl_certificate\ *" "cert" ");"
  41. .HP \w'const\ ne_ssl_certificate\ *ne_ssl_cert_signedby('u
  42. .BI "const ne_ssl_certificate *ne_ssl_cert_signedby(const\ ne_ssl_certificate\ *" "cert" ");"
  43. .HP \w'const\ ne_ssl_dname\ *ne_ssl_cert_subject('u
  44. .BI "const ne_ssl_dname *ne_ssl_cert_subject(const\ ne_ssl_certificate\ *" "cert" ");"
  45. .HP \w'const\ ne_ssl_dname\ *ne_ssl_cert_issuer('u
  46. .BI "const ne_ssl_dname *ne_ssl_cert_issuer(const\ ne_ssl_certificate\ *" "cert" ");"
  47. .SH "DESCRIPTION"
  48. .PP
  49. The function
  50. \fBne_ssl_cert_identity\fR
  51. retrieves the
  52. \(lqidentity\(rq
  53. of a certificate; for an SSL server certificate, this will be the hostname for which the certificate was issued\&. In PKI parlance, the identity is the
  54. \fIcommon name\fR
  55. attribute of the distinguished name of the certificate subject\&.
  56. .PP
  57. The functions
  58. \fBne_ssl_cert_subject\fR
  59. and
  60. \fBne_ssl_cert_issuer\fR
  61. can be used to access the objects representing the distinguished name of the subject and of the issuer of a certificate, respectively\&.
  62. .PP
  63. If a certificate object is part of a certificate chain, then
  64. \fBne_ssl_cert_signedby\fR
  65. can be used to find the certificate which signed a particular certificate\&. For a self\-signed certificate or a certificate for which the full chain is not available, this function will return
  66. NULL\&.
  67. .SH "RETURN VALUE"
  68. .PP
  69. \fBne_ssl_cert_issuer\fR
  70. and
  71. \fBne_ssl_cert_subject\fR
  72. are guaranteed to never return
  73. NULL\&.
  74. \fBne_ssl_cert_identity\fR
  75. may return
  76. NULL
  77. if the certificate has no specific
  78. \(lqidentity\(rq\&.
  79. \fBne_ssl_cert_signedby\fR
  80. may return
  81. NULL
  82. as covered above\&.
  83. .SH "EXAMPLES"
  84. .PP
  85. The following function could be used to display information about a given certificate:
  86. .sp
  87. .if n \{\
  88. .RS 4
  89. .\}
  90. .nf
  91. void dump_cert(const ne_ssl_certificate *cert) {
  92. const char *id = ne_ssl_cert_identity(cert);
  93. char *dn;
  94. if (id)
  95. printf("Certificate was issued for \*(Aq%s\*(Aq\&.\en", id);
  96. dn = ne_ssl_readable_dname(ne_ssl_cert_subject(cert));
  97. printf("Subject: %s\en", dn);
  98. free(dn);
  99. dn = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert));
  100. printf("Issuer: %s\en", dn);
  101. free(dn);
  102. }
  103. .fi
  104. .if n \{\
  105. .RE
  106. .\}
  107. .SH "SEE ALSO"
  108. .PP
  109. ne_ssl_cert_cmp,
  110. ne_ssl_readable_dname
  111. .SH "AUTHOR"
  112. .PP
  113. \fBJoe Orton\fR
  114. .RS 4
  115. Author.
  116. .RE
  117. .SH "COPYRIGHT"
  118. .br