Security Scol plugin
|
Ed25519 signature algorithm. More...
#include <xed25519.h>
Public Types | |
typedef Integer | Element |
Public Member Functions | |
CRYPTOPP_CONSTANT (SECRET_KEYLENGTH=32) | |
Size of the private key. | |
CRYPTOPP_CONSTANT (PUBLIC_KEYLENGTH=32) | |
Size of the public key. | |
CRYPTOPP_CONSTANT (SIGNATURE_LENGTH=64) | |
Size of the signature. | |
ed25519Signer () | |
Create an ed25519Signer object. | |
ed25519Signer (const byte y[PUBLIC_KEYLENGTH], const byte x[SECRET_KEYLENGTH]) | |
Create an ed25519Signer object. | |
ed25519Signer (const byte x[SECRET_KEYLENGTH]) | |
Create an ed25519Signer object. | |
ed25519Signer (const Integer &y, const Integer &x) | |
Create an ed25519Signer object. | |
ed25519Signer (const Integer &x) | |
Create an ed25519Signer object. | |
ed25519Signer (const PKCS8PrivateKey &key) | |
Create an ed25519Signer object. | |
ed25519Signer (RandomNumberGenerator &rng) | |
Create an ed25519Signer object. | |
ed25519Signer (BufferedTransformation ¶ms) | |
Create an ed25519Signer object. | |
PrivateKey & | AccessKey () |
Retrieves a reference to a Private Key. | |
PrivateKey & | AccessPrivateKey () |
Retrieves a reference to a Private Key. | |
const PrivateKey & | GetKey () const |
Retrieves a reference to a Private Key. | |
const PrivateKey & | GetPrivateKey () const |
Retrieves a reference to a Private Key. | |
size_t | SignatureLength () const |
Provides the signature length if it only depends on the key. | |
size_t | MaxRecoverableLength () const |
Provides the length of longest message that can be recovered. | |
size_t | MaxRecoverableLengthFromSignatureLength (size_t signatureLength) const |
Provides the length of longest message that can be recovered from a signature of given length. | |
bool | IsProbabilistic () const |
Determines whether a signature scheme requires a random number generator. | |
bool | AllowNonrecoverablePart () const |
Determines whether the non-recoverable message part can be signed. | |
bool | RecoverablePartFirst () const |
Determines whether the recoverable part must be input before the non-recoverable part. | |
PK_MessageAccumulator * | NewSignatureAccumulator (RandomNumberGenerator &rng) const |
Create a new HashTransformation to accumulate the message to be signed. | |
void | InputRecoverableMessage (PK_MessageAccumulator &messageAccumulator, const byte *recoverableMessage, size_t recoverableMessageLength) const |
Input a recoverable message to an accumulator. | |
size_t | SignAndRestart (RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart) const |
Sign and restart messageAccumulator. | |
size_t | SignStream (RandomNumberGenerator &rng, std::istream &stream, byte *signature) const |
Sign a stream. | |
Public Member Functions inherited from PK_Signer | |
virtual size_t | Sign (RandomNumberGenerator &rng, PK_MessageAccumulator *messageAccumulator, byte *signature) const |
Sign and delete the messageAccumulator. | |
virtual size_t | SignMessage (RandomNumberGenerator &rng, const byte *message, size_t messageLen, byte *signature) const |
Sign a message. | |
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. | |
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. | |
virtual bool | SignatureUpfront () const |
Determines whether the signature must be input before the message. | |
Public Member Functions inherited from PrivateKeyAlgorithm | |
CryptoMaterial & | AccessMaterial () |
Retrieves a reference to a Private Key. | |
const CryptoMaterial & | GetMaterial () const |
Retrieves a reference to a Private Key. | |
Public Member Functions inherited from Algorithm | |
Algorithm (bool checkSelfTestStatus=true) | |
Interface for all crypto algorithms. | |
virtual std::string | AlgorithmName () const |
Provides the name of this algorithm. | |
virtual std::string | AlgorithmProvider () const |
Retrieve the provider of this algorithm. | |
Public Member Functions inherited from Clonable | |
virtual Clonable * | Clone () const |
Copies this object. | |
Protected Attributes | |
ed25519PrivateKey | m_key |
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.
|
inlinevirtual |
Determines whether the non-recoverable message part can be signed.
Implements PK_SignatureScheme.
Definition at line 582 of file xed25519.h.
ed25519Signer::CRYPTOPP_CONSTANT | ( | PUBLIC_KEYLENGTH | = 32 | ) |
Size of the public key.
PUBLIC_KEYLENGTH is the size of the public key, in bytes.
ed25519Signer::CRYPTOPP_CONSTANT | ( | SECRET_KEYLENGTH | = 32 | ) |
Size of the private key.
SECRET_KEYLENGTH is the size of the private key, in bytes.
ed25519Signer::CRYPTOPP_CONSTANT | ( | SIGNATURE_LENGTH | = 64 | ) |
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
.
|
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 |
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.
|
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 |
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 |
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 |
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.
|
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.
|
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.
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.
|
protected |
Definition at line 612 of file xed25519.h.