Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The implementation of DeviceFingerprint differs from the spec #242

Open
ghost opened this issue Jun 14, 2017 · 1 comment
Open

The implementation of DeviceFingerprint differs from the spec #242

ghost opened this issue Jun 14, 2017 · 1 comment
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Jun 14, 2017

https://github.com/cryptocat/cryptocat/blob/master/src/js/omemo.js#L590-L597

			var h = '';
			var i = 0;
			for (i = 0; i < username.length; i += 1) {
				h += ProScript.encoding.a2h(username);
			}
			for (i = 0; i < deviceName.length; i += 1) {
				h += ProScript.encoding.a2h(deviceName[i]);
			}

According to https://crypto.cat/security.html, username will be used only once in a calculation of device fingerprint. But actually, Cryptocat.OMEMO.deviceFingerprint() concatenates an entire username multiple times.

This implementation is equivalent to:

DeviceFingerprint = SHA256(
	deviceId                ||
	SHA256(
		username.repeat(username.length)   ||
		deviceName ||
		deviceIcon
	)                       ||
	deviceIdentityKeyPublic
).HexString().First32Characters()
@nadimkobeissi nadimkobeissi self-assigned this Jul 18, 2017
@nadimkobeissi
Copy link
Contributor

That's an implementation bug, and quite a silly one at that. Thanks for catching it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant