lolgab / scala-native-crypto   0.2.0

Apache License 2.0 GitHub

java.security implementation for Scala Native

Scala versions: 3.x 2.13 2.12
Scala Native versions: 0.5

scala-native-crypto

java.security Scala Native implementation based on OpenSSL

Getting started

You need to add the dependency to your Scala Native project.

On SBT:

libraryDependencies += "com.github.lolgab" %%% "scala-native-crypto" % "x.y.z"

On Mill:

def ivyDeps = super.ivyDeps() ++ Agg(ivy"com.github.lolgab::scala-native-crypto::x.y.z")

You need also to install OpenSSL:

On Ubuntu:

sudo apt install libssl-dev

On Mac OS X (with Homebrew):

brew install openssl

And you need to have libcrypto.[so|dylib] in your linking path.

In Ubuntu it works out of the box since openssl is installed in the main lib directory.

In Mac OS X you will need to add the path via nativeLinkingOptions.

On SBT:

nativeConfig ~= { c => c.withLinkingOptions(c.nativeLinkingOptions :+ "-L/usr/local/opt/openssl@3/lib") }

On Mill:

def nativeLinkingOptions = super.nativeLinkingOptions() ++ Seq("-L/usr/local/opt/openssl@3/lib")

Implemented classes

  • java.security.MessageDigest
  • java.security.SecureRandom