Skip to content

Commit 3b229a3

Browse files
committed
RFC 7468 allows a larger character set in PEM label
1 parent b763a75 commit 3b229a3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

asn1crypto/pem.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import base64
1515
import re
1616
import sys
17+
import string
1718

1819
from ._errors import unwrap
1920
from ._types import type_name as _type_name, str_cls, byte_cls
@@ -150,8 +151,8 @@ def _unarmor(pem_bytes):
150151

151152
if state == "trash":
152153
# Look for a starting line since some CA cert bundle show the cert
153-
# into in a parsed format above each PEM block
154-
type_name_match = re.match(b'^(?:---- |-----)BEGIN ([A-Z0-9 ]+)(?: ----|-----)', line)
154+
# info in a parsed format above each PEM block
155+
type_name_match = re.match(br'''^(?:---- |-----)BEGIN ([0-9a-zA-Z!"#$%&'()*+,./:;<=>?@\\[\]^_`{|}~ ]+)(?: ----|-----)''', line)
155156
if not type_name_match:
156157
continue
157158
object_type = type_name_match.group(1).decode('ascii')

0 commit comments

Comments
 (0)