~ubuntu-branches/ubuntu/wily/signing-party/wily

« back to all changes in this revision

Viewing changes to gpg-key2ps/gpg-key2ps

  • Committer: Bazaar Package Importer
  • Author(s): Thijs Kinkhorst
  • Date: 2008-05-20 12:23:52 UTC
  • mfrom: (1.1.12 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080520122352-ifxepk04h8ktfr5p
Tags: 1.0-2
* gpg-mailkeys: Fix parameter escaping of printf, thanks
  Olivier Tetard (Closes: #478151).
* springgraph: clarify help text (Closes: 474351).
* Switch dependency libmime-perl to libmime-tools-perl (renamed).
* Put springgraph and sig2dot in section graphics.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# gpg-key2ps: convert a PGP/GnuPG key into paper slips.
4
4
# Copyright (C) 2001-2005  Simon Richter
5
 
# Copyright (C) 2005-2006  Thijs Kinkhorst
6
 
# Copyright (C) 2005-2006  Christoph Berg <cb@df7cb.de>
 
5
# Copyright (C) 2005-2007  Thijs Kinkhorst
 
6
# Copyright (C) 2005-2008  Christoph Berg <cb@df7cb.de>
7
7
# Licenced under the GNU General Public License,
8
8
# version 2 or later.
9
9
#
10
 
# $Id: gpg-key2ps 296 2006-08-16 11:44:38Z myon $
 
10
# $Id: gpg-key2ps 372 2008-03-16 18:41:31Z myon $
11
11
 
12
12
use strict;
13
13
use Getopt::Long;
14
14
 
15
 
my $version = '$Rev: 296 $';
 
15
my $version = '$Rev: 372 $';
16
16
$version =~ s/\$Rev:\s*(\d+)\s*\$/$1/;
17
17
my $revokestyle = "hide";
 
18
my $columns = 2;
18
19
my $creationdate = scalar(localtime);
19
20
 
20
21
sub version($) {
21
22
        my $fd = shift;
22
 
        print $fd "gpg-key2ps $version - (c) 2001-2006 Simon Richter, Thijs Kinkhorst, Christoph Berg\n";
 
23
        print $fd "gpg-key2ps $version - (c) 2001-2008 Simon Richter, Thijs Kinkhorst, Christoph Berg\n";
23
24
}
24
25
 
25
26
sub usage($$) {
26
27
        my ($fd, $exitcode) = @_;
27
28
        version ($fd);
28
29
        print $fd <<EOF;
29
 
Usage: $0 [-p papersize] [-r revoked-style] keyid-or-name ...
 
30
Usage: $0 [-p papersize] [-r revoked-style] [-1] keyid-or-name ...
30
31
Options:
31
32
 -p --paper-size
32
33
 -r --revoked-style
33
 
        hide   - Don't show revoked uids (default)
 
34
        hide   - Don't show revoked uids and subkeys (default)
34
35
        grey   - Print text in grey
35
36
        note   - Add "[revoked]"
36
37
        show   - List revoked uids normally
37
38
        strike - Strike through lines
 
39
 -1 Only print one column, for extra wide keys
38
40
 -h --help
39
41
 -v --version
40
42
EOF
53
55
        '--paper-size=s'    => \$opts->{papersize},
54
56
        '-r=s'              => \$opts->{revokestyle},
55
57
        '--revoked-style=s' => \$opts->{revokestyle},
 
58
        '-1'                => \$opts->{1},
56
59
)) {
57
60
        usage(\*STDERR, 1);
58
61
}
74
77
        usage (\*STDERR, 1);
75
78
}
76
79
 
 
80
if ( $opts->{1} ) { $columns = 1; }
 
81
 
77
82
usage(\*STDERR, 1) unless scalar @ARGV >= 1;
78
83
 
79
84
# determine the paper size through the paperconf tool
119
124
 
120
125
/hline {
121
126
        30 y 3 add moveto
122
 
        w 2 div 30 sub y 3 add lineto stroke
 
127
        w $columns div 30 sub y 3 add lineto stroke
123
128
        newline
124
129
} def
125
130
 
157
162
        newline
158
163
} def
159
164
 
 
165
/sbk {
 
166
        50 y moveto (sub) show
 
167
        70 y moveto show showAlgorithm (/) show show
 
168
        150 y moveto show
 
169
        newline
 
170
} def
 
171
 
160
172
EOF
161
173
 
162
174
# output the desired display for revoked uids
163
175
if ( $revokestyle eq "grey" ) {
164
 
        print "/revuid {\n";
165
 
        print " .5 setgray\n";
166
 
        print " uid\n";
167
 
        print " 0 setgray\n";
168
 
        print "} def\n";
 
176
        print <<EOF;
 
177
/revuid {
 
178
        .5 setgray
 
179
        uid
 
180
        0 setgray
 
181
} def
 
182
/revsbk {
 
183
        .5 setgray
 
184
        sbk
 
185
        0 setgray
 
186
} def
 
187
EOF
169
188
} elsif ( $revokestyle eq "note" ) {
170
 
        print "/revuid {\n";
171
 
        print " 50 y moveto (uid) show\n";
172
 
        print " 200 y moveto show ( [revoked]) show\n";
173
 
        print " newline\n";
174
 
        print "} def\n";
 
189
        print <<EOF;
 
190
/revuid {
 
191
        50 y moveto (uid) show
 
192
        200 y moveto show ( [revoked]) show
 
193
        newline
 
194
} def
 
195
/revsbk {
 
196
        sbk
 
197
        ( [revoked]) show
 
198
} def
 
199
EOF
175
200
} elsif ( $revokestyle eq "show" ) {
176
 
        print "/revuid { uid } def\n";
 
201
        print <<EOF;
 
202
/revuid { uid } def
 
203
/revsbk { sbk } def
 
204
EOF
177
205
} elsif ( $revokestyle eq "strike" ) {
178
 
        print "/revuid {\n";
179
 
        print " uid\n";
180
 
        print " 45 y 9 add moveto h 2 div 45 sub y 18 add lineto stroke\n";
181
 
        print "} def\n";
 
206
        print <<EOF;
 
207
/revuid {
 
208
        uid
 
209
        45 y 9 add moveto h 2 div 45 sub y 18 add lineto stroke
 
210
} def
 
211
/revsbk {
 
212
        sbk
 
213
        45 y 9 add moveto h 2 div 45 sub y 18 add lineto stroke
 
214
} def
 
215
EOF
182
216
}
183
217
 
184
218
print <<EOF;
185
219
 
186
 
/sbk {
187
 
        50 y moveto (sub) show
188
 
        70 y moveto show showAlgorithm (/) show show
189
 
        150 y moveto show
190
 
        newline
191
 
} def
192
 
 
193
220
/key {
194
221
        noneedhline
195
222
EOF
226
253
                next if $revokestyle eq "hide";
227
254
        }
228
255
        # subkey
229
 
        s/^sub:[^:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:.*/    ($4) ($3) $2 ($1) sbk/;
 
256
        s/^sub:[^r:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:.*/   ($4) ($3) $2 ($1) sbk/;
 
257
        if (s/^sub:r[^:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:.*/       ($4) ($3) $2 ($1) revsbk/) {
 
258
                next if $revokestyle eq "hide";
 
259
        }
230
260
        $numlines++;
231
261
        # print this line
232
262
        print;
249
279
        /y w 20 sub def
250
280
        1 1 num {
251
281
                gsave
252
 
                0 0 h 2 div w rectclip
 
282
                0 0 h $columns div w rectclip
253
283
                /upper y 11 add def
254
284
                key
255
285
                newline
256
286
                /lower y 11 add def
257
 
                0 upper h 2 div upper h 2 div lower 0 lower 0 upper moveto lineto lineto lineto lineto stroke
 
287
                0 upper h $columns div upper h $columns div lower 0 lower 0 upper moveto lineto lineto lineto lineto stroke
258
288
                grestore
259
289
        } for
260
290
} def
262
292
w 0 translate
263
293
90 rotate
264
294
column
265
 
h 2 div 0 translate
 
295
EOF
 
296
 
 
297
if ( $columns == 2 ) {
 
298
        print <<EOF;
 
299
h $columns div 0 translate
266
300
column
267
301
 
 
302
EOF
 
303
}
 
304
 
 
305
print <<EOF;
268
306
showpage
269
307
 
270
308
%%Trailer
303
341
 
304
342
=item B<-r> B<--revoked-style> I<revoked-style>
305
343
 
306
 
Select how to mark revoked UIDs. Five styles are available:
 
344
Select how to mark revoked UIDs and subkeys. Five styles are available:
307
345
 B<hide> don't show at all (default),
308
346
 B<show> show normally,
309
347
 B<grey> display in 50% grey,
324
362
 
325
363
=back
326
364
 
327
 
 
328
365
=head1 SEE ALSO
329
366
 
330
 
gpg(1)
331
 
 
332
 
http://pgp-tools.alioth.debian.org/
 
367
=over
 
368
 
 
369
=item gpg(1)
 
370
 
 
371
GNU Privacy Guard.
 
372
 
 
373
=item http://pgp-tools.alioth.debian.org/
 
374
 
 
375
The homepage of B<gpg-key2ps> and the other tools bundled in B<signing-party>.
 
376
 
 
377
=item http://www.debian.org/events/materials/business-cards/
 
378
 
 
379
B<gpg-key2ps> prints plain fingerprint slips. If you are looking for something
 
380
more stylish, look at these latex templates for business cards that also
 
381
include fingerprints.
 
382
 
 
383
=back
333
384
 
334
385
=head1 AUTHORS AND COPYRIGHT
335
386
 
336
 
(c) 2001 - 2005 Simon Richter <sjr@debian.org>
337
 
 
338
 
(c) 2005 Thijs Kinkhorst <thijs@kinkhorst.com>
339
 
 
340
 
(c) 2005 Christoph Berg <cb@df7cb.de>
341
 
 
 
387
=over
 
388
 
 
389
=item (c) 2001-2005 Simon Richter <sjr@debian.org>
 
390
 
 
391
=item (c) 2005-2007 Thijs Kinkhorst <thijs@kinkhorst.com>
 
392
 
 
393
=item (c) 2005-2008 Christoph Berg <cb@df7cb.de>
 
394
 
 
395
=back