Failing when file has multiple PEM blocks
For the command cfssl certinfo -cert <file>, if the file has multiple PEM blocks, it fails with the error
{
"code": 1003,
"message": "the PEM file should contain only one object"
}
If we are to go with the openssl behaviour, it should ignore the other PEM blocks and process only the first valid Certificate PEM block it encounters. I can see a snippet that deliberately fails when the file or stream has multiple valid PEM blocks instead of ignoring.
https://github.com/cloudflare/cfssl/blob/e04a6ddc69119c6ded64e0f61f76150066040105/helpers/helpers.go#L286-L300
Because, if i want to parse a pem bundle that has all the certificates including issuers and intermediates, i would want to see the leaf, without trying to manually copy it and paste to the stdout.
Please let me know if this sounds like a valid enhancement and I'd be happy to send a pull request.
Fix available at https://github.com/cloudflare/cfssl/pull/970
I ran into this while setting up cfsll and this issue helped me workaround the error. I would love to see the maintainers of this project comment on this issue/PR.
Interested in a fix