From: Fabian Grünbichler Date: Mon, 22 Jul 2019 15:11:36 +0000 (+0200) Subject: cert: add public key type and size to info X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=afa3f36910db2937248f085be393289fc28330c6 cert: add public key type and size to info Signed-off-by: Fabian Grünbichler Co-Authored-By: Alwin Antreich --- diff --git a/src/PVE/Certificate.pm b/src/PVE/Certificate.pm index 691e70b..65c5c8f 100644 --- a/src/PVE/Certificate.pm +++ b/src/PVE/Certificate.pm @@ -260,6 +260,14 @@ sub get_certificate_info { $info->{san} = $parse_san->(Net::SSLeay::X509_get_subjectAltNames($cert)); $info->{pem} = Net::SSLeay::PEM_get_string_X509($cert); + my $pub_key = eval { Net::SSLeay::X509_get_pubkey($cert) }; + warn $@ if $@; + if ($pub_key) { + $info->{'public-key-type'} = Net::SSLeay::OBJ_nid2sn(Net::SSLeay::EVP_PKEY_id($pub_key)); + $info->{'public-key-bits'} = Net::SSLeay::EVP_PKEY_bits($pub_key); + Net::SSLeay::EVP_PKEY_free($pub_key); + } + Net::SSLeay::X509_free($cert); $cert_path =~ s!^.*/!!g;