Takes a certificate in binary DER format and returns the PEM version of it as a string.
(der_cert_bytes)
| 1481 | PEM_FOOTER = "-----END CERTIFICATE-----" |
| 1482 | |
| 1483 | def DER_cert_to_PEM_cert(der_cert_bytes): |
| 1484 | """Takes a certificate in binary DER format and returns the |
| 1485 | PEM version of it as a string.""" |
| 1486 | |
| 1487 | f = str(base64.standard_b64encode(der_cert_bytes), 'ASCII', 'strict') |
| 1488 | ss = [PEM_HEADER] |
| 1489 | ss += [f[i:i+64] for i in range(0, len(f), 64)] |
| 1490 | ss.append(PEM_FOOTER + '\n') |
| 1491 | return '\n'.join(ss) |
| 1492 | |
| 1493 | def PEM_cert_to_DER_cert(pem_cert_string): |
| 1494 | """Takes a certificate in ASCII PEM format and returns the |
no test coverage detected