mirror of
https://github.com/libp2p/go-openssl.git
synced 2024-12-25 23:30:06 +08:00
Merge pull request #11 from stephaneberle9/master
Enabled PEM files with CRLF line endings to be used (#10)
This commit is contained in:
commit
6f65c2c3af
7
pem.go
7
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user