asmcrypto / asmcrypto.js

JavaScript Cryptographic Library with performance in mind.
MIT License
659 stars 182 forks source link

AES-ECB and AES-CMAC #133

Closed ghost closed 6 years ago

ghost commented 6 years ago

It would be great if these two algorithms were supported. The new Bluetooth mesh (https://www.bluetooth.com/bluetooth-technology/topology-options/le-mesh) uses them alongside AES-CCM.

alippai commented 6 years ago

ECB is supported, it's exported in the asmcrypto.all.js file or you can direcly import it from the src/aes/ecb/exports.js file. CMAC is not on the shortlist for implementation, however PR is welcome. Eventually it may be supported, however I don't have any spare time in the next month.

What's your use case, is it something with the Web Bluetooth API?

ghost commented 6 years ago

OK, thanks I hadn't realised that. AES-CMAC is used in Bluetooth mesh which is a new Bluetooth technology. It is not related to Web Bluetooth. See https://www.bluetooth.com/bluetooth-technology/topology-options/le-mesh

ghost commented 6 years ago

Btw the README says ECB support is still 'to do' which is why I thought it was not supported. See https://github.com/asmcrypto/asmcrypto.js/blob/master/README.md#aes_ecb

alippai commented 6 years ago

Good point, thanks!

ghost commented 6 years ago

Apparently you're ahead of schedule :-)

ghost commented 6 years ago

@alippai are you certain ECB is supported? Maybe it's a work in progress?

https://github.com/asmcrypto/asmcrypto.js/issues/137

https://github.com/asmcrypto/asmcrypto.js/issues/138

Maybe I'm doing something wrong. If so would you mind providing a very simple code sample, similar to that which I included in https://github.com/asmcrypto/asmcrypto.js/issues/138 ?

Thanks

ghost commented 6 years ago

Do you think you could schedule some time to add support for AES-CMAC? I'm using asmcrypto for all crypto functions in my project except for AES-CMAC and it would be great if I could source all the crypto functions I need for both browser and node.js from the same library.

Thanks in anticipation!

alippai commented 6 years ago

I have to ask @ngg, however based on the NIST papers it should be easy to implement.

ghost commented 6 years ago

OK, that would be great if it's possible.

alippai commented 6 years ago

Added the AES-CMAC mode. It needs further testing, but it's usable.

ghost commented 6 years ago

Thanks very much :-)