我正在尝试使用公钥加密签名并稍后验证文件.该文件是一个简单的纯文本文件,其中包含用于创作目的的用户信息.
我为公钥加密算法的C实现尝试了不同的站点,但我没有找到任何东西.许多站点都指向使用证书(x.509等),但这远远超出我的需要.我只是在寻找一种生成公钥和私钥的方法,并使用一种相对众所周知的算法来签名和验证文件.
有没有指向纯C实现的指针?重点是我可以重用的代码,而不是外部库.主要问题是我不想链接完整的lib及其依赖关系,以便拥有一个非常基本的公钥系统.
谢谢.
我需要一个字符串加密的例子(在C++中 - >我在linux-Ubuntu上工作)和aes-cbc256以及填充:PKCS7请帮忙.
对于以下代码,如何将IV设置为0并将键值设置为字符串值?我还想添加pkcs7填充.我正在使用crypto ++ lib(在Linux中)
// Driver.cpp
//
#include "stdafx.h"
#include "cryptopp/dll.h"
#include "cryptopp/default.h"
#include "crypto++/osrng.h"
using CryptoPP::AutoSeededRandomPool;
#include <iostream>
using std::cout;
using std::cerr;
#include <string>
using std::string;
#include "crypto++/cryptlib.h"
using CryptoPP::Exception;
#include "crypto++/hex.h"
using CryptoPP::HexEncoder;
using CryptoPP::HexDecoder;
#include "crypto++/filters.h"
using CryptoPP::StringSink;
using CryptoPP::StringSource;
using CryptoPP::StreamTransformationFilter;
#include "crypto++/aes.h"
using CryptoPP::AES;
#include "crypto++/ccm.h"
using CryptoPP::CBC_Mode;
#include "assert.h"
int main(int argc, char* argv[])
{
AutoSeededRandomPool prng;
byte key[ AES::DEFAULT_KEYLENGTH ];
prng.GenerateBlock( key, sizeof(key) );
byte iv[ AES::BLOCKSIZE];
iv[AES::BLOCKSIZE] = 0;
//prng.GenerateBlock(iv, …Run Code Online (Sandbox Code Playgroud)