Noise for Kotlin enables implementation of Noise protocols based on Diffie-Hellman key agreement.
Warning: This project has not been independently audited. Help is welcome to increase security or to make risks explicit. Also see the Security policy.
See the API docs about the latest release or use the Gradle dokkaHtml
task for a local copy about any version.
Run the tests. On POSIX:
./gradlew test
On Windows:
gradlew test
See HandshakeTest for some example handshakes.
Instead of test
, use jar
to create a JAR in build/distributions
.
Add the noise-kotlin
dependency to your project.
Then, implement Cryptography
for your platform and initialize
a Handshake
.
- Provide pure functions only, never a callback, leaving effect handling to the user.
- Consequence: users must provide any generated keys upfront. Not yet sure if this will work for all situations.
- Support only Curve25519, ChaCha20-Poly1305, and SHA-256 to reduce the need to choose and since these are available on most platforms.
- Consequence: it should be easy to use with Kotlin Multiplatform.
- Use only Kotlin types and functions, and nothing directly from Java SE or libraries.
- Consequence: all cryptographic function dependency implementation is behind an interface, which users need to implement using native platform functions.
- Do not include particular masking, encryption, or zeroization functionality for sensitive data, to avoid disproportional complexity.
- Consequence: run with sufficiently protected volatile memory and protect heap dump data from unauthorized access.
Test vectors are used from:
- snow.txt from mcginty/snow