+from n2vc.exceptions import N2VCInvalidCertificate
+
+
+def base64_to_cacert(b64string):
+ """Convert the base64-encoded string containing the VCA CACERT.
+
+ The input string....
+
+ """
+ try:
+ cacert = base64.b64decode(b64string).decode("utf-8")
+
+ cacert = re.sub(r"\\n", r"\n", cacert,)
+ except binascii.Error as e:
+ raise N2VCInvalidCertificate(message="Invalid CA Certificate: {}".format(e))
+
+ return cacert