Skip to content

Conversation

@reneme
Copy link
Collaborator

@reneme reneme commented Jan 9, 2026

This adds botan_x509_crl_get_entries that allows listing individual CRL entries along with the affected certificate serial, the revocation time and reason.

The serial number is retrieved as a big-endian binary encoding into a user-provided buffer. Using the view-callback style doesn't strike me as feasible or ergonomic for this. One would either have to introduce an additional function just for the serial or mixing out-params with view invocation in a single function call.

@coveralls
Copy link

coveralls commented Jan 9, 2026

Coverage Status

coverage: 90.425% (+0.005%) from 90.42%
when pulling bdcfce9 on Rohde-Schwarz:feature/ffi_list_crl_entries
into 9c30aa1 on randombit:master.

@reneme reneme force-pushed the feature/ffi_list_crl_entries branch from 54f1b75 to b3ac052 Compare January 9, 2026 10:31
Copy link
Owner

@randombit randombit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

I don't particularly like the API but the alternatives I can come up with are more work on our end for little to no benefit for end users so (shrug)

@reneme reneme force-pushed the feature/ffi_list_crl_entries branch from b3ac052 to 14b1e00 Compare January 9, 2026 14:34
@reneme reneme requested a review from Copilot January 9, 2026 14:34

This comment was marked as resolved.

@reneme reneme requested a review from randombit January 9, 2026 15:33
Comment on lines +2280 to +2289
/**
* View the serial number associated with the given CRL @p entry.
*/
BOTAN_FFI_EXPORT(3, 11)
int botan_x509_crl_entry_view_serial_number(botan_x509_crl_entry_t entry, botan_view_ctx ctx, botan_view_bin_fn view);
Copy link
Collaborator Author

@reneme reneme Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the same argument as in #5221 regarding OIDs and also this explicit remark by @arckoor, we should consider adding an "overload" to export the CRL entry serial as a botan_mp_t object. I.e. provide botan_x509_crl_entry_serial_number(..., botan_mp_t* serial) along with this byte-oriented view function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be an argument for also adding an MPI view function for the existing X509 cert serial

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll combine those in a follow-up PR after merging the current stack of changes.

This error may be returned when a user requests an enumerable value at
an index that is out of range of the available values.
@reneme reneme force-pushed the feature/ffi_list_crl_entries branch from 14b1e00 to bdcfce9 Compare January 11, 2026 15:57
@reneme reneme merged commit a4496f4 into randombit:master Jan 11, 2026
45 checks passed
@reneme reneme deleted the feature/ffi_list_crl_entries branch January 11, 2026 16:40
* the CRL entry list.
*/
BOTAN_FFI_EXPORT(3, 11)
int botan_x509_crl_entries(botan_x509_crl_t crl, size_t index, botan_x509_crl_entry_t* entry);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: botan-rs has this neat macro, to simplify calling methods that write to a new object. It expects that new object to be the first parameter though. (used e.g. like so)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion in #5230 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants