io.sockets.secure.openssl: support for getting issuer name

db4
Björn Lindqvist 2013-09-09 23:59:40 +02:00 committed by John Benediktsson
parent 454bffc14e
commit f4f60b8ba3
2 changed files with 12 additions and 6 deletions
basis
io/sockets/secure/openssl
openssl/libssl

View File

@ -170,12 +170,17 @@ M: ssl-handle dispose*
SSL_get_verify_result dup X509_V_OK =
[ drop ] [ verify-message certificate-verify-error ] if ;
: common-name ( certificate -- host )
X509_get_subject_name
: x509name>string ( x509name -- string )
NID_commonName 256 <byte-array>
[ 256 X509_NAME_get_text_by_NID ] keep
swap -1 = [ drop f ] [ latin1 alien>string ] if ;
: common-name ( certificate -- host )
X509_get_subject_name x509name>string ;
: issuer-name ( certificate -- issuer )
X509_get_issuer_name x509name>string ;
: common-names-match? ( expected actual -- ? )
[ >lower ] bi@ "*." ?head [ tail? ] [ = ] if ;

View File

@ -101,6 +101,7 @@ C-TYPE: X509_NAME
C-TYPE: X509
FUNCTION: int X509_NAME_get_text_by_NID ( X509_NAME* name, int nid, void* buf, int len ) ;
FUNCTION: X509_NAME* X509_get_issuer_name ( X509* a ) ;
FUNCTION: X509_NAME* X509_get_subject_name ( X509* a ) ;
! ===============================================