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

7
pem.go
View File

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