/** * Test trying to create a new passphrase file * * @return void * * @since 12.3 */ public function testCreatePassphraseFile() { $privateKeyFile = __DIR__ . '/data/private.key'; $passphraseFile = __DIR__ . '/data/web-passphrase.dat'; $keychain = new JKeychain(); $keychain->createPassphraseFile('testpassphrase', $passphraseFile, $privateKeyFile, 'password'); $this->assertTrue(file_exists($passphraseFile), 'Test passphrase file exists'); }
/** * Initialise a new passphrase file. * * @return void * * @since 12.3 */ protected function initPassphraseFile() { $keychain = new JKeychain(); $passphraseFile = $this->input->get('passphrase', '', 'raw'); $privateKeyFile = $this->input->get('private-key', '', 'raw'); if (!strlen($passphraseFile)) { $this->out('A passphrase file must be specified with --passphrase'); exit(1); } if (!file_exists($privateKeyFile)) { $this->out("protected key file specified doesn't exist: {$privateKeyFile}"); exit(1); } $this->out('Please enter the new passphrase:'); $passphrase = $this->in(); $this->out('Please enter the passphrase for the protected key:'); $privateKeyPassphrase = $this->in(); $keychain->createPassphraseFile($passphrase, $passphraseFile, $privateKeyFile, $privateKeyPassphrase); }