bug 1413336 - (5/7) ensure text files generated by pycert et. al. have trailing newlines r?Cykesiopka draft
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 25 Oct 2017 16:59:18 -0700
changeset 699149 f66b0bfc9e210879cb44cf33e2c3470fa4ec2388
parent 699148 4a77588ca6343a73f2338283bad252c3ec21a1b4
child 699150 efd024fefd93bb6a5f57f002afe8e250df601d34
push id89479
push userbmo:dkeeler@mozilla.com
push dateThu, 16 Nov 2017 18:28:32 +0000
reviewersCykesiopka
bugs1413336
milestone59.0a1
bug 1413336 - (5/7) ensure text files generated by pycert et. al. have trailing newlines r?Cykesiopka MozReview-Commit-ID: KduWJRzTxBp
security/manager/ssl/tests/unit/pycert.py
security/manager/ssl/tests/unit/pycms.py
security/manager/ssl/tests/unit/pykey.py
--- a/security/manager/ssl/tests/unit/pycert.py
+++ b/security/manager/ssl/tests/unit/pycert.py
@@ -723,17 +723,17 @@ class Certificate(object):
 
     def toPEM(self):
         output = '-----BEGIN CERTIFICATE-----'
         der = self.toDER()
         b64 = base64.b64encode(der)
         while b64:
             output += '\n' + b64[:64]
             b64 = b64[64:]
-        output += '\n-----END CERTIFICATE-----'
+        output += '\n-----END CERTIFICATE-----\n'
         return output
 
 
 # The build harness will call this function with an output
 # file-like object and a path to a file containing a
 # specification. This will read the specification and output
 # the certificate as PEM.
 # This utility tries as hard as possible to ensure that two
--- a/security/manager/ssl/tests/unit/pycms.py
+++ b/security/manager/ssl/tests/unit/pycms.py
@@ -189,16 +189,16 @@ class CMS(object):
 
     def toPEM(self):
         output = '-----BEGIN PKCS7-----'
         der = self.toDER()
         b64 = base64.b64encode(der)
         while b64:
             output += '\n' + b64[:64]
             b64 = b64[64:]
-        output += '\n-----END PKCS7-----'
+        output += '\n-----END PKCS7-----\n'
         return output
 
 
 # When run as a standalone program, this will read a specification from
 # stdin and output the certificate as PEM to stdout.
 if __name__ == '__main__':
     print CMS(sys.stdin).toPEM()
--- a/security/manager/ssl/tests/unit/pykey.py
+++ b/security/manager/ssl/tests/unit/pykey.py
@@ -558,17 +558,17 @@ class RSAKey(object):
 
     def toPEM(self):
         output = '-----BEGIN PRIVATE KEY-----'
         der = self.toDER()
         b64 = base64.b64encode(der)
         while b64:
             output += '\n' + b64[:64]
             b64 = b64[64:]
-        output += '\n-----END PRIVATE KEY-----'
+        output += '\n-----END PRIVATE KEY-----\n'
         return output
 
     def asSubjectPublicKeyInfo(self):
         """Returns a subject public key info representing
         this key for use by pyasn1."""
         algorithmIdentifier = rfc2459.AlgorithmIdentifier()
         algorithmIdentifier.setComponentByName('algorithm', rfc2459.rsaEncryption)
         # Directly setting parameters to univ.Null doesn't currently work.