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,7 +1,7 @@
/*
* Copyright (C) 2017-2019 Tobias Brunner
* Copyright (C) 2008-2009 Martin Willi
* Copyright (C) 2007-2014 Andreas Steffen
* Copyright (C) 2007-2022 Andreas Steffen
* Copyright (C) 2003 Christoph Gysin, Simon Zwahlen
*
* Copyright (C) secunet Security Networks AG
@@ -133,7 +133,7 @@ static chunk_t build_Request(private_x509_ocsp_request_t *this,
asn1_algorithmIdentifier(OID_SHA1),
asn1_simple_object(ASN1_OCTET_STRING, issuerNameHash),
asn1_simple_object(ASN1_OCTET_STRING, issuerKeyHash),
asn1_simple_object(ASN1_INTEGER, serialNumber)));
asn1_integer("c", serialNumber)));
}
/**