diff --git a/pem.go b/pem.go index c8b0c1c..1477109 100644 --- a/pem.go +++ b/pem.go @@ -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) {