Пример #1
0
    def test_get_key_not_wrapped_key(self):
        key_params = to_test.SessionKeyParams(self._config,
                                              "this is not a private key!",
                                              self._iv_encoded)

        with self.assertRaises(ValueError):
            key_params.key
Пример #2
0
    def test_get_key_invalid_wrapped_key(self):
        wrong_wrapped_key = self._wrapped_key[0:-15] + "c29tZSBkYXRh=="
        key_params = to_test.SessionKeyParams(self._config, wrong_wrapped_key,
                                              self._iv_encoded)

        with self.assertRaises(KeyWrappingError):
            key_params.key
Пример #3
0
    def test_get_iv_invalid_encoding(self):
        key_params = to_test.SessionKeyParams(self._config, self._wrapped_key,
                                              "df(sag")

        with self.assertRaises(Error):
            key_params.iv_spec
Пример #4
0
    def test_get_iv(self):
        key_params = to_test.SessionKeyParams(self._config, self._wrapped_key,
                                              self._iv_encoded)

        self.assertEqual(self._expected_iv, key_params.iv_spec)
Пример #5
0
    def test_get_key(self):
        key_params = to_test.SessionKeyParams(self._config, self._wrapped_key,
                                              self._iv_encoded)

        self.assertEqual(self._expected_private_key, key_params.key)