Ensuring Secure Data Remains in Memory

2019-08-30 14:29发布

问题:

On a Linux system, how would you structure a program (C/C++/Python/Java etc) to ensure that a piece of data remains in volatile memory and is never cached to disk or swap?

I'm specifically concerned with security applications where you want to ensure a manually entered password or cryptography key is forgotten and unrecoverable the moment the system loses power, but otherwise remains accessible.

回答1:

Have a look at mlock(2)/munlock(2)