cvs: php4 /ext/openssl openssl.c /ext/openssl/tests 001.phpt

From: Date: Thu, 28 Mar 2002 00:56:18 +0000
Subject: cvs: php4 /ext/openssl openssl.c /ext/openssl/tests 001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10735@lists.php.net to get a copy of this message
wez Wed Mar 27 19:56:18 2002 EDT Modified files: /php4/ext/openssl openssl.c /php4/ext/openssl/tests 001.phpt Log: Add subject hash to parsed x509 data. Make the test use file_get_contents(). Index: php4/ext/openssl/openssl.c diff -u php4/ext/openssl/openssl.c:1.42 php4/ext/openssl/openssl.c:1.43 --- php4/ext/openssl/openssl.c:1.42 Mon Mar 25 19:03:08 2002 +++ php4/ext/openssl/openssl.c Wed Mar 27 19:56:17 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: openssl.c,v 1.42 2002/03/26 00:03:08 wez Exp $ */ +/* $Id: openssl.c,v 1.43 2002/03/28 00:56:17 wez Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -819,6 +819,13 @@ /* add_assoc_bool(return_value, "valid", cert->valid); */ add_assoc_name_entry(return_value, "subject", X509_get_subject_name(cert), useshortnames); + /* hash as used in CA directories to lookup cert by subject name */ + { + char buf[32]; + snprintf(buf, sizeof(buf), "%08lx", X509_subject_name_hash(cert)); + add_assoc_string(return_value, "hash", buf, 1); + } + add_assoc_name_entry(return_value, "issuer", X509_get_issuer_name(cert), useshortnames); add_assoc_long(return_value, "version", X509_get_version(cert)); add_assoc_long(return_value, "serialNumber", ASN1_INTEGER_get(X509_get_serialNumber(cert))); Index: php4/ext/openssl/tests/001.phpt diff -u php4/ext/openssl/tests/001.phpt:1.1 php4/ext/openssl/tests/001.phpt:1.2 --- php4/ext/openssl/tests/001.phpt:1.1 Mon Mar 25 19:03:09 2002 +++ php4/ext/openssl/tests/001.phpt Wed Mar 27 19:56:18 2002 @@ -42,9 +42,7 @@ echo "Load key manually and use string syntax\n"; -$fp = fopen($key_file_name, "r"); -$key_content = fread($fp, filesize($key_file_name)); -fclose($fp); +$key_content = file_get_contents($key_file_name); $loaded_key = openssl_pkey_get_private($key_content, $passphrase); if ($loaded_key === false) @@ -53,6 +51,8 @@ openssl_pkey_free($loaded_key); echo "OK!\n"; + +@unlink($key_file_name); ?> --EXPECT--

« previous php.cvs (#10735) next »