Check whether the SSH public key matches the private key.
Note that you don't have to verify if you are using a custom image and have already stored the public key in the image.