MCPcopy Create free account
hub / github.com/adobe/Marinus / parse_data

Method parse_data

python3_cron_scripts/libs3/X509Parser.py:975–996  ·  view source on GitHub ↗

Parse the provided base64 encoded string or DER encoded bytes. For PEM files, the parser assumes that the header and footer exists. If you have the PEM base64 without headers, addHeaders will add them for you. Returns None if there is an error.

(self, cert_data, certSource, addHeaders=False)

Source from the content-addressed store, hash-verified

973 return cert_object
974
975 def parse_data(self, cert_data, certSource, addHeaders=False):
976 """
977 Parse the provided base64 encoded string or DER encoded bytes.
978 For PEM files, the parser assumes that the header and footer exists.
979 If you have the PEM base64 without headers, addHeaders will add them for you.
980 Returns None if there is an error.
981 """
982 if addHeaders:
983 data = bytes(
984 "-----BEGIN CERTIFICATE-----\n"
985 + cert_data
986 + "\n-----END CERTIFICATE-----",
987 "UTF-8",
988 )
989 else:
990 if type(cert_data) is str:
991 data = bytes(cert_data, "utf-8")
992 else:
993 data = bytes(cert_data)
994
995 cert_object = self.__parse(data, certSource)
996 return cert_object

Callers 3

mainFunction · 0.95
mainFunction · 0.95

Calls 1

__parseMethod · 0.95

Tested by

no test coverage detected