Crypto++ 7.0 Free C++ class library of cryptographic schemes

Public Types | Public Member Functions | Static Public Attributes | List of all members
ed25519Signer Struct Reference

Ed25519 signature algorithm. More...

Inheritance diagram for ed25519Signer:

## Public Types
typedef Integer | Element

## Public Member Functions
| ed25519Signer ()
| Create a ed25519Signer object.
| ed25519Signer (const byte y[PUBLIC_KEYLENGTH], const byte x[SECRET_KEYLENGTH])
| Create a ed25519Signer object. More...
| ed25519Signer (const byte x[SECRET_KEYLENGTH])
| Create a ed25519Signer object. More...
| ed25519Signer (const Integer &y, const Integer &x)
| Create a ed25519Signer object. More...
| ed25519Signer (const Integer &x)
| Create a ed25519Signer object. More...
| ed25519Signer (RandomNumberGenerator &rng)
| Create a ed25519Signer object. More...
| ed25519Signer (BufferedTransformation &params)
| Create a ed25519Signer object. More...
PrivateKey & | AccessKey ()
PrivateKey & | AccessPrivateKey ()
| Retrieves a reference to a Private Key. More...
const PrivateKey & | GetKey () const
const PrivateKey & | GetPrivateKey () const
| Retrieves a reference to a Private Key. More...
size_t | SignatureLength () const
| Provides the signature length if it only depends on the key. More...
size_t | MaxRecoverableLength () const
| Provides the length of longest message that can be recovered. More...
size_t | MaxRecoverableLengthFromSignatureLength (size_t signatureLength) const
| Provides the length of longest message that can be recovered from a signature of given length. More...
bool | IsProbabilistic () const
| Determines whether a signature scheme requires a random number generator. More...
bool | AllowNonrecoverablePart () const
| Determines whether the non-recoverable message part can be signed. More...
bool | RecoverablePartFirst () const
| Determines whether the recoverable part must be input before the non-recoverable part. More...
PK_MessageAccumulator * | NewSignatureAccumulator (RandomNumberGenerator &rng) const
| Create a new HashTransformation to accumulate the message to be signed. More...
void | InputRecoverableMessage (PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const
| Input a recoverable message to an accumulator. More...
size_t | SignAndRestart (RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const
| Sign and restart messageAccumulator. More...
Public Member Functions inherited from PK_Signer
virtual size_t | Sign (RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const
| Sign and delete the messageAccumulator. More...
virtual size_t | SignMessage (RandomNumberGenerator &rng, const byte *message, size_t messageLen, byte *signature) const
| Sign a message. More...
virtual size_t | SignMessageWithRecovery (RandomNumberGenerator &rng, const byte *recoverableMessage, size_t recoverableMessageLength, const byte *nonrecoverableMessage, size_t nonrecoverableMessageLength, byte *signature) const
| Sign a recoverable message. More...
Public Member Functions inherited from PK_SignatureScheme
virtual size_t | MaxSignatureLength (size_t recoverablePartLength=0) const
| Provides the maximum signature length produced given the length of the recoverable message part. More...
virtual bool | SignatureUpfront () const
| Determines whether the signature must be input before the message. More...
Public Member Functions inherited from PrivateKeyAlgorithm
CryptoMaterial & | AccessMaterial ()
| Retrieves a reference to a Private Key. More...
const CryptoMaterial & | GetMaterial () const
| Retrieves a reference to a Private Key. More...
Public Member Functions inherited from Algorithm
| Algorithm (bool checkSelfTestStatus=true)
| Interface for all crypto algorithms. More...
virtual std::string | AlgorithmName () const
| Provides the name of this algorithm. More...
virtual std::string | AlgorithmProvider () const
| Retrieve the provider of this algorithm. More...
Public Member Functions inherited from Clonable
virtual Clonable * | Clone () const
| Copies this object. More...

## Static Public Attributes
static const int | SECRET_KEYLENGTH = 32
| Size of the private key. More...
static const int | PUBLIC_KEYLENGTH = 32
| Size of the public key. More...
static const int | SIGNATURE_LENGTH = 64
| Size of the siganture. More...

## Detailed Description

Ed25519 signature algorithm.

Since
  Crypto++ 8.0

Definition at line 476 of file xed25519.h.

## Constructor & Destructor Documentation

## ◆ ed25519Signer() [1/6]

ed25519Signer::ed25519Signer | ( | const byte | y[PUBLIC_KEYLENGTH],
|  | const byte | x[SECRET_KEYLENGTH]
| ) |  |

Create a ed25519Signer object.

Parameters

  y | public key
  x | private key

This constructor creates a ed25519Signer object using existing parameters.

Note
  The public key is not validated.

Definition at line 581 of file xed25519.cpp.

## ◆ ed25519Signer() [2/6]

ed25519Signer::ed25519Signer | ( | const byte | x[SECRET_KEYLENGTH] | ) |

Create a ed25519Signer object.

Parameters

  x | private key

This constructor creates a ed25519Signer object using existing parameters. The public key is calculated from the private key.

Definition at line 588 of file xed25519.cpp.

## ◆ ed25519Signer() [3/6]

ed25519Signer::ed25519Signer | ( | const Integer & | y,
|  | const Integer & | x
| ) |  |

Create a ed25519Signer object.

Parameters

  y | public key
  x | private key

This constructor creates a ed25519Signer object using existing parameters.

Note
  The public key is not validated.

Definition at line 595 of file xed25519.cpp.

## ◆ ed25519Signer() [4/6]

ed25519Signer::ed25519Signer | ( | const Integer & | x | ) |

Create a ed25519Signer object.

Parameters

  x | private key

This constructor creates a ed25519Signer object using existing parameters. The public key is calculated from the private key.

Definition at line 609 of file xed25519.cpp.

## ◆ ed25519Signer() [5/6]

ed25519Signer::ed25519Signer | ( | RandomNumberGenerator & | rng | ) |

Create a ed25519Signer object.

Parameters

  rng | RandomNumberGenerator derived class

This constructor creates a new ed25519Signer using the random number generator.

Definition at line 621 of file xed25519.cpp.

## ◆ ed25519Signer() [6/6]

ed25519Signer::ed25519Signer | ( | BufferedTransformation & | params | ) |

Create a ed25519Signer object.

Parameters

  params | public and private key

This constructor creates a ed25519Signer object using existing parameters. The `params` can be created with `Save`.

Note
  The public key is not validated.

Definition at line 626 of file xed25519.cpp.

## Member Function Documentation

## ◆ AccessPrivateKey()

PrivateKey& ed25519Signer::AccessPrivateKey | ( |  | ) |
| inline virtual

Retrieves a reference to a Private Key.

Returns
  a reference the private key

Implements PrivateKeyAlgorithm.

Definition at line 536 of file xed25519.h.

## ◆ GetPrivateKey()

const PrivateKey& ed25519Signer::GetPrivateKey | ( |  | ) | const
| inline virtual

Retrieves a reference to a Private Key.

Returns
  a const reference the private key

Reimplemented from PrivateKeyAlgorithm.

Definition at line 539 of file xed25519.h.

## ◆ SignatureLength()

size_t ed25519Signer::SignatureLength | ( |  | ) | const
| inline virtual

Provides the signature length if it only depends on the key.

Returns
  the signature length if it only depends on the key, in bytes

SignatureLength() returns the signature length if it only depends on the key, otherwise 0.

Implements PK_SignatureScheme.

Definition at line 542 of file xed25519.h.

## ◆ MaxRecoverableLength()

size_t ed25519Signer::MaxRecoverableLength | ( |  | ) | const
| inline virtual

Provides the length of longest message that can be recovered.

Returns
  the length of longest message that can be recovered, in bytes

MaxRecoverableLength() returns the length of longest message that can be recovered, or 0 if this signature scheme does not support message recovery.

Implements PK_SignatureScheme.

Definition at line 543 of file xed25519.h.

## ◆ MaxRecoverableLengthFromSignatureLength()

size_t ed25519Signer::MaxRecoverableLengthFromSignatureLength | ( | size_t | signatureLength | ) | const
| inline virtual

Provides the length of longest message that can be recovered from a signature of given length.

Parameters

  signatureLength | the length of the signature, in bytes

Returns
  the length of longest message that can be recovered from a signature of given length, in bytes

MaxRecoverableLengthFromSignatureLength() returns the length of longest message that can be recovered from a signature of given length, or 0 if this signature scheme does not support message recovery.

Implements PK_SignatureScheme.

Definition at line 544 of file xed25519.h.

## ◆ IsProbabilistic()

bool ed25519Signer::IsProbabilistic | ( |  | ) | const
| inline virtual

Determines whether a signature scheme requires a random number generator.

Returns
  true if the signature scheme requires a RandomNumberGenerator() to sign

if IsProbabilistic() returns false, then NullRNG() can be passed to functions that take RandomNumberGenerator().

Implements PK_SignatureScheme.

Definition at line 548 of file xed25519.h.

## ◆ AllowNonrecoverablePart()

bool ed25519Signer::AllowNonrecoverablePart | ( |  | ) | const
| inline virtual

Determines whether the non-recoverable message part can be signed.

Returns
  true if the non-recoverable message part can be signed

Implements PK_SignatureScheme.

Definition at line 549 of file xed25519.h.

## ◆ RecoverablePartFirst()

bool ed25519Signer::RecoverablePartFirst | ( |  | ) | const
| inline virtual

Determines whether the recoverable part must be input before the non-recoverable part.

Returns
  true if the recoverable part must be input before the non-recoverable part during signing

RecoverablePartFirst() determines whether you must input the recoverable part before the non-recoverable part during signing

Implements PK_SignatureScheme.

Definition at line 550 of file xed25519.h.

## ◆ NewSignatureAccumulator()

PK_MessageAccumulator* ed25519Signer::NewSignatureAccumulator | ( | RandomNumberGenerator & | rng | ) | const
| inline virtual

Create a new HashTransformation to accumulate the message to be signed.

Parameters

  rng | a RandomNumberGenerator derived class

Returns
  a pointer to a PK_MessageAccumulator

NewSignatureAccumulator() can be used with all signing methods. Sign() will autimatically delete the accumulator pointer. The caller is responsible for deletion if a method is called that takes a reference.

Implements PK_Signer.

Definition at line 552 of file xed25519.h.

## ◆ InputRecoverableMessage()

void ed25519Signer::InputRecoverableMessage | ( | PK_MessageAccumulator & | messageAccumulator,
|  | const byte * | recoverableMessage,
|  | size_t | recoverableMessageLength
| ) |  | const
| inline virtual

Input a recoverable message to an accumulator.

Parameters

  messageAccumulator | a reference to a PK_MessageAccumulator
  recoverableMessage | a pointer to the recoverable message part to be signed
  recoverableMessageLength | the size of the recoverable message part

Implements PK_Signer.

Definition at line 556 of file xed25519.h.

## ◆ SignAndRestart()

size_t ed25519Signer::SignAndRestart | ( | RandomNumberGenerator & | rng,
|  | PK_MessageAccumulator & | messageAccumulator,
|  | byte * | signature,
|  | bool | restart
| ) |  | const
| virtual

Sign and restart messageAccumulator.

Parameters

  rng | a RandomNumberGenerator derived class
  messageAccumulator | a pointer to a PK_MessageAccumulator derived class
  signature | a block of bytes for the signature
  restart | flag indicating whether the messageAccumulator should be restarted

Returns
  actual signature length

Precondition
  `COUNTOF(signature) == MaxSignatureLength()`

Implements PK_Signer.

Definition at line 631 of file xed25519.cpp.

## Member Data Documentation

## ◆ SECRET_KEYLENGTH

const int ed25519Signer::SECRET_KEYLENGTH = 32
| static

Size of the private key.

SECRET_KEYLENGTH is the size of the private key, in bytes.

Definition at line 480 of file xed25519.h.

## ◆ PUBLIC_KEYLENGTH

const int ed25519Signer::PUBLIC_KEYLENGTH = 32
| static

Size of the public key.

PUBLIC_KEYLENGTH is the size of the public key, in bytes.

Definition at line 483 of file xed25519.h.

## ◆ SIGNATURE_LENGTH

const int ed25519Signer::SIGNATURE_LENGTH = 64
| static

Size of the siganture.

SIGNATURE_LENGTH is the size of the signature, in bytes. ed25519 is a DL-based signature scheme. The signature is the concatenation of `r || s`.

Definition at line 488 of file xed25519.h.

The documentation for this struct was generated from the following files:

- xed25519.h
- xed25519.cpp