I would like to securely clear (in simple case, setting contents to zeros) sensitive information from memory stored by std::string and std::vector elements. My vector can contain also primitive types (like std::vector) so I guess it would be more convenient to do clearing of all contained elements inside destructor of vector because primite types don't have destructor. I can't override std::string and std::vector classes with inheritance because those types are not designed for that (no virtual destructor, etc). Is there any other way? I found some posts with std::string automatic clearing but sample implementations there were all incomplete. Currently I clear my objects by manually setting contents to zeros when finished using object but that is very tedious.
Aucun commentaire:
Enregistrer un commentaire