Skip to content

Commit ee648b3

Browse files
committed
Use i2a_ASN1_INTEGER(), don't access ASN1_INTEGER data directly
to fix a build error against OpenSSL 4.0. OpenSSL 4.0 made `ASN1_INTEGER` an opaque type. Also, `X509_get0_serialNumber()` must be used now, which returns `const ASN1_INTEGER*`.
1 parent c02434e commit ee648b3

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/remote/pkiutility.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,8 @@ String PkiUtility::GetCertificateInformation(const std::shared_ptr<X509>& cert)
345345

346346
pre = "\n Serial: ";
347347
BIO_write(out, pre.CStr(), pre.GetLength());
348-
ASN1_INTEGER *asn1_serial = X509_get_serialNumber(cert.get());
349-
for (int i = 0; i < asn1_serial->length; i++) {
350-
BIO_printf(out, "%02x%c", asn1_serial->data[i], ((i + 1 == asn1_serial->length) ? '\n' : ':'));
351-
}
348+
i2a_ASN1_INTEGER(out, X509_get0_serialNumber(cert.get()));
349+
BIO_write(out, "\n", 1);
352350

353351
pre = "\n Signature Algorithm: " + GetSignatureAlgorithm(cert);
354352
BIO_write(out, pre.CStr(), pre.GetLength());

0 commit comments

Comments
 (0)