Skip to content

Commit 99e9c65

Browse files
committed
feat: use Basic scheme only for public key serialization in bls_ies
It also removes unused ToByteVector from CBLSWrapper
1 parent 91f10b1 commit 99e9c65

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/bls/bls.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,6 @@ class CBLSWrapper
127127
return impl.Serialize(specificLegacyScheme);
128128
}
129129

130-
std::vector<uint8_t> ToByteVector() const
131-
{
132-
return ToByteVector(bls::bls_legacy_scheme.load());
133-
}
134-
135130
const uint256& GetHash() const
136131
{
137132
if (cachedHash.IsNull()) {

src/bls/bls_ies.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include <crypto/aes.h>
1111

12-
template <typename Out>
13-
static bool EncryptBlob(const void* in, size_t inSize, Out& out, const void* symKey, const void* iv)
12+
static bool EncryptBlob(const void* in, size_t inSize, std::vector<unsigned char>& out, const void* symKey, const void* iv)
1413
{
1514
out.resize(inSize);
1615

@@ -45,7 +44,7 @@ bool CBLSIESEncryptedBlob::Decrypt(size_t idx, const CBLSSecretKey& secretKey, C
4544
return false;
4645
}
4746

48-
std::vector<unsigned char> symKey = pk.ToByteVector();
47+
std::vector<unsigned char> symKey = pk.ToByteVector(false);
4948
symKey.resize(32);
5049

5150
uint256 iv = GetIV(idx);
@@ -81,7 +80,7 @@ bool CBLSIESMultiRecipientBlobs::Encrypt(size_t idx, const CBLSPublicKey& recipi
8180
return false;
8281
}
8382

84-
std::vector<uint8_t> symKey = pk.ToByteVector();
83+
std::vector<uint8_t> symKey = pk.ToByteVector(false);
8584
symKey.resize(32);
8685

8786
return EncryptBlob(blob.data(), blob.size(), blobs[idx], symKey.data(), ivVector[idx].begin());
@@ -98,7 +97,7 @@ bool CBLSIESMultiRecipientBlobs::Decrypt(size_t idx, const CBLSSecretKey& sk, Bl
9897
return false;
9998
}
10099

101-
std::vector<uint8_t> symKey = pk.ToByteVector();
100+
std::vector<uint8_t> symKey = pk.ToByteVector(false);
102101
symKey.resize(32);
103102

104103
uint256 iv = ivSeed;

src/bls/bls_ies.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#include <bls/bls.h>
99
#include <streams.h>
1010

11+
/**
12+
* All objects in this module working from assumption that basic scheme is
13+
* available on all masternodes. Serialization of public key for Encrypt and
14+
* Decrypt by bls_ies.h done using Basic Scheme.
15+
*/
1116
class CBLSIESEncryptedBlob
1217
{
1318
public:

0 commit comments

Comments
 (0)