Nebula
Transport

X25519

Implements X25519 key agreement from RFC 7748 §5 using BigInteger arithmetic.

generated from the sources
public static class X25519

Implements X25519 key agreement from RFC 7748 §5 using BigInteger arithmetic. This managed implementation is not constant-time.

Fields

KeySize

public const int KeySize = 32;

Methods

NewPrivateKey

public static byte[] NewPrivateKey();

Generates a random 32-byte private scalar with the X25519 clamping rules applied.

PublicKey

public static byte[] PublicKey(byte[] privateKey);

Agree

public static byte[] Agree(byte[] privateKey, byte[] peerPublicKey);

Computes the shared secret from two 32-byte keys. Returns null when agreement produces an all-zero result.

On this page