cloudflare / cloudflare/cfssl

Failing when file has multiple PEM blocks

Open
#969 3 comments 4 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
9.5k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

For the command `cfssl certinfo -cert `, if the file has multiple PEM blocks, it fails with the error
```json
{
"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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.