mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-27 19:10:20 +01:00 
			
		
		
		
	enh(Foundation): add Poco::secureClear() for securely clearing a string by first overwriting it with zeroes.
This commit is contained in:
		| @@ -763,6 +763,18 @@ struct CILess | ||||
| }; | ||||
|  | ||||
|  | ||||
| template <typename T> | ||||
| void secureClear(T& str) | ||||
| 	/// Securely clears a string's contents by first overwriting | ||||
| 	/// the entire buffer (up to capacity) with zeroes, then | ||||
| 	/// clearing the string. | ||||
| { | ||||
| 	str.resize(str.capacity()); | ||||
| 	std::fill(str.begin(), str.end(), typename T::value_type()); | ||||
| 	str.clear(); | ||||
| } | ||||
|  | ||||
|  | ||||
| } // namespace Poco | ||||
|  | ||||
| #if defined(__clang__) && ((__clang_major__ > 3) || (__clang_major__ == 3 && __clang_minor__ >= 6)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Günter Obiltschnig
					Günter Obiltschnig