-- 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 . 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 ' 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;