In key management, one of the topics is key storage, I want to know where and how these keys(long-term and short-term) are stored? For example I read that android password apps use KeyStore api to encrypt the the user passwords. I found the following steps for these kinds of apps:
1.Generate a random key when the app runs the first time; 2.When you want to store a secret, retrieve the key from KeyStore, encrypt the data with it, and then store the encrypted data in Preferences. When you want to read a secret, read the encrypted data from Preferences, get the key from KeyStore and then use the key to decrypt the data.
Now the question is how does this randomly generated key gets stored in a safe way and then retrieved?(more common question is how apps store secrets used for encryption either in windows or android or other OSs)
About short term keys like session key for example TLS protocol for this website, I found out that they are stored in memory but again how? I mean can we access that part of memory?