@@ -505,9 +505,9 @@ if(window.rcmail) {
505
505
} else {
506
506
// Selected set as $("#openpgpjs_selected_id").val(), then get that value from set_passphrase
507
507
for ( var i = 0 ; i < getPrivkeyCount ( ) ; i ++ ) {
508
- for ( var j = 0 ; j < openpgp . keyring . privateKeys [ i ] . obj . userIds . length ; j ++ ) {
508
+ for ( var j = 0 ; j < getKeyUserids ( i , true ) . length ; j ++ ) {
509
509
fingerprint = getFingerprint ( i , true , false ) ;
510
- person = escapeHtml ( openpgp . keyring . privateKeys [ i ] . obj . userIds [ j ] . text ) ;
510
+ person = escapeHtml ( getPerson ( i , j , true ) ) ;
511
511
$ ( "#openpgpjs_key_select_list" ) . append ( "<div class=\"clickme\" onclick=\"select_key(" + i + ");\">" + fingerprint + " " + person + "</div>" ) ;
512
512
}
513
513
}
@@ -526,13 +526,13 @@ if(window.rcmail) {
526
526
// fill key manager public key table
527
527
$ ( "#openpgpjs_pubkeys tbody" ) . empty ( ) ;
528
528
for ( var i = 0 ; i < getPubkeyCount ( ) ; i ++ ) {
529
- var key_id = "0x" + util . hexstrdump ( openpgp . keyring . publicKeys [ i ] . obj . getKeyId ( ) ) . toUpperCase ( ) . substring ( 8 ) ;
529
+ var key_id = getKeyID ( i ) ;
530
530
var fingerprint = getFingerprint ( i ) ;
531
- var person = escapeHtml ( openpgp . keyring . publicKeys [ i ] . obj . userIds [ 0 ] . text ) ;
532
- var length_alg = getAlgorithmString ( openpgp . keyring . publicKeys [ i ] . obj ) ;
533
- var status = ( openpgp . keyring . publicKeys [ i ] . obj . verifyBasicSignatures ( ) ? rcmail . gettext ( "valid" , "rc_openpgpjs" ) : rcmail . gettext ( "invalid" , "rc_openpgpjs" ) ) ;
534
- var del = "<a href='#' onclick='if(confirm(\"" + rcmail . gettext ( 'delete_pub' , 'rc_openpgpjs' ) + "\")) { openpgp.keyring.removePublicKey (" + i + "); updateKeyManager(); }'>" + rcmail . gettext ( 'delete' , 'rc_openpgpjs' ) + "</a>" ;
535
- var exp = "<a href=\"data:asc," + encodeURIComponent ( openpgp . keyring . publicKeys [ i ] . armored ) + "\" download=\"pubkey_" + util . hexstrdump ( openpgp . keyring . publicKeys [ i ] . obj . getKeyId ( ) ) . toUpperCase ( ) . substring ( 8 ) + ".asc\">Export</a> " ;
531
+ var person = escapeHtml ( getPerson ( i , 0 ) ) ;
532
+ var length_alg = getAlgorithmString ( i ) ;
533
+ var status = ( verifyBasicSignatures ( i ) ? rcmail . gettext ( "valid" , "rc_openpgpjs" ) : rcmail . gettext ( "invalid" , "rc_openpgpjs" ) ) ;
534
+ var del = "<a href='#' onclick='if(confirm(\"" + rcmail . gettext ( 'delete_pub' , 'rc_openpgpjs' ) + "\")) { removeKey (" + i + "); updateKeyManager(); }'>" + rcmail . gettext ( 'delete' , 'rc_openpgpjs' ) + "</a>" ;
535
+ var exp = "<a href=\"data:asc," + encodeURIComponent ( exportArmored ( i ) ) + "\" download=\"pubkey_" + getKeyID ( i ) + ".asc\">Export</a> " ;
536
536
537
537
var result = "<tr>" +
538
538
"<td>" + key_id + "</td>" +
@@ -548,13 +548,13 @@ if(window.rcmail) {
548
548
// fill key manager private key table
549
549
$ ( "#openpgpjs_privkeys tbody" ) . empty ( ) ;
550
550
for ( var i = 0 ; i < getPrivkeyCount ( ) ; i ++ ) {
551
- for ( var j = 0 ; j < openpgp . keyring . privateKeys [ i ] . obj . userIds . length ; j ++ ) {
552
- var key_id = "0x" + util . hexstrdump ( openpgp . keyring . privateKeys [ i ] . obj . getKeyId ( ) ) . toUpperCase ( ) . substring ( 8 ) ;
551
+ for ( var j = 0 ; j < getKeyUserids ( i , true ) . length ; j ++ ) {
552
+ var key_id = getKeyID ( i , true ) ;
553
553
var fingerprint = getFingerprint ( i , true ) ;
554
- var person = escapeHtml ( openpgp . keyring . privateKeys [ i ] . obj . userIds [ j ] . text ) ;
555
- var length_alg = getAlgorithmString ( openpgp . keyring . privateKeys [ i ] . obj ) ;
556
- var del = "<a href='#' onclick='if(confirm(\"" + rcmail . gettext ( 'delete_priv' , 'rc_openpgpjs' ) + "\")) { openpgp.keyring.removePrivateKey (" + i + "); updateKeyManager(); }'>" + rcmail . gettext ( 'delete' , 'rc_openpgpjs' ) + "</a>" ;
557
- var exp = "<a href=\"data:asc," + encodeURIComponent ( openpgp . keyring . privateKeys [ i ] . armored ) + "\" download=\"privkey_" + util . hexstrdump ( openpgp . keyring . privateKeys [ i ] . obj . getKeyId ( ) ) . toUpperCase ( ) . substring ( 8 ) + ".asc\">Export</a> " ;
554
+ var person = escapeHtml ( getPerson ( i , j , true ) ) ;
555
+ var length_alg = getAlgorithmString ( i , true ) ;
556
+ var del = "<a href='#' onclick='if(confirm(\"" + rcmail . gettext ( 'delete_priv' , 'rc_openpgpjs' ) + "\")) { removeKey (" + i + ", true ); updateKeyManager(); }'>" + rcmail . gettext ( 'delete' , 'rc_openpgpjs' ) + "</a>" ;
557
+ var exp = "<a href=\"data:asc," + encodeURIComponent ( exportArmored ( i , true ) ) + "\" download=\"privkey_" + getKeyID ( i , true ) + ".asc\">Export</a> " ;
558
558
559
559
var result = "<tr>" +
560
560
"<td>" + key_id + "</td>" +
@@ -576,28 +576,6 @@ if(window.rcmail) {
576
576
}
577
577
}
578
578
579
- /**
580
- * Extract the algorithm string from a key and
581
- * return the algorithm type.
582
- *
583
- * @param key {String} Key
584
- * @return {String } Algorithm type
585
- */
586
- function getAlgorithmString ( key ) {
587
- if ( typeof ( key . publicKeyPacket ) !== "undefined" ) {
588
- var result = key . publicKeyPacket . MPIs [ 0 ] . mpiByteLength * 8 + "/" ;
589
- var sw = key . publicKeyPacket . publicKeyAlgorithm ;
590
- } else {
591
- // For some reason publicKeyAlgorithm doesn't work directly on the privatekeyPacket, heh
592
- var result = ( key . privateKeyPacket . publicKey . MPIs [ 0 ] . mpiByteLength * 8 + "/" ) ;
593
- var sw = key . privateKeyPacket . publicKey . publicKeyAlgorithm ;
594
- }
595
-
596
- result += typeToStr ( sw ) ;
597
-
598
- return result ;
599
- }
600
-
601
579
/**
602
580
* Converts an algorithm id (1/2/3/16/17) to the
603
581
* corresponding algorithm type
0 commit comments