Add checks to verify correctness of RSA/DSA/ElGamal keys

When the various components are assembled into an RSA,
DSA or ElGamal key via the construct() method, we must verify
as much as possible if the result is indeed a valid key.