[Rt-commit] rt branch, 4.2/crypt-key-format, created. rt-4.2.3-88-g9805ea6
Alex Vandiver
alexmv at bestpractical.com
Wed Apr 23 17:33:17 EDT 2014
The branch, 4.2/crypt-key-format has been created
at 9805ea67ea1625dca310676e76ec55e2bb0ac464 (commit)
- Log -----------------------------------------------------------------
commit 74b62c59ade5ee5c8256dbb3d3b814eb665156b2
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Apr 23 16:59:30 2014 -0400
Drop the "id" attribute of keys, which we never set
diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index c07cfc8..a607c48 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -1777,11 +1777,11 @@ sub PreferredKey
return undef if @keys == 0;
if (@keys == 1) {
- $prefkey = $keys[0]->{'id'} || $keys[0]->{'Fingerprint'};
+ $prefkey = $keys[0]->{'Fingerprint'};
} else {
# prefer the maximally trusted key
@keys = sort { $b->{'TrustLevel'} <=> $a->{'TrustLevel'} } @keys;
- $prefkey = $keys[0]->{'id'} || $keys[0]->{'Fingerprint'};
+ $prefkey = $keys[0]->{'Fingerprint'};
}
$self->SetAttribute(Name => 'PreferredKey', Content => $prefkey);
diff --git a/share/html/Admin/Elements/ShowKeyInfo b/share/html/Admin/Elements/ShowKeyInfo
index 3915d12..efcd0ed 100644
--- a/share/html/Admin/Elements/ShowKeyInfo
+++ b/share/html/Admin/Elements/ShowKeyInfo
@@ -58,7 +58,7 @@
<tr><th colspan="2"><% loc('No [_1] keys for this address', $protocol) %></th></tr>
% } else {
-<tr><th colspan="2"><% loc("[_1] key '[_2]'", $protocol, $res{'info'}{'id'} || $res{'info'}{'Fingerprint'} ) %></th></tr>
+<tr><th colspan="2"><% loc("[_1] key '[_2]'", $protocol, $res{'info'}{'Fingerprint'} ) %></th></tr>
% if ( $Type ne 'private' && $res{'info'}{'Trust'} ) {
<tr><th class="label"><% loc('Trust') %>:</th> <td><% loc( $res{'info'}{'Trust'} ) %></td></tr>
diff --git a/share/html/Elements/Crypt/SelectKeyForEncryption b/share/html/Elements/Crypt/SelectKeyForEncryption
index 168d7bd..d94adab 100644
--- a/share/html/Elements/Crypt/SelectKeyForEncryption
+++ b/share/html/Elements/Crypt/SelectKeyForEncryption
@@ -50,7 +50,7 @@
% } else {
<select name="<% $Name %>">
% foreach my $key (@keys) {
-<option value="<% $key->{'id'} || $key->{'Fingerprint'} %>"><% $key->{'id'} || $key->{'Fingerprint'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
+<option value="<% $key->{'Fingerprint'} %>"><% $key->{'Fingerprint'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
% }
</select>
% }
@@ -61,7 +61,7 @@ my $d;
my %res = RT::Crypt->GetKeysForEncryption($EmailAddress);
# move the preferred key to the top of the list
my @keys = map {
- ($_->{'id'} || $_->{'Fingerprint'}) eq ( $Default || '' )
+ $_->{'Fingerprint'} eq ( $Default || '' )
? do { $d = $_; () }
: $_
}
commit 9805ea67ea1625dca310676e76ec55e2bb0ac464
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Apr 23 17:01:26 2014 -0400
Provide a user-legible representation of the user's key
Fixes I#25376.
diff --git a/lib/RT/Crypt.pm b/lib/RT/Crypt.pm
index d89cdcd..d01d0f1 100644
--- a/lib/RT/Crypt.pm
+++ b/lib/RT/Crypt.pm
@@ -817,6 +817,10 @@ An L<RT::Date> of the date the key expires; undef if the key does not expire.
A fingerprint unique to this key
+=item Formatted
+
+A formatted string representation of the key
+
=item User
An array reference of associated user data, each of which is a hashref
diff --git a/lib/RT/Crypt/GnuPG.pm b/lib/RT/Crypt/GnuPG.pm
index 316d2fa..ca1b632 100644
--- a/lib/RT/Crypt/GnuPG.pm
+++ b/lib/RT/Crypt/GnuPG.pm
@@ -1649,6 +1649,13 @@ sub GetKeysInfo {
@info = $self->ParseKeysInfo( @info );
$res{'info'} = \@info;
+
+ for my $key (@{$res{info}}) {
+ $key->{Formatted} =
+ join("; ", map {$_->{String}} @{$key->{User}})
+ . " (".substr($key->{Fingerprint}, -8) . ")";
+ }
+
return %res;
}
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index 5351dba..90d57fa 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -937,6 +937,9 @@ sub GetCertificateInfo {
$res{info}[0]{TrustLevel} = 0;
}
+ $res{info}[0]{Formatted} = $res{info}[0]{User}[0]{String}
+ . " (issued by $res{info}[0]{Issuer}[0]{String})";
+
return %res;
}
diff --git a/share/html/Admin/Elements/ShowKeyInfo b/share/html/Admin/Elements/ShowKeyInfo
index efcd0ed..273fcbc 100644
--- a/share/html/Admin/Elements/ShowKeyInfo
+++ b/share/html/Admin/Elements/ShowKeyInfo
@@ -58,7 +58,7 @@
<tr><th colspan="2"><% loc('No [_1] keys for this address', $protocol) %></th></tr>
% } else {
-<tr><th colspan="2"><% loc("[_1] key '[_2]'", $protocol, $res{'info'}{'Fingerprint'} ) %></th></tr>
+<tr><th colspan="2"><% loc("[_1] key '[_2]'", $protocol, $res{'info'}{'Formatted'} ) %></th></tr>
% if ( $Type ne 'private' && $res{'info'}{'Trust'} ) {
<tr><th class="label"><% loc('Trust') %>:</th> <td><% loc( $res{'info'}{'Trust'} ) %></td></tr>
diff --git a/share/html/Elements/Crypt/SelectKeyForEncryption b/share/html/Elements/Crypt/SelectKeyForEncryption
index d94adab..645e48f 100644
--- a/share/html/Elements/Crypt/SelectKeyForEncryption
+++ b/share/html/Elements/Crypt/SelectKeyForEncryption
@@ -50,7 +50,7 @@
% } else {
<select name="<% $Name %>">
% foreach my $key (@keys) {
-<option value="<% $key->{'Fingerprint'} %>"><% $key->{'Fingerprint'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
+<option value="<% $key->{'Fingerprint'} %>"><% $key->{'Formatted'} %> <% loc("(trust: [_1])", $key->{'TrustTerse'}) %></option>
% }
</select>
% }
-----------------------------------------------------------------------
More information about the rt-commit
mailing list