## OpenCA - RA Server Command ## (c) 1998-2001 by Massimiliano Pala and OpenCA Group ## (c) Copyright 2001-2004 The OpenCA Project ## ## File Name: approveCSR ## Brief: approve Request ## Version: $Revision: 1.3 $ ## Description: Adds a confirmed request into the APPROVED_REQUEST dB ## Parameters: key, dataType, text, signature use strict; sub cmdApproveCSR { our ($query, $db, $errno, $errval, $cryptoShell); ## Get the parameters my $key = $query->param( 'key' ); my $dataType = $query->param( 'dataType' ); my $text = $query->param( 'text' ); my $head = $query->param( 'head' ); my $signature = $query->param( 'signature' ); my $inform = "PEM"; ## Get Conf Parameters my $tempDir = getRequired('tempDir'); my ( $req, $item, $sig, $sigStatus, $signer ); $signature =~ s/\n*$//; $text = "$head" . "$text\n"; if ($signature !~ /^\s*$/) { $text .= "-----BEGIN PKCS7-----\n"; $text .= "$signature\n"; $text .= "-----END PKCS7-----\n"; } print STDERR $text; if( not $req = $db->getItem( DATATYPE=>$dataType, KEY=>$key) ) { generalError( i18nGettext ("Cannot find __DATATYPE__ REQ in DB!", "__DATATYPE__", $dataType)); } $text .= $req->getParsed()->{KEY}; ## FIXME: should we check the subject here if it is not dynamic via serials? if ($dataType !~ /RENEW/i and not $req->getParsed()->{HEADER}->{RENEW}) { # check the public key ## Check if there are certificates with the same keys my @certList = $db->searchItems( DATATYPE=> "CERTIFICATE", PUBKEY => $req->getParsed()->{PUBKEY}); my $errorString = gettext ("A Certificate with the same public key exists!")."
\n". gettext ("This is a keycompromise of the certificates with the serial:")."\n". "