Skip to content

trailing white space in "-----BEGIN CERTIFICATE----- " causes readPemObject returning null #1533

@WalkerWalker

Description

@WalkerWalker

if the certificate starts with "-----BEGIN CERTIFICATE----- ", or in general any pem with the begining line including a trailing white space, the readPemObject() function would return null and this causes the readObject in PEMParser to also return null.

It is because this line of code

if (index > 0 && line.endsWith("-----") && (line.length() - index) == 5)

I wonder if this is design choice or not? There are some old discussions about whether trailing white space(s) are allowed in x509certificate https://stackoverflow.com/questions/26496155/are-spaces-alowed-in-x509-certificates but it seems to me that the answers are not clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions