Check-in [4ce30d9e04]
Overview
Comment:Work on getting an SSH agent UI going
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | ssh-agent-ui
Files: files | file ages | folders
SHA1:4ce30d9e04e10bac5027cdaceacc6f38eb85d541
User & Date: rkeene on 2019-06-05 18:12:58
Other Links: manifest | tags
Context
2019-06-06
21:56
Merged in trunk Leaf check-in: 8a375324e9 user: rkeene tags: ssh-agent-ui
2019-06-05
18:12
Work on getting an SSH agent UI going check-in: 4ce30d9e04 user: rkeene tags: ssh-agent-ui
2019-02-04
23:17
Better matching of requested blob to one of our certificates check-in: fd3c997789 user: rkeene tags: trunk
Changes

Modified build/chrome/manifest.json.in from [5fb3c02ed9] to [6924f71c75].

    11     11   	},
    12     12   
    13     13   	"app": {
    14     14   		"background": {
    15     15   			"scripts": [
    16     16   				"google-pcsc.js",
    17     17   				"jsrsasign.js",
           18  +				"options.js",
    18     19   				"ssh-agent.js",
    19     20   				"cackey.js"
    20     21   			],
    21     22   			"persistent": false
    22     23   		}
    23     24   	},
    24     25   
    25     26   	"permissions": [
    26     27   		"certificateProvider",
           28  +		"storage",
    27     29   		"alwaysOnTopWindows"
    28     30   	],
           31  +
    29     32   	"externally_connectable": {
    30     33   		"ids": [
    31     34   			"pnhechapfaindjhompbnflcldabbghjo",
    32     35   			"okddffdblfhhnmhodogpojmfkjmhinfp"
    33     36   		]
    34     37   	}
    35     38   }

Added build/chrome/options.js version [96c52a5607].

            1  +function backendNameToObject(name) {
            2  +	var backend;
            3  +
            4  +	switch (name) {
            5  +		case "local":
            6  +			backend = chrome.storage.local;
            7  +			break;
            8  +		case "sync":
            9  +			backend = chrome.storage.sync;
           10  +			break;
           11  +		default:
           12  +			throw(new Error("Invalid backend selected:" + name));
           13  +			break;
           14  +	}
           15  +
           16  +	return(backend);
           17  +}
           18  +
           19  +function optionValue(optionName, optionValue) {
           20  +	var backend;
           21  +	var retrievePromise;
           22  +
           23  +	switch (optionName) {
           24  +		case "backend":
           25  +			backend = backendNameToObject("local");
           26  +			break;
           27  +		default:
           28  +			backend = backendNameToObject(optionValue("backend"));
           29  +			break;
           30  +	}
           31  +
           32  +	/*
           33  +	 * If a value has been specified, set the parameter -- otherwise retrieve
           34  +	 */
           35  +	if (optionValue) {
           36  +		var setObject = {};
           37  +		var previousBackendName, previousBackend;
           38  +
           39  +		/*
           40  +		 * If we are changing the backend, migrate settings
           41  +		 */
           42  +		if (optionName === "backend") {
           43  +			previousBackendName = optionValue("backend");
           44  +			if (previousBackendName !== optionValue) {
           45  +				previousBackend = backendNameToObject(previousBackendName);
           46  +			}
           47  +		}
           48  +
           49  +		setObject[optionName] = optionValue;
           50  +
           51  +		backend.set(setObject);
           52  +
           53  +		return;
           54  +	} else {
           55  +		
           56  +	}
           57  +}

Modified build/chrome/ui.html from [646f12701f] to [a24ccf52c0].

     1      1   <html>
     2      2   	<head>
     3      3   		<title>CACKey</title>
     4      4   		<script type="text/javascript" src="jsrsasign.js"></script>
            5  +		<script type="text/javascript" src="options.js"></script>
     5      6   		<script type="text/javascript" src="ui.js"></script>
     6      7   	</head>
     7      8   	<body>
     8      9   		<h1>CACKey for Chrome</h1>
     9     10   		<div>Certificate Provider: <span id="certificate_provider"></span></div>
    10     11   		<div>Smartcard Readers: <span id="smartcard_readers"></span></div>
    11     12   		<div>Certificates: <span id="certificates"></span></div>
    12     13   		<div><button id="reload">Refresh</button></div>
    13     14   	</body>
    14     15   </html>

Modified build/chrome/ui.js from [8a4e675e00] to [153c088fd4].

     1      1   var globalCerts = null;
     2      2   
     3      3   function displayCerts(htmlObject, certs) {
     4      4   	var html = "";
     5      5   	var idx;
     6         -	var cert;
            6  +	var cert, certTitle;
     7      7   	var certObj;
            8  +	var ignoredException;
     8      9   
     9     10   	if (certs.length == 0) {
    10     11   		htmlObject.innerHTML = "<b>No certificates found</b>";
    11     12   
    12     13   		return;
    13     14   	}
    14     15   
................................................................................
    17     18   	html += "<ol type=\"1\">";
    18     19   
    19     20   	for (idx = 0; idx < certs.length; idx++) {
    20     21   		cert = certs[idx];
    21     22   
    22     23   		certObj.readCertHex(BAtohex(new Uint8Array(cert.certificate)));
    23     24   
           25  +		certTitle = certObj.getSubjectString();
           26  +		try {
           27  +			certObj.getExtSubjectAltName2().forEach(function(itemPair) {
           28  +				var itemName, itemValue;
           29  +
           30  +				itemName = itemPair[0];
           31  +				itemValue = itemPair[1];
           32  +
           33  +				if (itemName === "MAIL") {
           34  +					certTitle = itemValue;
           35  +				}
           36  +			});
           37  +		} catch (ignoredException) {};
           38  +
    24     39   		html += "\t<li>";
    25         -		html += "\t\t" + certObj.getSubjectString() + ":" + certObj.getSerialNumberHex();
           40  +		html += "\t\t" + certTitle;
    26     41   		html += "\t\t<ol type=\"a\">";
    27     42   		html += "\t\t\t<li>Serial Number: " + certObj.getSerialNumberHex() + "</li>";
    28     43   		try {
    29     44   			html += "\t\t\t<li>Usage: " + certObj.getExtKeyUsageString() + "</li>";
    30         -		} catch (_) {};
           45  +		} catch (ignoredException) {};
    31     46   		html += "\t\t</ol>";
    32     47   		html += "\t</li>";
    33     48   	}
    34     49   
    35     50   	html += "</ol>";
    36     51   
    37     52   	delete certObj;
................................................................................
   118    133   	return;
   119    134   }
   120    135   
   121    136   function clearStatusInfo() {
   122    137   	document.getElementById('certificates').innerHTML = '<i>Loading...</i>';
   123    138   	document.getElementById('smartcard_readers').innerHTML = '<i>Loading...</i>';
   124    139   	document.getElementById('certificate_provider').innerHTML = '<i>Loading...</i>';
          140  +	document.getElementById('pin_caching_timeout').value = '';
          141  +	document.getElementById('ssh_agent_enabled').checked = false;
          142  +	document.getElementById('ssh_agent_keys').checked = false;
          143  +	document.getElementById('ssh_agent_certs').checked = false;
          144  +	document.getElementById('ssh_agent_certs_legacy').checked = false;
   125    145   }
   126    146   
   127    147   function loadStatusInfo() {
   128    148   	updateCertificates(document.getElementById('certificates'));
   129    149   	updateSmartcardReaders(document.getElementById('smartcard_readers'));
   130    150   	updateCertificateProvider(document.getElementById('certificate_provider'));
          151  +	// updateOptions(getOptions());
   131    152   }
   132    153   
   133    154   setTimeout(function() {
   134    155   	loadStatusInfo();
   135    156   
   136    157   	document.getElementById('reload').onclick = function() {
   137    158   		clearStatusInfo();