Check-in [43f92f8f98]
Overview
Comment:Improved SSH agent
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 43f92f8f98cb9e1bef41faa37bfa96083ee10675
User & Date: rkeene on 2019-01-31 07:23:46
Other Links: manifest | tags
Context
2019-01-31
13:25
Better handling for unapproved apps and dealing with non-RSA signing attempts check-in: d756b0ea34 user: rkeene tags: trunk
07:23
Improved SSH agent check-in: 43f92f8f98 user: rkeene tags: trunk
07:16
Added SSH agent support check-in: 5d6a50ef48 user: rkeene tags: trunk
Changes

Modified build/chrome/ssh-agent.js from [d68e90b355] to [f8ff078c88].

84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

	return({
		value: result,
		output: input.slice(info.value)
	});
}

function cackeySSHAgentEncodeTLV(tag, array) {
	var result;

	result = [];

	result.push(tag & 0xff);

	result = result.concat(cackeySSHAgentEncodeLV(array));

	return(result);
}

function cackeySSHAgentEncodeToUTF8Array(str) {
	var utf8 = [];

	if (typeof(str) === "string") {
		str = str.split("").map(function(c) {
			return(c.charCodeAt(0));
		});







<
<
<
<
<
<
<
<
<
<
<
<







84
85
86
87
88
89
90












91
92
93
94
95
96
97

	return({
		value: result,
		output: input.slice(info.value)
	});
}













function cackeySSHAgentEncodeToUTF8Array(str) {
	var utf8 = [];

	if (typeof(str) === "string") {
		str = str.split("").map(function(c) {
			return(c.charCodeAt(0));
		});
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
	 */
	if ((flags & flagMeaning.SSH_AGENT_RSA_SHA2_512) == flagMeaning.SSH_AGENT_RSA_SHA2_512) {
		hashMethod = "SHA512";
		data = await crypto.subtle.digest("SHA-512", new Uint8Array(data));
	} else if ((flags & flagMeaning.SSH_AGENT_RSA_SHA2_256) == flagMeaning.SSH_AGENT_RSA_SHA2_256) {
		hashMethod = "SHA256";
		data = await crypto.subtle.digest("SHA-256", new Uint8Array(data));
	} else if (flags == 1) {
		hashMethod = "SHA1";
		data = await crypto.subtle.digest("SHA-1", new Uint8Array(data));
	} else {
		console.info("[cackeySSH] Sign request with flags set to", flags, "which is unsupported, failing the request.");

		return(null);
	}







|







297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
	 */
	if ((flags & flagMeaning.SSH_AGENT_RSA_SHA2_512) == flagMeaning.SSH_AGENT_RSA_SHA2_512) {
		hashMethod = "SHA512";
		data = await crypto.subtle.digest("SHA-512", new Uint8Array(data));
	} else if ((flags & flagMeaning.SSH_AGENT_RSA_SHA2_256) == flagMeaning.SSH_AGENT_RSA_SHA2_256) {
		hashMethod = "SHA256";
		data = await crypto.subtle.digest("SHA-256", new Uint8Array(data));
	} else if (flags == 0) {
		hashMethod = "SHA1";
		data = await crypto.subtle.digest("SHA-1", new Uint8Array(data));
	} else {
		console.info("[cackeySSH] Sign request with flags set to", flags, "which is unsupported, failing the request.");

		return(null);
	}
381
382
383
384
385
386
387

388

389
390
391
392
393
394
395
	sshRequest = {};
	if (sshRequestID < cackeySSHAgentCommands.length) {
		sshRequest = cackeySSHAgentCommands[sshRequestID];
	}

	response = null;
	if (!sshRequest.name) {

		console.log("[cackeySSH] Unsupported request: ", request, "; from: ", socket.sender.id);

	} else {
		if (goog.DEBUG) {
			console.log("[cackeySSH] Request: ", sshRequest.name, "; from: ", socket.sender.id);
		}

		try {
			response = await sshRequest.handler(request.data);







>
|
>







369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
	sshRequest = {};
	if (sshRequestID < cackeySSHAgentCommands.length) {
		sshRequest = cackeySSHAgentCommands[sshRequestID];
	}

	response = null;
	if (!sshRequest.name) {
		if (goog.DEBUG) {
			console.log("[cackeySSH] Unsupported request: ", request, "; from: ", socket.sender.id);
		}
	} else {
		if (goog.DEBUG) {
			console.log("[cackeySSH] Request: ", sshRequest.name, "; from: ", socket.sender.id);
		}

		try {
			response = await sshRequest.handler(request.data);