hx509: support reading private keys from PEM files

This commit adds:

 - hx509_cert_init_private_key() for creating an hx509_cert object that
   has just a private key

 - hx509_cert_have_private_key_only() for checking whether an hx509_cert
   object has just a private key

This also generalizes the get_key() internal function in hxtool, which
is tasked with reding or generating a private key for use in signing
CSRs.  Now hxtool request-create can read/write private keys to/from PEM
files, not just DER files.

This is needed to support key types other than just RSA for CSRs and
certificates.
This commit is contained in:
Nicolas Williams
2019-07-01 21:38:27 -05:00
parent 8d232aa87d
commit 252487dfe4
4 changed files with 99 additions and 23 deletions

View File

@@ -74,8 +74,11 @@ HEIMDAL_X509_1.2 {
hx509_cert_get_subject;
hx509_cert_get_issuer_unique_id;
hx509_cert_get_subject_unique_id;
hx509_cert_have_private_key;
hx509_cert_have_private_key_only;
hx509_cert_init;
hx509_cert_init_data;
hx509_cert_init_private_key;
hx509_cert_keyusage_print;
hx509_cert_public_encrypt;
hx509_cert_ref;