fix for bug #1359197
This issue occurs due to CR 87405 merge which references a non existing function. Closes-Bug: 1359197 Change-Id: If54641532f21c74fbf79706b9196f00e3a40e84f
This commit is contained in:
parent
bd6fe53de6
commit
6c8b6a870b
|
@ -190,7 +190,7 @@ class KeyAlgorithm(object):
|
|||
SYMMETRIC_ALGORITHMS = [AES, DES, DESEDE]
|
||||
|
||||
def get_secret_type(self, alg):
|
||||
if alg in self.SYMMETRIC_ALGORITHMS:
|
||||
if str(alg).lower() in self.SYMMETRIC_ALGORITHMS:
|
||||
return SecretType.SYMMETRIC
|
||||
else: # TODO(kaitlin-farr) add asymmetric once it's supported
|
||||
return None
|
||||
|
|
|
@ -167,7 +167,8 @@ class StoreCryptoAdapterPlugin(sstore.SecretStoreBase):
|
|||
Specifies whether the plugin supports key generation with the
|
||||
given key_spec.
|
||||
"""
|
||||
return key_spec and sstore.KeyAlgorithm.supports(key_spec.alg.lower())
|
||||
return (key_spec and
|
||||
sstore.KeyAlgorithm().get_secret_type(key_spec.alg))
|
||||
|
||||
def store_secret_supports(self, key_spec):
|
||||
"""Key storage supported?
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright (c) 2014 Red Hat, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from barbican.plugin.interface import secret_store
|
||||
from barbican.plugin import store_crypto
|
||||
import testtools
|
||||
|
||||
|
||||
class WhenStoreCryptoAdapterPlugin(testtools.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(WhenStoreCryptoAdapterPlugin, self).setUp()
|
||||
self.store_crypto = store_crypto.StoreCryptoAdapterPlugin()
|
||||
|
||||
def tearDown(self):
|
||||
super(WhenStoreCryptoAdapterPlugin, self).tearDown()
|
||||
|
||||
def test_generate_supports(self):
|
||||
"""test generate_supports."""
|
||||
# key_spec should not be None
|
||||
self.assertFalse(self.store_crypto.generate_supports(None))
|
||||
self.key_spec = secret_store.KeySpec('AES', 64, 'CBC')
|
||||
self.assertEqual(secret_store.SecretType.SYMMETRIC,
|
||||
self.store_crypto.generate_supports(self.key_spec))
|
||||
self.key_spec = secret_store.KeySpec('aes', 64, 'CBC')
|
||||
self.assertEqual(secret_store.SecretType.SYMMETRIC,
|
||||
self.store_crypto.generate_supports(self.key_spec))
|
Loading…
Reference in New Issue