From: Michael Friedrich Date: Thu, 3 Sep 2015 15:11:12 +0000 (+0200) Subject: Fix missing zero padding for generated CA serial X-Git-Tag: v2.4.0~341 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a2ae6e58f6d6284fed2d46d09a6601c9439917b;p=icinga2 Fix missing zero padding for generated CA serial fixes #10074 --- diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index eccc343fe..9be90f39c 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -399,7 +399,7 @@ boost::shared_ptr CreateCert(EVP_PKEY *pubkey, X509_NAME *subject, X509_NA std::ofstream ofp; ofp.open(serialfile.CStr()); - ofp << std::hex << serial + 1; + ofp << std::hex << std::setw(2) << std::setfill('0') << serial + 1; ofp.close(); if (ofp.fail())