2023-05-09 14:36:33 -05:00
|
|
|
from collections import namedtuple
|
|
|
|
|
|
|
|
USER_AGENT = "com.apple.madrid-lookup [macOS,13.2.1,22D68,MacBookPro18,3]"
|
|
|
|
PROTOCOL_VERSION = "1640"
|
|
|
|
|
|
|
|
# KeyPair is a named tuple that holds a key and a certificate in PEM form
|
|
|
|
KeyPair = namedtuple("KeyPair", ["key", "cert"])
|
|
|
|
|
2023-05-09 16:03:27 -05:00
|
|
|
|
2023-05-09 14:36:33 -05:00
|
|
|
def dearmour(armoured: str) -> str:
|
|
|
|
import re
|
2023-05-09 16:03:27 -05:00
|
|
|
|
2023-05-09 14:36:33 -05:00
|
|
|
# Use a regex to remove the header and footer (generic so it work on more than just certificates)
|
2023-05-09 16:03:27 -05:00
|
|
|
return re.sub(r"-----BEGIN .*-----|-----END .*-----", "", armoured).replace(
|
|
|
|
"\n", ""
|
|
|
|
)
|