[Rt-commit] rt branch, 4.2/smime-v2, updated. rt-4.0.4-538-g19c26e9
Kevin Falcone
falcone at bestpractical.com
Fri Sep 28 15:24:00 EDT 2012
The branch, 4.2/smime-v2 has been updated
via 19c26e9111264d9ce8d1c0203827131f7edc86c3 (commit)
via b6b53aa58ee545eb638aed7c39807aabdf8b49d9 (commit)
via acb997246b0548e2d2efbe9459e246c248e111c5 (commit)
via cd978dd12587eddf319d0cc53f50650f687b4145 (commit)
via ae6d549c42430b8a01625e63ea1f3aeb978871d5 (commit)
via fde8a3f6520f736a6781c19fe7593c4a0b166aae (commit)
via f37f58b444ee3191dcdce55f51771a1b7bcfad15 (commit)
via 4598f0b68ae536e57551da0a5b2d13676b67769b (commit)
via f5504208fa0784d74f830e86e5476ce4099cdcd7 (commit)
via 019089fdc3dcad6b39681c760d8befbe420837fb (commit)
via 09ccedaaf224ea71a4659f9ff9f1760336149332 (commit)
via dc46058f56a2d309429b62f0d65c8320007d5f2b (commit)
via 47a9cb5ba7de2ac50a0b94a89c85cf00c2864408 (commit)
from dc2cdf955402d21d4f0a046857074d6c48187767 (commit)
Summary of changes:
lib/RT/Crypt/GnuPG.pm | 910 +++++++++++---------------------------
lib/RT/Crypt/GnuPG/CRLFHandle.pm | 22 +
lib/RT/Test.pm | 141 ++----
t/data/gnupg/keyrings/trustdb.gpg | Bin 1520 -> 1520 bytes
4 files changed, 325 insertions(+), 748 deletions(-)
create mode 100644 lib/RT/Crypt/GnuPG/CRLFHandle.pm
- Log -----------------------------------------------------------------
commit acb997246b0548e2d2efbe9459e246c248e111c5
Merge: dc2cdf9 cd978dd
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Sep 27 15:26:37 2012 -0400
Merge branch '4.2/gnupg-refactor-backported' into 4.2/smime-v2
Conflicts:
lib/RT/Crypt/GnuPG.pm
diff --cc lib/RT/Crypt/GnuPG.pm
index da72c52,1504688..398110f
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@@ -50,9 -50,9 +50,10 @@@ use strict
use warnings;
package RT::Crypt::GnuPG;
+use base 'RT::Crypt::Base';
use IO::Handle;
+ use RT::Crypt::GnuPG::CRLFHandle;
use GnuPG::Interface;
use RT::EmailParser ();
use RT::Util 'safe_run_child', 'mime_recommended_filename';
@@@ -689,34 -716,8 +700,7 @@@ sub _SignEncryptAttachmentInline
);
return unless $args{'Sign'} || $args{'Encrypt'};
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
--
- # handling passphrase in GnupGOptions
- $args{'Passphrase'} = delete $opt{'passphrase'}
- if !defined($args{'Passphrase'});
-
- $opt{'digest-algo'} ||= 'SHA1';
- $opt{'default_key'} = $args{'Signer'}
- if $args{'Sign'} && $args{'Signer'};
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- armor => 1,
- meta_interactive => 0,
- );
-
- if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
- $args{'Passphrase'} = $self->GetPassphrase( Address => $args{'Signer'} );
- }
-
my $entity = $args{'Entity'};
- if ( $args{'Encrypt'} ) {
- $gnupg->options->push_recipients( $_ ) foreach
- map RT::Crypt->UseKeyForEncryption($_) || $_,
- @{ $args{'Recipients'} || [] };
- }
-
- my %res;
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
@@@ -1130,29 -1001,18 +1046,21 @@@ sub VerifyDecrypt
if ( $args{'SetStatus'} || $args{'AddStatus'} ) {
my $method = $args{'AddStatus'} ? 'add' : 'set';
$status_on->head->$method(
- 'X-RT-GnuPG-Status' => $res[-1]->{'status'}
+ 'X-RT-GnuPG-Status' => $res{'status'}
);
}
+ } else {
+ die "Unknow type '". $item->{'Type'} ."' of protected item";
}
- return @res;
+ return %res;
}
-sub VerifyInline { return DecryptInline( @_ ) }
+sub VerifyInline { return (shift)->DecryptInline( @_ ) }
sub VerifyAttachment {
+ my $self = shift;
my %args = ( Data => undef, Signature => undef, Top => undef, @_ );
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $opt{'digest-algo'} ||= 'SHA1';
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- meta_interactive => 0,
- );
-
foreach ( $args{'Data'}, $args{'Signature'} ) {
next unless $_->bodyhandle->is_encoded;
@@@ -1197,17 -1034,8 +1082,9 @@@
}
sub VerifyRFC3156 {
+ my $self = shift;
my %args = ( Data => undef, Signature => undef, Top => undef, @_ );
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $opt{'digest-algo'} ||= 'SHA1';
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- meta_interactive => 0,
- );
-
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw:eol(CRLF?)';
$args{'Data'}->print( $tmp_fh );
@@@ -1377,9 -1125,8 +1176,8 @@@ sub DecryptInline
seek $block_fh, 0, 0;
my ($res_fh, $res_fn);
- ($res_fh, $res_fn, %res) = _DecryptInlineBlock(
+ ($res_fh, $res_fn, %res) = $self->_DecryptInlineBlock(
%args,
- GnuPG => $gnupg,
BlockHandle => $block_fh,
);
return %res unless $res_fh;
@@@ -1435,9 -1181,7 +1232,8 @@@
}
sub _DecryptInlineBlock {
+ my $self = shift;
my %args = (
- GnuPG => undef,
BlockHandle => undef,
Passphrase => undef,
@_
@@@ -1520,9 -1225,8 +1278,8 @@@ sub DecryptAttachment
$args{'Data'}->bodyhandle->print( $tmp_fh );
seek $tmp_fh, 0, 0;
- my ($res_fh, $res_fn, %res) = _DecryptInlineBlock(
+ my ($res_fh, $res_fn, %res) = $self->_DecryptInlineBlock(
%args,
- GnuPG => $gnupg,
BlockHandle => $tmp_fh,
);
return %res unless $res_fh;
@@@ -2024,63 -1796,29 +1741,35 @@@ sub GetKeysForSigning
}
sub GetKeysInfo {
- my $email = shift;
- my $type = shift || 'public';
- my $force = shift;
+ my $self = shift;
+ my %args = (
+ Key => undef,
+ Type => 'public',
+ Force => 0,
+ @_
+ );
+ my $email = $args{'Key'};
+ my $type = $args{'Type'};
unless ( $email ) {
- return (exit_code => 0) unless $force;
+ return (exit_code => 0) unless $args{'Force'};
}
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $opt{'digest-algo'} ||= 'SHA1';
- $opt{'with-colons'} = undef; # parseable format
- $opt{'fingerprint'} = undef; # show fingerprint
- $opt{'fixed-list-mode'} = undef; # don't merge uid with keys
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- armor => 1,
- meta_interactive => 0,
+ my @info;
+ my $method = $type eq 'private'? 'list_secret_keys': 'list_public_keys';
+ my %res = CallGnuPG(
+ Options => {
+ 'with-colons' => undef, # parseable format
+ 'fingerprint' => undef, # show fingerprint
+ 'fixed-list-mode' => undef, # don't merge uid with keys
+ },
+ Command => $method,
+ ( $email ? (CommandArgs => [$email]) : () ),
+ Output => \@info,
);
-
- my %res;
-
- my ($handles, $handle_list) = _make_gpg_handles();
- my %handle = %$handle_list;
-
- eval {
- local $SIG{'CHLD'} = 'DEFAULT';
- my $method = $type eq 'private'? 'list_secret_keys': 'list_public_keys';
- my $pid = safe_run_child { $gnupg->$method( handles => $handles, $email? (command_args => $email) : () ) };
- close $handle{'stdin'};
- waitpid $pid, 0;
- };
-
- my @info = readline $handle{'stdout'};
- close $handle{'stdout'};
-
- $res{'exit_code'} = $?;
- foreach ( qw(stderr logger status) ) {
- $res{$_} = do { local $/; readline $handle{$_} };
- delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
- close $handle{$_};
- }
- $RT::Logger->debug( $res{'status'} ) if $res{'status'};
- $RT::Logger->warning( $res{'stderr'} ) if $res{'stderr'};
- $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
- if ( $@ || $? ) {
- $res{'message'} = $@? $@: "gpg exitted with error code ". ($? >> 8);
- return %res;
- }
+ return %res if $res{'message'};
- @info = ParseKeysInfo( @info );
+ @info = $self->ParseKeysInfo( @info );
$res{'info'} = \@info;
return %res;
}
@@@ -2219,101 -1956,52 +1908,38 @@@ sub ParseKeysInfo
}
}
-sub _ParseDate {
- my $value = shift;
- # never
- return $value unless $value;
-
- require RT::Date;
- my $obj = RT::Date->new( RT->SystemUser );
- # unix time
- if ( $value =~ /^\d+$/ ) {
- $obj->Set( Value => $value );
- } else {
- $obj->Set( Format => 'unknown', Value => $value, Timezone => 'utc' );
- }
- return $obj;
-}
-
sub DeleteKey {
+ my $self = shift;
my $key = shift;
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- meta_interactive => 0,
- );
-
- my ($handles, $handle_list) = _make_gpg_handles();
- my %handle = %$handle_list;
-
- eval {
- local $SIG{'CHLD'} = 'DEFAULT';
- my $pid = safe_run_child { $gnupg->wrap_call(
- handles => $handles,
- commands => ['--delete-secret-and-public-key'],
- command_args => [$key],
- ) };
- close $handle{'stdin'};
- while ( my $str = readline $handle{'status'} ) {
- if ( $str =~ /^\[GNUPG:\]\s*GET_BOOL delete_key\..*/ ) {
- print { $handle{'command'} } "y\n";
+ return CallGnuPG(
+ Command => "--delete-secret-and-public-key",
+ CommandArgs => [$key],
+ Callback => sub {
+ my %handle = @_;
+ while ( my $str = readline $handle{'status'} ) {
+ if ( $str =~ /^\[GNUPG:\]\s*GET_BOOL delete_key\..*/ ) {
+ print { $handle{'command'} } "y\n";
+ }
}
- }
- waitpid $pid, 0;
- };
- my $err = $@;
- close $handle{'stdout'};
-
- my %res;
- $res{'exit_code'} = $?;
- foreach ( qw(stderr logger status) ) {
- $res{$_} = do { local $/; readline $handle{$_} };
- delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
- close $handle{$_};
- }
- $RT::Logger->debug( $res{'status'} ) if $res{'status'};
- $RT::Logger->warning( $res{'stderr'} ) if $res{'stderr'};
- $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
- if ( $err || $res{'exit_code'} ) {
- $res{'message'} = $err? $err : "gpg exitted with error code ". ($res{'exit_code'} >> 8);
- }
- return %res;
+ },
+ );
}
sub ImportKey {
+ my $self = shift;
my $key = shift;
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- meta_interactive => 0,
+ return CallGnuPG(
+ Command => "import_keys",
+ Content => $key,
);
-
- my ($handles, $handle_list) = _make_gpg_handles();
- my %handle = %$handle_list;
-
- eval {
- local $SIG{'CHLD'} = 'DEFAULT';
- my $pid = safe_run_child { $gnupg->wrap_call(
- handles => $handles,
- commands => ['--import'],
- ) };
- print { $handle{'stdin'} } $key;
- close $handle{'stdin'};
- waitpid $pid, 0;
- };
- my $err = $@;
- close $handle{'stdout'};
-
- my %res;
- $res{'exit_code'} = $?;
- foreach ( qw(stderr logger status) ) {
- $res{$_} = do { local $/; readline $handle{$_} };
- delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
- close $handle{$_};
- }
- $RT::Logger->debug( $res{'status'} ) if $res{'status'};
- $RT::Logger->warning( $res{'stderr'} ) if $res{'stderr'};
- $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
- if ( $err || $res{'exit_code'} ) {
- $res{'message'} = $err? $err : "gpg exitted with error code ". ($res{'exit_code'} >> 8);
- }
- return %res;
}
-=head2 KEY
+=head2 DrySign Signer => KEY
Signs a small message with the key, to make sure the key exists and
-we have a useable passphrase. The first argument MUST be a key identifier
+we have a useable passphrase. The Signer argument MUST be a key identifier
of the signer: either email address, key id or finger print.
Returns a true value if all went well.
@@@ -2329,14 -2041,11 +1955,12 @@@ properly (and false otherwise)
sub Probe {
+ my $self = shift;
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
+ my $gnupg = GnuPG::Interface->new;
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
- armor => 1,
- meta_interactive => 0,
+ _PrepareGnuPGOptions( RT->Config->Get('GnuPGOptions') )
);
+ $gnupg->options->meta_interactive( 0 );
my ($handles, $handle_list) = _make_gpg_handles();
my %handle = %$handle_list;
diff --cc lib/RT/Test.pm
index 073be16,3ccd017..4ac4fb2c
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@@ -1250,103 -1171,32 +1213,65 @@@ sub trust_gnupg_key
my $self = shift;
my $key = shift;
- require RT::Crypt::GnuPG; require GnuPG::Interface;
- my $gnupg = GnuPG::Interface->new();
- my %opt = RT->Config->Get('GnuPGOptions');
- $gnupg->options->hash_init(
- RT::Crypt::GnuPG::_PrepareGnuPGOptions( %opt ),
- meta_interactive => 0,
- );
-
- my %handle;
- my $handles = GnuPG::Handles->new(
- stdin => ($handle{'input'} = IO::Handle->new()),
- stdout => ($handle{'output'} = IO::Handle->new()),
- stderr => ($handle{'error'} = IO::Handle->new()),
- logger => ($handle{'logger'} = IO::Handle->new()),
- status => ($handle{'status'} = IO::Handle->new()),
- command => ($handle{'command'} = IO::Handle->new()),
- );
+ require RT::Crypt::GnuPG;
- eval {
- local $SIG{'CHLD'} = 'DEFAULT';
- local @ENV{'LANG', 'LC_ALL'} = ('C', 'C');
- my $pid = $gnupg->wrap_call(
- handles => $handles,
- commands => ['--edit-key'],
- command_args => [$key],
- );
- close $handle{'input'};
-
- my $done = 0;
- while ( my $str = readline $handle{'status'} ) {
- if ( $str =~ /^\[GNUPG:\]\s*\QGET_LINE keyedit.prompt/ ) {
- if ( $done ) {
- print { $handle{'command'} } "quit\n";
- } else {
- print { $handle{'command'} } "trust\n";
+ return RT::Crypt::GnuPG::CallGnuPG(
+ Command => '--edit-key',
+ CommandArgs => [$key],
+ Callback => sub {
+ my %handle = @_;
+ my $done = 0;
+ while ( my $str = readline $handle{'status'} ) {
+ if ( $str =~ /^\[GNUPG:\]\s*\QGET_LINE keyedit.prompt/ ) {
+ if ( $done ) {
+ print { $handle{'command'} } "quit\n";
+ } else {
+ print { $handle{'command'} } "trust\n";
+ }
+ } elsif ( $str =~ /^\[GNUPG:\]\s*\QGET_LINE edit_ownertrust.value/ ) {
+ print { $handle{'command'} } "5\n";
+ } elsif ( $str =~ /^\[GNUPG:\]\s*\QGET_BOOL edit_ownertrust.set_ultimate.okay/ ) {
+ print { $handle{'command'} } "y\n";
+ $done = 1;
}
- } elsif ( $str =~ /^\[GNUPG:\]\s*\QGET_LINE edit_ownertrust.value/ ) {
- print { $handle{'command'} } "5\n";
- } elsif ( $str =~ /^\[GNUPG:\]\s*\QGET_BOOL edit_ownertrust.set_ultimate.okay/ ) {
- print { $handle{'command'} } "y\n";
- $done = 1;
}
- }
- waitpid $pid, 0;
- };
- my $err = $@;
- close $handle{'output'};
-
- my %res;
- $res{'exit_code'} = $?;
- foreach ( qw(error logger status) ) {
- $res{$_} = do { local $/; readline $handle{$_} };
- delete $res{$_} unless $res{$_} && $res{$_} =~ /\S/s;
- close $handle{$_};
- }
- $RT::Logger->debug( $res{'status'} ) if $res{'status'};
- $RT::Logger->warning( $res{'error'} ) if $res{'error'};
- $RT::Logger->error( $res{'logger'} ) if $res{'logger'} && $?;
- if ( $err || $res{'exit_code'} ) {
- $res{'message'} = $err? $err : "gpg exitted with error code ". ($res{'exit_code'} >> 8);
- }
- return %res;
+ },
+ );
}
+sub import_smime_key {
+ my $self = shift;
+ my $key = shift;
+ my $user = shift;
+
+ my $path = find_relocatable_path( 'data', 'smime', 'keys' );
+ die "can't find the dir where smime keys are stored"
+ unless $path;
+
+ $key .= ".pem" unless $key =~ /\.(pem|crt|key)$/;
+
+ my $content = RT::Test->file_content( [ $path, $key ] );
+
+ if ( $user ) {
+ my ($status, $msg) = $user->AddCustomFieldValue(
+ Field => 'SMIME Key',
+ Value => $content,
+ );
+ die "Couldn't set CF: $msg" unless $status;
+ } else {
+ my $keyring = RT->Config->Get('SMIME')->{'Keyring'};
+ die "SMIME keyring '$keyring' doesn't exist"
+ unless $keyring && -e $keyring;
+
+ open my $fh, '>:raw', File::Spec->catfile($keyring, $key)
+ or die "can't open file: $!";
+ print $fh $content;
+ close $fh;
+ }
+
+ return;
+}
+
sub started_ok {
my $self = shift;
commit b6b53aa58ee545eb638aed7c39807aabdf8b49d9
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Sep 28 13:24:23 2012 -0400
Adapt merged 4.2/gnupg-refactor for changes on the branch
UseKeyForEncryption was elevated into RT::Crypt and all of the
subroutines became methods, so we need $self in CallGnuPG
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 398110f..e6b74ea 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -364,6 +364,7 @@ our $RE_FILE_EXTENSIONS = qr/pgp|asc/i;
=cut
sub CallGnuPG {
+ my $self = shift;
my %args = (
Options => undef,
Signer => undef,
@@ -406,13 +407,13 @@ sub CallGnuPG {
my %seen;
$gnupg->options->push_recipients( $_ ) for
- map { UseKeyForEncryption($_) || $_ }
+ map { RT::Crypt->UseKeyForEncryption($_) || $_ }
grep { !$seen{ $_ }++ }
@{ $args{Recipients} || [] };
$args{Passphrase} = $GnuPGOptions{passphrase}
unless defined $args{'Passphrase'};
- $args{Passphrase} = GetPassphrase( Address => $args{Signer} )
+ $args{Passphrase} = $self->GetPassphrase( Address => $args{Signer} )
unless defined $args{'Passphrase'};
$gnupg->passphrase( $args{'Passphrase'} )
if defined $args{Passphrase};
@@ -557,7 +558,7 @@ sub SignEncryptRFC3156 {
my @signature;
# We use RT::Crypt::GnuPG::CRLFHandle to canonicalize the
# MIME::Entity output to use \r\n instead of \n for its newlines
- %res = CallGnuPG(
+ %res = $self->CallGnuPG(
Signer => $args{'Signer'},
Command => "detach_sign",
Handles => { stdin => RT::Crypt::GnuPG::CRLFHandle->new },
@@ -590,7 +591,7 @@ sub SignEncryptRFC3156 {
binmode $tmp_fh, ':raw';
$entity->make_multipart( 'mixed', Force => 1 );
- %res = CallGnuPG(
+ %res = $self->CallGnuPG(
Signer => $args{'Signer'},
Recipients => \@recipients,
Command => ( $args{'Sign'} ? "sign_and_encrypt" : "encrypt" ),
@@ -664,7 +665,7 @@ sub _SignEncryptTextInline {
binmode $tmp_fh, ':raw';
my $entity = $args{'Entity'};
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Command => ( $args{'Sign'} && $args{'Encrypt'}
@@ -705,7 +706,7 @@ sub _SignEncryptAttachmentInline {
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Command => ( $args{'Sign'} && $args{'Encrypt'}
@@ -759,7 +760,7 @@ sub SignEncryptContent {
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Signer => $args{'Signer'},
Recipients => $args{'Recipients'},
Command => ( $args{'Sign'} && $args{'Encrypt'}
@@ -1073,7 +1074,7 @@ sub VerifyAttachment {
$args{'Data'}->bodyhandle->print( $tmp_fh );
$tmp_fh->flush;
- return CallGnuPG(
+ return $self->CallGnuPG(
Command => "verify",
CommandArgs => [ '-', $tmp_fn ],
Passphrase => $args{'Passphrase'},
@@ -1090,7 +1091,7 @@ sub VerifyRFC3156 {
$args{'Data'}->print( $tmp_fh );
$tmp_fh->flush;
- return CallGnuPG(
+ return $self->CallGnuPG(
Command => "verify",
CommandArgs => [ '-', $tmp_fn ],
Passphrase => $args{'Passphrase'},
@@ -1116,7 +1117,7 @@ sub DecryptRFC3156 {
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Command => "decrypt",
Handles => { stdout => $tmp_fh },
Passphrase => $args{'Passphrase'},
@@ -1242,7 +1243,7 @@ sub _DecryptInlineBlock {
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Command => "decrypt",
Handles => { stdout => $tmp_fh, stdin => $args{'BlockHandle'} },
Passphrase => $args{'Passphrase'},
@@ -1313,7 +1314,7 @@ sub DecryptContent {
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( UNLINK => 1 );
binmode $tmp_fh, ':raw';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Command => "decrypt",
Handles => { stdout => $tmp_fh },
Passphrase => $args{'Passphrase'},
@@ -1757,7 +1758,7 @@ sub GetKeysInfo {
my @info;
my $method = $type eq 'private'? 'list_secret_keys': 'list_public_keys';
- my %res = CallGnuPG(
+ my %res = $self->CallGnuPG(
Options => {
'with-colons' => undef, # parseable format
'fingerprint' => undef, # show fingerprint
@@ -1912,7 +1913,7 @@ sub DeleteKey {
my $self = shift;
my $key = shift;
- return CallGnuPG(
+ return $self->CallGnuPG(
Command => "--delete-secret-and-public-key",
CommandArgs => [$key],
Callback => sub {
@@ -1930,7 +1931,7 @@ sub ImportKey {
my $self = shift;
my $key = shift;
- return CallGnuPG(
+ return $self->CallGnuPG(
Command => "import_keys",
Content => $key,
);
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 4ac4fb2c..d056210 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1195,7 +1195,7 @@ sub lsign_gnupg_key {
require RT::Crypt::GnuPG;
- return RT::Crypt::GnuPG::CallGnuPG(
+ return RT::Crypt::GnuPG->CallGnuPG(
Command => '--lsign-key',
CommandArgs => [$key],
Callback => sub {
@@ -1215,7 +1215,7 @@ sub trust_gnupg_key {
require RT::Crypt::GnuPG;
- return RT::Crypt::GnuPG::CallGnuPG(
+ return RT::Crypt::GnuPG->CallGnuPG(
Command => '--edit-key',
CommandArgs => [$key],
Callback => sub {
commit 19c26e9111264d9ce8d1c0203827131f7edc86c3
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Jun 8 16:28:07 2012 -0400
GPG 1.4.12 tweaked the header on the trustdb
Without this, anyone running rt tests on 1.4.12 rather than 1.4.10 would
end up with changes in the test suite. This should be back-compat to
1.4.10.
(cherry picked from commit 41dc5b44091d3c5ccf01c534823a15143a09ba86)
diff --git a/t/data/gnupg/keyrings/trustdb.gpg b/t/data/gnupg/keyrings/trustdb.gpg
index 9f2ae63..331d5dd 100644
Binary files a/t/data/gnupg/keyrings/trustdb.gpg and b/t/data/gnupg/keyrings/trustdb.gpg differ
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list