Skip to content

Instantly share code, notes, and snippets.

@rf-
Last active June 25, 2016 01:59
Show Gist options
  • Save rf-/eb31bc57b21b766c68ecbbdfc2322f8b to your computer and use it in GitHub Desktop.
Save rf-/eb31bc57b21b766c68ecbbdfc2322f8b to your computer and use it in GitHub Desktop.
Kalium issue repro
scalaVersion := "2.11.8"
resolvers += "Sonatype" at "https://oss.sonatype.org/content/repositories/releases"
resolvers += "Twitter" at "https://maven.twttr.com/"
libraryDependencies ++= Seq(
"asm" % "asm" % "3.1",
"org.abstractj.kalium" % "kalium" % "0.4.0"
)
package main
import java.security.SecureRandom
import org.abstractj.kalium.NaCl.Sodium.XSALSA20_POLY1305_SECRETBOX_NONCEBYTES
import org.abstractj.kalium.NaCl.Sodium.XSALSA20_POLY1305_SECRETBOX_KEYBYTES
import org.abstractj.kalium.crypto.SecretBox
object Main extends App {
val secureRandom = new SecureRandom
val nonce = {
val bytes = new Array[Byte](XSALSA20_POLY1305_SECRETBOX_NONCEBYTES)
secureRandom.nextBytes(bytes)
bytes
}
val key = {
val bytes = new Array[Byte](XSALSA20_POLY1305_SECRETBOX_KEYBYTES)
secureRandom.nextBytes(bytes)
bytes
}
val box = new SecretBox(key)
box.encrypt(nonce, "Hello world!".getBytes)
}
@rf-
Copy link
Author

rf- commented Jun 25, 2016

Output:

[error] (run-main-0) java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected
java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected
    at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:74)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:59)
    at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:43)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:265)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:244)
    at org.abstractj.kalium.NaCl$SingletonHolder.<clinit>(NaCl.java:41)
    at org.abstractj.kalium.NaCl.sodium(NaCl.java:28)
    at org.abstractj.kalium.crypto.SecretBox.encrypt(SecretBox.java:47)
    at main.Main$.delayedEndpoint$main$Main$1(main.scala:24)
    at main.Main$delayedInit$body.apply(main.scala:8)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.App$$anonfun$main$1.apply(App.scala:76)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
    at scala.App$class.main(App.scala:76)
    at main.Main$.main(main.scala:8)
    at main.Main.main(main.scala)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment