.functions: Improve `getcertnames`

Follow-up to 12bb9dac8ee7f4bcdf3e74fcbc0455a04be0211f.

Many thanks to @dserodio!