tuweni / org.apache.tuweni.crypto.sodium / Signature

Signature

class Signature (source)

Public-key signatures.

In this system, a signer generates a key pair:

Verifiers need to already know and ultimately trust a public key before messages signed using it can be verified.

Warning: this is different from authenticated encryption. Appending a signature does not change the representation of the message itself.

This class depends upon the JNR-FFI library being available on the classpath, along with its dependencies. See https://github.com/jnr/jnr-ffi. JNR-FFI can be included using the gradle dependency 'com.github.jnr:jnr-ffi'.

Types

KeyPair

A Signature key pair.

class KeyPair

PublicKey

A signing public key.

class PublicKey : Destroyable

SecretKey

A Signature secret key.

class SecretKey : Destroyable

Seed

A Signature key pair seed.

class Seed

Functions

sign

Signs a message for a given key.

static fun sign(message: Bytes!, secretKey: SecretKey!): Bytes!
static fun sign(message: ByteArray!, secretKey: SecretKey!): ByteArray!

signDetached

Signs a message for a given key.

static fun signDetached(message: Bytes!, secretKey: SecretKey!): Bytes!
static fun signDetached(message: Allocated!, secretKey: SecretKey!): Allocated!
static fun signDetached(message: ByteArray!, secretKey: SecretKey!): ByteArray!

verify

Verifies the signature of the signed message using the public key and returns the message.

static fun verify(signed: Bytes!, publicKey: PublicKey!): Bytes!
static fun verify(signed: ByteArray!, publicKey: PublicKey!): ByteArray!

verifyDetached

Decrypt a message using a given key.

static fun verifyDetached(message: Bytes!, signature: Bytes!, publicKey: PublicKey!): Boolean
static fun verifyDetached(message: Allocated!, signature: Allocated!, publicKey: PublicKey!): Boolean
static fun verifyDetached(message: ByteArray!, signature: ByteArray!, publicKey: PublicKey!): Boolean