-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSignaturesForm.pas
87 lines (70 loc) · 1.95 KB
/
SignaturesForm.pas
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
unit SignaturesForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, SBPGP, SBPGPKeys, SBPGPStreams;
type
TfrmSignatures = class(TForm)
lvSignatures: TListView;
private
{ Private declarations }
public
procedure Init(const Signatures: array of TElPGPSignature; const Validities: array of TSBPGPSignatureValidity; pgpKeyring: TElPGPKeyring);
end;
var
frmSignatures: TfrmSignatures;
implementation
{$R *.DFM}
{ TfrmSignatures }
procedure TfrmSignatures.Init(const Signatures: array of TElPGPSignature;
const Validities: array of TSBPGPSignatureValidity;
pgpKeyring: TElPGPKeyring);
var
i, Index: Integer;
Item: TListItem;
key: TElPGPCustomPublicKey;
mainKey: TElPGPPublicKey;
userID, sigVal: string;
begin
Key := nil;
lvSignatures.Items.Clear();
for i := 0 to Length(Signatures) - 1 do
begin
item := lvSignatures.Items.Add();
index := pgpKeyring.FindPublicKeyByID(Signatures[i].SignerKeyID(), key, 0);
if (key <> nil) then
begin
if (key is SBPGPKeys.TElPGPPublicKey) then
mainKey := SBPGPKeys.TElPGPPublicKey(key)
else
// retrieving supkey...
mainKey := nil;
if (mainKey <> nil) then
begin
if (mainKey.UserIDCount > 0) then
userID := mainKey.UserIDs[0].Name
else
userID := 'No name';
end
else
userID := 'Unknown Key';
end
else
userID := 'Unknown Key';
item.Caption := userID;
case Validities[i] of
svCorrupted:
sigVal := 'Corrupted'; //Ïîâðåæäåííûé
svNoKey:
sigVal := 'Signing key not found, unable to verify';
svUnknownAlgorithm:
sigVal := 'Unknown signing algorithm';
svValid:
sigVal := 'Valid';
else
sigVal := 'Unknown reason';
end;
item.SubItems.Add(sigVal);
end;
end;
end.