pgpPacketInformation() публичный Метод

If the data block contains multiple keys, only the first is returned. To return all keys of this block, use pgpPacketInformationMultiple() instead.
См. также: pgpPacketInformationMultiple()
public pgpPacketInformation ( string $pgpdata ) : array
$pgpdata string The PGP data block.
Результат array An array with information on the PGP data block. If an element is not present in the data block, it will likewise not be set in the array.
Array Format:
-------------
[public_key]/[secret_key] => Array
  (
    [created] => Key creation - UNIX timestamp
    [expires] => Key expiration - UNIX timestamp (0 = never expires)
    [size]    => Size of the key in bits
  )

[keyid] => Key ID of the PGP data (if available)
           16-bit hex value

[signature] => Array (
    [id{n}/'_SIGNATURE'] => Array (
        [name]        => Full Name
        [comment]     => Comment
        [email]       => E-mail Address
        [keyid]       => 16-bit hex value
        [created]     => Signature creation - UNIX timestamp
        [expires]     => Signature expiration - UNIX timestamp
        [micalg]      => The hash used to create the signature
        [sig_{hex}]   => Array [details of a sig verifying the ID] (
            [created]     => Signature creation - UNIX timestamp
            [expires]     => Signature expiration - UNIX timestamp
            [keyid]       => 16-bit hex value
            [micalg]      => The hash used to create the signature
        )
    )
)
Each user ID will be stored in the array 'signature' and have data associated with it, including an array for information on each signature that has signed that UID. Signatures not associated with a UID (e.g. revocation signatures and sub keys) will be stored under the special keyword '_SIGNATURE'.
Пример #1
0
 /**
  * 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."));
 }
Пример #2
0
 /**
  * Returns information on a PGP data block.
  *
  * @param string $pgpdata  The PGP data block.
  *
  * @return array  An array with information on the PGP data block. If an
  *                element is not present in the data block, it will
  *                likewise not be set in the array.
  * <pre>
  * Array Format:
  * -------------
  * [public_key]/[secret_key] => Array
  *   (
  *     [created] => Key creation - UNIX timestamp
  *     [expires] => Key expiration - UNIX timestamp (0 = never expires)
  *     [size]    => Size of the key in bits
  *   )
  *
  * [keyid] => Key ID of the PGP data (if available)
  *            16-bit hex value
  *
  * [signature] => Array (
  *     [id{n}/'_SIGNATURE'] => Array (
  *         [name]        => Full Name
  *         [comment]     => Comment
  *         [email]       => E-mail Address
  *         [keyid]       => 16-bit hex value
  *         [created]     => Signature creation - UNIX timestamp
  *         [expires]     => Signature expiration - UNIX timestamp
  *         [micalg]      => The hash used to create the signature
  *         [sig_{hex}]   => Array [details of a sig verifying the ID] (
  *             [created]     => Signature creation - UNIX timestamp
  *             [expires]     => Signature expiration - UNIX timestamp
  *             [keyid]       => 16-bit hex value
  *             [micalg]      => The hash used to create the signature
  *         )
  *     )
  * )
  * </pre>
  *
  * Each user ID will be stored in the array 'signature' and have data
  * associated with it, including an array for information on each
  * signature that has signed that UID. Signatures not associated with a
  * UID (e.g. revocation signatures and sub keys) will be stored under the
  * special keyword '_SIGNATURE'.
  */
 public function pgpPacketInformation($pgpdata)
 {
     return $this->_pgp->pgpPacketInformation($pgpdata);
 }