Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions threshold_encryption/TEDecryptionShare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,21 @@ along with libBLS. If not, see <https://www.gnu.org/licenses/>.

namespace libBLS {

TEDecryptionShare::TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex )
TEDecryptionShare::TEDecryptionShare(
const algebra::G2Point& _share, size_t _signerIndex, bool _validate )
: signerIndex( _signerIndex ), share( _share ) {
share.validate();
if ( _validate ) {
share.validate();
Comment thread
PropzSaladaz marked this conversation as resolved.
}
}

TEDecryptionShare::TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex )
TEDecryptionShare::TEDecryptionShare(
const std::string& _hexaEncoded, size_t _signerIndex, bool _validate )
: signerIndex( _signerIndex ) {
share = algebra::G2Point::fromString( _hexaEncoded, Base::HEXA );
share.validate();
if ( _validate ) {
share.validate();
}
}

size_t TEDecryptionShare::getSignerIndex() const {
Expand Down
17 changes: 11 additions & 6 deletions threshold_encryption/TEDecryptionShare.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,23 @@ class TEDecryptionShare {

public:
/**
* @param _signerIndex Index of the signer
* @param _share Decryption share
* @note Validates that the share is well formed and non-zero.
* @param _signerIndex Index of the signer
* @param _validate Whether to validate the share or not (Optional, default: true)
* Note: Validation is a costly operation, so it can be skipped if the share is already known to
* be valid.
*/
TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex );
TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate = true );
Comment thread
PropzSaladaz marked this conversation as resolved.

/**
* @param _signerIndex Index of the signer
* @param _hexaEncoded Hexa encoded string of the share
* @note Used when building from serialized decription share
* @param _signerIndex Index of the signer
* @param _validate Whether to validate the share or not (Optional, default: true)
* Note: Validation is a costly operation, so it can be skipped if the share is already known to
* be valid.
*/
TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex );
TEDecryptionShare(
const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true );


size_t getSignerIndex() const;
Expand Down
Loading