diff options
Diffstat (limited to 'base/common/python')
| -rw-r--r-- | base/common/python/pki/nss.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/base/common/python/pki/nss.py b/base/common/python/pki/nss.py index 196fe462f..67fd90b4c 100644 --- a/base/common/python/pki/nss.py +++ b/base/common/python/pki/nss.py @@ -43,9 +43,13 @@ def convert_data(data, input_format, output_format, header=None, footer=None): if input_format == 'base64' and output_format == 'pem': - # split a single line into multiple lines - data = data.rstrip('\r\n') + # join base-64 data into a single line + data = data.replace('\r', '').replace('\n', '') + + # re-split the line into fixed-length lines lines = [data[i:i+64] for i in range(0, len(data), 64)] + + # add header and footer return '%s\n%s\n%s\n' % (header, '\n'.join(lines), footer) if input_format == 'pem' and output_format == 'base64': |
