如何使用Botan::MemoryRegion

How do I use Botan::MemoryRegion?

本文关键字:MemoryRegion Botan 何使用      更新时间:2023-10-16

有人知道如何创建Botan::MemoryRegion类型的对象用于此方法吗?

BigInt BOTAN_DLL fe1_encrypt(const BigInt& n, const BigInt& X,
                         const SymmetricKey& key,
                         const MemoryRegion<byte>& tweak);

MemoryVectorSecureVector都继承自MemoryRegion,使用起来与std::vector非常相似。

BYTE tweakData[tweakDataLen] = { ... };
MemoryVector<byte> myTweak(tweakData, tweakDataLen);

SecureVector采取了一些预防措施来防止数据四处传播(例如,在删除之前覆盖并支持一些交换到磁盘的场景)