Handle NULL bytes in get_components() values (#804)

* Handle NULL bytes in get_components() values

Some old software may generate "bogus" CN with each character preceded
by a NULL.

This is already handled in commonName, but wasn't in get_components()

* review fixes (fix py3 test & avoid unpack/cast)
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index ec632d9..c938021 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -1214,6 +1214,17 @@
         subject = cert.get_subject()
         assert "null.python.org\x00example.org" == subject.commonName
 
+    def test_load_nul_byte_components(self):
+        """
+        An `X509Name` from an `X509` instance loaded from a file can have a
+        NUL byte in the value of its components
+        """
+        cert = load_certificate(FILETYPE_PEM, nulbyteSubjectAltNamePEM)
+        subject = cert.get_subject()
+        components = subject.get_components()
+        ccn = [value for name, value in components if name == b'CN']
+        assert ccn[0] == b'null.python.org\x00example.org'
+
     def test_set_attribute_failure(self):
         """
         If the value of an attribute cannot be set for some reason then