]> git.donarmstrong.com Git - roundcube.git/blob - plugins/enigma/lib/enigma_subkey.php
Imported Upstream version 0.6+dfsg
[roundcube.git] / plugins / enigma / lib / enigma_subkey.php
1 <?php
2 /*
3  +-------------------------------------------------------------------------+
4  | SubKey class for the Enigma Plugin                                      |
5  |                                                                         |
6  | This program is free software; you can redistribute it and/or modify    |
7  | it under the terms of the GNU General Public License version 2          |
8  | as published by the Free Software Foundation.                           |
9  |                                                                         |
10  | This program is distributed in the hope that it will be useful,         |
11  | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
12  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
13  | GNU General Public License for more details.                            |
14  |                                                                         |
15  | You should have received a copy of the GNU General Public License along |
16  | with this program; if not, write to the Free Software Foundation, Inc., |
17  | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.             |
18  |                                                                         |
19  +-------------------------------------------------------------------------+
20  | Author: Aleksander Machniak <alec@alec.pl>                              |
21  +-------------------------------------------------------------------------+
22 */
23
24 class enigma_subkey
25 {
26     public $id;
27     public $fingerprint;
28     public $expires;
29     public $created;
30     public $revoked;
31     public $has_private;
32     public $can_sign;
33     public $can_encrypt;
34     
35     /**
36      * Converts internal ID to short ID
37      * Crypt_GPG uses internal, but e.g. Thunderbird's Enigmail displays short ID
38      *
39      * @return string Key ID
40      */
41     function get_short_id()
42     {
43         // E.g. 04622F2089E037A5 => 89E037A5
44         return enigma_key::format_id($this->id);
45     }
46
47     /**
48      * Getter for formatted fingerprint
49      *
50      * @return string Formatted fingerprint
51      */
52     function get_fingerprint()
53     {
54         return enigma_key::format_fingerprint($this->fingerprint);
55     }
56
57 }