Security Scol plugin
Macros | Functions
donna.h File Reference
#include "cryptlib.h"
#include "stdcpp.h"

Go to the source code of this file.

Macros

#define CRYPTOPP_CURVE25519_32BIT   1
 

Functions

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

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.

Macro Definition Documentation

◆ CRYPTOPP_CURVE25519_32BIT

#define CRYPTOPP_CURVE25519_32BIT   1

Definition at line 146 of 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.

Definition at line 1873 of file donna_32.cpp.

◆ 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.

Definition at line 1886 of file donna_32.cpp.

◆ 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.

Definition at line 1924 of file donna_32.cpp.

◆ 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.

Definition at line 2025 of file donna_32.cpp.

◆ 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.

Definition at line 2018 of file donna_32.cpp.

◆ 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.

Definition at line 2088 of file donna_32.cpp.

◆ 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.

Definition at line 2094 of file donna_32.cpp.