mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 940994 - Adding '.p7b' to 'known file types' list of 'Certificate Manager'. r=keeler
This commit is contained in:
parent
8958797f0a
commit
cfb6b6200c
@ -16,6 +16,8 @@ const nsPKIParamBlock = "@mozilla.org/security/pkiparamblock;1";
|
||||
const nsINSSCertCache = Components.interfaces.nsINSSCertCache;
|
||||
const nsNSSCertCache = "@mozilla.org/security/nsscertcache;1";
|
||||
|
||||
const gCertFileTypes = "*.p7b; *.crt; *.cert; *.cer; *.pem; *.der";
|
||||
|
||||
let { NetUtil } = Components.utils.import("resource://gre/modules/NetUtil.jsm", {});
|
||||
let { Services } = Components.utils.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
@ -378,13 +380,21 @@ function restoreCerts()
|
||||
fp.appendFilter(bundle.getString("file_browse_PKCS12_spec"),
|
||||
"*.p12; *.pfx");
|
||||
fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
|
||||
"*.crt; *.cert; *.cer; *.pem; *.der");
|
||||
gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
// If this is an X509 user certificate, import it as one.
|
||||
if (fp.file.path.endsWith(".crt") || fp.file.path.endsWith(".cert") ||
|
||||
fp.file.path.endsWith(".cer") || fp.file.path.endsWith(".pem") ||
|
||||
fp.file.path.endsWith(".der")) {
|
||||
|
||||
var isX509FileType = false;
|
||||
var fileTypesList = gFileTypesList.split('; ');
|
||||
for (var type in fileTypesList) {
|
||||
if (fp.file.path.endsWith(type)) {
|
||||
isX509FileType = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isX509FileType) {
|
||||
let fstream = Components.classes["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||
fstream.init(fp.file, -1, 0, 0);
|
||||
@ -538,7 +548,7 @@ function addCACerts()
|
||||
bundle.getString("importCACertsPrompt"),
|
||||
nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
|
||||
"*.crt; *.cert; *.cer; *.pem; *.der");
|
||||
gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(null, fp.file, nsIX509Cert.CA_CERT);
|
||||
@ -573,7 +583,7 @@ function addEmailCert()
|
||||
bundle.getString("importEmailCertPrompt"),
|
||||
nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
|
||||
"*.crt; *.cert; *.cer; *.pem; *.der");
|
||||
gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(null, fp.file, nsIX509Cert.EMAIL_CERT);
|
||||
@ -594,7 +604,7 @@ function addWebSiteCert()
|
||||
bundle.getString("importServerCertPrompt"),
|
||||
nsIFilePicker.modeOpen);
|
||||
fp.appendFilter(bundle.getString("file_browse_Certificate_spec"),
|
||||
"*.crt; *.cert; *.cer; *.pem; *.der");
|
||||
gCertFileTypes);
|
||||
fp.appendFilters(nsIFilePicker.filterAll);
|
||||
if (fp.show() == nsIFilePicker.returnOK) {
|
||||
certdb.importCertsFromFile(null, fp.file, nsIX509Cert.SERVER_CERT);
|
||||
|
Loading…
Reference in New Issue
Block a user