1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
-- Topal: GPG/GnuPG and Alpine/Pine integration
-- Copyright (C) 2001--2012 Phillip J. Brooke
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License version 3 as
-- published by the Free Software Foundation.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Globals; use Globals;
package Keys is
type Key_List is limited private;
Key_Not_Found : exception;
type Key_Property_Types is
(Invalid, Disabled, Revoked, Expired, Encrypter, Signer);
type Key_Properties is array(Key_Property_Types) of Boolean;
-- Both means Encrypter or Signer. Any means any, even those not
-- capable of signing or encrypting.
type Key_Roles is (Encrypter, Signer, Both, Any);
-- Do the properties and roles match?
function Match_PR (KP : Key_Properties;
KR : Key_Roles) return Boolean;
-- Is the key usable?
function Usable (KP : Key_Properties) return Boolean;
-- Given a line from Findkey, return a processed version.
procedure Process_Key (L : in String;
P : out UBS;
KP : out Key_Properties);
-- Given a fingerprint, return the process key info.
procedure Process_Key_By_FP (FP : in String;
P : out UBS;
KP : out Key_Properties;
SMIME : in Boolean);
-- Add a key to the list....
procedure Add_Key (Key : in UBS;
List : in out Key_List;
Role : in Key_Roles);
Fingerprint_Expected : exception;
-- Remove a key.
-- Only deletes one instance.
procedure Remove_Key (Key : in UBS;
List : in out Key_List;
Exception_If_Missing : in Boolean := False);
-- Turn the list of keys to send into `-r <key>' string.
function Processed_Recipient_List (List : in Key_List) return String;
-- Turn the list of keys to send into a list of filenames and
-- create those files.
function Processed_Recipient_List_OpenSSL (List : in Key_List) return String;
-- Get key fingerprint(s) for a key. Add them.
-- The name is a bit odd. Really, they should be `Search_For_Keys' or similar.
-- The `By_Fingerprint' bit refers to how the keys are recorded.
procedure Add_Keys_By_Fingerprint (Key_In : in UBS;
List : in out Key_List;
Role : in Key_Roles;
Found : out Boolean);
procedure Add_Keys_By_Fingerprint (Key_In : in UBS;
List : in out Key_List;
Role : in Key_Roles);
-- Add the secret keys to this keylist.
procedure Add_Secret_Keys (Key_In : in UBS;
List : in out Key_List;
Role : in Key_Roles);
-- List the keys and edit them as appropriate (include removing a key
-- from that list, and adding one from the keyring.
procedure List_Keys (List : in out Key_List);
-- List the keys. Either return with Aborted true, or
-- The_Fingerprint set to the chosen fingerprint.
procedure Select_Key_From_List (List : in out Key_List;
The_Fingerprint : out UBS;
Aborted : out Boolean);
procedure First_Key_From_List (List : in out Key_List;
The_Fingerprint : out UBS);
-- Use keylist. Given a list of recipients, add the keys, returning a
-- new key list.
procedure Use_Keylist (Recipients : in UBS_Array;
List : in out Key_List;
Missing : out Boolean);
procedure Empty_Keylist (List : in out Key_List;
SMIME : in Boolean);
function Count (List : in Key_List) return Natural;
function Contains (List : in Key_List;
Key : in UBS) return Boolean;
private
type Key_List is
record
KA : UVV;
SMIME : Boolean; -- A flag that changes further internal operations.
end record;
end Keys;
|