Encryption/Decryption Lib in Motoko?

is there an encryption/decryption/cryptographie lib for motoko? As far as I know there is non.
Does the motoko-team have any plan to provide such functionality or is it expected to be implemented by the community?
If so then I think this could harm the adoptation of motoko compared f.e. to rust because to implement a good lib for encryption/decryption in motoko (or similar low level api which is not trivial to be implemented and should be very robust) there must be some crypto-experts be interested in it and I doubt that in near future some of these crypto-experts will do this job (probably they will just use rust if they want implement something on ic).
Actually I see there two good solutions right now:

  • it will be possible to call rust code/libs inside motoko project (in a single canister, not canister to canister)
  • ic-system/canisters provide some api for common critical functionality like encryption/decryption/… which every sdk (motoko or rust or …) can call directly without to implement an additional lib.

I like motoko and want it to succeed but the eco-system is very bad compared to rust and some critical functionality (which is not trivial to implement) doesn’t exist yet. I’m afraid that one can’t learn just motoko but also need to learn rust additionally to implement all possible usecases.


From a longer time span, I support motoko’s native encryption/decryption/cryptography library.

Such a general purpose Foreign Function Interface (FFI) would be super useful indeed! But it is also hard; you’d have to deal with multi-language build tools, and it is unclear (to me) how to provide an FFI from Motoko to Rust or C that nicely shares the single Wasm memory, and does not compromise the type safety guarantees of Motoko. You can track Foreign linking / FFI · Issue #1400 · dfinity/motoko · GitHub to see progress in that direction.


Does anyone know if there is an Encryption/Decryption Lib now?

This has been slow in coming because decryption keys stored on the IC are not considered “Safe”.

Is there a timetable? I think the storage security of the decryption key may be more of a consideration in application business design. In our current business design, we just need a symmetric encryption library. So looking forward to it.