Small fix to the pgp key validation tool

- doesn't break on completely invalid keys anymore
pull/712/head
Iglocska 2015-10-27 14:00:31 +01:00
parent f7f3142a91
commit f9da3f2d2c
2 changed files with 3 additions and 3 deletions

View File

@ -1 +1 @@
{"major":2, "minor":3, "hotfix":146}
{"major":2, "minor":3, "hotfix":147}

View File

@ -383,9 +383,9 @@ class User extends AppModel {
));
foreach ($users as $k => $user) {
$gpg = new Crypt_GPG(array('homedir' => Configure::read('GnuPG.homedir'), 'binary' => (Configure::read('GnuPG.binary') ? Configure::read('GnuPG.binary') : '/usr/bin/gpg')));
$key = $gpg->importKey($user['User']['gpgkey']);
$gpg->addEncryptKey($key['fingerprint']); // use the key that was given in the import
try {
$key = $gpg->importKey($user['User']['gpgkey']);
$gpg->addEncryptKey($key['fingerprint']); // use the key that was given in the import
$enc = $gpg->encrypt('test', true);
} catch (Exception $e){
$results[$user['User']['id']][0] = true;