sbsign: fix failure to sign when key is password protected

The current incarnation of sbsign doesn't all all ciphers to OpenSSL
meaning that if the private key is encrypted, it can't decrypt it and
instead it returns the unhelpful error message

error reading private key ../certs/PK.key

Fix this by adding all ciphers before trying to read the private key.

Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
James Bottomley 2012-06-26 13:57:03 +00:00 committed by Jeremy Kerr
parent 14cff46671
commit 8f8939d9bb

View file

@ -170,6 +170,7 @@ int main(int argc, char **argv)
ERR_load_crypto_strings();
OpenSSL_add_all_digests();
OpenSSL_add_all_ciphers();
BIO *privkey_bio = BIO_new_file(keyfilename, "r");
EVP_PKEY *pkey = PEM_read_bio_PrivateKey(privkey_bio, NULL, NULL, NULL);