[Rt-commit] r10523 - in rt/branches/3.999-DANGEROUS: . html/Admin/Elements html/Admin/Users html/Elements/GnuPG html/Elements/RT__Model__Ticket html/Ticket/Elements lib/RT lib/RT/Crypt lib/RT/Interface lib/RT/Interface/Email/Auth lib/RT/Interface/Web lib/RT/Model t/mail
jesse at bestpractical.com
jesse at bestpractical.com
Sun Jan 27 22:32:46 EST 2008
Author: jesse
Date: Sun Jan 27 22:32:46 2008
New Revision: 10523
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/html/Admin/Elements/ShowKeyInfo
rt/branches/3.999-DANGEROUS/html/Admin/Users/GnuPG.html
rt/branches/3.999-DANGEROUS/html/Elements/GnuPG/SignEncryptWidget
rt/branches/3.999-DANGEROUS/html/Elements/RT__Model__Ticket/ColumnMap
rt/branches/3.999-DANGEROUS/html/Ticket/Elements/ShowGnuPGStatus
rt/branches/3.999-DANGEROUS/lib/RT/Crypt/GnuPG.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/GnuPG.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Handler.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
rt/branches/3.999-DANGEROUS/lib/RT/Test.pm
rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t
rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t
rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t
Log:
r75775 at pinglin: jesse | 2008-01-27 22:31:36 -0500
more lower-casification
Modified: rt/branches/3.999-DANGEROUS/html/Admin/Elements/ShowKeyInfo
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Admin/Elements/ShowKeyInfo (original)
+++ rt/branches/3.999-DANGEROUS/html/Admin/Elements/ShowKeyInfo Sun Jan 27 22:32:46 2008
@@ -79,7 +79,7 @@
</%ARGS>
<%INIT>
require RT::Crypt::GnuPG;
-my %res = RT::Crypt::GnuPG::GetKeyInfo( $email, $Type );
+my %res = RT::Crypt::GnuPG::get_key_info( $email, $Type );
my $title;
unless ( $Type eq 'private' ) {
Modified: rt/branches/3.999-DANGEROUS/html/Admin/Users/GnuPG.html
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Admin/Users/GnuPG.html (original)
+++ rt/branches/3.999-DANGEROUS/html/Admin/Users/GnuPG.html Sun Jan 27 22:32:46 2008
@@ -47,7 +47,7 @@
$id = $ARGS{'id'} = $user_object->id;
my $email = $user_object->email;
-my %keys_meta = RT::Crypt::GnuPG::GetKeysForSigning( $email, 'force' );
+my %keys_meta = RT::Crypt::GnuPG::get_keys_for_signing( $email, 'force' );
$ARGS{'private_key'} = $m->comp('/Widgets/Form/Select:Process',
name => 'private_key',
Modified: rt/branches/3.999-DANGEROUS/html/Elements/GnuPG/SignEncryptWidget
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Elements/GnuPG/SignEncryptWidget (original)
+++ rt/branches/3.999-DANGEROUS/html/Elements/GnuPG/SignEncryptWidget Sun Jan 27 22:32:46 2008
@@ -82,11 +82,11 @@
? ( $queue_obj->comment_address || RT->Config->Get('comment_address') )
: ( $queue_obj->correspond_address || RT->Config->Get('correspond_address') );
- unless ( RT::Crypt::GnuPG::DrySign( $address ) ) {
+ unless ( RT::Crypt::GnuPG::dry_sign( $address ) ) {
push @{ $self->{'GnuPGCanNotSignAs'} ||= [] }, $address;
$checks_failure = 1;
} else {
- RT::Crypt::GnuPG::UseKeyForSigning( $self->{'SignUsing'} )
+ RT::Crypt::GnuPG::use_key_for_signing( $self->{'SignUsing'} )
if $self->{'SignUsing'};
}
}
@@ -121,13 +121,13 @@
my %seen;
@recipients = grep !$seen{ lc $_ }++, @recipients;
- RT::Crypt::GnuPG::UseKeyForEncryption(
+ RT::Crypt::GnuPG::use_key_for_encryption(
map { (/^UseKey-(.*)$/)[0] => $self->{ $_ } }
grep $self->{ $_ } && /^UseKey-/,
keys %$self
);
- my ($status, @issues) = RT::Crypt::GnuPG::CheckRecipients( @recipients );
+ my ($status, @issues) = RT::Crypt::GnuPG::check_recipients( @recipients );
push @{ $self->{'GnuPGRecipientsKeyIssues'} ||= [] }, @issues;
$checks_failure = 1 unless $status;
}
Modified: rt/branches/3.999-DANGEROUS/html/Elements/RT__Model__Ticket/ColumnMap
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Elements/RT__Model__Ticket/ColumnMap (original)
+++ rt/branches/3.999-DANGEROUS/html/Elements/RT__Model__Ticket/ColumnMap Sun Jan 27 22:32:46 2008
@@ -233,7 +233,7 @@
my @requestors = $t->Requestors->member_emails;
for my $email (@requestors)
{
- my %key = RT::Crypt::GnuPG::GetKeyInfo($email);
+ my %key = RT::Crypt::GnuPG::get_key_info($email);
if (!defined $key{'info'}) {
$email .= _(" (no pubkey!)");
}
@@ -250,7 +250,7 @@
value => sub {
my $t = shift;
my $name = $t->OwnerObj->name;
- my %key = RT::Crypt::GnuPG::GetKeyInfo($t->OwnerObj->email);
+ my %key = RT::Crypt::GnuPG::get_key_info($t->OwnerObj->email);
if (!defined $key{'info'}) {
$name .= _(" (no pubkey!)");
}
Modified: rt/branches/3.999-DANGEROUS/html/Ticket/Elements/ShowGnuPGStatus
==============================================================================
--- rt/branches/3.999-DANGEROUS/html/Ticket/Elements/ShowGnuPGStatus (original)
+++ rt/branches/3.999-DANGEROUS/html/Ticket/Elements/ShowGnuPGStatus Sun Jan 27 22:32:46 2008
@@ -65,7 +65,7 @@
foreach ( $Attachment->split_headers ) {
if ( s/^X-RT-GnuPG-Status:\s*//i ) {
require RT::Crypt::GnuPG;
- push @runs, [ RT::Crypt::GnuPG::ParseStatus( $_ ) ];
+ push @runs, [ RT::Crypt::GnuPG::parse_status( $_ ) ];
}
$needs_unsigned_warning = 0 if /^X-RT-Incoming-Signature:/;
@@ -104,7 +104,7 @@
}
use RT::Interface::Email::Auth::GnuPG;
- my ($status, @res) = RT::Interface::Email::Auth::GnuPG::VerifyDecrypt( Entity => $entity );
+ my ($status, @res) = RT::Interface::Email::Auth::GnuPG::verify_decrypt( Entity => $entity );
if ( $status && !@res ) {
# imposible in this situation
return (0, "Content of attachment #". $original->id ." is not signed and/or encrypted");
@@ -117,7 +117,7 @@
$top->set_header('X-RT-Privacy' => 'PGP' );
$top->del_header('X-RT-Incoming-Signature');
- my @status = RT::Crypt::GnuPG::ParseStatus( $res[0]->{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res[0]->{'status'} );
for ( @status ) {
if ( $_->{'Operation'} eq 'Verify' && $_->{'Status'} eq 'DONE' ) {
$top->add_header( 'X-RT-Incoming-Signature' => $_->{'UserString'} );
@@ -137,7 +137,7 @@
next unless $line->{'KeyType'} eq 'public' && $line->{'Status'} eq 'MISSING';
# but only if we have key
- my %key = RT::Crypt::GnuPG::GetPublicKeyInfo( $line->{'Key'} );
+ my %key = RT::Crypt::GnuPG::get_public_key_info( $line->{'Key'} );
if ( $key{'info'} ) {
my ($status, $msg) = $reverify_cb->($Attachment);
unless ($status) {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Crypt/GnuPG.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Crypt/GnuPG.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Crypt/GnuPG.pm Sun Jan 27 22:32:46 2008
@@ -383,7 +383,7 @@
return shift->();
}
-=head2 SignEncrypt Entity => MIME::Entity, [ Encrypt => 1, Sign => 1, ... ]
+=head2 sign_encrypt Entity => MIME::Entity, [ Encrypt => 1, Sign => 1, ... ]
Signs and/or encrypts an email message with GnuPG utility.
@@ -395,7 +395,7 @@
overrides gnupg's C<default-key> option. If C<Signer> argument is not provided
then address of a message sender is used.
-As well you can pass C<Passphrase>, but if value is undefined then L</GetPassphrase>
+As well you can pass C<Passphrase>, but if value is undefined then L</get_passphrase>
called to get it.
=item Encrypting
@@ -415,12 +415,12 @@
=cut
-sub SignEncrypt {
+sub sign_encrypt {
my %args = (@_);
my $entity = $args{'Entity'};
if ( $args{'Sign'} && !defined $args{'Signer'} ) {
- $args{'Signer'} = UseKeyForSigning()
+ $args{'Signer'} = use_key_for_signing()
|| (Mail::Address->parse( $entity->head->get( 'From' ) ))[0]->address;
}
if ( $args{'Encrypt'} && !$args{'Recipients'} ) {
@@ -434,13 +434,13 @@
my $format = lc RT->Config->Get('GnuPG')->{'OutgoingMessagesFormat'} || 'RFC';
if ( $format eq 'inline' ) {
- return SignEncryptInline( %args );
+ return sign_encrypt_inline( %args );
} else {
- return SignEncryptRFC3156( %args );
+ return sign_encrypt_rfc3156( %args );
}
}
-sub SignEncryptRFC3156 {
+sub sign_encrypt_rfc3156 {
my %args = (
Entity => undef,
@@ -460,7 +460,7 @@
$opt{'default_key'} = $args{'Signer'}
if $args{'Sign'} && $args{'Signer'};
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
armor => 1,
meta_interactive => 0,
);
@@ -472,7 +472,7 @@
if !defined $args{'Passphrase'};
if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
- $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+ $args{'Passphrase'} = get_passphrase( Address => $args{'Signer'} );
}
my %res;
@@ -531,7 +531,7 @@
if ( $args{'Encrypt'} ) {
my %seen;
$gnupg->options->push_recipients( $_ ) foreach
- map UseKeyForEncryption($_) || $_,
+ map use_key_for_encryption($_) || $_,
grep !$seen{ $_ }++, map $_->address,
map Mail::Address->parse( $entity->head->get( $_ ) ),
qw(To Cc Bcc);
@@ -597,7 +597,7 @@
return %res;
}
-sub SignEncryptInline {
+sub sign_encrypt_inline {
my %args = ( @_ );
my $entity = $args{'Entity'};
@@ -606,19 +606,19 @@
$entity->make_singlepart;
if ( $entity->is_multipart ) {
foreach ( $entity->parts ) {
- %res = SignEncryptInline( @_, Entity => $_ );
+ %res = sign_encrypt_inline( @_, Entity => $_ );
return %res if $res{'exit_code'};
}
return %res;
}
- return _SignEncryptTextInline( @_ )
+ return _sign_encrypt_text_inline( @_ )
if $entity->effective_type =~ /^text\//i;
- return _SignEncryptAttachmentInline( @_ );
+ return _sign_encryptAttachmentInline( @_ );
}
-sub _SignEncryptTextInline {
+sub _sign_encrypt_text_inline {
my %args = (
Entity => undef,
@@ -639,7 +639,7 @@
$opt{'default_key'} = $args{'Signer'}
if $args{'Sign'} && $args{'Signer'};
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
armor => 1,
meta_interactive => 0,
);
@@ -649,12 +649,12 @@
if !defined($args{'Passphrase'});
if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
- $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+ $args{'Passphrase'} = get_passphrase( Address => $args{'Signer'} );
}
if ( $args{'Encrypt'} ) {
$gnupg->options->push_recipients( $_ ) foreach
- map UseKeyForEncryption($_) || $_,
+ map use_key_for_encryption($_) || $_,
@{ $args{'Recipients'} || [] };
}
@@ -707,7 +707,7 @@
return %res;
}
-sub _SignEncryptAttachmentInline {
+sub _sign_encryptAttachmentInline {
my %args = (
Entity => undef,
@@ -728,7 +728,7 @@
$opt{'default_key'} = $args{'Signer'}
if $args{'Sign'} && $args{'Signer'};
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
armor => 1,
meta_interactive => 0,
);
@@ -738,13 +738,13 @@
if !defined($args{'Passphrase'});
if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
- $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+ $args{'Passphrase'} = get_passphrase( Address => $args{'Signer'} );
}
my $entity = $args{'Entity'};
if ( $args{'Encrypt'} ) {
$gnupg->options->push_recipients( $_ ) foreach
- map UseKeyForEncryption($_) || $_,
+ map use_key_for_encryption($_) || $_,
@{ $args{'Recipients'} || [] };
}
@@ -811,7 +811,7 @@
return %res;
}
-sub SignEncryptContent {
+sub sign_encrypt_content {
my %args = (
Content => undef,
@@ -832,7 +832,7 @@
$opt{'default_key'} = $args{'Signer'}
if $args{'Sign'} && $args{'Signer'};
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
armor => 1,
meta_interactive => 0,
);
@@ -842,12 +842,12 @@
if !defined($args{'Passphrase'});
if ( $args{'Sign'} && !defined $args{'Passphrase'} ) {
- $args{'Passphrase'} = GetPassphrase( Address => $args{'Signer'} );
+ $args{'Passphrase'} = get_passphrase( Address => $args{'Signer'} );
}
if ( $args{'Encrypt'} ) {
$gnupg->options->push_recipients( $_ ) foreach
- map UseKeyForEncryption($_) || $_,
+ map use_key_for_encryption($_) || $_,
@{ $args{'Recipients'} || [] };
}
@@ -908,7 +908,7 @@
return %res;
}
-sub FindProtectedParts {
+sub find_protected_parts {
my %args = ( Entity => undef, CheckBody => 1, @_ );
my $entity = $args{'Entity'};
@@ -1026,32 +1026,32 @@
};
}
- push @res, FindProtectedParts( Entity => $_ )
+ push @res, find_protected_parts( Entity => $_ )
foreach grep !$skip{"$_"}, $entity->parts;
return @res;
}
-=head2 VerifyDecrypt Entity => undef, [ Detach => 1, Passphrase => undef ]
+=head2 verify_decrypt Entity => undef, [ Detach => 1, Passphrase => undef ]
=cut
-sub VerifyDecrypt {
+sub verify_decrypt {
my %args = ( Entity => undef, Detach => 1, @_ );
- my @protected = FindProtectedParts( Entity => $args{'Entity'} );
+ my @protected = find_protected_parts( Entity => $args{'Entity'} );
my @res;
# XXX: detaching may brake nested signatures
foreach my $item( grep $_->{'Type'} eq 'signed', @protected ) {
if ( $item->{'Format'} eq 'RFC3156' ) {
- push @res, { VerifyRFC3156( %$item ) };
+ push @res, { verify_rfc3156( %$item ) };
if ( $args{'Detach'} ) {
$item->{'Top'}->parts( [ $item->{'Data'} ] );
$item->{'Top'}->make_singlepart;
}
} elsif ( $item->{'Format'} eq 'Inline' ) {
- push @res, { VerifyInline( %$item ) };
+ push @res, { verify_inline( %$item ) };
} elsif ( $item->{'Format'} eq 'Attachment' ) {
- push @res, { VerifyAttachment( %$item ) };
+ push @res, { verify_attachment( %$item ) };
if ( $args{'Detach'} ) {
$item->{'Top'}->parts( [ grep "$_" ne $item->{'Signature'}, $item->{'Top'}->parts ] );
$item->{'Top'}->make_singlepart;
@@ -1060,11 +1060,11 @@
}
foreach my $item( grep $_->{'Type'} eq 'encrypted', @protected ) {
if ( $item->{'Format'} eq 'RFC3156' ) {
- push @res, { DecryptRFC3156( %$item ) };
+ push @res, { decrypt_rfc3156( %$item ) };
} elsif ( $item->{'Format'} eq 'Inline' ) {
- push @res, { DecryptInline( %$item ) };
+ push @res, { decrypt_inline( %$item ) };
} elsif ( $item->{'Format'} eq 'Attachment' ) {
- push @res, { DecryptAttachment( %$item ) };
+ push @res, { decrypt_attachment( %$item ) };
# if ( $args{'Detach'} ) {
# $item->{'Top'}->parts( [ grep "$_" ne $item->{'Signature'}, $item->{'Top'}->parts ] );
# $item->{'Top'}->make_singlepart;
@@ -1074,19 +1074,19 @@
return @res;
}
-sub VerifyInline {
+sub verify_inline {
my %args = ( Data => undef, Top => undef, @_ );
- return DecryptInline( %args );
+ return decrypt_inline( %args );
}
-sub VerifyAttachment {
+sub verify_attachment {
my %args = ( Data => undef, Signature => undef, Top => undef, @_ );
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -1128,14 +1128,14 @@
return %res;
}
-sub VerifyRFC3156 {
+sub verify_rfc3156 {
my %args = ( Data => undef, Signature => undef, Top => undef, @_ );
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -1177,7 +1177,7 @@
return %res;
}
-sub DecryptRFC3156 {
+sub decrypt_rfc3156 {
my %args = (
Data => undef,
Info => undef,
@@ -1190,7 +1190,7 @@
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -1203,7 +1203,7 @@
$args{'Passphrase'} = delete $opt{'passphrase'}
if !defined($args{'Passphrase'});
- $args{'Passphrase'} = GetPassphrase()
+ $args{'Passphrase'} = get_passphrase()
unless defined $args{'Passphrase'};
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile();
@@ -1260,7 +1260,7 @@
return %res;
}
-sub DecryptInline {
+sub decrypt_inline {
my %args = (
Data => undef,
Passphrase => undef,
@@ -1271,7 +1271,7 @@
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -1284,7 +1284,7 @@
$args{'Passphrase'} = delete $opt{'passphrase'}
if !defined($args{'Passphrase'});
- $args{'Passphrase'} = GetPassphrase()
+ $args{'Passphrase'} = get_passphrase()
unless defined $args{'Passphrase'};
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile();
@@ -1336,14 +1336,14 @@
return %res;
}
-sub DecryptAttachment {
+sub decrypt_attachment {
my %args = (
Top => undef,
Data => undef,
Passphrase => undef,
@_
);
- my %res = DecryptInline( %args );
+ my %res = decrypt_inline( %args );
return %res if $res{'exit_code'};
my $filename = $args{'Data'}->head->recommended_filename;
@@ -1354,7 +1354,7 @@
return %res;
}
-sub DecryptContent {
+sub decrypt_content {
my %args = (
Content => undef,
Passphrase => undef,
@@ -1365,7 +1365,7 @@
my %opt = RT->Config->Get('GnuPGOptions');
$opt{'digest-algo'} ||= 'SHA1';
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -1373,7 +1373,7 @@
$args{'Passphrase'} = delete $opt{'passphrase'}
if !defined($args{'Passphrase'});
- $args{'Passphrase'} = GetPassphrase()
+ $args{'Passphrase'} = get_passphrase()
unless defined $args{'Passphrase'};
my ($tmp_fh, $tmp_fn) = File::Temp::tempfile();
@@ -1434,18 +1434,18 @@
return %res;
}
-=head2 GetPassphrase [ Address => undef ]
+=head2 get_passphrase [ Address => undef ]
Returns passphrase, called whenever it's required with Address as a named argument.
=cut
-sub GetPassphrase {
+sub get_passphrase {
my %args = ( Address => undef, @_ );
return 'test';
}
-=head2 ParseStatus
+=head2 parse_status
Takes a string containing output of gnupg status stream. Parses it and returns
array of hashes. Each element of array is a hash ref and represents line or
@@ -1504,7 +1504,7 @@
},
);
-sub ReasonCodeToText {
+sub reason_code_to_text {
my $keyword = shift;
my $code = shift;
return $REASON_CODE_TO_TEXT{ $keyword }{ $code }
@@ -1550,7 +1550,7 @@
TRUST_UNDEFINED TRUST_NEVER TRUST_MARGINAL TRUST_FULLY TRUST_ULTIMATE
);
-sub ParseStatus {
+sub parse_status {
my $status = shift;
return () unless $status;
@@ -1577,7 +1577,7 @@
}
if ( $keyword eq 'USERID_HINT' ) {
- my %tmp = _ParseUserHint($status, $line);
+ my %tmp = _parse_user_hint($status, $line);
$latest_user_main_key = $tmp{'MainKey'};
if ( $user_hint{ $tmp{'MainKey'} } ) {
while ( my ($k, $v) = each %tmp ) {
@@ -1716,7 +1716,7 @@
@res{qw(Key PubkeyAlgo HashAlgo Class Timestamp ReasonCode Other)}
= split /\s+/, $args, 7;
- $res{'Reason'} = ReasonCodeToText( $keyword, $res{'ReasonCode'} );
+ $res{'Reason'} = reason_code_to_text( $keyword, $res{'ReasonCode'} );
$res{'Message'} .= ", the reason is ". $res{'Reason'};
push @res, \%res;
@@ -1741,7 +1741,7 @@
}
elsif ( $keyword eq 'INV_RECP' ) {
my ($rcode, $recipient) = split /\s+/, $args, 2;
- my $reason = ReasonCodeToText( $keyword, $rcode );
+ my $reason = reason_code_to_text( $keyword, $rcode );
push @res, {
Operation => 'RecipientsCheck',
Status => 'ERROR',
@@ -1753,7 +1753,7 @@
}
elsif ( $keyword eq 'NODATA' ) {
my $rcode = (split /\s+/, $args)[0];
- my $reason = ReasonCodeToText( $keyword, $rcode );
+ my $reason = reason_code_to_text( $keyword, $rcode );
push @res, {
Operation => 'Data',
Status => 'ERROR',
@@ -1771,7 +1771,7 @@
return @res;
}
-sub _ParseUserHint {
+sub _parse_user_hint {
my ($status, $hint) = (@_);
my ($main_key_id, $user_str) = ($hint =~ /^USERID_HINT\s+(\S+)\s+(.*)$/);
return () unless $main_key_id;
@@ -1782,7 +1782,7 @@
);
}
-sub _PrepareGnuPGOptions {
+sub _prepare_gnupg_options {
my %opt = @_;
my %res = map { lc $_ => $opt{ $_ } } grep $supported_opt{ lc $_ }, keys %opt;
$res{'extra_args'} ||= [];
@@ -1798,7 +1798,7 @@
# no args -> clear
# one arg -> return preferred key
# many -> set
-sub UseKeyForEncryption {
+sub use_key_for_encryption {
unless ( @_ ) {
%key = ();
} elsif ( @_ > 1 ) {
@@ -1810,7 +1810,7 @@
return ();
} }
-=head2 UseKeyForSigning
+=head2 use_key_for_signing
Returns or sets identifier of the key that should be used for signing.
@@ -1821,7 +1821,7 @@
=cut
{ my $key;
-sub UseKeyForSigning {
+sub use_key_for_signing {
if ( @_ ) {
$key = $_[0];
}
@@ -1839,7 +1839,7 @@
sub get_keys_for_encryption {
my $key_id = shift;
- my %res = GetKeysInfo( $key_id, 'public', @_ );
+ my %res = get_keys_info( $key_id, 'public', @_ );
return %res if $res{'exit_code'};
return %res unless $res{'info'};
@@ -1858,12 +1858,12 @@
return %res;
}
-sub GetKeysForSigning {
+sub get_keys_for_signing {
my $key_id = shift;
- return GetKeysInfo( $key_id, 'private', @_ );
+ return get_keys_info( $key_id, 'private', @_ );
}
-sub CheckRecipients {
+sub check_recipients {
my @recipients = (@_);
my ($status, @issues) = (1, ());
@@ -1880,7 +1880,7 @@
# it's possible that we have no User record with the email
$user = undef unless $user->id;
- if ( my $fpr = UseKeyForEncryption( $address ) ) {
+ if ( my $fpr = use_key_for_encryption( $address ) ) {
if ( $res{'info'} && @{ $res{'info'} } ) {
next if
grep lc $_->{'Fingerprint'} eq lc $fpr,
@@ -1928,21 +1928,21 @@
return ($status, @issues);
}
-sub GetPublicKeyInfo {
- return GetKeyInfo( shift, 'public', @_ );
+sub get_public_key_info {
+ return get_key_info( shift, 'public', @_ );
}
-sub Getprivate_keyInfo {
- return GetKeyInfo( shift, 'private', @_ );
+sub get_private_key_info {
+ return get_key_info( shift, 'private', @_ );
}
-sub GetKeyInfo {
- my %res = GetKeysInfo(@_);
+sub get_key_info {
+ my %res = get_keys_info(@_);
$res{'info'} = $res{'info'}->[0];
return %res;
}
-sub GetKeysInfo {
+sub get_keys_info {
my $email = shift;
my $type = shift || 'public';
my $force = shift;
@@ -1958,7 +1958,7 @@
$opt{'fingerprint'} = undef; # show fingerprint
$opt{'fixed-list-mode'} = undef; # don't merge uid with keys
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
armor => 1,
meta_interactive => 0,
);
@@ -2000,12 +2000,12 @@
return %res;
}
- @info = ParseKeysInfo( @info );
+ @info = parse_keys_info( @info );
$res{'info'} = \@info;
return %res;
}
-sub ParseKeysInfo {
+sub parse_keys_info {
my @lines = @_;
my %gpg_opt = RT->Config->Get('GnuPGOptions');
@@ -2031,15 +2031,15 @@
$always_trust = 1 if exists $gpg_opt{'always-trust'};
$always_trust = 1 if exists $gpg_opt{'trust-model'} && $gpg_opt{'trust-model'} eq 'always';
@info{qw(Trust TrustTerse TrustLevel)} =
- _ConvertTrustChar( $info{'TrustChar'} );
+ _convert_trust_char( $info{'TrustChar'} );
if ( $always_trust && $info{'TrustLevel'} >= 0 ) {
@info{qw(Trust TrustTerse TrustLevel)} =
- _ConvertTrustChar( 'u' );
+ _convert_trust_char( 'u' );
}
@info{qw(OwnerTrust OwnerTrustTerse OwnerTrustLevel)} =
- _ConvertTrustChar( $info{'OwnerTrustChar'} );
- $info{ $_ } = _ParseDate( $info{ $_ } )
+ _convert_trust_char( $info{'OwnerTrustChar'} );
+ $info{ $_ } = _parse_date( $info{ $_ } )
foreach qw(Created Expire);
push @res, \%info;
}
@@ -2051,8 +2051,8 @@
Empty Empty Capabilities Other
) } = split /:/, $line, 12;
@info{qw(OwnerTrust OwnerTrustTerse OwnerTrustLevel)} =
- _ConvertTrustChar( $info{'OwnerTrustChar'} );
- $info{ $_ } = _ParseDate( $info{ $_ } )
+ _convert_trust_char( $info{'OwnerTrustChar'} );
+ $info{ $_ } = _parse_date( $info{ $_ } )
foreach qw(Created Expire);
push @res, \%info;
}
@@ -2060,7 +2060,7 @@
my %info;
@info{ qw(Trust Created Expire String) }
= (split /:/, $line)[0,4,5,8];
- $info{ $_ } = _ParseDate( $info{ $_ } )
+ $info{ $_ } = _parse_date( $info{ $_ } )
foreach qw(Created Expire);
push @{ $res[-1]{'User'} ||= [] }, \%info;
}
@@ -2130,7 +2130,7 @@
],
);
- sub _ConvertTrustChar {
+ sub _convert_trust_char {
my $value = shift;
return @{ $verbose{'-'} } unless $value;
$value = substr $value, 0, 1;
@@ -2138,7 +2138,7 @@
}
}
-sub _ParseDate {
+sub _parse_date {
my $value = shift;
# never
return $value unless $value;
@@ -2154,13 +2154,13 @@
return $obj;
}
-sub DeleteKey {
+sub delete_key {
my $key = shift;
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -2209,13 +2209,13 @@
return %res;
}
-sub ImportKey {
+sub import_key {
my $key = shift;
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$gnupg->options->hash_init(
- _PrepareGnuPGOptions( %opt ),
+ _prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -2269,7 +2269,7 @@
=cut
-sub DrySign {
+sub dry_sign {
my $from = shift;
my $mime = MIME::Entity->build(
@@ -2280,7 +2280,7 @@
Data => ['t'],
);
- my %res = SignEncrypt(
+ my %res = sign_encrypt(
Sign => 1,
Encrypt => 0,
Entity => $mime,
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email.pm Sun Jan 27 22:32:46 2008
@@ -384,7 +384,7 @@
}
}
- my $res = SignEncrypt( %args, %crypt );
+ my $res = sign_encrypt( %args, %crypt );
return $res unless $res > 0;
}
@@ -672,7 +672,7 @@
return (1, $txn->_("Send email successfully"));
}
-=head2 SignEncrypt Entity => undef, Sign => 0, Encrypt => 0
+=head2 sign_encrypt Entity => undef, Sign => 0, Encrypt => 0
Signs and encrypts message using L<RT::Crypt::GnuPG>, but as well
handle errors with users' keys.
@@ -688,7 +688,7 @@
=cut
-sub SignEncrypt {
+sub sign_encrypt {
my %args = (
Entity => undef,
Sign => 0,
@@ -704,10 +704,10 @@
Jifty->log->debug("$msgid Encrypting message") if $args{'Encrypt'};
require RT::Crypt::GnuPG;
- my %res = RT::Crypt::GnuPG::SignEncrypt( %args );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( %args );
return 1 unless $res{'exit_code'};
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
my @bad_recipients;
foreach my $line ( @status ) {
@@ -771,7 +771,7 @@
}
# redo without broken recipients
- %res = RT::Crypt::GnuPG::SignEncrypt( %args );
+ %res = RT::Crypt::GnuPG::sign_encrypt( %args );
return 0 if $res{'exit_code'};
return 1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/GnuPG.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/GnuPG.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Email/Auth/GnuPG.pm Sun Jan 27 22:32:46 2008
@@ -80,7 +80,7 @@
my $msg = $args{'Message'}->dup;
- my ($status, @res) = VerifyDecrypt( Entity => $args{'Message'} );
+ my ($status, @res) = verify_decrypt( Entity => $args{'Message'} );
if ( $status && !@res ) {
$args{'Message'}->head->add(
'X-RT-Incoming-Encryption' => 'Not encrypted'
@@ -113,7 +113,7 @@
# XXX: first entity only for now
if (@res) {
my $decrypted;
- my @status = RT::Crypt::GnuPG::ParseStatus( $res[0]->{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res[0]->{'status'} );
for (@status) {
if ( $_->{Operation} eq 'Decrypt' && $_->{Status} eq 'DONE' ) {
$decrypted = 1;
@@ -144,7 +144,7 @@
my %sent_once = ();
foreach my $run ( @{ $args{'Result'} } ) {
- my @status = RT::Crypt::GnuPG::ParseStatus( $run->{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $run->{'status'} );
unless ( $sent_once{'Noprivate_key'} ) {
unless ( CheckNoprivate_key( Message => $args{'Message'}, Status => \@status ) ) {
$sent_once{'Noprivate_key'}++;
@@ -218,13 +218,13 @@
return 0;
}
-sub VerifyDecrypt {
+sub verify_decrypt {
my %args = (
Entity => undef,
@_
);
- my @res = RT::Crypt::GnuPG::VerifyDecrypt( %args );
+ my @res = RT::Crypt::GnuPG::verify_decrypt( %args );
unless ( @res ) {
Jifty->log->debug("No more encrypted/signed parts");
return 1;
@@ -239,7 +239,7 @@
}
# nesting
- my ($status, @nested) = VerifyDecrypt( %args );
+ my ($status, @nested) = verify_decrypt( %args );
return $status, @res, @nested;
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Handler.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Handler.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Handler.pm Sun Jan 27 22:32:46 2008
@@ -212,8 +212,8 @@
if (RT->Config->Get('GnuPG')->{'Enable'}) {
require RT::Crypt::GnuPG;
- RT::Crypt::GnuPG::UseKeyForEncryption();
- RT::Crypt::GnuPG::UseKeyForSigning( undef );
+ RT::Crypt::GnuPG::use_key_for_encryption();
+ RT::Crypt::GnuPG::use_key_for_signing( undef );
}
}
# }}}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Attachment.pm Sun Jan 27 22:32:46 2008
@@ -599,7 +599,7 @@
RT->Config->Get('CorrespondAddress'),
RT->Config->Get('CommentAddress'),
) {
- my %res = RT::Crypt::GnuPG::GetKeysInfo( $address, 'private' );
+ my %res = RT::Crypt::GnuPG::get_keys_info( $address, 'private' );
next if $res{'exit_code'} || !$res{'info'};
%res = RT::Crypt::GnuPG::get_keys_for_encryption( $address );
next if $res{'exit_code'} || !$res{'info'};
@@ -613,7 +613,7 @@
$self->set_header( 'Content-Type' => $type );
my $content = $self->Content;
- my %res = RT::Crypt::GnuPG::SignEncryptContent(
+ my %res = RT::Crypt::GnuPG::sign_encrypt_content(
Content => \$content,
Sign => 0,
Encrypt => 1,
@@ -653,7 +653,7 @@
$self->set_header( 'Content-Type' => $type );
my $content = $self->Content;
- my %res = RT::Crypt::GnuPG::DecryptContent( Content => \$content, );
+ my %res = RT::Crypt::GnuPG::decrypt_content( Content => \$content, );
if ( $res{'exit_code'} ) {
return (0, _('GnuPG error. Contact with administrator'));
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm Sun Jan 27 22:32:46 2008
@@ -1347,7 +1347,7 @@
# check that it's really private key
{
- my %tmp = RT::Crypt::GnuPG::GetKeysForSigning( $key );
+ my %tmp = RT::Crypt::GnuPG::get_keys_for_signing( $key );
return (0, _("No such key or it's not suitable for signing"))
if $tmp{'exit_code'} || !$tmp{'info'};
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Test.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Test.pm Sun Jan 27 22:32:46 2008
@@ -331,7 +331,7 @@
$key =~ s/\@/-at-/g;
$key .= ".$type.key";
require RT::Crypt::GnuPG;
- return RT::Crypt::GnuPG::ImportKey(
+ return RT::Crypt::GnuPG::import_key(
RT::Test->file_content([qw(t data gnupg keys), $key])
);
}
@@ -388,7 +388,7 @@
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$gnupg->options->hash_init(
- RT::Crypt::GnuPG::_PrepareGnuPGOptions( %opt ),
+ RT::Crypt::GnuPG::_prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
@@ -445,7 +445,7 @@
my $gnupg = new GnuPG::Interface;
my %opt = RT->Config->Get('GnuPGOptions');
$gnupg->options->hash_init(
- RT::Crypt::GnuPG::_PrepareGnuPGOptions( %opt ),
+ RT::Crypt::GnuPG::_prepare_gnupg_options( %opt ),
meta_interactive => 0,
);
Modified: rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t Sun Jan 27 22:32:46 2008
@@ -34,11 +34,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
ok( $entity, 'signed entity');
ok( !$res{'logger'}, "log is here as well" );
warn $res{'logger'};
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 2, 'two records: passphrase, signing');
is( $status[0]->{'Operation'}, 'PassphraseCheck', 'operation is correct');
is( $status[0]->{'Status'}, 'DONE', 'good passphrase');
@@ -49,15 +49,15 @@
ok( $entity->is_multipart, 'signed message is multipart' );
is( $entity->parts, 2, 'two parts' );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 1, 'one protected part' );
is( $parts[0]->{'Type'}, 'signed', "have signed part" );
is( $parts[0]->{'Format'}, 'RFC3156', "RFC3156 format" );
is( $parts[0]->{'Top'}, $entity, "it's the same entity" );
- my @res = RT::Crypt::GnuPG::VerifyDecrypt( Entity => $entity );
+ my @res = RT::Crypt::GnuPG::verify_decrypt( Entity => $entity );
is scalar @res, 1, 'one operation';
- @status = RT::Crypt::GnuPG::ParseStatus( $res[0]{'status'} );
+ @status = RT::Crypt::GnuPG::parse_status( $res[0]{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Operation'}, 'Verify', 'operation is correct');
is( $status[0]->{'Status'}, 'DONE', 'good passphrase');
@@ -71,12 +71,12 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Encrypt => 0, Passphrase => '' );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Encrypt => 0, Passphrase => '' );
ok( $res{'exit_code'}, "couldn't sign without passphrase");
ok( $res{'error'}, "error is here" );
ok( $res{'logger'}, "log is here as well" );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Operation'}, 'PassphraseCheck', 'operation is correct');
is( $status[0]->{'Status'}, 'MISSING', 'missing passphrase');
@@ -89,12 +89,12 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Encrypt => 0, Passphrase => 'wrong' );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Encrypt => 0, Passphrase => 'wrong' );
ok( $res{'exit_code'}, "couldn't sign with bad passphrase");
ok( $res{'error'}, "error is here" );
ok( $res{'logger'}, "log is here as well" );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Operation'}, 'PassphraseCheck', 'operation is correct');
is( $status[0]->{'Status'}, 'BAD', 'wrong passphrase');
@@ -108,18 +108,18 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, "successful encryption" );
ok( !$res{'logger'}, "no records in logger" );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Operation'}, 'Encrypt', 'operation is correct');
is( $status[0]->{'Status'}, 'DONE', 'done');
ok($entity, 'get an encrypted part');
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 1, 'one protected part' );
is( $parts[0]->{'Type'}, 'encrypted', "have encrypted part" );
is( $parts[0]->{'Format'}, 'RFC3156', "RFC3156 format" );
@@ -134,11 +134,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( $res{'exit_code'}, 'no way to encrypt without keys of recipients');
ok( $res{'logger'}, "errors are in logger" );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Keyword'}, 'INV_RECP', 'invalid recipient');
}
@@ -151,11 +151,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Passphrase => 'test' );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Passphrase => 'test' );
ok( !$res{'exit_code'}, "successful encryption with signing" );
ok( !$res{'logger'}, "no records in logger" );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res{'status'} );
+ my @status = RT::Crypt::GnuPG::parse_status( $res{'status'} );
is( scalar @status, 3, 'three records: passphrase, sign and encrypt');
is( $status[0]->{'Operation'}, 'PassphraseCheck', 'operation is correct');
is( $status[0]->{'Status'}, 'DONE', 'done');
@@ -166,7 +166,7 @@
ok($entity, 'get an encrypted and signed part');
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 1, 'one protected part' );
is( $parts[0]->{'Type'}, 'encrypted', "have encrypted part" );
is( $parts[0]->{'Format'}, 'RFC3156', "RFC3156 format" );
@@ -181,14 +181,14 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, 'successful encryption' );
ok( !$res{'logger'}, "no records in logger" );
- %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
+ %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
ok( !$res{'exit_code'}, 'successful signing' );
ok( !$res{'logger'}, "no records in logger" );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 1, 'one protected part, top most' );
is( $parts[0]->{'Type'}, 'signed', "have signed part" );
is( $parts[0]->{'Format'}, 'RFC3156', "RFC3156 format" );
@@ -203,7 +203,7 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, "success" );
$entity->make_multipart( 'mixed', Force => 1 );
$entity->attach(
@@ -211,7 +211,7 @@
Data => ['-'x76, 'this is mailing list'],
);
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 1, 'one protected part' );
is( $parts[0]->{'Type'}, 'encrypted', "have encrypted part" );
is( $parts[0]->{'Format'}, 'RFC3156', "RFC3156 format" );
@@ -226,11 +226,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, 'success' );
$entity->head->mime_attr( 'Content-Type.protocol' => undef );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 0, 'no protected parts' );
}
@@ -242,11 +242,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, 'success' );
$entity->parts([ $entity->parts(0) ]);
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 0, 'no protected parts' );
}
@@ -258,11 +258,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Sign => 0 );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Sign => 0 );
ok( !$res{'exit_code'}, 'success' );
$entity->head->mime_attr( 'Content-Type.protocol' => 'application/bad-proto' );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 0, 'no protected parts' );
}
@@ -274,11 +274,11 @@
Subject => 'test',
Data => ['test'],
);
- my %res = RT::Crypt::GnuPG::SignEncrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
+ my %res = RT::Crypt::GnuPG::sign_encrypt( Entity => $entity, Encrypt => 0, Passphrase => 'test' );
ok( !$res{'exit_code'}, 'success' );
$entity->head->mime_attr( 'Content-Type.protocol' => 'application/bad-proto' );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 0, 'no protected parts' );
}
@@ -288,7 +288,7 @@
my $parser = new MIME::Parser;
my $entity = $parser->parse( $fh );
- my @parts = RT::Crypt::GnuPG::FindProtectedParts( Entity => $entity );
+ my @parts = RT::Crypt::GnuPG::find_protected_parts( Entity => $entity );
is( scalar @parts, 2, 'two protected parts' );
is( $parts[1]->{'Type'}, 'signed', "have signed part" );
is( $parts[1]->{'Format'}, 'Inline', "inline format" );
@@ -299,8 +299,8 @@
is( $parts[0]->{'Data'}, $entity->parts(1), "data in second part" );
is( $parts[0]->{'Signature'}, $entity->parts(2), "file's signature in third part" );
- my @res = RT::Crypt::GnuPG::VerifyDecrypt( Entity => $entity );
- my @status = RT::Crypt::GnuPG::ParseStatus( $res[0]->{'status'} );
+ my @res = RT::Crypt::GnuPG::verify_decrypt( Entity => $entity );
+ my @status = RT::Crypt::GnuPG::parse_status( $res[0]->{'status'} );
is( scalar @status, 1, 'one record');
is( $status[0]->{'Operation'}, 'Verify', 'operation is correct');
is( $status[0]->{'Status'}, 'DONE', 'good passphrase');
Modified: rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-create.t Sun Jan 27 22:32:46 2008
@@ -65,7 +65,7 @@
{
RT::Test->import_gnupg_key('rt-recipient at example.com');
RT::Test->trust_gnupg_key('rt-recipient at example.com');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-recipient at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-recipient at example.com');
is $res{'info'}[0]{'TrustTerse'}, 'ultimate', 'ultimately trusted key';
}
@@ -99,7 +99,7 @@
my $fpr1 = '';
{
RT::Test->import_gnupg_key('rt-test at example.com', 'public');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
}
@@ -146,7 +146,7 @@
my $fpr2 = '';
{
RT::Test->import_gnupg_key('rt-test at example.com.2', 'public');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
}
@@ -191,7 +191,7 @@
{
RT::Test->lsign_gnupg_key( $fpr1 );
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
ok $res{'info'}[0]{'TrustLevel'} > 0, 'trusted key';
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
}
Modified: rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/gnupg-select-keys-on-update.t Sun Jan 27 22:32:46 2008
@@ -77,7 +77,7 @@
{
RT::Test->import_gnupg_key('rt-recipient at example.com');
RT::Test->trust_gnupg_key('rt-recipient at example.com');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-recipient at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-recipient at example.com');
is $res{'info'}[0]{'TrustTerse'}, 'ultimate', 'ultimately trusted key';
}
@@ -113,7 +113,7 @@
my $fpr1 = '';
{
RT::Test->import_gnupg_key('rt-test at example.com', 'public');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
is $res{'info'}[0]{'TrustLevel'}, 0, 'is not trusted key';
$fpr1 = $res{'info'}[0]{'Fingerprint'};
}
@@ -161,7 +161,7 @@
my $fpr2 = '';
{
RT::Test->import_gnupg_key('rt-test at example.com.2', 'public');
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
$fpr2 = $res{'info'}[2]{'Fingerprint'};
}
@@ -207,7 +207,7 @@
{
RT::Test->lsign_gnupg_key( $fpr1 );
- my %res = RT::Crypt::GnuPG::GetKeysInfo('rt-test at example.com');
+ my %res = RT::Crypt::GnuPG::get_keys_info('rt-test at example.com');
ok $res{'info'}[0]{'TrustLevel'} > 0, 'trusted key';
is $res{'info'}[1]{'TrustLevel'}, 0, 'is not trusted key';
}
More information about the Rt-commit
mailing list