Bug#579666: libgnupg-interface-perl: allow reporting of usage_flags on GnuPG::Key objects

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Apr 29 17:51:52 UTC 2010


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
-------------- next part --------------
--- 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


More information about the pkg-perl-maintainers mailing list