daily pastebin goal
56%
SHARE
TWEET

docmur

a guest Jan 3rd, 2012 12 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ShowCerts(SSL* ssl)
  2.  
  3. {  
  4.  
  5.         X509 *cert;
  6.  
  7.     char *line;
  8.  
  9.  
  10.  
  11.     cert = SSL_get_peer_certificate(ssl);       /* Get certificates (if available) */
  12.  
  13.     if ( cert != NULL )
  14.  
  15.     {
  16.  
  17.         printf("Server certificates:\n");
  18.  
  19.         line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
  20.  
  21.         printf("Subject: %s\n", line);
  22.  
  23.         free(line);
  24.  
  25.         line = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
  26.  
  27.         printf("Issuer: %s\n", line);
  28.  
  29.         free(line);
  30.  
  31.         X509_free(cert);
  32.  
  33.     } else {
  34.  
  35.         printf("No certificates.\n");
  36.  
  37.         }
  38.  
  39. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top