本文整理汇总了C++中Digest::asData方法的典型用法代码示例。如果您正苦于以下问题:C++ Digest::asData方法的具体用法?C++ Digest::asData怎么用?C++ Digest::asData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Digest
的用法示例。
在下文中一共展示了Digest::asData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notarize
Bool SignerReal::notarize( PublicKey pubkey, Signature signature, Digest hash, Monitor& monitor )
{
if (!check_interface(monitor)) return false;
eprovider::TheKey thepubkey = creator.getCreatureCurrentTheKey(pubkey);
Size hashsize;
RECOVER_CALL(hashsize = iface->getMaxHashSize(thepubkey, error));
Padder curpad = padder;
if (pubkey.getPadder(Monitor()))
{
curpad = pubkey.getPadder(monitor);
} else if (signature.getPadder(Monitor()))
{
curpad = signature.getPadder(monitor);
} else {
//TODO: find default padder
}
if (curpad.ok() && hashsize.bits()) hash = curpad.pad(hash, hashsize, monitor); if (!monitor) return Bool();
Data hashblock = hash.asData();
Image signimage = signature.encode(monitor);
Snapshot signblock = signimage.snapshot();
Bool result;
RECOVER_CALL( (result = iface->notarizeHash(session,hashblock.get(), hashblock.size(), signblock.get(), signblock.size(), signblock.encid(), thepubkey, error)) );
return result;
}
示例2: sign
Signature SignerReal::sign( PrivateKey privkey, Digest hash, Monitor& monitor )
{
if (!check_interface(monitor)) return Signature();
Parameters params = privkey.getAlgParams(acSign, Monitor());
if (params) setAlgParams(params,monitor);
Padder curpad = padder;
if (privkey.getPadder(Monitor()))
{
curpad = privkey.getPadder(monitor);
} else {
//TODO: find default padder
}
Error error;
if (random)
{
IRef<eprovider::ProviderInterface> randomer = creator.getCreatureCurrentInterface(random);
if (randomer) iface->setRandom(session, randomer.cast<eprovider::RandomGenerator>().get(), error);
}
eprovider::TheKey thekey = creator.getCreatureCurrentTheKey(privkey);
Size hashsize = iface->getMaxHashSize(thekey, error);
if (curpad.ok() && hashsize.bits()) hash = curpad.pad(hash, hashsize, monitor); if (!monitor) return Signature();
Data hashblock = hash.asData();
eprovider::Block binsign;
RECOVER_CALL( (binsign = iface->signHash(session, hashblock.get(), hashblock.size(), thekey, error)) );
Snapshot snapshot = creator.createSnapshot(binsign.get(), binsign.size(), binsign.encid(), iface->getKeyId(kcSignature));
return snapshot.reviveSignature(monitor);
}