📄 gencareq
字号:
## OpenCA - CA Command## (c) 1998-2001 by Massimiliano Pala and OpenCA Group#### File Name: genCAReq## Brief: Generate CA Request## Description: Generate CA's certificate Request## Parameters: email, cn, ou, o, c, pwdmy $cmdName = "genCAReq";if ( $cmd !~ /$cmdName/i ) { configError( "Wrong Command Usage ($cmd over $cmdName)!" ); exit 1;}## This command will generate the $openca/ca_req.pem## that should be exported to the root ca for approvalmy $opencaDir = getRequired( 'opencadir' );my $baseDoc = getRequired( 'gencareqsheet');## Get the parametersmy $email = $query->param('email');my $cn = $query->param('cn');my $ou = $query->param('ou');my $o = $query->param('o');my $c = $query->param('c');my $pwd = $query->param('passwd');my $dn = $query->param('dn');my $careqFile = "$opencaDir/careq.pem";my $cakeyFile = "$opencaDir/private/cakey.pem";## Other reserved variablesmy ( $page, $ret, $key );## Check the private keyif( not ( -e "$cakeyFile" ) ) { configError("Private key is missing, please generate" . " a new one!");}## Remove the old careq file, it is not important to keep a## copy of it. As it is very simple to generate a new one.unlink( "$careqFile") if( -e "$careqFile" );## Send parameters: it is important that you send them## in the same order as they are asked for. This means## email->cn->ou->o->c$cryptoShell->genReq( KEYFILE=>"$cakeyFile", OUTFILE=>"$careqFile", DN => [ "$email", "$cn", "$ou", "$o", "$c" ], SUBJECT => "$dn", PASSWD => $pwd );## Try loading the Req Filemy $req = new OpenCA::REQ ( SHELL => $cryptoShell, INFILE => "$careqFile" );if( not $req ) { $msg = "<BR>CryptoShell Error.<BR><BR>\n"; $msg .= "($email, $cn, $ou, $o, $c)<BR>\n"; $msg .= "($subject)\n";}## If we cannot load the base Document, then errorconfigError("Cannot load $baseDoc.") unless ( $page = $query->getFile("$baseDoc"));## Substitute the variables$page = $query->subVar( $page, '$key', $req->getTXT() );$page = $query->subVar( $page, '$msg', $msg );## Send out the pageprint "$page";1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -