Populate INDEX_CERT_ALIAS keystore slot when null.

In some cases it may be possible that a keystore file is present on disk
but does not have a keypair & self signed certificate stored in the
INDEX_CERT_ALIAS slot. Prior to this commit this would result in the
crash described in Bug #2999.

Instead of only generating the INDEX_CERT_ALIAS cert/keypair when the
keystore is first created we now separate keystore creation
& INDEX_CERT_ALIAS population so that it happens as required with loaded
keystores as well as newly created keystores.

Fixes #2999