Saving Crypto++ objects to std::vector
问题 I want to save Crypto++ keys to std::vector<uint8_t> . Unfortunately there is only CryptoPP::StringSink , that takes std::string reference but no CryptoPP::VectorSink that would take a reference to std::vector . Following code works fine std::string spki; CryptoPP::StringSink ss(spki); CryptoPP::RSA::PublicKey publicKey(...); publicKey.Save(ss); But I want this std::vector<uint8_t> spki; CryptoPP::VectorSink vs(spki); CryptoPP::RSA::PublicKey publicKey(...); publicKey.Save(vs); The problem