Add exception handling to X509::generatePrivateKey().