Bug#579666: allow reporting of usage_flags on GnuPG::Key objects

Salvatore Bonaccorso salvatore.bonaccorso at gmail.com
Thu Apr 29 18:13:26 UTC 2010


Hi

In Debian Bugtracker, Daniel Kahn Gillmor posted the following request
[1]. He also prepared a patch implementing this. Could you have a
look, if you would like to add this? (I added the patch additionaly as
file, as RT may garble the patch in mailtext). [I have not tested the
patch yet].

 [1] http://bugs.debian.org/579666

Bests
Salvatore

----- Forwarded message from Daniel Kahn Gillmor <dkg at fifthhorseman.net> -----

From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Resent-From: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
Reply-To: Daniel Kahn Gillmor <dkg at fifthhorseman.net>,
	579666 at bugs.debian.org
X-Mailer: reportbug 4.11
Date: Thu, 29 Apr 2010 13:51:52 -0400
To: Debian Bug Tracking System <submit at bugs.debian.org>
Subject: Bug#579666: libgnupg-interface-perl: allow reporting of usage_flags
	on GnuPG::Key objects

Package: libgnupg-interface-perl
Version: 0.42-2
Severity: wishlist
Tags: patch

It would be nice to know the reported usage flags (encrypt,
authenticate, sign, and certify) for each key from a listing of public
keys.

The attached patch adds (and populates) a usage_flags member for
GnuPG::Key, and adds it to the test suite as well.

            --dkg

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-4-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgnupg-interface-perl depends on:
ii  gnupg                         1.4.10-2   GNU privacy guard - a free PGP rep
ii  gnupg2                        2.0.14-1   GNU privacy guard - a free PGP rep
ii  libany-moose-perl             0.12-1     module to use either Moose or Mous
ii  perl                          5.10.1-12  Larry Wall's Practical Extraction 

libgnupg-interface-perl recommends no packages.

libgnupg-interface-perl suggests no packages.

-- no debconf information

--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -417,7 +417,9 @@
             my (
                 $user_id_validity, $key_length, $algo_num, $hex_key_id,
                 $creation_date_string, $expiration_date_string,
-                $local_id, $owner_trust, $user_id_string
+                $local_id, $owner_trust, $user_id_string,
+                $sigclass, #unused
+                $usage_flags,
             ) = @fields[ 1 .. $#fields ];
 
 
@@ -431,6 +433,11 @@
                 ? GnuPG::PublicKey->new()
                 : GnuPG::SecretKey->new();
 
+            # only allow expected usage flags, and exclude uppercase
+            # letters (which refer to the entire key, rather than this
+            # one)
+            $usage_flags =~ s/[^ecsa]//g;
+
             $current_key->hash_init(
                 length                 => $key_length,
                 algo_num               => $algo_num,
@@ -439,6 +446,7 @@
                 owner_trust            => $owner_trust,
                 creation_date_string   => $creation_date_string,
                 expiration_date_string => $expiration_date_string,
+                usage_flags            => $usage_flags,
             );
 
             $current_signed_item = GnuPG::UserId->new(
--- a/lib/GnuPG/Key.pm
+++ b/lib/GnuPG/Key.pm
@@ -25,6 +25,7 @@
         creation_date_string
         expiration_date_string
         fingerprint
+        usage_flags
         )
     ] => (
     isa => 'Any',
--- a/t/get_public_keys.t
+++ b/t/get_public_keys.t
@@ -32,6 +32,7 @@
 	creation_date_string   => '2000-02-06',
 	expiration_date_string => '2002-02-05',
 	owner_trust            => 'f',
+        usage_flags            => 'sc',
       );
     
     $handmade_key->fingerprint
@@ -65,6 +66,7 @@
 	hex_id                   => 'ADB99D9C2E854A6B',
 	creation_date_string     => '2000-02-06',
 	expiration_date_string   => '2002-02-05',
+        usage_flags              => 'e',
       );
     
     $subkey->fingerprint

_______________________________________________
pkg-perl-maintainers mailing list
pkg-perl-maintainers at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-perl-maintainers

----- End forwarded message -----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add_usage_flags.patch
Type: text/x-diff
Size: 1998 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20100429/57bcc8de/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20100429/57bcc8de/attachment.pgp>


More information about the pkg-perl-maintainers mailing list