Summary | Enabling retrieving PGP-PublicKeys withing the Horde pref System |
Queue | IMP |
Queue Version | 4.1.5 |
Type | Enhancement |
State | Rejected |
Priority | 1. Low |
Owners | |
Requester | horde (at) immerda (dot) ch |
Created | 11/18/2007 (6510 days ago) |
Due | |
Updated | 11/19/2007 (6509 days ago) |
Assigned | |
Resolved | 11/19/2007 (6509 days ago) |
Milestone | |
Patch | No |
specific to commit. For something centralized, wouldn't it be better
to automatically update a user's contacts entry with the public key
using a prefs_change_hook?
addresses. however wouldn't your proposal also only be a better
solution if a centralized user contacts storage (like a global
addressbook) is used?
maybe this lookup could be made optional and disabled by default? so
only admins who uses email-addresses to authenticate would enable it
to use? if you would prefer such a solution we could extend our patch.
State ⇒ Rejected
to commit. For something centralized, wouldn't it be better to
automatically update a user's contacts entry with the public key using
a prefs_change_hook?
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ Enabling retrieving PGP-PublicKeys withing the Horde pref System
Queue ⇒ IMP
preference storage to retrieve a public key. This can be very
comfortable on systems where a lot of users are using webmail with pgp
however nor exchange keys nor upload them on keyservers due to various
reasons.
As well it fixes some behaviour lookup by setting the fingerprint as
the mailaddress if it haven't yet been set.
--- ./lib/Crypt/PGP.php-old 2007-11-18 20:31:33.000000000 +0100
+++ ./lib/Crypt/PGP.php 2007-11-18 21:00:10.000000000 +0100
@@ -163,6 +163,18 @@
return $key_info;
}
+ /**
+ * Retrieves the public key from the preference storage.
+ */
+ function _getPublicKeyFromPrefs($address)
+ {
+ global $conf;
+ $userprefs =
&Prefs::singleton($conf['prefs']['driver'],'imp', $address, '', null,
false);
+ $userprefs->retrieve();
+ return $pk = $userprefs->getValue('pgp_public_key');
+ }
+
+
/**
* Retrieves a public key by e-mail.
* First, the key will be attempted to be retrieved from a user's
@@ -178,10 +190,20 @@
*/
function getPublicKey($address, $fingerprint = null)
{
- /* Try retrieving by e-mail only first. */
+ /* 1. try users database */
+ $prefs_key = $this->_getPublicKeyFromPrefs($address);
+ if(strlen($prefs_key) > 100 &&
+ preg_match('/-----BEGIN PGP ([^-]+)-----/', $prefs_key)){
+ return $prefs_key;
+ }
+
+ /* 2. try retrieving from Contacts */
$result = $GLOBALS['registry']->call('contacts/getField',
array($address, IMP_PGP_PUBKEY_FIELD, $this->_sources, false, true));
/* TODO: Retrieve by ID. */
+ if($fingerprint == null){
+ $fingerprint = $address;
+ }
/* Try retrieving via a PGP public keyserver. */
if (is_a($result, 'PEAR_Error') && !empty($fingerprint)) {