mirror of
https://github.com/OpenKMIP/PyKMIP.git
synced 2025-07-24 22:44:36 +02:00
Updated app specific info to be a list of dictionaries, removed unneeded sudo in run.sh, updated server.conf to remove db, updated tests and comments to reflect app specific info being a list
This commit is contained in:
parent
6bf55b98f5
commit
0a3e39143f
@ -14,8 +14,8 @@ if [[ "${RUN_INTEGRATION_TESTS}" == "1" ]]; then
|
|||||||
sudo cp ./.travis/policy.json /etc/pykmip/policies/policy.json
|
sudo cp ./.travis/policy.json /etc/pykmip/policies/policy.json
|
||||||
sudo mkdir -p /var/log/pykmip
|
sudo mkdir -p /var/log/pykmip
|
||||||
sudo chmod 777 /var/log/pykmip
|
sudo chmod 777 /var/log/pykmip
|
||||||
sudo python3 ./bin/run_server.py &
|
python3 ./bin/run_server.py &
|
||||||
sudo tox -e integration -- --config client
|
tox -e integration -- --config client
|
||||||
elif [[ "${RUN_INTEGRATION_TESTS}" == "2" ]]; then
|
elif [[ "${RUN_INTEGRATION_TESTS}" == "2" ]]; then
|
||||||
# Set up the SLUGS instance
|
# Set up the SLUGS instance
|
||||||
cp -r ./.travis/functional/slugs /tmp/
|
cp -r ./.travis/functional/slugs /tmp/
|
||||||
@ -23,14 +23,14 @@ elif [[ "${RUN_INTEGRATION_TESTS}" == "2" ]]; then
|
|||||||
|
|
||||||
# Set up the PyKMIP server
|
# Set up the PyKMIP server
|
||||||
cp -r ./.travis/functional/pykmip /tmp/
|
cp -r ./.travis/functional/pykmip /tmp/
|
||||||
sudo python3 ./bin/create_certificates.py
|
python3 ./bin/create_certificates.py
|
||||||
mv *.pem /tmp/pykmip/certs/
|
mv *.pem /tmp/pykmip/certs/
|
||||||
sudo mkdir -p /var/log/pykmip
|
sudo mkdir -p /var/log/pykmip
|
||||||
sudo chmod 777 /var/log/pykmip
|
sudo chmod 777 /var/log/pykmip
|
||||||
sudo pykmip-server -f /tmp/pykmip/server.conf -l /tmp/pykmip/server.log &
|
pykmip-server -f /tmp/pykmip/server.conf -l /tmp/pykmip/server.log &
|
||||||
|
|
||||||
# Run the functional tests
|
# Run the functional tests
|
||||||
sudo tox -e functional -- --config-file /tmp/pykmip/client.conf
|
tox -e functional -- --config-file /tmp/pykmip/client.conf
|
||||||
else
|
else
|
||||||
sudo tox
|
tox
|
||||||
fi
|
fi
|
||||||
|
@ -7,4 +7,3 @@ ca_path=/etc/pykmip/certs/cert.pem
|
|||||||
auth_suite=TLS1.2
|
auth_suite=TLS1.2
|
||||||
enable_tls_client_auth=False
|
enable_tls_client_auth=False
|
||||||
policy_path=/etc/pykmip/policies/
|
policy_path=/etc/pykmip/policies/
|
||||||
database_path=/tmp/pykmip.db
|
|
||||||
|
@ -559,11 +559,13 @@ class ProxyKmipClient(object):
|
|||||||
|
|
||||||
if hasattr(managed_object, '_application_specific_informations'):
|
if hasattr(managed_object, '_application_specific_informations'):
|
||||||
if managed_object._application_specific_informations:
|
if managed_object._application_specific_informations:
|
||||||
attribute = self.attribute_factory.create_attribute(
|
for info in managed_object._application_specific_informations:
|
||||||
enums.AttributeType.APPLICATION_SPECIFIC_INFORMATION,
|
attribute = self.attribute_factory.create_attribute(
|
||||||
managed_object._application_specific_informations
|
enums.AttributeType.APPLICATION_SPECIFIC_INFORMATION,
|
||||||
)
|
info,
|
||||||
object_attributes.append(attribute)
|
index=0
|
||||||
|
)
|
||||||
|
object_attributes.append(attribute)
|
||||||
template = cobjects.TemplateAttribute(attributes=object_attributes)
|
template = cobjects.TemplateAttribute(attributes=object_attributes)
|
||||||
object_type = managed_object.object_type
|
object_type = managed_object.object_type
|
||||||
# Register the managed object and handle the results
|
# Register the managed object and handle the results
|
||||||
|
@ -674,7 +674,7 @@ class SymmetricKey(Key):
|
|||||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||||
settings, describing how the key value has been wrapped.
|
settings, describing how the key value has been wrapped.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
app_specific_info(dict): A dictionary containing application_namespace and application_data.
|
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
"""
|
"""
|
||||||
super(SymmetricKey, self).__init__(
|
super(SymmetricKey, self).__init__(
|
||||||
@ -844,7 +844,7 @@ class PublicKey(Key):
|
|||||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||||
settings, describing how the key value has been wrapped.
|
settings, describing how the key value has been wrapped.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
app_specific_info(dict): A dictionary containing application_namespace and application_data.
|
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
"""
|
"""
|
||||||
super(PublicKey, self).__init__(
|
super(PublicKey, self).__init__(
|
||||||
@ -1013,7 +1013,7 @@ class PrivateKey(Key):
|
|||||||
key_wrapping_data(dict): A dictionary containing key wrapping data
|
key_wrapping_data(dict): A dictionary containing key wrapping data
|
||||||
settings, describing how the key value has been wrapped.
|
settings, describing how the key value has been wrapped.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
app_specific_info(dict): A dictionary containing application_namespace and application_data.
|
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
"""
|
"""
|
||||||
super(PrivateKey, self).__init__(
|
super(PrivateKey, self).__init__(
|
||||||
@ -1606,7 +1606,7 @@ class SecretData(CryptographicObject):
|
|||||||
masks(list): A list of CryptographicUsageMask enumerations
|
masks(list): A list of CryptographicUsageMask enumerations
|
||||||
defining how the key will be used.
|
defining how the key will be used.
|
||||||
name(string): The string name of the key.
|
name(string): The string name of the key.
|
||||||
app_specific_info(dict): A dictionary containing application_namespace and application_data.
|
app_specific_info(list): A list of dictionaries containing application_namespace and application_data.
|
||||||
Optional, defaults to None.
|
Optional, defaults to None.
|
||||||
"""
|
"""
|
||||||
super(SecretData, self).__init__()
|
super(SecretData, self).__init__()
|
||||||
|
@ -39,10 +39,8 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
|
|
||||||
uuids = self.client.locate()
|
uuids = self.client.locate()
|
||||||
for uuid in uuids:
|
for uuid in uuids:
|
||||||
try:
|
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, uuid)
|
||||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, uuid)
|
self.client.destroy(uid=uuid)
|
||||||
finally:
|
|
||||||
self.client.destroy(uid=uuid)
|
|
||||||
|
|
||||||
def test_symmetric_key_create_get_destroy(self):
|
def test_symmetric_key_create_get_destroy(self):
|
||||||
"""
|
"""
|
||||||
@ -197,10 +195,16 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
128,
|
128,
|
||||||
(b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E'
|
(b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E'
|
||||||
b'\x0F'),
|
b'\x0F'),
|
||||||
app_specific_info={
|
app_specific_info=[
|
||||||
'application_namespace': 'Testing',
|
{
|
||||||
'application_data': 'Testing2'
|
'application_namespace': 'Testing',
|
||||||
}
|
'application_data': 'Testing2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'application_namespace': 'Testing3',
|
||||||
|
'application_data': 'Testing4'
|
||||||
|
}
|
||||||
|
]
|
||||||
)
|
)
|
||||||
key_id = self.client.register(key)
|
key_id = self.client.register(key)
|
||||||
attribute_list = self.client.get_attribute_list(key_id)
|
attribute_list = self.client.get_attribute_list(key_id)
|
||||||
@ -210,14 +214,12 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
attribute_names=['Application Specific Information']
|
attribute_names=['Application Specific Information']
|
||||||
)
|
)
|
||||||
self.assertEqual(key_id, result_id)
|
self.assertEqual(key_id, result_id)
|
||||||
self.assertEqual(1, len(attribute_list))
|
|
||||||
|
|
||||||
attribute = attribute_list[0]
|
attribute = attribute_list[0]
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'Application Specific Information',
|
'Application Specific Information',
|
||||||
attribute.attribute_name.value
|
attribute.attribute_name.value
|
||||||
)
|
)
|
||||||
print(attribute.attribute_value)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'Testing',
|
'Testing',
|
||||||
attribute.attribute_value.application_namespace
|
attribute.attribute_value.application_namespace
|
||||||
@ -227,6 +229,20 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
attribute.attribute_value.application_data
|
attribute.attribute_value.application_data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
attribute2 = attribute_list[1]
|
||||||
|
self.assertEqual(
|
||||||
|
'Application Specific Information',
|
||||||
|
attribute2.attribute_name.value
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
'Testing3',
|
||||||
|
attribute2.attribute_value.application_namespace
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
'Testing4',
|
||||||
|
attribute2.attribute_value.application_data
|
||||||
|
)
|
||||||
|
|
||||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, key_id)
|
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, key_id)
|
||||||
self.client.destroy(key_id)
|
self.client.destroy(key_id)
|
||||||
|
|
||||||
@ -546,10 +562,16 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
secret = objects.SecretData(
|
secret = objects.SecretData(
|
||||||
b'\x53\x65\x63\x72\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64',
|
b'\x53\x65\x63\x72\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64',
|
||||||
enums.SecretDataType.PASSWORD,
|
enums.SecretDataType.PASSWORD,
|
||||||
app_specific_info={
|
app_specific_info=[
|
||||||
'application_namespace': 'Testing',
|
{
|
||||||
'application_data': 'Testing2'
|
'application_namespace': 'Testing',
|
||||||
}
|
'application_data': 'Testing2'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'application_namespace': 'Testing3',
|
||||||
|
'application_data': 'Testing4'
|
||||||
|
}
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
uid = self.client.register(secret)
|
uid = self.client.register(secret)
|
||||||
@ -568,14 +590,12 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
attribute_names=['Application Specific Information']
|
attribute_names=['Application Specific Information']
|
||||||
)
|
)
|
||||||
self.assertEqual(uid, result_id)
|
self.assertEqual(uid, result_id)
|
||||||
self.assertEqual(1, len(attribute_list))
|
|
||||||
|
|
||||||
attribute = attribute_list[0]
|
attribute = attribute_list[0]
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'Application Specific Information',
|
'Application Specific Information',
|
||||||
attribute.attribute_name.value
|
attribute.attribute_name.value
|
||||||
)
|
)
|
||||||
print(attribute.attribute_value)
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
'Testing',
|
'Testing',
|
||||||
attribute.attribute_value.application_namespace
|
attribute.attribute_value.application_namespace
|
||||||
@ -585,6 +605,20 @@ class TestProxyKmipClientIntegration(testtools.TestCase):
|
|||||||
attribute.attribute_value.application_data
|
attribute.attribute_value.application_data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
attribute2 = attribute_list[1]
|
||||||
|
self.assertEqual(
|
||||||
|
'Application Specific Information',
|
||||||
|
attribute2.attribute_name.value
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
'Testing3',
|
||||||
|
attribute2.attribute_value.application_namespace
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
'Testing4',
|
||||||
|
attribute2.attribute_value.application_data
|
||||||
|
)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, uid)
|
self.client.revoke(enums.RevocationReasonCode.KEY_COMPROMISE, uid)
|
||||||
self.client.destroy(uid)
|
self.client.destroy(uid)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user