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

#include <bppp.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, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) const
 Deterministically prepares a message-bound nonce together with its BPPP proof.
 
Result< PreparedNonceWithProofprepare_message_nonce_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) 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, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) const
 Deterministically prepares a topic-bound nonce together with its BPPP proof.
 
Result< PreparedNonceWithProofprepare_topic_nonce_with_proof (const TopicProofCache &cache, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) 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, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) const
 Signs a message and returns the signature bundled with its BPPP nonce proof.
 
Result< ProvenSignaturesign_message_with_proof (const MessageProofCache &cache, purify_secp_context *secp_context, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) 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, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) 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, bppp::ExperimentalCircuitBackend *circuit_cache=nullptr) 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 PureSign++ signing key pair from one packed Purify secret.
 
static Result< KeyPairfrom_secret (SecretKey &&secret, purify_secp_context *secp_context)
 Derives a PureSign++ signing key pair from one owned Purify secret.
 

Detailed Description

Definition at line 430 of file bppp.hpp.

Constructor & Destructor Documentation

◆ KeyPair() [1/2]

purify::puresign_plusplus::KeyPair::KeyPair ( const KeyPair )
delete

◆ KeyPair() [2/2]

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

◆ ~KeyPair()

purify::puresign_plusplus::KeyPair::~KeyPair ( )
default

Member Function Documentation

◆ from_secret() [1/2]

Result< KeyPair > purify::puresign_plusplus::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 798 of file bppp.cpp.

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

Referenced by from_secret().

◆ from_secret() [2/2]

Result< KeyPair > purify::puresign_plusplus::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 803 of file bppp.cpp.

References purify::puresign_plusplus::PublicKey::from_secret(), public_key(), and PURIFY_ASSIGN_OR_RETURN.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ prepare_message_nonce()

Result< PreparedNonce > purify::puresign_plusplus::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 808 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_message_nonce().

Referenced by sign_message().

◆ prepare_message_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign_plusplus::KeyPair::prepare_message_nonce_with_proof ( const MessageProofCache cache,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
cacheThe prebuilt cache for the exact message to bind.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The prepared nonce plus its public proof.

Definition at line 820 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_message_nonce_with_proof().

◆ prepare_message_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign_plusplus::KeyPair::prepare_message_nonce_with_proof ( std::span< const unsigned char >  message,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
messageThe message to bind into the nonce derivation and proof statement.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The prepared nonce plus its public proof.

Definition at line 813 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_message_nonce_with_proof().

Referenced by sign_message_with_proof(), and sign_message_with_proof().

◆ prepare_topic_nonce()

Result< PreparedNonce > purify::puresign_plusplus::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 827 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_topic_nonce().

Referenced by sign_with_topic().

◆ prepare_topic_nonce_with_proof() [1/2]

Result< PreparedNonceWithProof > purify::puresign_plusplus::KeyPair::prepare_topic_nonce_with_proof ( const TopicProofCache cache,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
cacheThe prebuilt cache for the exact topic to bind.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The prepared nonce plus its public proof.

Definition at line 839 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof().

◆ prepare_topic_nonce_with_proof() [2/2]

Result< PreparedNonceWithProof > purify::puresign_plusplus::KeyPair::prepare_topic_nonce_with_proof ( std::span< const unsigned char >  topic,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
topicThe topic to bind into the nonce derivation and proof statement.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The prepared nonce plus its public proof.

Definition at line 832 of file bppp.cpp.

References purify::puresign_plusplus::api_impl::prepare_topic_nonce_with_proof().

Referenced by sign_with_topic_proof(), and sign_with_topic_proof().

◆ public_key()

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

Definition at line 458 of file bppp.hpp.

Referenced by from_secret().

◆ sign_message()

Result< Signature > purify::puresign_plusplus::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 846 of file bppp.cpp.

References prepare_message_nonce(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared().

◆ sign_message_with_prepared()

Result< Signature > purify::puresign_plusplus::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 852 of file bppp.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

Referenced by sign_message().

◆ sign_message_with_prepared_proof()

Result< ProvenSignature > purify::puresign_plusplus::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 859 of file bppp.cpp.

Referenced by sign_message_with_proof(), and sign_message_with_proof().

◆ sign_message_with_proof() [1/2]

Result< ProvenSignature > purify::puresign_plusplus::KeyPair::sign_message_with_proof ( const MessageProofCache cache,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
cacheThe prebuilt cache for the exact signed message.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The resulting signature-plus-proof bundle.

Definition at line 893 of file bppp.cpp.

References purify::puresign_plusplus::MessageProofCache::message, prepare_message_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared_proof().

◆ sign_message_with_proof() [2/2]

Result< ProvenSignature > purify::puresign_plusplus::KeyPair::sign_message_with_proof ( std::span< const unsigned char >  message,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
messageThe message to sign.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The resulting signature-plus-proof bundle.

Definition at line 885 of file bppp.cpp.

References prepare_message_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_message_with_prepared_proof().

◆ sign_with_prepared_topic()

Result< Signature > purify::puresign_plusplus::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 872 of file bppp.cpp.

References purify::derive_bip340_key(), and PURIFY_ASSIGN_OR_RETURN.

Referenced by sign_with_topic().

◆ sign_with_prepared_topic_proof()

Result< ProvenSignature > purify::puresign_plusplus::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 879 of file bppp.cpp.

Referenced by sign_with_topic_proof(), and sign_with_topic_proof().

◆ sign_with_topic()

Result< Signature > purify::puresign_plusplus::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 865 of file bppp.cpp.

References prepare_topic_nonce(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic().

◆ sign_with_topic_proof() [1/2]

Result< ProvenSignature > purify::puresign_plusplus::KeyPair::sign_with_topic_proof ( std::span< const unsigned char >  message,
const TopicProofCache cache,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
messageThe message to sign.
cacheThe prebuilt cache for the exact topic bound into the proof.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The resulting signature-plus-proof bundle.

Definition at line 910 of file bppp.cpp.

References prepare_topic_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic_proof().

◆ sign_with_topic_proof() [2/2]

Result< ProvenSignature > purify::puresign_plusplus::KeyPair::sign_with_topic_proof ( std::span< const unsigned char >  message,
std::span< const unsigned char >  topic,
purify_secp_context secp_context,
bppp::ExperimentalCircuitBackend circuit_cache = nullptr 
) const
Parameters
messageThe message to sign.
topicThe topic that the nonce proof must bind to.
circuit_cacheOptional BPPP prover cache to reuse across calls.
Returns
The resulting signature-plus-proof bundle.

Definition at line 901 of file bppp.cpp.

References prepare_topic_nonce_with_proof(), PURIFY_ASSIGN_OR_RETURN, and sign_with_prepared_topic_proof().


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