Created
March 4, 2015 11:53
-
-
Save webmaster128/a5622ee31b96665d9c5b to your computer and use it in GitHub Desktop.
Create certificate validation hash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| createDownload($_REQUEST['csr']); | |
| function createDownload($csr_content) | |
| { | |
| # Write CSR content into csr.pem | |
| file_put_contents("csr.pem", $csr_content) | |
| or die("PEM file could not be written. Write permissions set?\n"); | |
| # Convert CSR from PEM to DER format | |
| system("openssl req -outform der -in csr.pem -out csr.der", $error_code); | |
| if ($error_code != 0) die("Error while converting PEM to DER file.\n"); | |
| # Generate hash content | |
| $output = sha1_file("csr.der") . "\ncomodoca.com\n"; | |
| # Download resulting hash file | |
| $filename = strtoupper(md5_file("csr.der")) . ".txt"; | |
| header("Content-Type: application/txt"); | |
| header('Content-Disposition: attachment; filename="' . $filename . "'"); | |
| echo $output; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment