summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-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