There are a number of ways that the public key can be stored.
The private key is stored on your computer hard disk.
The public key is stored on the target machine in the file.
The private key is stored on the local machine.
The keys are stored in tables with a few constraints on the structure.
The keys are then stored on the user's computer, further encrypted.
My server's private keys are necessarily stored on the server.
In the second method, a secret key is also stored in the file.
However distributed, keys must be stored securely to maintain communications security.
When storing small keys and values, the space overhead of the pointer in each entry record can be significant.