Mercurial > hg > rc1
comparison vendor/pear/crypt_gpg/tools/build-keyring.php @ 0:1e000243b222
vanilla 1.3.3 distro, I hope
| author | Charlie Root |
|---|---|
| date | Thu, 04 Jan 2018 15:50:29 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1e000243b222 |
|---|---|
| 1 <?php | |
| 2 | |
| 3 /* | |
| 4 * Helper script for test keyring generation | |
| 5 * | |
| 6 * See build-keyring.sh | |
| 7 * | |
| 8 * Copyright (c) 2008 Michael Gauthier | |
| 9 */ | |
| 10 | |
| 11 echo "<?php\n\n"; | |
| 12 | |
| 13 $HOMEDIR = $_SERVER['argv'][1]; | |
| 14 | |
| 15 $dataFiles = array( | |
| 16 'pubring' => 'pubring.gpg', | |
| 17 'secring' => 'secring.gpg', | |
| 18 'trustdb' => 'trustdb.gpg', | |
| 19 'random_seed' => 'random_seed' | |
| 20 ); | |
| 21 | |
| 22 $keyFiles = array( | |
| 23 'expectedKeyData' => 'public-only-pub.asc', | |
| 24 'privateKeyData' => 'public-only-sec.asc', | |
| 25 'publicKeyData' => 'external-public-pub.asc' | |
| 26 ); | |
| 27 | |
| 28 $signatureFiles = array( | |
| 29 'normalSignedData' => 'normal-signed-data.asc', | |
| 30 'clearsignedData' => 'clearsigned-data.asc', | |
| 31 'detachedSignature' => 'detached-signature.asc', | |
| 32 'dualNormalSignedData' => 'dual-normal-signed-data.asc', | |
| 33 'dualClearsignedData' => 'dual-clearsigned-data.asc', | |
| 34 'dualDetachedSignature' => 'dual-detached-signature.asc' | |
| 35 ); | |
| 36 | |
| 37 $encryptedFiles = array( | |
| 38 'encryptedData' => 'encrypted-data.asc', | |
| 39 'encryptedDataNoPassphrase' => 'encrypted-data-no-passphrase.asc', | |
| 40 'encryptedDataMissingKey' => 'encrypted-data-missing-key.asc', | |
| 41 'dualEncryptedData' => 'dual-encrypted-data.asc', | |
| 42 'dualEncryptedDataOnePassphrase' => 'dual-encrypted-data-one-passphrase.asc' | |
| 43 ); | |
| 44 | |
| 45 echo "\n// For TestCase\n"; | |
| 46 | |
| 47 foreach ($dataFiles as $key => $file) { | |
| 48 echo " // {{{ " . $key . " data\n"; | |
| 49 echo " $" . $key . "Data = <<<TEXT\n"; | |
| 50 | |
| 51 $content = file_get_contents($HOMEDIR . '/' . $file); | |
| 52 $content = base64_encode($content); | |
| 53 $content = wordwrap($content, 60, "\n", true); | |
| 54 | |
| 55 echo $content; | |
| 56 | |
| 57 echo "\n\nTEXT;\n"; | |
| 58 echo " // }}}\n"; | |
| 59 } | |
| 60 | |
| 61 echo "\n// For ImportKeyTestCase and ExportKeyTestCase\n"; | |
| 62 | |
| 63 foreach ($keyFiles as $key => $file) { | |
| 64 $comment = strtolower(preg_replace('([A-Z])', ' ${0}', $key)); | |
| 65 | |
| 66 echo " // {{{ " . $comment . "\n"; | |
| 67 echo " $" . $key . " = <<<TEXT\n"; | |
| 68 | |
| 69 $content = file_get_contents($HOMEDIR . '/' . $file); | |
| 70 | |
| 71 echo $content; | |
| 72 | |
| 73 echo "\nTEXT;\n"; | |
| 74 echo " // }}}\n"; | |
| 75 } | |
| 76 | |
| 77 echo "\n// For SignTestCase and VerifyTestCase\n"; | |
| 78 | |
| 79 foreach ($signatureFiles as $key => $file) { | |
| 80 $comment = strtolower(preg_replace('([A-Z])', ' ${0}', $key)); | |
| 81 | |
| 82 echo " // {{{ " . $comment . "\n"; | |
| 83 echo " $" . $key . " = <<<TEXT\n"; | |
| 84 | |
| 85 $content = file_get_contents($HOMEDIR . '/' . $file); | |
| 86 | |
| 87 echo $content; | |
| 88 | |
| 89 echo "\nTEXT;\n"; | |
| 90 echo " // }}}\n"; | |
| 91 } | |
| 92 | |
| 93 echo "\n// For DecryptTestCase\n"; | |
| 94 | |
| 95 foreach ($encryptedFiles as $key => $file) { | |
| 96 $comment = strtolower(preg_replace('([A-Z])', ' ${0}', $key)); | |
| 97 | |
| 98 echo " // {{{ " . $comment . "\n"; | |
| 99 echo " $" . $key . " = <<<TEXT\n"; | |
| 100 | |
| 101 $content = file_get_contents($HOMEDIR . '/' . $file); | |
| 102 | |
| 103 echo $content; | |
| 104 | |
| 105 echo "\nTEXT;\n"; | |
| 106 echo " // }}}\n"; | |
| 107 } | |
| 108 | |
| 109 echo "\n?>\n"; | |
| 110 | |
| 111 ?> |
