Project

General

Profile

« Previous | Next » 

Revision d3e0194e

Added by Jim Pingle over 7 years ago

When retrieving a the modulus for a certificate, private key, or signing request, write the certificate data out to a temp file instead of echoing it through a pipe. Fixes #8153

(cherry picked from commit 6e316e955350ad69d4f86cb332a1a48bfa028e2e)

View differences:

src/etc/inc/certs.inc
573 573
	if ($decode) {
574 574
		$str_crt = base64_decode($str_crt);
575 575
	}
576

  
576
	$certfn = tempnam('/tmp', 'CGM');
577
	file_put_contents($certfn, $str_crt);
577 578
	$modulus = "";
578 579
	if (in_array($type, array("crt", "prv", "csr"))) {
579 580
		$type = str_replace(array("crt", "prv", "csr"), array("x509", "rsa", "req"), $type);
580
		$modulus = exec("echo \"{$str_crt}\" | openssl {$type} -noout -modulus");
581
		$modulus = exec("/usr/bin/openssl {$type} -in {$certfn} -noout -modulus");
581 582
	}
583
	unlink($certfn);
582 584
	return $modulus;
583 585
}
584 586

  

Also available in: Unified diff