botan

PKCS11 - 为 SHA256_HMAC 生成密钥

我使用 Botan2 库来访问 SoftHSM2。我设法生成了一些 AES/DES 密钥,但我想为 SHA256 HMAC 生成一个秘密。 我的代码(在创建会话、登录并检测到我的令牌之后): namespace p11 = Botan::PKCS11; p11::SecretKeyProperties propsOtpGen(p11::KeyType::Sha256Hmac); propsOt... »

c++

无法在 Windows 上为 Android 构建 Botan

根据here的说明,我无法理解如何为Android构建Botan: $ export CXX=/opt/android-ndk/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++ $ ./configure.py --os=android --cc=clang --cpu=arm64 我不明白如何在... »

如何使用 Botan 库和特定密码套件加密数据?

我曾使用Botan::TLS::Callbacks 和Botan::TLS::Client Botan::TLS::Server 来获得客户端和服务器之间的安全通道。此外,为了加密-解密数据,我使用了 <botan/pubkeys.h> <botan/pk_keys.h> 和 Botan 库中的其他包含头文件。 我的问题是: 为什么Botan::PK_Encrypto... »

c++

std::bad_alloc 使用 Botan 进行 PKCS#11

我是 C++ 新手,我真的坚持使用 Botan 连接到硬件加密令牌。我不知道我是否错过了 libs 或 dll 的任何设置。 我基于Building Botan library in Windows 10构建了Botan库。 botan.lib 和 botan.dll 是在构建后在 lib 文件夹中创建的。 然后我使用以下简单代码在 Visual Studio 2019 中创建一个控制台应用程... »

c++

使用Botan从私钥中提取公钥

我正在尝试使用非对称私钥-公钥加密消息。 在Botan 中,使用Load_key() 函数,我读取了私钥并想从中提取它的公钥。为了在其构造函数中构造 RSA 公钥,我需要一个“算法标识符”对象和我拥有的“密钥位”。算法标识符对象使用pcks8_algorithm_identifier()函数。 问题是“密钥位”返回 secure_vector<unsigned char> 而不是 v... »

在 Visual C++ 中设置植物

出于某种原因,我想出使用 botan 连接到 PKCS11 硬件令牌。我是 C++ 新手,想用 Visual Studio 2019 编写代码。 我下载了botan源代码并使用nmake构建了源代码。构建完成后,创建一个名为 build 的文件夹。 我将botan的目录添加到VC++目录[右键单击应用程序-->属性-->VC++目录] #include <iostream&g... »

Botan 构建错误“AutoSeeded_RNG”未命名类型

尝试构建 Botan 可执行文件,我收到以下错误: ../src/cli/timing_tests.cpp: In static member function 'static Botan::RandomNumberGenerator& Botan_CLI::Timing_Test::timing_test_rng()': ../src/cli/timing_tests... »

使用 MSVC 在 Windows 上编译错误 Botan 库

我正在遵循指南Building The Library,但我有错误。我的步骤。 1.使用vcvars64.bat设置x64环境。 C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat 2.运行configure.py python "C:\Users\Me... »

c++

生成 blake2b 哈希时崩溃

我正在尝试编写一个以 Botan 作为后端的哈希函数: std::string hex_hash(std::string &in, const std::string &HASH) { std::unique_ptr<Botan::HashFunction> hash(Botan::HashFunction::create(HASH)); return Botan::... »

c++

vcpkg cmake 找不到植物

我使用 vcpkg 作为我的包管理器,按照示例使用 sqlite 构建 example 非常容易。 之后我成功安装了botan并尝试使用 find_package(botan REQUIRED) 如示例 here 所示。 但是不幸的是,这不起作用,并且生成退出并出现错误 CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:247 (_f... »

c++

QT中使用Botan C++加密文件

我在 Windows 10 上使用 Qt Creator 4.6.1 基于 Qt 5.10.1 (MSVC 2015, 32 bit) 基于 May 2 2018 04:24:33qmake 和 mingw491_32 网上有一个项目使用botanwrapper 和包含Botan.pri 完整的代码很长,因此无法在此处发布,但可以在http://www.voidrealms.com/ind... »

c++

Botan 加载现有的 RSA 私钥

我正在使用 Botan C++ 库来签署和验证一些 license.ini 文件。我已经设置 Botan PK_Signer 使用 RSA 算法来加密使用 PKCS v1.5 创建的散列。这是我的代码: uint8_t private_key[] = "private key I already have generated." // Read file content that needs ... »

c++

用Java序列化BigInteger,用Botan反序列化?

问题:如何在 Java 中转换 BigInteger 以匹配 Botan BigInt 编码? 我使用 Botan 在 Java 和 C++ 应用程序之间进行通信。 Botan 有一个 BigInt 类,与 BigInteger 相当。但是,转换为字节数组时,编码会有所不同。 在 Botan 中,BigInt 编码如下: void BigInt::binary_encode(uint8_t ... »

MinGW64 和“C 函数 int select(...) 的冲突声明”

我正在尝试在 MinGW 上构建 Botan,它实际上是 MinGW-w64 (x86_64-pc-msys)。它在 MinGW 上失败,如下所示。我想我已将其缩减为 MCVE : #include <sys/select.h> #include <winsock2.h> #include <windows.h> #include <memory>... »

c++

AEAD模式安全

当我阅读Botan document时, 我遇到了以下注释: 在解密期间,如果 MAC 未验证,finish 将抛出一个 Integrity_Failure 实例。如果发生这种情况,之前通过调用 update 输出的所有明文都必须被销毁,并且不能以任何攻击者可以观察到的影响的方式使用。 确保这种情况永远不会发生的一种简单方法是永远不要调用更新,而是始终将整个消息编组到单个缓冲区中,并在解密时对其... »

使用 Botan 访问冲突读取位置

我已经集成了用于 TLS 安全性的植物库。 我收到以下错误: jsonrpctest.exe 中 0x6DBFD1CE (vcruntime140.dll) 的第一次机会异常:0xC0000005:访问冲突读取位置 0x00962000。 如果有这个异常的处理程序,程序可以安全地继续 下面是我调用的代码 int main(int argc, char *argv[]) { // prepar... »

c++

如何解决“没有模块名称 Botan”的问题

我使用的是 windows 8 和 python 3.6.1 我在我的 cmd 中完成了以下命令: pip 安装cryptoshop 但是,当我运行以下 python 代码时: from cryptoshop import encryptfile from cryptoshop import decryptfile result1 = encryptfile(filename="test"... »

Botan 库和“压缩”公钥

Botan 是否支持 EC 公钥的“压缩”表示的序列化/反序列化? (只有 EC + 符号上点的 X 坐标)。有什么例子吗?... »

c++

Botan 管道故障位异常

当我按照 Botan 文档管道/过滤器消息处理中的说明进行操作时,我遇到了意外的失败位错误。 我的代码很简单: ifstream in("2.txt", ios::binary); ofstream out("2.enc", ios::binary); AutoSeeded_RNG rng; SymmetricKey key(rng, 16); // a random 128-bit key... »

c++