Esempio n. 1
0
def x509_name_entry2tuple(entry):
    bio = BIO.MemoryBuffer()
    m2.asn1_string_print(bio._ptr(), m2.x509_name_entry_get_data(entry._ptr()))
    return (
        six.ensure_text(m2.obj_obj2txt(
            m2.x509_name_entry_get_object(entry._ptr()), 0)),
        six.ensure_text(bio.getvalue()))
Esempio n. 2
0
def x509_name_entry2tuple(entry):
    bio = BIO.MemoryBuffer()
    m2.asn1_string_print(bio._ptr(), m2.x509_name_entry_get_data(entry._ptr()))
    return (
        util.py3str(m2.obj_obj2txt(
            m2.x509_name_entry_get_object(entry._ptr()), 0)),
        util.py3str(bio.getvalue()))
Esempio n. 3
0
 def test_obj2txt(self):
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1),
                      b"2.5.4.3", b"2.5.4.3")
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0),
                      b"commonName", b"commonName")
Esempio n. 4
0
 def test_obj2txt(self):
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0),
                           1) == "2.5.4.3", "2.5.4.3"
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0),
                           0) == "commonName", "commonName"
Esempio n. 5
0
 def test_obj2txt(self):
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1) == "2.5.4.3", "2.5.4.3"
     assert m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0) == "commonName", "commonName"
Esempio n. 6
0
def asn1_object_get_oid(self):
    return m2.obj_obj2txt(self._ptr(), 1)
Esempio n. 7
0
 def test_obj2txt(self):
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 1),
                      b"2.5.4.3", b"2.5.4.3")
     self.assertEqual(m2.obj_obj2txt(m2.obj_txt2obj("commonName", 0), 0),
                      b"commonName", b"commonName")