Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/muntashirakon/spake2-java
SPAKE2 implementation in Java
https://github.com/muntashirakon/spake2-java
Last synced: 3 months ago
JSON representation
SPAKE2 implementation in Java
- Host: GitHub
- URL: https://github.com/muntashirakon/spake2-java
- Owner: MuntashirAkon
- License: lgpl-3.0
- Created: 2021-08-07T19:32:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-25T09:47:14.000Z (almost 3 years ago)
- Last Synced: 2024-04-14T00:31:55.817Z (9 months ago)
- Language: Java
- Homepage:
- Size: 187 KB
- Stars: 14
- Watchers: 6
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SPAKE2-Java
Implementation of SPAKE2 protocol in Java, fully compatible with BoringSSL implementation.
**DISCLAIMER:** This is an unaudited library tested with Android 11 wireless debugging. Use it at your own risk.
The ultimate goal of this project is to provide both pure java and (for android) JNI implementation of SPAKE2.
The project is fully usable as of now, but it requires further optimizations.## Get Started
import `io.github.muntashirakon.crypto.spake2.*` in your project. Do not import any other files from
`io.github.muntashirakon.crypto` as there's no guarantee that they will not be modified in the future.```java
// Create alice and bob
Spake2Context alice = new Spake2Context(Spake2Role.Alice, "alice", "bob");
Spake2Context bob = new Spake2Context(Spake2Role.Bob, "bob", "alice");
// The below methods are kept for compatibility with BoringSSL
// alice.setDisablePasswordScalarHack(true);
// bob.setDisablePasswordScalarHack(true);
// Messages
byte[] aliceMsg = alice.generateMessage(alicePassword.getBytes(StandardCharsets.UTF_8));
byte[] bobMsg = bob.generateMessage(bobPassword.getBytes(StandardCharsets.UTF_8));
// Fetch keys
byte[] aliceKey = alice.processMessage(bobMsg);
byte[] bobKey = bob.processMessage(aliceMsg);
```### Notice for BoringSSL Users
Beware that strings in C/C++ adds a `NULL` character (i.e. `\u0000`) at the end, so if you've accidentally used
`sizeof(my_name)` instead of `sizeof(my_name)-1`, you have to make sure that you're adding this character to your
Java implementation too.## Credits
ED25519 implementation is a modified and a simplified version of the [EdDSA-Java](https://github.com/str4d/ed25519-java) library (CC0 license).
## License
Copyright 2021 Muntashir Al-IslamLicensed under the LGPL-3.0: http://www.gnu.org/licenses/lgpl-3.0.html