Commit 6d00a817 authored by Stephan Eberle's avatar Stephan Eberle

Enabled PEM files with CRLF line endings to be used (#10); made PEM file...

Enabled PEM files with CRLF line endings to be used (#10); made PEM file splitter tolerant of trailing whitespace in PEM block delimiter lines
parent d9b64028
......@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment