asmcrypto / asmcrypto.js

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

AES_CCM undefined? #129

Closed ghost closed 6 years ago

ghost commented 6 years ago

This code:

encrypted = asmCrypto.AES_CCM.encrypt(payload, key, nonce, [], 4);

is causing

Uncaught TypeError: Cannot read property 'encrypt' of undefined

I believe I've installed per the instructions and npm test does not generate any errors i.e. all tests pass.

Furthermore, this call works fine:

console.log("SHA256:"+asmCrypto.SHA256.hex("hello"));

Is AES_CCM missing from the asmcrypto.js file that the build process generated?

See https://stackoverflow.com/questions/46846476/why-is-asmcrypto-giving-a-runtime-error-when-calling-aes-ccm-encrypt

vibornoff commented 6 years ago

AES-CCM isn't build by default. Take a look to https://github.com/vibornoff/asmcrypto.js/blob/master/Gruntfile.js Once you need non-default features, follow the build process from README.md

ghost commented 6 years ago

Aha, OK. Thanks you very much!

vibornoff commented 6 years ago

AES-CCM isn't build by default. Take a look to https://github.com/vibornoff/asmcrypto.js/blob/master/Gruntfile.js Once you need non-default features, follow the build process from README.md

ghost commented 6 years ago

Apologies (since you've closed this). I'm not familiar with this build process. Do I need to do more than just add aes-ccm to the defaults array like this?

var defaults = [
    'utils',
    'globals',
    'aes-cbc',
    'aes-ccm',

I did this and re-ran npm install but I still don't see CCM in the resultant asmcrypto.js file.

I don't see any further information on the build process in README.MD.