{"id":38091894,"url":"https://github.com/fortanix/sq-dsm","last_synced_at":"2026-01-16T20:58:25.090Z","repository":{"id":39519105,"uuid":"358312994","full_name":"fortanix/sq-dsm","owner":"fortanix","description":"PGP operations with Fortanix DSM","archived":false,"fork":false,"pushed_at":"2025-11-03T05:49:51.000Z","size":18787,"stargazers_count":8,"open_issues_count":13,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-03T07:18:21.950Z","etag":null,"topics":["cryptography","ed25519","encryption","pgp","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fortanix.png","metadata":{"files":{"readme":"README.android","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-15T15:48:00.000Z","updated_at":"2025-11-03T05:49:55.000Z","dependencies_parsed_at":"2023-11-18T10:22:30.620Z","dependency_job_id":"076d7463-ebd3-4258-b5fd-7f66b253d20f","html_url":"https://github.com/fortanix/sq-dsm","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/fortanix/sq-dsm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortanix%2Fsq-dsm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortanix%2Fsq-dsm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortanix%2Fsq-dsm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortanix%2Fsq-dsm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortanix","download_url":"https://codeload.github.com/fortanix/sq-dsm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortanix%2Fsq-dsm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","ed25519","encryption","pgp","rust"],"created_at":"2026-01-16T20:58:25.002Z","updated_at":"2026-01-16T20:58:25.067Z","avatar_url":"https://github.com/fortanix.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Build Sequoia for Android\n\nBased on this [guide].\n\n  [guide]: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html\n\nFor building and using a plain rust project, its enough with following the guide,\nbut if they are native dependencies like openssl or Nettle as in the Sequoia case,\nthese dependencies need to be crossbuilt before starting the cargo build.\n\nThis instructions are tested for the host target `$HOST=armv7-linux-androideabi`\nand using **Debian Squeeze**\n\n0. Setup env to build using NDK and env\n1. Setup rust for crossbuilding (follow guide above)\n2. Download dependencies\n3. Cross build OpenSSL for Android\n4. Cross build Nettle and its dependencies (libgmp) for Android\n5. Build Sequoia\n\n### 0. ANDROID NDK Standalone toolchains\n\nWe need `$ANDROID_NDK` to be pointing to the [NDK standalone toolchain]\n\n  [NDK standalone toolchain]: https://developer.android.com/ndk/guides/standalone_toolchain\n\n```bash\nANDROID_NDK=$STANDALONE_NDK_PATH\nexport PATH=$PATH:ANDROID_NDK/bin\n```\n\nNow that we have the NDK setup, we need to setup and define our build environment:\n\n```bash\nmkdir -p /tmp/sequoia-build\nexport PREFIX=/tmp/sequoia-build\nexport BUILD_DIR=/tmp/sequoia-build\nexport HOST_ARCH=arm-linux-androideabi\n```\n\n### 1. Setup rust for crossbuilding\n\nFollow this [guide] until:\n\n  [guide]: https://mozilla.github.io/firefox-browser-architecture/experiments/2017-09-21-rust-on-android.html\n\n```\nrustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android\n```\n\nNow you have your env ready to cross build, we need to build Sequoia's dependencies.\n\n### 2. Download dependencies\n\nWe need to download, OpenSSL, GMP and Nettle, for that we will use\nthe official download pages:\n\n* Openssl: http://www.openssl.org/source/\n* GMP: https://gmplib.org/\n* Neetle: https://ftp.gnu.org/gnu/nettle/\n\nReplace \"X.Y.Z\" with the latest version of each software package.\n\n```bash\nexport OPENSSL_VERSION=\"X.Y.Z\"\nexport GMP_VERSION=\"X.Y.Z\"\nexport NETTLE_VERSION=\"X.Y.Z\"\n```\n\nto get them:\n\n```bash\nwget -nc https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz\nwget -nc https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz.asc\nwget -nc https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.bz2\nwget -nc https://gmplib.org/download/gmp/gmp-$GMP_VERSION.tar.bz2.sig\nwget -nc https://ftp.gnu.org/gnu/nettle/nettle-$NETTLE_VERSION.tar.gz\nwget -nc https://ftp.gnu.org/gnu/nettle/nettle-$NETTLE_VERSION.tar.gz.sig\n```\n\n\n**Before using the downloaded files please check their integrity, if it fails\nabort**\n\n\nAnd then untar:\n\n```bash\ngpg --auto-key-locate --verify openssl-$OPENSSL_VERSION.tar.gz.asc openssl-$OPENSSL_VERSION.tar.gz\ntar xvf openssl-$OPENSSL_VERSION.tar.gz\ngpg --verify gmp-$GMP_VERSION.tar.bz2.sig gmp-$GMP_VERSION.tar.bz2\ntar xvf gmp-$GMP_VERSION.tar.bz2\ngpg --verify nettle-$NETTLE_VERSION.tar.gz.sig nettle-$NETTLE_VERSION.tar.gz\ntar xvf nettle-$NETTLE_VERSION.tar.gz\n```\n\n### 3. CrossBuild OpenSSL for Android\n\nNote: These instructions are for OpenSSL 1.1.1 series, not compatible with\nprevious series.\n\n```bash\ncd openssl-$OPENSSL_VERSION \u0026\u0026 \\\n./Configure android-arm --prefix=$PREFIX \u0026\u0026 \\\nmake \u0026\u0026 make install \u0026\u0026 cd ..\n```\n\nNow we need to set ARMV7_LINUX_ANDROIDEABI_OPENSSL_LIB_DIR and\nARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR to\nmake rust native-tls find the right openssl.\n\n```bash\nARMV7_LINUX_ANDROIDEABI_OPENSSL_LIB_DIR=\"$PREFIX/lib\"\nARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR=\"$PREFIX/include\"\n```\n\n### 4. Crossbuild Nettle for Android\n\nFirst we need to build libgmp:\n\n```bash\ncd gmp-${GMP_VERSION} \u0026\u0026 \\\nCFLAGS=\"-fPIE -fPIC\" \\\nLDFLAGS=\"-pie -march=armv7-a -Wl,--fix-cortex-a8\" \\\nAR=\"${HOST_ARCH}-ar\" \\\nAS=\"${HOST_ARCH}-clang\" \\\nCC=\"${HOST_ARCH}-clang\" \\\nCXX=\"${HOST_ARCH}-clang++\" \\\nLD=\"${HOST_ARCH}-ld\" \\\nPKG_CONFIG_ALLOW_CROSS=1 \\\nPKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \\\nSTRIP=\"${HOST_ARCH}-strip\" ./configure --host=${HOST_ARCH} --prefix=${PREFIX} \u0026\u0026 \\\nmake \u0026\u0026 make install \u0026\u0026 cd ..\n```\n\nNow is Nettle turn:\n\n```bash\ncd nettle-${NETTLE_VERSION} \u0026\u0026 \\\nCFLAGS=\"-fPIE -fPIC\" \\\nLDFLAGS=\"-pie -march=armv7-a -Wl,--fix-cortex-a8\" \\\nAR=\"${HOST_ARCH}-ar\" \\\nAS=\"${HOST_ARCH}-clang\" \\\nCC=\"${HOST_ARCH}-clang\" \\\nCXX=\"${HOST_ARCH}-clang++\" \\\nLD=\"${HOST_ARCH}-ld\" \\\nPKG_CONFIG_ALLOW_CROSS=1 \\\nPKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \\\nSTRIP=\"${HOST_ARCH}-strip\" ./configure --host=${HOST_ARCH}  --prefix=${PREFIX} \\\n--with-lib-path=${PREFIX}/lib \\\n--with-include-path=${PREFIX}/include \u0026\u0026 \\\nmake \u0026\u0026 make install \u0026\u0026 cd ..\n```\n\n### 5. Build Sequoia\n\nTo build Sequoia for android it is needed to use sqlite as amalgam as the NDK\ndoes not provide access to the system sqlite.\n\nFirst get the source code\n\n```bash\ngit clone https://gitlab.com/sequoia-pgp/sequoia.git\n```\n\nand then build\n\n```\n cd sequoia \u0026\u0026 \\\n LD_LIBRARY_PATH=$PREFIX/lib/ PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig \\\n PKG_CONFIG_ALLOW_CROSS=1 ARMV7_LINUX_ANDROIDEABI_OPENSSL_LIB_DIR=\"$PREFIX/lib\" \\\n ARMV7_LINUX_ANDROIDEABI_OPENSSL_INCLUDE_DIR=\"$PREFIX/include\" \\\n ARMV7_LINUX_ANDROIDEABI_OPENSSL_DIR=\"$PREFIX/bin\" \\\n CARGO_TARGET_DIR=$BUILD_DIR CARGO_FLAGS=\"--target armv7-linux-androideabi\" \\\n make build PYTHON=disable\n```\n\nOnce we have it build, we only need to link sequoia-ffi.so to the jni libs\npaths for example\n\n```bash\nln -s $CARGO_TARGET_DIR/armv7-linux-androideabi/debug/libsequoia_ffi.so \\\n$ANDROID_PROJECT_PATH/app/src/main/jniLibs/armeabi/libsequoia_ffi.so\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortanix%2Fsq-dsm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortanix%2Fsq-dsm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortanix%2Fsq-dsm/lists"}