Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 3.09 KB

File metadata and controls

69 lines (44 loc) · 3.09 KB

Rust Crypto Library (Encryption/Decryption)

Crypto is a SAMPLE Rust Crate that showcases cross-platform compilation for different projects and environments. In terms of functinality and for LEARNING PURPOSE, it simulates 'encryption/decryption' by using base64 encoding/decoding.

In order to fully understand the purpose of this repo, please refer to the follwing blog posts:

Local Development

  • cargo build -> builds the entire project.
  • cargo test -> run all the tests.

Sub-projects

The Crypto Library is composed by a Rust Workspace containing a set of crates.

rust-cross-platform-crypto-project-overview

cryptor

It is the core domain library, which contains the main logic for encryption/decryption.

Available commands

$ cargo build               // build the debug version of the project.
$ cargo build --release     // build the release version of the project.
$ cargo test                // run all the tests.

cryptor_jni

This crate fully depends on the crypto crate and its main purpose is to act as a proxy between Rust and Android (Java/Kotlin) via JNI.

Project Configuration

  1. Install the Android SDK and Android NDK.
  2. Make sure your $ANDROID_HOME is pointing to your SDK location. Mine: /home/fernando/Android/Sdk.
  3. Check that your Android NDK version matches the one inside the jni_crypto build.rs file.
    • In my case $ANDROID_HOME/ndk/25.2.9519653 matches with ANDROID_NDK_VERSION = "25.2.9519653" inside build.rs file.

Available commands

$ cargo build                 // build the debug version of the project.
$ cargo run --bin release     // build the release version of the project for all android targets.
$ cargo run --bin publish     // copy all the released libraries/crates inside the android project.
$ cargo test                  // run all the tests.

cryptor_c

  • Still a TODO

cryptor_wasm

  • Still a TODO

Rust Useful References

https://fernandocejas.com

Buy Me A Coffee