Open joebandenburg opened 9 years ago
Hi,
You could require the HKDF constructor to take a version variable then, set iterationStartOffset to either 1 or 0 depending on the version... for a start
I think the HKDF for V3 is more in line with the standard... or is it the other way around?
IT would be good to support both versions just in case
@CharlesOkwuagwu Absolutely, I've put a few "TODO" comments in the code to indicate where changes would need to be made to support version 2. I don't think it would be too difficult. The biggest unknown is if both the node.js crypto module and WebCrypto support AES-256-CTR with a custom CTR (see libaxolotl-android). They both support counter mode, but it's not entirely clear if node.js supports initialising the counter to a specific value.
@joebandenburg Interesting. I've been toying with porting Axolotl to .net, the full libaxolotl-android seems like over-kill compared to the Web-browser version or, better yet your version. There is no CTR mode in .net at all... that would make V2 support tricky, without a 3rd party lib.
Quick question, you leave Store and Crypto as service interfaces in your implementation. Where is the concrete implementation for these?
(Over-kill WRT https://github.com/trevp/axolotl/wiki, i've actually come a cross a surprisingly simple python implementation, here on github)
I think the HKDF for V3 is more in line with the standard... or is it the other way around?
Yes, from my reading of the spec starting with 1 (version 3) is in line with the standard.
I've been toying with porting Axolotl to .net
Awesome :) I'd be very interested to hear your feedback about my code. I've tried to make the implementation as clear as possible to help others understand it. I found Axolotl quite complex initially.
without a 3rd party lib.
You may need a 3rd party library anyway to support Curve25519 and Ed25519, which are required by both versions of the protocol. (They are needed for the calculateAgreement
and sign
methods on the Crypto
interface.)
Quick question, you leave Store and Crypto as service interfaces in your implementation. Where is the concrete implementation for these?
There aren't any implementations yet. You can see a sort-of node.js implementation in test/unit/FakeCrypto.js
, although take note that the calculateAgreement
and sign
methods are not suitable for a real implementation. I've been pondering including an implementation of Curve25519/Ed25519 in libaxolotl-javascript, so the user doesn't need to provide it themselves.
I will be adding documentation to the README to explain the exact requirements for each method of Crypto
interface.
(Over-kill WRT https://github.com/trevp/axolotl/wiki, i've actually come a cross a surprisingly simple python implementation, here on github)
My implementation, like libaxolotl-android, is specific to TextSecure and therefore has the same "non-standard" bits (WTR https://github.com/trevp/axolotl/wiki).
It would be good to be interoperable with older clients. Although it would be worth finding out if there are many version 2 clients out there before starting on this.