PEM Regex seems questionable
aschmahmann opened this issue · 1 comments
aschmahmann commented
Lines 22 to 25 in 6d00a81
Allows for whitespace and dashes beyond what is allowed in the spec https://tools.ietf.org/html/rfc7468. We should clean this up.
stephaneberle9 commented
To remedy this, the following more restrictive regex would also work from the CRLF line endings point of view:
var pemSplit *regexp.Regexp = regexp.MustCompile(`(?sm)` +
`(^-----[\s-]*?BEGIN.*?-----\r?$` +
`.*?` +
`^-----[\s-]*?END.*?-----\r?$)`)