certificates: Retrieve serial numbers in canonical form

The x509 plugin retrieves serial numbers with two's complement
encoding whereas the openssl plugin partially returns them without
leading zeroes.

Serial numbers in X.509 certificates, X.509 CRL, X.509 attribute
certificates, OCSP Requests and OCSP responses are now returned in
canonical form without prepended zero octets.
This commit is contained in:
Andreas Steffen
2022-12-05 20:18:24 +01:00
parent cb5ae75ac1
commit 18082ce2b0
10 changed files with 90 additions and 97 deletions
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2017 Tobias Brunner
* Copyright (C) 2010 Martin Willi
* Copyright (C) 2022 Andreas Steffen
*
* Copyright (C) secunet Security Networks AG
*
@@ -230,7 +231,7 @@ METHOD(crl_t, create_enumerator, enumerator_t*,
METHOD(crl_t, get_serial, chunk_t,
private_openssl_crl_t *this)
{
return this->serial;
return chunk_skip_zero(this->serial);
}
METHOD(crl_t, is_delta_crl, bool,
@@ -240,7 +241,7 @@ METHOD(crl_t, is_delta_crl, bool,
{
if (base_crl)
{
*base_crl = this->base;
*base_crl = chunk_skip_zero(this->base);
}
return TRUE;
}