From 7cc17a4cedeb1a6a874bd5359d9d0f8970907543 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Fri, 2 Apr 2021 10:09:14 +0200 Subject: [PATCH] chg: [api] skip extraction of extension for empty fields Sample certificate: c46fed822dadac3f31f9bb4d1a78a1d9eae4567b --- bin/x509/ip-ssl-subject-api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/x509/ip-ssl-subject-api.py b/bin/x509/ip-ssl-subject-api.py index b62f406..aec5d11 100644 --- a/bin/x509/ip-ssl-subject-api.py +++ b/bin/x509/ip-ssl-subject-api.py @@ -168,7 +168,10 @@ class FetchCertificateHandler(tornado.web.RequestHandler): extcount = cert.get_ext_count() for i in range(0, extcount): - out['info']['extension'][cert.get_ext_at(i).get_name()] = cert.get_ext_at(i).get_value() + try: + out['info']['extension'][cert.get_ext_at(i).get_name()] = cert.get_ext_at(i).get_value() + except: + pass if ricsi.exists(fp): icsi = ricsi.hgetall(fp) out['icsi'] = icsi