/**
* Sends a PGP public key to a public keyserver.
*
* @param string $pubkey The PGP public key
*
* @throws Horde_Crypt_Exception
*/
public function put($pubkey)
{
/* Get the key ID of the public key. */
$info = $this->_pgp->pgpPacketInformation($pubkey);
/* See if the public key already exists on the keyserver. */
try {
$this->get($info['keyid']);
} catch (Horde_Crypt_Exception $e) {
$pubkey = 'keytext=' . urlencode(rtrim($pubkey));
try {
$this->_http->post($this->_createUrl('/pks/add'), $pubkey, array('User-Agent: Horde Application Framework', 'Content-Type: application/x-www-form-urlencoded', 'Content-Length: ' . strlen($pubkey), 'Connection: close'));
} catch (Horde_Http_Exception $e) {
throw new Horde_Crypt_Exception($e);
}
}
throw new Horde_Crypt_Exception(Horde_Crypt_Translation::t("Key already exists on the public keyserver."));
}