Make default sha a configurabloe option and set to 512

This commit is contained in:
John Crisp
2020-03-07 13:04:15 +01:00
parent 1a148b3640
commit 11fc6be55e
2 changed files with 9 additions and 6 deletions

View File

@@ -62,7 +62,7 @@ crl_extentions = crl_ext
default_days = 365 default_days = 365
default_crl_days = 30 default_crl_days = 30
preserve = no preserve = no
default_md = sha256 default_md = $config[default_md]
[ req ] [ req ]
default_bits = $keysize default_bits = $keysize

View File

@@ -201,7 +201,7 @@ case 'write':
print '<strong>Writing configuration files...</strong><br>'; print '<strong>Writing configuration files...</strong><br>';
flush(); flush();
$config_txt = <<<EOS $config_main_txt = <<<EOS
<?php <?php
# PHPki CONFIGURATION FILE # PHPki CONFIGURATION FILE
# Automatically generated by PHPki. Edit at your own peril. # Automatically generated by PHPki. Edit at your own peril.
@@ -284,6 +284,9 @@ case 'write':
# Default OpenSSL Config File. # Default OpenSSL Config File.
\$config['openssl_cnf'] = \$config['home_dir'] . '/config/openssl.cnf'; \$config['openssl_cnf'] = \$config['home_dir'] . '/config/openssl.cnf';
# Define default md
\$config['default_md'] = 'sha512';
\$PHPki_admins = Array(md5('pkiadmin')); \$PHPki_admins = Array(md5('pkiadmin'));
define('OPENSSL',\$config['openssl_bin'].' '); define('OPENSSL',\$config['openssl_bin'].' ');
@@ -301,14 +304,14 @@ EOS;
# Write out the CA configuration file. # Write out the CA configuration file.
# #
$fd = fopen("$store_dir/config/config.php",'w'); $fd = fopen("$store_dir/config/config.php",'w');
fwrite($fd, $config_txt); fwrite($fd, $config_main_txt);
fclose($fd); fclose($fd);
# #
# Create the bootstrap configuration # Create the bootstrap configuration
# #
$config_txt = <<<EOS $config_boot_txt = <<<EOS
<?php <?php
define('PHPKI_VERSION','$version'); define('PHPKI_VERSION','$version');
define('STORE_DIR','$store_dir'); define('STORE_DIR','$store_dir');
@@ -321,7 +324,7 @@ EOS;
# Write out the bootstrap config # Write out the bootstrap config
# #
$fd = fopen('./config.php','w'); $fd = fopen('./config.php','w');
fwrite($fd, $config_txt); fwrite($fd, $config_boot_txt);
fclose($fd); fclose($fd);
@@ -351,7 +354,7 @@ crl_extensions = crl_ext
default_days = 365 default_days = 365
default_crl_days= 30 default_crl_days= 30
preserve = no preserve = no
default_md = sha256 default_md = $config[default_md]
[ ca ] [ ca ]
default_ca = email_cert default_ca = email_cert