Index: build/chrome/manifest.json.in ================================================================== --- build/chrome/manifest.json.in +++ build/chrome/manifest.json.in @@ -13,21 +13,24 @@ "app": { "background": { "scripts": [ "google-pcsc.js", "jsrsasign.js", + "options.js", "ssh-agent.js", "cackey.js" ], "persistent": false } }, "permissions": [ "certificateProvider", + "storage", "alwaysOnTopWindows" ], + "externally_connectable": { "ids": [ "pnhechapfaindjhompbnflcldabbghjo", "okddffdblfhhnmhodogpojmfkjmhinfp" ] ADDED build/chrome/options.js Index: build/chrome/options.js ================================================================== --- /dev/null +++ build/chrome/options.js @@ -0,0 +1,57 @@ +function backendNameToObject(name) { + var backend; + + switch (name) { + case "local": + backend = chrome.storage.local; + break; + case "sync": + backend = chrome.storage.sync; + break; + default: + throw(new Error("Invalid backend selected:" + name)); + break; + } + + return(backend); +} + +function optionValue(optionName, optionValue) { + var backend; + var retrievePromise; + + switch (optionName) { + case "backend": + backend = backendNameToObject("local"); + break; + default: + backend = backendNameToObject(optionValue("backend")); + break; + } + + /* + * If a value has been specified, set the parameter -- otherwise retrieve + */ + if (optionValue) { + var setObject = {}; + var previousBackendName, previousBackend; + + /* + * If we are changing the backend, migrate settings + */ + if (optionName === "backend") { + previousBackendName = optionValue("backend"); + if (previousBackendName !== optionValue) { + previousBackend = backendNameToObject(previousBackendName); + } + } + + setObject[optionName] = optionValue; + + backend.set(setObject); + + return; + } else { + + } +} Index: build/chrome/ui.html ================================================================== --- build/chrome/ui.html +++ build/chrome/ui.html @@ -1,9 +1,10 @@ CACKey +

CACKey for Chrome

Certificate Provider:
Index: build/chrome/ui.js ================================================================== --- build/chrome/ui.js +++ build/chrome/ui.js @@ -1,12 +1,13 @@ var globalCerts = null; function displayCerts(htmlObject, certs) { var html = ""; var idx; - var cert; + var cert, certTitle; var certObj; + var ignoredException; if (certs.length == 0) { htmlObject.innerHTML = "No certificates found"; return; @@ -19,17 +20,31 @@ for (idx = 0; idx < certs.length; idx++) { cert = certs[idx]; certObj.readCertHex(BAtohex(new Uint8Array(cert.certificate))); + certTitle = certObj.getSubjectString(); + try { + certObj.getExtSubjectAltName2().forEach(function(itemPair) { + var itemName, itemValue; + + itemName = itemPair[0]; + itemValue = itemPair[1]; + + if (itemName === "MAIL") { + certTitle = itemValue; + } + }); + } catch (ignoredException) {}; + html += "\t
  • "; - html += "\t\t" + certObj.getSubjectString() + ":" + certObj.getSerialNumberHex(); + html += "\t\t" + certTitle; html += "\t\t
      "; html += "\t\t\t
    1. Serial Number: " + certObj.getSerialNumberHex() + "
    2. "; try { html += "\t\t\t
    3. Usage: " + certObj.getExtKeyUsageString() + "
    4. "; - } catch (_) {}; + } catch (ignoredException) {}; html += "\t\t
    "; html += "\t
  • "; } html += ""; @@ -120,16 +135,22 @@ function clearStatusInfo() { document.getElementById('certificates').innerHTML = 'Loading...'; document.getElementById('smartcard_readers').innerHTML = 'Loading...'; document.getElementById('certificate_provider').innerHTML = 'Loading...'; + document.getElementById('pin_caching_timeout').value = ''; + document.getElementById('ssh_agent_enabled').checked = false; + document.getElementById('ssh_agent_keys').checked = false; + document.getElementById('ssh_agent_certs').checked = false; + document.getElementById('ssh_agent_certs_legacy').checked = false; } function loadStatusInfo() { updateCertificates(document.getElementById('certificates')); updateSmartcardReaders(document.getElementById('smartcard_readers')); updateCertificateProvider(document.getElementById('certificate_provider')); + // updateOptions(getOptions()); } setTimeout(function() { loadStatusInfo();