Bug 774964 - Implement the getPKCS12FilePassword dialog in native fennec. r=mfinkle
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 27 Feb 2013 00:08:47 -0500
changeset 123114 a9873a552eda15a2248ae8c631cff9da592f7d08
parent 123113 74d4c4a7e5c0bf32bd8f0ccdc9524d645528306e
child 123115 62f32eb94356870e47af4490fd1a0bc845d6812c
push id24372
push useremorley@mozilla.com
push dateWed, 27 Feb 2013 13:22:59 +0000
treeherdermozilla-central@0a91da5f5eab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs774964
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 774964 - Implement the getPKCS12FilePassword dialog in native fennec. r=mfinkle
mobile/android/components/NSSDialogService.js
mobile/android/locales/en-US/chrome/pippki.properties
--- a/mobile/android/components/NSSDialogService.js
+++ b/mobile/android/components/NSSDialogService.js
@@ -76,19 +76,27 @@ NSSDialogs.prototype = {
 
   setPKCS12FilePassword: function(aCtx, aPassword) {
     // this dialog is never shown in Fennec; in Desktop it is shown while backing up a personal
     // certificate to a file via Preferences->Advanced->Encryption->View Certificates->Your Certificates
     throw "Unimplemented";
   },
 
   getPKCS12FilePassword: function(aCtx, aPassword) {
-    // this dialog is never shown in Fennec; in Desktop it is shown while backing up a personal
-    // certificate to a file via Preferences->Advanced->Encryption->View Certificates->Your Certificates
-    throw "Unimplemented";
+    let response = this.showPrompt(this.getString("pkcs12.getpassword.title"),
+                                   this.getString("pkcs12.getpassword.message"),
+                                   [ this.getString("nssdialogs.ok.label"),
+                                     this.getString("nssdialogs.cancel.label")
+                                   ],
+                                   [ { type: "password", id: "pw" } ]);
+    if (response.button != 0) {
+      return false;
+    }
+    aPassword.value = response.pw;
+    return true;
   },
 
   certInfoSection: function(aHeading, aDataPairs, aTrailingNewline = true) {
     var str = "<big>" + this.getString(aHeading) + "</big><br/>";
     for (var i = 0; i < aDataPairs.length; i += 2) {
       str += this.getString(aDataPairs[i]) + ": " + aDataPairs[i+1] + "<br/>";
     }
     return str + (aTrailingNewline ? "<br/>" : "");
--- a/mobile/android/locales/en-US/chrome/pippki.properties
+++ b/mobile/android/locales/en-US/chrome/pippki.properties
@@ -9,16 +9,18 @@ nssdialogs.cancel.label=Cancel
 downloadCert.title=Downloading Certificate
 downloadCert.message1=You have been asked to trust a new Certificate Authority (CA).
 downloadCert.viewCert.label=View
 downloadCert.trustSSL=Trust to identify websites.
 downloadCert.trustEmail=Trust to identify email users.
 downloadCert.trustObjSign=Trust to identify software developers.
 caCertExists.title=Certificate Exists
 caCertExists.message=The Certificate already exists.
+pkcs12.getpassword.title=Password Entry Dialog
+pkcs12.getpassword.message=Please enter the password that was used to encrypt this certificate backup.
 
 certmgr.title=Certificate Details
 # These strings are stolen from security/manager/locales/en-US/chrome/pippki/certManager.dtd
 certmgr.subjectinfo.label=Issued To
 certmgr.issuerinfo.label=Issued By
 certmgr.validity.label=Validity
 certmgr.fingerprints.label=Fingerprints
 certmgr.certdetail.cn=Common Name (CN)