Crypto++ 8.7
Free C++ class library of cryptographic schemes
|
Ed25519 signature algorithm. More...
#include <xed25519.h>
Public Types | |
typedef Integer | Element |
Public Member Functions | |
ed25519Signer () | |
Create an ed25519Signer object. More... | |
ed25519Signer (const byte y[PUBLIC_KEYLENGTH], const byte x[SECRET_KEYLENGTH]) | |
Create an ed25519Signer object. More... | |
ed25519Signer (const byte x[SECRET_KEYLENGTH]) | |
Create an ed25519Signer object. More... | |
ed25519Signer (const Integer &y, const Integer &x) | |
Create an ed25519Signer object. More... | |
ed25519Signer (const Integer &x) | |
Create an ed25519Signer object. More... | |
ed25519Signer (const PKCS8PrivateKey &key) | |
Create an ed25519Signer object. More... | |
ed25519Signer (RandomNumberGenerator &rng) | |
Create an ed25519Signer object. More... | |
ed25519Signer (BufferedTransformation ¶ms) | |
Create an ed25519Signer object. More... | |
PrivateKey & | AccessKey () |
Retrieves a reference to a Private Key. More... | |
PrivateKey & | AccessPrivateKey () |
Retrieves a reference to a Private Key. More... | |
const PrivateKey & | GetKey () const |
Retrieves a reference to a Private Key. More... | |
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... | |
size_t | SignStream (RandomNumberGenerator &rng, std::istream &stream, byte *signature) const |
Sign a stream. More... | |
Public Member Functions inherited from PK_Signer | |
virtual PK_MessageAccumulator * | NewSignatureAccumulator (RandomNumberGenerator &rng) const =0 |
Create a new HashTransformation to accumulate the message to be signed. More... | |
virtual void | InputRecoverableMessage (PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const =0 |
Input a recoverable message to an accumulator. More... | |
virtual size_t | Sign (RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const |
Sign and delete the messageAccumulator. More... | |
virtual size_t | SignAndRestart (RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const =0 |
Sign and restart 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 | SignatureLength () const =0 |
Provides the signature length if it only depends on the key. More... | |
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 size_t | MaxRecoverableLength () const =0 |
Provides the length of longest message that can be recovered. More... | |
virtual size_t | MaxRecoverableLengthFromSignatureLength (size_t signatureLength) const =0 |
Provides the length of longest message that can be recovered from a signature of given length. More... | |
virtual bool | IsProbabilistic () const =0 |
Determines whether a signature scheme requires a random number generator. More... | |
virtual bool | AllowNonrecoverablePart () const =0 |
Determines whether the non-recoverable message part can be signed. More... | |
virtual bool | SignatureUpfront () const |
Determines whether the signature must be input before the message. More... | |
virtual bool | RecoverablePartFirst () const =0 |
Determines whether the recoverable part must be input before the non-recoverable part. 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... | |
virtual PrivateKey & | AccessPrivateKey ()=0 |
Retrieves a reference to a Private Key. More... | |
virtual const PrivateKey & | GetPrivateKey () const |
Retrieves a reference to a Private Key. More... | |
virtual CryptoMaterial & | AccessMaterial ()=0 |
Retrieves a reference to CryptoMaterial. More... | |
virtual const CryptoMaterial & | GetMaterial () const =0 |
Retrieves a reference to CryptoMaterial. 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 signature. More... | |
typedef Integer ed25519Signer::Element |
Definition at line 511 of file xed25519.h.
|
inlinevirtual |
Definition at line 513 of file xed25519.h.
|
inline |
Create an ed25519Signer object.
Definition at line 516 of file xed25519.h.
Create an ed25519Signer object.
y | public key |
x | private key |
This constructor creates an ed25519Signer object using existing parameters.
Definition at line 626 of file xed25519.cpp.
ed25519Signer::ed25519Signer | ( | const byte | x[SECRET_KEYLENGTH] | ) |
Create an ed25519Signer object.
x | private key |
This constructor creates an ed25519Signer object using existing parameters. The public key is calculated from the private key.
Definition at line 633 of file xed25519.cpp.
Create an ed25519Signer object.
y | public key |
x | private key |
This constructor creates an ed25519Signer object using existing parameters.
Definition at line 640 of file xed25519.cpp.
ed25519Signer::ed25519Signer | ( | const Integer & | x | ) |
Create an ed25519Signer object.
x | private key |
This constructor creates an ed25519Signer object using existing parameters. The public key is calculated from the private key.
Definition at line 654 of file xed25519.cpp.
ed25519Signer::ed25519Signer | ( | const PKCS8PrivateKey & | key | ) |
Create an ed25519Signer object.
key | PKCS8 private key |
This constructor creates an ed25519Signer object using existing private key.
Definition at line 666 of file xed25519.cpp.
ed25519Signer::ed25519Signer | ( | RandomNumberGenerator & | rng | ) |
Create an ed25519Signer object.
rng | RandomNumberGenerator derived class |
This constructor creates a new ed25519Signer using the random number generator.
Definition at line 674 of file xed25519.cpp.
ed25519Signer::ed25519Signer | ( | BufferedTransformation & | params | ) |
Create an ed25519Signer object.
params | public and private key |
This constructor creates an ed25519Signer object using existing parameters. The params
can be created with Save
.
Definition at line 679 of file xed25519.cpp.
|
inline |
Retrieves a reference to a Private Key.
AccessKey() retrieves a non-const reference to a private key.
Definition at line 566 of file xed25519.h.
|
inlinevirtual |
Retrieves a reference to a Private Key.
Implements PrivateKeyAlgorithm.
Definition at line 567 of file xed25519.h.
|
inline |
Retrieves a reference to a Private Key.
AccessKey() retrieves a const reference to a private key.
Definition at line 571 of file xed25519.h.
|
inlinevirtual |
Retrieves a reference to a Private Key.
Reimplemented from PrivateKeyAlgorithm.
Definition at line 572 of file xed25519.h.
|
inlinevirtual |
Provides the signature length if it only depends on the key.
SignatureLength() returns the signature length if it only depends on the key, otherwise 0.
Implements PK_SignatureScheme.
Definition at line 575 of file xed25519.h.
|
inlinevirtual |
Provides the length of longest message that can be recovered.
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 576 of file xed25519.h.
|
inlinevirtual |
Provides the length of longest message that can be recovered from a signature of given length.
signatureLength | the length of the signature, 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 577 of file xed25519.h.
|
inlinevirtual |
Determines whether a signature scheme requires a random number generator.
if IsProbabilistic() returns false, then NullRNG() can be passed to functions that take RandomNumberGenerator().
Implements PK_SignatureScheme.
Definition at line 581 of file xed25519.h.
|
inlinevirtual |
Determines whether the non-recoverable message part can be signed.
Implements PK_SignatureScheme.
Definition at line 582 of file xed25519.h.
|
inlinevirtual |
Determines whether the recoverable part must be input before the non-recoverable part.
RecoverablePartFirst() determines whether you must input the recoverable part before the non-recoverable part during signing
Implements PK_SignatureScheme.
Definition at line 583 of file xed25519.h.
|
inlinevirtual |
Create a new HashTransformation to accumulate the message to be signed.
rng | a RandomNumberGenerator derived class |
NewSignatureAccumulator() can be used with all signing methods. Sign() will automatically 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 585 of file xed25519.h.
|
inlinevirtual |
Input a recoverable message to an accumulator.
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 589 of file xed25519.h.
|
virtual |
Sign and restart messageAccumulator.
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 |
COUNTOF(signature) == MaxSignatureLength()
Implements PK_Signer.
Definition at line 684 of file xed25519.cpp.
size_t ed25519Signer::SignStream | ( | RandomNumberGenerator & | rng, |
std::istream & | stream, | ||
byte * | signature | ||
) | const |
Sign a stream.
rng | a RandomNumberGenerator derived class |
stream | an std::istream derived class |
signature | a block of bytes for the signature |
SignStream() handles large streams. The Stream functions were added to ed25519 for signing and verifying files that are too large for a memory allocation. The functions are not present in other library signers and verifiers.
ed25519 is a deterministic signature scheme. IsProbabilistic()
returns false and the random number generator can be NullRNG()
.
COUNTOF(signature) == MaxSignatureLength()
Definition at line 699 of file xed25519.cpp.
|
static |
Size of the private key.
SECRET_KEYLENGTH is the size of the private key, in bytes.
Definition at line 502 of file xed25519.h.
|
static |
Size of the public key.
PUBLIC_KEYLENGTH is the size of the public key, in bytes.
Definition at line 505 of file xed25519.h.
|
static |
Size of the signature.
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 510 of file xed25519.h.