📄 exportcareqcert
字号:
## OpenCA - CA Command## (c) 1998-2001 by Massimiliano Pala and OpenCA Group#### File Name: exportCAReqCert## Brief: Exports CA's Certificate or Request## Description: Exports CA's Certificate or Certificate Request## Parameters: dataType## Cfg Keyword: CreateArchive, TestArchive, ExportDev, opencadirmy $cmdName = "exportCAReqCert";if ( $cmd !~ /$cmdName/i ) { configError( "Wrong Command Usage ($cmd over $cmdName)!" ); exit 1;}## Get Parameter REQUEST|CERTIFICATEmy $dataType = $query->param('dataType');## To export the CA request and CA certificate we use## the same export device as the one used for the certificates## (is there any reason for not doing so ?)## Get required parameters from the configuration filemy $arc = getRequired( 'CreateArchive' );my $test = getRequired( 'TestArchive' );my $dest = getRequired( 'ExportDev' );my $opencaDir = getRequired( 'opencadir' );## Build the right $arc with substitution of the $dest## with the 'ExportDest' and in 'TestArchive'$arc = $query->subVar( $arc, '$dest', $dest );$test = $query->subVar( $test, '$dest', $dest );## Other reserved variablesmy ( $dir, $file );## If we want to export the cacert.pem the $dir must be## set to the main OpenCA directory. If we want to export## the request for the CA, just set the $dir to the## $pendingreqs set in the config file.if( $dataType eq "REQUEST" ) { $dir = "$opencaDir"; $file = "careq.pem"; configError("Can not find \"$dir/$file\" file!") if (not -e "$dir/$file" );} elsif ( $dataType eq "CERTIFICATE" ) { $dir = "$opencaDir"; $file = "cacert.*"; configError("Can not find \"$dir/cacert.pem\" file!") unless ( -e "$dir/cacert.pem" ); configError("Can not find \"$dir/cacert.der\" file!") unless ( -e "$dir/cacert.der" );} else { configError("Can not find \"$dir/cacert.der\" file!"); exit 1;}print startLogPage("CA Management Results Page");print addLogSection( "Exporting ($file) ... ");if( not chdir( "$dir" )) { print addErrorLog( "Failed changing dir to $dir." ); closePage(); exit 1;}$ret = `$arc $file 2>&1`;if( $? != 0 ) { print addErrorLog( "Archiving Failed on $dev!", "$ret" ); closePage(); exit;}print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();print addLogSection("Testing Created Archive ... ");$ret = `$test 2>&1`;if( $? != 0 ) { print addErrorLog( "Check Failed on $dev!" ); closePage(); exit;}print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();closePage();1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -