コード例 #1
0
 def test_create_intermediate_ca_cert_duplicate_ids_invalid(self):
     """
     Test API create_intermediate_ca_cert raises exception when invalid validity day values used
     """
     cert_util = EdgeCertUtil()
     cert_util.create_root_ca_cert('root', subject_dict=VALID_SUBJECT_DICT)
     with self.assertRaises(edgectl.errors.EdgeValueError):
         cert_util.create_intermediate_ca_cert('root', 'root', common_name='name')
コード例 #2
0
 def test_create_intermediate_ca_cert_validity_days_invalid(self):
     """
     Test API create_intermediate_ca_cert raises exception when invalid validity day values used
     """
     cert_util = EdgeCertUtil()
     cert_util.create_root_ca_cert('root', subject_dict=VALID_SUBJECT_DICT)
     for validity in [-1, 0, 366, 1096]:
         with self.assertRaises(edgectl.errors.EdgeValueError):
             cert_util.create_intermediate_ca_cert('int', 'root', common_name='name',
                                                   validity_days_from_now=validity)
コード例 #3
0
    def test_create_intermediate_ca_cert_common_name_invalid(self):
        """
        Test API create_intermediate_ca_cert raises exception when common name is invalid
        """
        cert_util = EdgeCertUtil()
        cert_util.create_root_ca_cert('root', subject_dict=VALID_SUBJECT_DICT)
        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root')

        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name=None)

        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name='')

        bad_common_name = 'a' * 65
        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name=bad_common_name)
コード例 #4
0
    def test_create_intermediate_ca_cert_passphrase_invalid(self):
        """
        Test API create_intermediate_ca_cert raises exception when passphrase is invalid
        """
        cert_util = EdgeCertUtil()
        cert_util.create_root_ca_cert('root', subject_dict=VALID_SUBJECT_DICT)
        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name='name',
                                                  passphrase='')

        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name='name',
                                                  passphrase='123')

        bad_pass_1024 = 'a' * 1024
        with self.assertRaises(edgectl.errors.EdgeValueError):
            cert_util.create_intermediate_ca_cert('int', 'root', common_name='name',
                                                  passphrase=bad_pass_1024)