Curve25519-keyshare

Elliptic Curve Diffie-Hellman

License

License

Categories

Categories

Net
GroupId

GroupId

com.github.netricecake
ArtifactId

ArtifactId

x25519
Last Version

Last Version

2.0
Release Date

Release Date

Type

Type

jar
Description

Description

Curve25519-keyshare
Elliptic Curve Diffie-Hellman
Project URL

Project URL

https://github.com/NetRiceCake/Curve25519-keyshare
Source Code Management

Source Code Management

https://github.com/NetRiceCake/Curve25519-keyshare

Download x25519

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.netricecake/x25519/ -->
<dependency>
    <groupId>com.github.netricecake</groupId>
    <artifactId>x25519</artifactId>
    <version>2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.netricecake/x25519/
implementation 'com.github.netricecake:x25519:2.0'
// https://jarcasting.com/artifacts/com.github.netricecake/x25519/
implementation ("com.github.netricecake:x25519:2.0")
'com.github.netricecake:x25519:jar:2.0'
<dependency org="com.github.netricecake" name="x25519" rev="2.0">
  <artifact name="x25519" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.netricecake', module='x25519', version='2.0')
)
libraryDependencies += "com.github.netricecake" % "x25519" % "2.0"
[com.github.netricecake/x25519 "2.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Curve25519 Keyshare

Curve25519 is an elliptic curve offering 128 bits of security and designed for use with the elliptic curve Diffie–Hellman (ECDH) key agreement scheme. It is one of the fastest ECC curves

Version Version

Using in Gradle :

repositories {
  mavenCentral()
}

dependencies {
  implementation 'com.github.netricecake:x25519:2.0'
}

Using in Maven :

<dependencies>
  <dependency>
    <groupId>com.github.netricecake</groupId>
    <artifactId>x25519</artifactId>
    <version>2.0</version>
  </dependency>
</dependencies>

How to use :

Make private key :

Curve25519.generateRandomKey() //Return 32 byte random bytes

Make public key from private key :

Curve25519.publicKey(byte[] privateKey)

Get shared secret :

Curve25519.sharedSecrete(byte[] privateKey, byte[] publicKey) //Private key and Public key must be 32 byte array

Example :

byte[] aPrivate = Curve25519.generateRandomKey();
byte[] aPublic = Curve25519.publicKey(aPrivate);

byte[] bPrivate = Curve25519.generateRandomKey();
byte[] bPublic = Curve25519.publicKey(bPrivate);

byte[] aSharedSecret = Curve25519.sharedSecret(aPrivate, bPublic);
byte[] bSharedSecret = Curve25519.sharedSecret(bPrivate, aPublic);

Additional

Version 1.0 has one big problem. Please use version 2.0.

Versions

Version
2.0
1.0