Reading the secret key may result in generating and writing a new key to disk. Do that under the lock.