You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.4 KiB

<?php
$Data = array();
$Data[] = "oid_section = OIDs";
$Data[] = "[ req ]";
$Data[] = "default_bits = 2048";
$Data[] = "encrypt_key = no";
$Data[] = "default_md = sha256";
$Data[] = "distinguished_name = dn";
$Data[] = "prompt = no";
$Data[] = "[ OIDs ]";
$Data[] = "MySensationalOID=1.2.3.4";
$Data[] = "MyOutstandingOID=2.3.4.56";
$Data[] = "[ dn ]";
$Data[] = "CN = Evgeny Gagua";
$Data[] = "emailAddress = poocka@gmail.com";
$Data[] = "O = Dr. Frucht Systems Ltd.";
$Data[] = "C = IL";
$Data[] = "MySensationalOID={$argv[1]}";
$Data[] = "[ req_ext ]";
$Data[] = "subjectAltName = email:gagua@gmail.com";
$Data[] = "MyOutstandingOID=Evgeny Gagua";
if( count( $argv ) > 1 ){
$TMP = md5(time());
$FD = fopen( $TMP.".conf", "w+" );
if( $FD ){
$JJ = implode( "\n", $Data ) . "\n";
fprintf( $FD, $JJ );
fclose( $FD );
if( 0 ){
$L = `openssl genrsa -out {$TMP}.key 2048`;
$L = `openssl req -sha256 -verbose -config {$TMP}.conf -extensions req_ext -new -nodes -key {$TMP}.key -out {$TMP}.csr`;
} else {
$L = `openssl req -new -config {$TMP}.conf -key host.key -out {$TMP}.csr`;
};
$L = `openssl x509 -req -CA rootCA.crt -CAkey rootCA.key -in {$TMP}.csr -out {$TMP}.crt -days 365 -CAcreateserial`;
unlink( $TMP . '.conf' );
unlink( $TMP . '.csr' );
echo "{$TMP}.crt";
};
};
?>