certigo icon indicating copy to clipboard operation
certigo copied to clipboard

Add support for CSR in the dump function

Open prateeknischal opened this issue 6 years ago • 3 comments

Add support for CSR when using the dump command by implementing a flag --csr that would look for CSR(s) in the file and then parse it. Usage could be like:

$ certigo dump --csr <file.csr>

It supports the --depth, --json and --verbose flags.

Add tests for the same.

prateeknischal avatar Jan 25 '20 11:01 prateeknischal

CLA assistant check)
All committers have signed the CLA.

claassistantio avatar Jan 25 '20 11:01 claassistantio

Do we need a --csr flag? The tool is simpler to use if it just figures out what the file is and dumps the contents. We can put a message saying "here is the content of your CSR" vs "here is the content of your cert" if we are worried about anyone getting confused.

alokmenghrajani avatar Jan 26 '20 08:01 alokmenghrajani

@alokmenghrajani that's a good point. The direction from where I am coming is, this tools only scans for x509 certificates right now. If we let the PEM parser decide what is the type of the block, then it might have to be designed in such a way. The code is written in such a way that it will only accept x509.Certificate objects. I have tried to have as small disruption as possible in the signatures and change signatures where it is sufficiently abstract (for which I may be wrong as well).

If this seems to be a good feature, to let the parser understand the type of the block, then I can work on getting the CSR within the above frame and not have a --csr flag.

I was looking at the code and I can think of using the output of ReadAsPEMFromFiles to determine the type since it has the param pem.Block which has the Type attribute and that can be used to use an appropriate parser.

prateeknischal avatar Jan 26 '20 13:01 prateeknischal

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 15 '23 22:08 CLAassistant