addTurnsSelfsignedCert.js (919B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 /* eslint-env mozilla/chrome-script */ 6 7 "use strict"; 8 9 // This is only usable from the parent process, even for doing simple stuff like 10 // serializing a cert. 11 var gCertMaker = Cc["@mozilla.org/security/x509certdb;1"].getService( 12 Ci.nsIX509CertDB 13 ); 14 15 var gCertOverrides = Cc["@mozilla.org/security/certoverride;1"].getService( 16 Ci.nsICertOverrideService 17 ); 18 19 addMessageListener("add-turns-certs", certs => { 20 var port = 5349; 21 certs.forEach(certDescription => { 22 var cert = gCertMaker.constructX509FromBase64(certDescription.cert); 23 gCertOverrides.rememberValidityOverride( 24 certDescription.hostname, 25 port, 26 {}, 27 cert, 28 false 29 ); 30 }); 31 sendAsyncMessage("certs-added"); 32 });