Making keystore thread-safe

Given the interchange of the keystore dictionary for each key action, it would be best if key storage and retrieval methods were thread-blocking.