Handle error cases of PySequence_Length() and PySequence_GetItem(). Add an test case for zero length CA.
diff --git a/test/test_crypto.py b/test/test_crypto.py
index 684ae06..528fde4 100644
--- a/test/test_crypto.py
+++ b/test/test_crypto.py
@@ -1005,6 +1005,20 @@
#p12 = load_pkcs12(dumped_p12, passwd)
+ def test_zero_len_list_for_ca(self):
+ """
+ Export a PKCS12 with a zero length list for CA.
+ Verify it with the openssl program.
+ """
+ passwd = 'Hobie 18'
+ p12 = self.gen_pkcs12( server_cert_pem, server_key_pem )
+ p12.set_ca_certificates( [] )
+ self.assertEqual((), p12.get_ca_certificates())
+ dumped_p12 = p12.export(passphrase=passwd, iter=3)
+ self.check_recovery(dumped_p12, key=server_key_pem,
+ cert=server_cert_pem, passwd=passwd, )
+
+
def test_export_without_args(self):
"""
Run L{OpenSSL.crypto.PKCS12.export} without any