Better error handling with eet identity.

SVN revision: 37937
This commit is contained in:
Cedric BAIL 2008-12-05 09:42:06 +00:00
parent 0b63514546
commit 9c381ceb1f
2 changed files with 6 additions and 1 deletions

View File

@ -248,6 +248,11 @@ do_eet_sign(const char *file, const char *private_key, const char *public_key)
}
key = eet_identity_open(public_key, private_key, NULL);
if (!key)
{
fprintf(stdout, "cannot open key '%s:%s'.\n", public_key, private_key);
exit(-1);
}
fprintf(stdout, "Using the following key to sign `%s`.\n", file);
eet_identity_print(key, stdout);

View File

@ -171,7 +171,7 @@ eet_identity_open(const char *certificate_file, const char *private_key_file, Ee
if (!fp) return NULL;
cert = PEM_read_X509(fp, NULL, NULL, NULL);
fclose(fp);
if (!cert) return NULL;
if (!cert) goto on_error;
/* Check the presence of the public key. Just in case. */
pkey = X509_get_pubkey(cert);