[Rt-commit] r7394 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Thu Mar 29 11:53:36 EDT 2007


Author: ruz
Date: Thu Mar 29 11:53:36 2007
New Revision: 7394

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm

Log:
 r4850 at cubic-pc:  cubic | 2007-03-29 19:47:34 +0400
 * add GetPrivateKeyInfo


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Crypt/GnuPG.pm	Thu Mar 29 11:53:36 2007
@@ -814,7 +814,16 @@
 }
 
 sub GetPublicKeyInfo {
+    return GetKeyInfo(shift, 'public');
+}
+
+sub GetPrivateKeyInfo {
+    return GetKeyInfo(shift, 'private');
+}
+
+sub GetKeyInfo {
     my $email = shift;
+    my $type = shift || 'public';
 
     my $gnupg = new GnuPG::Interface;
     my %opt = RT->Config->Get('GnuPG');
@@ -839,7 +848,8 @@
     eval {
         local $SIG{'CHLD'} = 'DEFAULT';
         local @ENV{'LANG', 'LC_ALL'} = ('C', 'C');
-        my $pid = $gnupg->list_public_keys( handles => $handles, command_args => [ $email ]  );
+        my $method = $type eq 'private'? 'list_secret_keys': 'list_public_keys';
+        my $pid = $gnupg->$method( handles => $handles, command_args => [ $email ]  );
         waitpid $pid, 0;
     };
 


More information about the Rt-commit mailing list