[pve-devel] [PATCH common 1/2] cert: add public key type and size to info
Alwin Antreich
a.antreich at proxmox.com
Mon Jul 22 17:11:36 CEST 2019
From: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
Co-Authored-By: Alwin Antreich <a.antreich at proxmox.com>
---
src/PVE/Certificate.pm | 8 ++++++++
1 file changed, 8 insertions(+)
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;
--
2.20.1
More information about the pve-devel
mailing list