Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/starkbank_ecdsa-2.3.1-py3.11.egg/ellipticcurve/utils/pem.py: 90%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1from re import search 

2 

3 

4def getPemContent(pem, template): 

5 pattern = template.format(content="(.*)") 

6 match = search("".join(pattern.splitlines()), "".join(pem.splitlines())) 

7 if match is None: 

8 raise Exception("PEM content does not match expected template") 

9 return match.group(1) 

10 

11 

12def createPem(content, template): 

13 lines = [ 

14 content[start:start + 64] 

15 for start in range(0, len(content), 64) 

16 ] 

17 return template.format(content="\n".join(lines))