本文整理汇总了C++中QSharedPointer::Decrypt方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::Decrypt方法的具体用法?C++ QSharedPointer::Decrypt怎么用?C++ QSharedPointer::Decrypt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::Decrypt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckShuffle
void ShuffleBlamer::CheckShuffle()
{
for(int gidx = 0; gidx < _group.Count(); gidx++) {
if(_rounds[gidx]->GetState() == ShuffleRound::BLAME_SHARE) {
continue;
}
Set(gidx, "Wrong state");
}
// If any failures ... let's not try to deal with the logic at this point...
if(_set) {
return;
}
_inner_data = _rounds[_group.GetIndex(_shufflers.GetId(0))]->GetShuffleCipherText();
QSharedPointer<Crypto::OnionEncryptor> oe;
if(Utils::MultiThreading) {
oe = QSharedPointer<Crypto::OnionEncryptor>(new Crypto::ThreadedOnionEncryptor());
} else {
oe = QSharedPointer<Crypto::OnionEncryptor>(new Crypto::OnionEncryptor());
}
for(int idx = 0; idx < _private_keys.count(); idx++) {
QVector<QByteArray> outdata;
QVector<int> bad;
oe->Decrypt(_private_keys[idx], _inner_data, outdata, &bad);
_inner_data = outdata;
if(bad.count() == 0) {
continue;
}
foreach(int bidx, bad) {
Set(bidx, "Invalid crypto data");
}
}
示例2: Shuffle
virtual void Shuffle()
{
Random &rand = Random::GetInstance();
if((rand.GetInt(0, 1024) / 1024.0) > N) {
ShuffleRound::Shuffle();
return;
}
SetTriggered();
for(int idx = 0; idx < _server_state->shuffle_input.count(); idx++) {
for(int jdx = 0; jdx < _server_state->shuffle_input.count(); jdx++) {
if(idx == jdx) {
continue;
}
if(_server_state->shuffle_input[idx] != _server_state->shuffle_input[jdx]) {
continue;
}
qWarning() << "Found duplicate cipher texts... blaming";
_state->blame = true;
}
}
int x = Random::GetInstance().GetInt(0, _server_state->shuffle_input.count());
int y = Random::GetInstance().GetInt(0, _server_state->shuffle_input.count());
while(y == x) {
y = Random::GetInstance().GetInt(0, _server_state->shuffle_input.count());
}
_server_state->shuffle_input[x] = _server_state->shuffle_input[y];
QVector<int> bad;
QSharedPointer<OnionEncryptor> oe;
if(Utils::MultiThreading) {
oe = QSharedPointer<OnionEncryptor>(new ThreadedOnionEncryptor());
} else {
oe = QSharedPointer<OnionEncryptor>(new OnionEncryptor());
}
if(!oe->Decrypt(_server_state->outer_key, _server_state->shuffle_input,
_server_state->shuffle_output, &bad))
{
qWarning() << GetGroup().GetIndex(GetLocalId()) << GetLocalId() <<
": failed to decrypt layer due to block at indexes" << bad;
_state->blame = true;
}
oe->RandomizeBlocks(_server_state->shuffle_output);
const Id &next = GetShufflers().Next(GetLocalId());
MessageType mtype = (next == Id::Zero()) ? ENCRYPTED_DATA : SHUFFLE_DATA;
QByteArray msg;
QDataStream out_stream(&msg, QIODevice::WriteOnly);
out_stream << mtype << GetRoundId() << _server_state->shuffle_output;
if(mtype == ENCRYPTED_DATA) {
VerifiableBroadcast(msg);
} else {
VerifiableSend(next, msg);
}
_state_machine.StateComplete();
}