【发布时间】:2014-01-04 05:56:54
【问题描述】:
我尝试在 Crypto++ 中使用 SecretSharing 类,但无法使用。
这是我的代码:
using namespace CryptoPP;
void secretSharing(){
AutoSeededRandomPool rng;
SecretSharing shamir(rng, 4, 6);
byte test[] = {'a', 'b', 'c', 'd'};
shamir.Put(test, 4);
//shamir.MessageEnd();
//cout << shamir.TotalBytesRetrievable() <<endl;
}
编译运行后得到:
./main
terminate called after throwing an instance of 'CryptoPP::BufferedTransformation::NoChannelSupport'
what(): unknown: this object doesn't support multiple channels
[1] 3597 abort (core dumped) ./main
SecretSharing::SecretSharing()的声明是:
SecretSharing (RandomNumberGenerator &rng, int threshold, int nShares, BufferedTransformation *attachment=NULL, bool addPadding=true)
我应该给它一个BufferedTransformation*,但我应该使用哪个类?
Crypto++ 中是否有任何秘密共享示例代码?
【问题讨论】:
-
test.cpp 中有一个使用示例。看起来您应该传递一个指向
ChannelSwitch类的指针。
标签: c++ cryptography crypto++