#include "poco/Crypto/Cipher.h"
#include "poco/Crypto/CipherFactory.h"
#include "Poco/Crypto/RSAKey.h"
using Poco::Crypto::Cipher;
using Poco::Crypto::CipherFactory;
using Poco::Crypto::RSAKey;
Cipher::Ptr pCipher = CipherFactory::defaultFactory().createCipher(RSAKey(RSAKey::KL_1024, RSAKey::EXP_SMALL));
std::string val("I love karen!");
std::string enc = pCipher->encryptString(val);
std::string dec = pCipher->decryptString(enc);
std::cout << "加密后:" << enc << std::endl;
std::cout << "解密后:" << dec << std::endl;
时间: 2024-10-08 11:51:04