diff -Nru w3m-0.1.11-pre/buffer.c w3m-0.1.11-pre-ja/buffer.c --- w3m-0.1.11-pre/buffer.c Thu Dec 14 01:17:21 2000 +++ w3m-0.1.11-pre-ja/buffer.c Sat Dec 16 03:58:44 2000 @@ -40,6 +40,9 @@ *n->clone = 1; n->linelen = 0; n->trbyte = 0; +#ifdef USE_SSL + n->ssl_certificate = NULL; +#endif return n; } diff -Nru w3m-0.1.11-pre/file.c w3m-0.1.11-pre-ja/file.c --- w3m-0.1.11-pre/file.c Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/file.c Sat Dec 16 04:17:42 2000 @@ -971,6 +971,13 @@ } if (t_buf == NULL) t_buf = newBuffer(INIT_BUFFER_WIDTH); +#ifdef USE_SSL + if (IStype(f.stream) == IST_SSL) { + Str s = ssl_get_certificate(f.stream); + if (s != NULL) + t_buf->ssl_certificate = s->ptr; + } +#endif readHeader(&f, t_buf, FALSE, &pu); t = checkContentType(t_buf); if (t == NULL) @@ -1214,6 +1221,13 @@ t_buf = newBuffer(INIT_BUFFER_WIDTH); t_buf->bufferprop |= BP_FRAME; } +#ifdef USE_SSL + if (IStype(f.stream) == IST_SSL) { + Str s = ssl_get_certificate(f.stream); + if (s != NULL) + t_buf->ssl_certificate = s->ptr; + } +#endif b = loadSomething(&f, pu.file, proc, t_buf); UFclose(&f); if (b) { diff -Nru w3m-0.1.11-pre/fm.h w3m-0.1.11-pre-ja/fm.h --- w3m-0.1.11-pre/fm.h Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/fm.h Sat Dec 16 03:58:08 2000 @@ -343,6 +343,9 @@ FormItemList *form_submit; char *savecache; char *edit; +#ifdef USE_SSL + char *ssl_certificate; +#endif } Buffer; #define NO_BUFFER ((Buffer*)1) diff -Nru w3m-0.1.11-pre/html.h w3m-0.1.11-pre-ja/html.h --- w3m-0.1.11-pre/html.h Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/html.h Sat Dec 16 03:54:34 2000 @@ -2,6 +2,8 @@ #ifndef _HTML_H #define _HTML_H #ifdef USE_SSL +#include +#include #include #endif /* USE_SSL */ diff -Nru w3m-0.1.11-pre/istream.c w3m-0.1.11-pre-ja/istream.c --- w3m-0.1.11-pre/istream.c Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/istream.c Sat Dec 16 04:19:59 2000 @@ -328,6 +328,33 @@ } } +#ifdef USE_SSL +Str +ssl_get_certificate(InputStream stream) +{ + BIO *bp; + X509 *x; + char *p; + int len; + Str s; + if (stream == NULL) + return NULL; + if (IStype(stream) != IST_SSL) + return NULL; + if (stream->ssl.handle == NULL) + return NULL; + x = SSL_get_peer_certificate(stream->ssl.handle->ssl); + if (x == NULL) + return NULL; + bp = BIO_new(BIO_s_mem()); + X509_print(bp, x); + len = (int)BIO_ctrl(bp, BIO_CTRL_INFO,0,(char *)&p); + s = Strnew_charp_n(p, len); + BIO_free_all(bp); + return s; +} +#endif + /* Raw level input stream functions */ static void diff -Nru w3m-0.1.11-pre/istream.h w3m-0.1.11-pre-ja/istream.h --- w3m-0.1.11-pre/istream.h Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/istream.h Sat Dec 16 03:54:52 2000 @@ -4,6 +4,8 @@ #include #ifdef USE_SSL +#include +#include #include #endif #include "Str.h" @@ -121,6 +123,9 @@ extern Str StrmyISgets(InputStream stream); extern int ISread(InputStream stream, Str buf, int count); extern int ISfileno(InputStream stream); +#ifdef USE_SSL +extern Str ssl_get_certificate(InputStream stream); +#endif #define IST_BASIC 0 #define IST_FILE 1 diff -Nru w3m-0.1.11-pre/map.c w3m-0.1.11-pre-ja/map.c --- w3m-0.1.11-pre/map.c Thu Dec 14 01:17:22 2000 +++ w3m-0.1.11-pre-ja/map.c Sat Dec 16 03:59:50 2000 @@ -179,6 +179,14 @@ append_frame_info(tmp, f_set, 0); Strcat_charp(tmp, ""); } +#ifdef USE_SSL + if (buf->ssl_certificate == NULL) + goto end; + Strcat_charp(tmp, "

SSL certificate

\n"); + Strcat_charp(tmp, "
\n");
+    Strcat_charp(tmp, buf->ssl_certificate);
+    Strcat_charp(tmp, "
\n"); +#endif end: Strcat_charp(tmp, ""); return loadHTMLString(tmp);