I know that Python strings are immutable in the way they don't have write accessors, but assume I store a private key in memory. Is there a way I can clean de memory occupied by the string when I don't use it anymore? (clean means zero-filling). I don't expect the string classes have a method like this, but perhaps a python (perhaps a C extension) library does.
My problem: When a string memory space holding a private key is not used anymore, clean that space with zeroes (after losing all the references, it will be garbage collected eventually, but I want to ensure no remains of the PK is in memory when it happens).
Edit I am using PyCrypto with RSA, AES, PKCS 1.5.