Merge pull request #11 from stephaneberle9/master

Enabled PEM files with CRLF line endings to be used (#10)
This commit is contained in:
Adin Schmahmann 2020-10-16 13:09:40 -04:00 committed by GitHub
commit 6f65c2c3af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

7
pem.go
View File

@ -16,13 +16,14 @@ package openssl
import (
"regexp"
)
var pemSplit *regexp.Regexp = regexp.MustCompile(`(?sm)` +
`(^-----[\s-]*?BEGIN.*?-----$` +
`(^-----[\s-]*?BEGIN.*?-----[\s-]*?$` +
`.*?` +
`^-----[\s-]*?END.*?-----$)`)
`^-----[\s-]*?END.*?-----[\s-]*?$)`)
func SplitPEM(data []byte) [][]byte {
var results [][]byte
for _, block := range pemSplit.FindAll(data, -1) {