summaryrefslogtreecommitdiffstats
path: root/etc/inc/certs.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-11-10 16:37:51 -0500
committerjim-p <jimp@pfsense.org>2011-11-10 16:37:51 -0500
commit1379d66f11aaf72982a70287b83e24efcd18898e (patch)
treec33a3cd95a7951cc4d0020b89e7037811bc1a3e1 /etc/inc/certs.inc
parent298fe5ae746d5240a34f66695fd6d70947765929 (diff)
downloadpfsense-1379d66f11aaf72982a70287b83e24efcd18898e.zip
pfsense-1379d66f11aaf72982a70287b83e24efcd18898e.tar.gz
Add an indication in the certificate list to show if a certificate is internally capable of being a CA (basicConstraints has CA:TRUE) or if the nsCertType is set to server.
Diffstat (limited to 'etc/inc/certs.inc')
-rw-r--r--etc/inc/certs.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc
index 50ce0ad..ec3227d 100644
--- a/etc/inc/certs.inc
+++ b/etc/inc/certs.inc
@@ -458,6 +458,17 @@ function cert_get_modulus($str_crt, $decode = true, $type = "crt"){
function csr_get_modulus($str_crt, $decode = true){
return cert_get_modulus($str_crt, $decode, "csr");
}
+
+function cert_get_purpose($str_crt, $decode = true) {
+ if ($decode)
+ $str_crt = base64_decode($str_crt);
+ $crt_details = openssl_x509_parse($str_crt);
+ $purpose = array();
+ $purpose['ca'] = (stristr($crt_details['extensions']['basicConstraints'], 'CA:TRUE') === false) ? 'No': 'Yes';
+ $purpose['server'] = ($crt_details['extensions']['nsCertType'] == "SSL Server") ? 'Yes': 'No';
+ return $purpose;
+}
+
function prv_get_modulus($str_crt, $decode = true){
return cert_get_modulus($str_crt, $decode, "prv");
}
OpenPOWER on IntegriCloud