purify
C++ Purify implementation with native circuit and BPP support
Loading...
Searching...
No Matches
purify::puresign::KeyPair Class Reference

#include <legacy.hpp>

Public Member Functions

 KeyPair (const KeyPair &)=delete
 
KeyPairoperator= (const KeyPair &)=delete
 
 KeyPair (KeyPair &&other) noexcept=default
 
KeyPairoperator= (KeyPair &&other) noexcept=default
 
 ~KeyPair ()=default
 
const PublicKeypublic_key () const noexcept
 Returns the public key bundle associated with this signer.
 
Result< PreparedNonceprepare_message_nonce (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Deterministically prepares a message-bound nonce.
 
Result< PreparedNonceWithProofprepare_message_nonce_with_proof (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Deterministically prepares a message-bound nonce together with its proof.
 
Result< PreparedNonceWithProofprepare_message_nonce_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context) const
 Prepares a message-bound nonce proof using a reusable message cache.
 
Result< PreparedNonceprepare_topic_nonce (std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Deterministically prepares a topic-bound nonce.
 
Result< PreparedNonceWithProofprepare_topic_nonce_with_proof (std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Deterministically prepares a topic-bound nonce together with its proof.
 
Result< PreparedNonceWithProofprepare_topic_nonce_with_proof (const TopicProofCache &cache, purify_secp_context *secp_context) const
 Prepares a topic-bound nonce proof using a reusable topic cache.
 
Result< Signaturesign_message (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Signs a message with a deterministically derived message-bound nonce.
 
Result< Signaturesign_message_with_prepared (std::span< const unsigned char > message, PreparedNonce &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared message-bound nonce.
 
Result< ProvenSignaturesign_message_with_prepared_proof (std::span< const unsigned char > message, PreparedNonceWithProof &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared message-bound nonce proof bundle.
 
Result< Signaturesign_with_topic (std::span< const unsigned char > message, std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Signs a message using a topic-bound deterministic nonce.
 
Result< Signaturesign_with_prepared_topic (std::span< const unsigned char > message, PreparedNonce &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared topic-bound nonce.
 
Result< ProvenSignaturesign_with_prepared_topic_proof (std::span< const unsigned char > message, PreparedNonceWithProof &&prepared, purify_secp_context *secp_context) const
 Signs a message using an already prepared topic-bound nonce proof bundle.
 
Result< ProvenSignaturesign_message_with_proof (std::span< const unsigned char > message, purify_secp_context *secp_context) const
 Signs a message and returns the signature bundled with its nonce proof.
 
Result< ProvenSignaturesign_message_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context) const
 Signs a message with proof using a reusable message cache.
 
Result< ProvenSignaturesign_with_topic_proof (std::span< const unsigned char > message, std::span< const unsigned char > topic, purify_secp_context *secp_context) const
 Signs a message with a topic-bound nonce proof.
 
Result< ProvenSignaturesign_with_topic_proof (std::span< const unsigned char > message, const TopicProofCache &cache, purify_secp_context *secp_context) const
 Signs a message with a topic-bound nonce proof using a reusable topic cache.
 

Static Public Member Functions

static Result< KeyPairfrom_secret (const SecretKey &secret, purify_secp_context *secp_context)
 Derives a signing key pair from one packed Purify secret.
 
static Result< KeyPairfrom_secret (SecretKey &&secret, purify_secp_context *secp_context)
 Derives a signing key pair from one owned Purify secret.
 

Detailed Description

Definition at line 445 of file legacy.hpp.

Constructor & Destructor Documentation

◆ KeyPair() [1/2]

purify::puresign::KeyPair::KeyPair ( const KeyPair )
delete

◆ KeyPair() [2/2]

purify::puresign::KeyPair::KeyPair ( KeyPair &&  other)
defaultnoexcept

◆ ~KeyPair()

purify::puresign::KeyPair::~KeyPair ( )
default

Member Function Documentation

◆ from_secret() [1/2]

Result< KeyPair > purify::puresign::KeyPair::from_secret ( const SecretKey secret,
purify_secp_context secp_context 
)
static
Parameters
secretThe secret to clone into the returned key pair.
Returns
A move-only signer object bundling the secret and public key.

Definition at line 779 of file legacy.cpp.

References purify::SecretKey::clone(), and PURIFY_ASSIGN_OR_RETURN.

◆ from_secret() [2/2]

Result< KeyPair > purify::puresign::KeyPair::from_secret ( SecretKey &&  secret,
purify_secp_context secp_context 
)
static
Parameters
secretThe secret to move into the returned key pair.
Returns
A move-only signer object bundling the secret and public key.

Definition at line 784 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.

◆ operator=() [1/2]

KeyPair & purify::puresign::KeyPair::operator= ( const KeyPair )
delete

◆ operator=() [2/2]

KeyPair & purify::puresign::KeyPair::operator= ( KeyPair &&  other)
defaultnoexcept

◆ prepare_message_nonce()

Result< PreparedNonce > purify::puresign::KeyPair::prepare_message_nonce ( std::span< const unsigned char >  message,
purify_secp_context secp_context 
) const
Parameters
messageThe message to bind into the nonce derivation.
Returns
The move-only prepared nonce.

Definition at line 789 of file legacy.cpp.

◆ prepare_message_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_message_nonce_with_proof ( const MessageProofCache cache,
purify_secp_context secp_context 
) const
Parameters
cacheThe prebuilt cache for the exact message to bind.
Returns
The prepared nonce plus its public proof.

Definition at line 799 of file legacy.cpp.

◆ prepare_message_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_message_nonce_with_proof ( std::span< const unsigned char >  message,
purify_secp_context secp_context 
) const
Parameters
messageThe message to bind into the nonce derivation and proof statement.
Returns
The prepared nonce plus its public proof.

Definition at line 794 of file legacy.cpp.

◆ prepare_topic_nonce()

Result< PreparedNonce > purify::puresign::KeyPair::prepare_topic_nonce ( std::span< const unsigned char >  topic,
purify_secp_context secp_context 
) const
Parameters
topicThe topic to bind into the nonce derivation.
Returns
The move-only prepared nonce.

Definition at line 804 of file legacy.cpp.

◆ prepare_topic_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_topic_nonce_with_proof ( const TopicProofCache cache,
purify_secp_context secp_context 
) const
Parameters
cacheThe prebuilt cache for the exact topic to bind.
Returns
The prepared nonce plus its public proof.

Definition at line 814 of file legacy.cpp.

◆ prepare_topic_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign::KeyPair::prepare_topic_nonce_with_proof ( std::span< const unsigned char >  topic,
purify_secp_context secp_context 
) const
Parameters
topicThe topic to bind into the nonce derivation and proof statement.
Returns
The prepared nonce plus its public proof.

Definition at line 809 of file legacy.cpp.

◆ public_key()

const PublicKey & purify::puresign::KeyPair::public_key ( ) const
inlinenoexcept
Returns
The derived public-key bundle.

Definition at line 473 of file legacy.hpp.

◆ sign_message()

Result< Signature > purify::puresign::KeyPair::sign_message ( std::span< const unsigned char >  message,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
Returns
The resulting BIP340 signature.

Definition at line 819 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.

◆ sign_message_with_prepared()

Result< Signature > purify::puresign::KeyPair::sign_message_with_prepared ( std::span< const unsigned char >  message,
PreparedNonce &&  prepared,
purify_secp_context secp_context 
) const
Parameters
messageThe message that must match the prepared nonce binding.
preparedThe prepared message-bound nonce to consume.
Returns
The resulting BIP340 signature.

Definition at line 825 of file legacy.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

◆ sign_message_with_prepared_proof()

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_prepared_proof ( std::span< const unsigned char >  message,
PreparedNonceWithProof &&  prepared,
purify_secp_context secp_context 
) const
Parameters
messageThe message that must match the prepared nonce binding.
preparedThe prepared nonce-plus-proof bundle to consume.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 832 of file legacy.cpp.

◆ sign_message_with_proof() [1/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_proof ( const MessageProofCache cache,
purify_secp_context secp_context 
) const
Parameters
cacheThe prebuilt cache for the exact signed message.
Returns
The resulting signature-plus-proof bundle.

Definition at line 865 of file legacy.cpp.

References purify::puresign::MessageProofCache::message, and PURIFY_ASSIGN_OR_RETURN.

◆ sign_message_with_proof() [2/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_message_with_proof ( std::span< const unsigned char >  message,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
Returns
The resulting signature-plus-proof bundle.

Definition at line 858 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.

◆ sign_with_prepared_topic()

Result< Signature > purify::puresign::KeyPair::sign_with_prepared_topic ( std::span< const unsigned char >  message,
PreparedNonce &&  prepared,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
preparedThe topic-bound nonce to consume.
Returns
The resulting BIP340 signature.

Definition at line 845 of file legacy.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

◆ sign_with_prepared_topic_proof()

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_prepared_topic_proof ( std::span< const unsigned char >  message,
PreparedNonceWithProof &&  prepared,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
preparedThe topic-bound nonce-plus-proof bundle to consume.
Returns
The resulting signature bundled with its nonce proof.

Definition at line 852 of file legacy.cpp.

◆ sign_with_topic()

Result< Signature > purify::puresign::KeyPair::sign_with_topic ( std::span< const unsigned char >  message,
std::span< const unsigned char >  topic,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
topicThe topic that the nonce must be bound to.
Returns
The resulting BIP340 signature.

Definition at line 838 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.

◆ sign_with_topic_proof() [1/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_topic_proof ( std::span< const unsigned char >  message,
const TopicProofCache cache,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
cacheThe prebuilt cache for the exact topic bound into the proof.
Returns
The resulting signature-plus-proof bundle.

Definition at line 880 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.

◆ sign_with_topic_proof() [2/2]

Result< ProvenSignature > purify::puresign::KeyPair::sign_with_topic_proof ( std::span< const unsigned char >  message,
std::span< const unsigned char >  topic,
purify_secp_context secp_context 
) const
Parameters
messageThe message to sign.
topicThe topic that the nonce proof must bind to.
Returns
The resulting signature-plus-proof bundle.

Definition at line 872 of file legacy.cpp.

References PURIFY_ASSIGN_OR_RETURN.


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