⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getid

📁 Perl写的CA认证程序
💻
字号:
#!/usr/bin/perl ## Get the User Certificate## (c) 1998 by Massimiliano Pala - Ver 2.1## All Rights Reserved#### DISC CLAIMER: THIS SOFTWARE IS GIVEN AS IS WITHOUT ANY WARRANTIES## ABOUT ANY DAMAGE DERIVED BY THE USE ( CORRECT OR NOT ) OF THIS## SOFTWARE. THE AUTHOR IS THEREFORE NOT RESPONSABLE IN ANY WAY OF## DAMAGES RELATED IN ANY WAY TO THIS OR SUPPORTED SOFTWARE AS WELL.#### If you want to contact me (the author) please use the e-mail## addresses listed below. Do not esitate in reporting bugs, enhancement## or anything seems useful in developing this software:####      madwolf@openca.org##      madwolf@cpan.org##      madwolf@hackmasters.net#### Thank you for using this software, and remember that Open Projects## are the future of mankind. Do not sleep, partecipate to world wide## efforts to make life easier for all!## Base requirementsrequire 5.001;## Version Information$VER = '2.1.01';$PRG = 'Certificates Send over HTTP';## Add lib/ dir in includes listpush ( @INC, "lib/" );## New OpenCA modulesuse OpenCA::OpenSSL;use OpenCA::X509;use OpenCA::Tools;## Modules to be installed to have this program to work properlyuse OpenCA::Configuration;use OpenCA::TRIStateCGI;## Functions Requirements## ======================require "misc-utils.lib";## Generate a new reference to Configuration ( instance )local $config = new OpenCA::Configuration;local $dbconfig = new OpenCA::Configuration;local $dbiconfig = new OpenCA::Configuration;## Let's load our default configurationlocal $CONFIG = 'conf/public.conf';local $DBCONFIG  = 'conf/DB.conf';local $DBICONFIG = 'conf/DBI.conf';## Load the Configuration file (read and parse)if( $config->loadCfg( $CONFIG ) == undef ) {        print "Content-type: text/html\n\n";        configError( "Unable to load configuration file (request.cnf)!");}## Now it's time to get the parameters passed over the weblocal $query  = new OpenCA::TRIStateCGI;# Flush the Output stream$|=1;## Let's get the base Directorylocal ( $basedir ) = ( $ENV{'SCRIPT_FILENAME'} =~ /(.*)\/.*/ );local $self = $query->url(-query=>0,-full=>0);## Init Section## ============local $shellPath = getRequired( 'openssl' );local $tmpdir    = getRequired( 'TempDir' );local $dbDir     = getRequired( 'dbDir' );local $sslcnf    = getRequired( 'sslconfig' );local $verify    = getRequired( 'VerifyPath' );local $sign      = getRequired( 'SignPath' );local $cryptoShell = new OpenCA::OpenSSL( SHELL=>"$shellPath" );$cryptoShell->setParams( CONFIG=>"$sslcnf",                         TMPDIR=>"$tmpdir",                         VERIFY=>"$verify",                         SIGN  =>"$sign", );if ( not $cryptoShell ) {        configError( "Cannot initialize Crypto Shell ($shellPath)!" );        exit 1;}local $tools = new OpenCA::Tools();if ( not $tools ) {        configError( "Cannot initialize OpenCA::Tools class!" );        exit 1;}local $db;if ( uc getRequired ('DBmodule') eq "DBI") {        require "initDBI";} else {        require "initDB";}## Main Section## ============## Let's get parametersmy $type      = $query->param('type');my $key       = ( $query->param('key') || $query->param('serial') );my $dataType  = ( $query->param('dataType') || "VALID_CERTIFICATE" );## Certificates directorymy $errPage  = getRequired( 'getIDErrForm' );my $mimetype = "Content-type: application/x-x509-XXX-cert\n\n";my $bgcert = '-----BEGIN CERTIFICATE-----';my $endcert = '-----END CERTIFICATE-----';my $cert;if ( $query->user_agent(netscape) ) {	## Netscape} elsif ( $query->user_agent(IE) ) {	## Mozilla} elsif ( $query->user_agent(Mozilla) ) {} else {	## Unknown}## Now we must take different path for we can give certs for user/ca## or whatever we want.if ( "$type" =~ /(email|user)/i ) {	$mimetype =~ s/XXX/$type/g;}## If we want the Text Version of the Certificateif ( $type =~ /txt/i ) {	$mimetype = "Content-type: text/html\n\n";	$mimetype .= "<PRE>\n";}## Get the certificate from the DBif ( $cert = $db->getItem(DATATYPE=>$dataType,			    KEY=>$key ) ) {	print "$mimetype";	if( $type =~ /txt/i ) {		print $cert->getTXT();	} else {		print $cert->getPEM();	}} else {	sendPage( $errPage );}exit 0;## Subroutines Section : expecially there is room for## the erro page transmitting.sub sendPage {	my @keys;	@keys = @_ ;	$filename = $keys[0];	print "Content-type: text/html\n\n";	print $query->getFile( "$filename" );	exit 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -