poco库 RSA加解密

#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;

 

posted @ 2017-05-20 11:12  hellohyi  阅读(610)  评论(0编辑  收藏  举报