Crypto++ 8.7
Free C++ class library of cryptographic schemes
Functions
donna.h File Reference

Go to the source code of this file.

Functions

int curve25519_mult (byte publicKey[32], const byte secretKey[32])
 Generate a public key. More...
 
int curve25519_mult (byte sharedKey[32], const byte secretKey[32], const byte othersKey[32])
 Generate a shared key. More...
 
int ed25519_publickey (byte publicKey[32], const byte secretKey[32])
 Creates a public key from a secret key. More...
 
int ed25519_sign (const byte *message, size_t messageLength, const byte secretKey[32], const byte publicKey[32], byte signature[64])
 Creates a signature on a message. More...
 
int ed25519_sign (std::istream &stream, const byte secretKey[32], const byte publicKey[32], byte signature[64])
 Creates a signature on a message. More...
 
int ed25519_sign_open (const byte *message, size_t messageLength, const byte publicKey[32], const byte signature[64])
 Verifies a signature on a message. More...
 
int ed25519_sign_open (std::istream &stream, const byte publicKey[32], const byte signature[64])
 Verifies a signature on a message. More...
 

Detailed Description

Functions for curve25519 and ed25519 operations

This header provides the entry points into Andrew Moon's curve25519 and ed25519 curve functions. The Crypto++ classes x25519 and ed25519 use the functions. The functions are in the Donna namespace and are curve25519_mult(), ed25519_publickey(), ed25519_sign() and ed25519_sign_open().

At the moment the hash function for signing is fixed at SHA512.

Definition in file donna.h.

Function Documentation

◆ curve25519_mult() [1/2]

int curve25519_mult ( byte  publicKey[32],
const byte  secretKey[32] 
)

Generate a public key.

Parameters
publicKeybyte array for the public key
secretKeybyte array with the private key
Returns
0 on success, non-0 otherwise

curve25519_mult() generates a public key from an existing secret key. Internally curve25519_mult() performs a scalar multiplication using the base point and writes the result to pubkey.

◆ curve25519_mult() [2/2]

int curve25519_mult ( byte  sharedKey[32],
const byte  secretKey[32],
const byte  othersKey[32] 
)

Generate a shared key.

Parameters
sharedKeybyte array for the shared secret
secretKeybyte array with the private key
othersKeybyte array with the peer's public key
Returns
0 on success, non-0 otherwise

curve25519_mult() generates a shared key from an existing secret key and the other party's public key. Internally curve25519_mult() performs a scalar multiplication using the two keys and writes the result to sharedKey.

◆ ed25519_publickey()

int ed25519_publickey ( byte  publicKey[32],
const byte  secretKey[32] 
)

Creates a public key from a secret key.

Parameters
publicKeybyte array for the public key
secretKeybyte array with the private key
Returns
0 on success, non-0 otherwise

ed25519_publickey() generates a public key from a secret key. Internally ed25519_publickey() performs a scalar multiplication using the secret key and then writes the result to publicKey.

◆ ed25519_sign() [1/2]

int ed25519_sign ( const byte message,
size_t  messageLength,
const byte  secretKey[32],
const byte  publicKey[32],
byte  signature[64] 
)

Creates a signature on a message.

Parameters
messagebyte array with the message
messageLengthsize of the message, in bytes
publicKeybyte array with the public key
secretKeybyte array with the private key
signaturebyte array for the signature
Returns
0 on success, non-0 otherwise

ed25519_sign() generates a signature on a message using the public and private keys. The various buffers can be exact sizes, and do not require extra space like when using the NaCl library functions.

At the moment the hash function for signing is fixed at SHA512.

◆ ed25519_sign() [2/2]

int ed25519_sign ( std::istream &  stream,
const byte  secretKey[32],
const byte  publicKey[32],
byte  signature[64] 
)

Creates a signature on a message.

Parameters
streamstd::istream derived class
publicKeybyte array with the public key
secretKeybyte array with the private key
signaturebyte array for the signature
Returns
0 on success, non-0 otherwise

ed25519_sign() generates a signature on a message using the public and private keys. The various buffers can be exact sizes, and do not require extra space like when using the NaCl library functions.

This ed25519_sign() overload handles large streams. It was added for signing and verifying files that are too large for a memory allocation.

At the moment the hash function for signing is fixed at SHA512.

◆ ed25519_sign_open() [1/2]

int ed25519_sign_open ( const byte message,
size_t  messageLength,
const byte  publicKey[32],
const byte  signature[64] 
)

Verifies a signature on a message.

Parameters
messagebyte array with the message
messageLengthsize of the message, in bytes
publicKeybyte array with the public key
signaturebyte array with the signature
Returns
0 on success, non-0 otherwise

ed25519_sign_open() verifies a signature on a message using the public key. The various buffers can be exact sizes, and do not require extra space like when using the NaCl library functions.

At the moment the hash function for signing is fixed at SHA512.

◆ ed25519_sign_open() [2/2]

int ed25519_sign_open ( std::istream &  stream,
const byte  publicKey[32],
const byte  signature[64] 
)

Verifies a signature on a message.

Parameters
streamstd::istream derived class
publicKeybyte array with the public key
signaturebyte array with the signature
Returns
0 on success, non-0 otherwise

ed25519_sign_open() verifies a signature on a message using the public key. The various buffers can be exact sizes, and do not require extra space like when using the NaCl library functions.

This ed25519_sign_open() overload handles large streams. It was added for signing and verifying files that are too large for a memory allocation.

At the moment the hash function for signing is fixed at SHA512.