Commit Graph

104 Commits

Author SHA1 Message Date
Konstantin Trushin 263cb34662 Fix source code style to comply with PEP8 2023-03-27 11:16:46 -04:00
Grace Lombardi 0a3e39143f 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 2022-07-25 10:12:56 -04:00
Grace Lombardi 6bf55b98f5 Added app_specific_info to init comments 2022-07-25 10:12:56 -04:00
Grace Lombardi 5920dca210 Removed uneeded important and code cleanup 2022-07-25 10:12:56 -04:00
Grace Lombardi 124f7db5cb Updated test for App Specific Info for Symmetric Key and added test for App Specific Info for SecretData 2022-07-25 10:12:56 -04:00
Grace Lombardi 1773fba67c Updated client integration tests, Added test for Application Specific Information 2022-07-25 10:12:56 -04:00
gracelombardi 20f20b0e29 Code consistency updated 2022-07-25 10:12:56 -04:00
Pranathi Locula 95b54707f7 add app_specific_info 2022-07-25 10:12:56 -04:00
Pranathi Locula 19a901d0be add custom attribute support 2022-07-25 10:12:56 -04:00
Pranathi Locula 8a2289c9bd custom attributes for SymmetricKey 2022-07-25 10:12:56 -04:00
locula 6c2bc6b3d5 Update client.py 2021-08-03 10:33:15 -04:00
Pranathi Locula a9d15eb253 create SecretData objects with custom attributes 2021-08-03 10:33:15 -04:00
Peter Hamilton 53308c346b Add ModifyAttribute support to the client
This change adds ModifyAttribute support to the ProxyKmipClient,
leveraging the new generic request capability in the underlying
KMIPProxy client. New unit tests have been added to cover the new
client additions.

Partially implements #547
2019-11-27 14:57:47 -05:00
Peter Hamilton 2d283e128c Add SetAttribute support to the client
This change adds SetAttribute support to the ProxyKmipClient,
leveraging the new generic request capability in the underlying
KMIPProxy client. New unit tests have been added to cover the new
client additions.

Partially implements #547
2019-11-22 18:01:23 -05:00
Peter Hamilton e313731692 Add support for the Sensitive attribute
This change adds support for the Sensitive attribute, adding it to
the attribute factory, the SQLAlchemy object hierarchy, and to the
server attribute handling methods. The intent is to use this new
attribute to test the new SetAttribute and ModifyAttribute
operations coming in future commits. Unit tests have been added
and modified to support the new additions.
2019-11-22 15:08:37 -05:00
Peter Hamilton b045e08ce2 Add DeleteAttribute support to the client
This change adds DeleteAttribute support to the ProxyKmipClient,
leveraging the new generic request capability in the underlying
KMIPProxy client. Going forward all new attribute support will
leverage the new request capability and older supported operations
will be migrated to use it as well, with the ultimate vision
being a final merger of the two client classes into one easy to
use architecture. New unit tests have been added to cover the new
client additions.

Partially implements #547
2019-11-15 17:01:21 -05:00
Peter Hamilton 676aaf5e72 Add DeleteAttribute support to the server
This change adds DeleteAttribute operation support to the PyKMIP
server, supporting functionality unique to KMIP 1.0 - 1.4 and the
newer KMIP 2.0. Due to the current list of attributes supported
by the server, only multivalued attributes can currently be
deleted from a stored KMIP object. Over a dozen unit tests have
been added to verify the functionality of the new additions.

Partially implements #547
2019-11-08 18:36:03 -05:00
Peter Hamilton cd1079afd5 Add integration tests for Locate using new attributes
This change adds integration tests that verify that objects can
be found by Locate when filtering off of the new ObjectGroup and
ApplicationSpecificInformation attributes. Some minor tweaks to
the database attribute models are included to simplify usage.
2019-10-11 16:45:50 -04:00
Peter Hamilton 1b81fff431 Add ObjectGroup to the database model
This change adds a new SQLAlchemy object to the database model
representing the ObjectGroup attribute. The new object is linked
to the base ManagedObject object, allowing ObjectGroup attributes
to be associated with any managed object. A new unit test suite
has been added to verify the new object functionality and to
confirm that the object can be stored and retrieved from an
in-memory database.
2019-10-10 16:33:39 -04:00
Peter Hamilton 3f84a20a0c Add ApplicationSpecificInformation to the database model
This change adds a new SQLAlchemy object to the database model
representing the ApplicationSpecificInformation attribute. The
new object is linked to the base ManagedObject object, allowing
ApplicationSpecificInformation attributes to be associated with
any managed object. This also represents how KMIP attributes
should be supported going forward. A new unit test suite has
been added to verify the new object functionality and to confirm
that the object can be stored and retrieved from an in-memory
database.
2019-09-30 12:32:10 -04:00
Peter Hamilton 29750cbda6 Add SplitKey server integration tests
This change adds integration tests that test registering,
retrieving, and destroying SplitKey objects with the server.
Minor updates are included for the client and server to ensure
that SplitKey operations function as expected.

Partially implements #545
2019-09-20 14:04:57 -04:00
Peter Hamilton a8713fc909 Add conversion utilities for SplitKey objects
This change adds conversion utilities for SplitKey objects,
allowing for conversions between the Pie and Core object spaces.
The server is also updated to recognize the new Pie SplitKey
object. Unit tests have been added and tweaked to accommodate
these changes.

Partially implements #545
2019-09-20 11:11:26 -04:00
Peter Hamilton 84ab77cd8d Add SQLAlchemy-based SplitKey support
This change adds a SQLAlchemy-based implementation of the SplitKey
object that will be used by the ProxyKmipClient and PyKMIP server
to store SplitKeys. A new unit test suite is included that checks
object fields and verifies it can be persisted to and retrieved
from an in-memory SQLAlchemy-managed database.

Partially implements #545
2019-09-13 16:35:49 -04:00
Peter Hamilton c1b816bf04 Fix a bug with how key pair names are handled in the client
This change fixes a bug with how key pair names are handled by the
ProxyKmipClient. The original implementation stored key pair names
in the 'names' field of the various template attributes used to
define the key pair attributes. However, the 'names' field is
meant for the names of existing template objects that should be
used as another source for attribute values. Before KMIP 2.0
support was added, this worked because attributes and names were
encoded the same way and were interpreted by the server correctly.
The addition of KMIP 2.0 drops the 'names' field when handling
template attributes, dropping the names from being sent to the
server when creating new key pairs. This change fixes this and
updates relevant client unit tests to detect this error in the
future.

Fixes #560
2019-08-23 17:22:27 -04:00
Peter Hamilton 4a6a2eccc1 Add offset and maximum item filtering for the Locate operation
This change updates Locate operation support in the PyKMIP server,
allowing users to filter objects using the offset and maximum item
constraints. The offset constraint tells the server how many
matching items should be skipped before results are returned. The
maximum items constraint tells the server how many matching items
should be returned. Unit tests and integration tests have been
added to test and verify the correctness of this feature.

Additionally, the Locate demo scripts have also been updated to
support offset and maximum item filtering. Simply use the
"--offset-items" and "--maximum-items" flags to specify offset and
maximum item values for the Locate script to filter on.

Fixes #562
2019-08-09 17:13:20 -04:00
Peter Hamilton 71d508019a Update the CreateKeyPair payloads
This change updates the CreateKeyPair payloads to the current
payload format, adding properties for different payload attributes
and adding comparison and string operators. Changes are also made
to the PyKMIP clients and the surrounding testing infrastructure
to reflect the payload changes. The official unit test suite for
the CreateKeyPair payloads has been updated to also reflect these
changes.

This change prepares the CreateKeyPair payloads for future
updates to support KMIP 2.0.
2019-03-15 16:51:07 -04:00
Peter Hamilton 938a0a3b16 Update the Locate payloads
This change updates the Locate payloads to the current payload
format, adding properties for different payload attributes and
adding comparison and string operators. Changes are also made to
the PyKMIP clients and the surrounding testing infrastructure to
reflect the payload changes. An official unit test suite for the
Locate payloads has also been included, which will eventually
replace the existing Locate message tests elsewhere in the test
suite.

This change prepares the Locate payloads for future updates to
support KMIP 2.0.
2019-03-12 08:34:35 -04:00
Peter Hamilton a81233aa2a Update the Register payloads
This change updates the Register payloads to the current payload
format, adding properties for different payload attributes and
adding comparison and string operators. Changes are also made to
the PyKMIP clients and the surrounding testing infrastructure to
reflect the payload changes. An official unit test suite for the
Register payloads has also been included, which will eventually
replace the existing Register message tests elsewhere in the test
suite.

This change prepares the Register payloads for future updates to
support KMIP 2.0.
2019-03-06 13:37:39 -05:00
Peter Hamilton 30d7773d96 Update the Create payloads
This change updates the Create payloads to the current payload
format, adding properties for different payload attributes and
adding comparison and string operators. Changes are also made to
the PyKMIP clients and the surrounding testing infrastructure to
reflect the payload changes. An official unit test suite for the
Create payloads has also been included, which will eventually
replace the existing Create message tests elsewhere in the test
suite.

This change prepares the Create payloads for future updates to
support KMIP 2.0.
2019-02-27 16:40:22 -05:00
Peter Hamilton c5e4c4a290 Update the PyKMIP clients to support changing their KMIP version
This change updates the PyKMIP clients, adding support for getting
and setting the KMIP version they use when making KMIP requests.
You can now do:

>>> client.kmip_version

to get the KMIP version enumeration the client is using. Use:

>>> client.kmip_version = enums.KMIPVersion.KMIP_1_1

to set the KMIP version the client uses.

The client unit tests have been updated to check and cover these
changes.

Fixes #470
2018-12-04 15:01:24 -05:00
Tim Burke eb2fee80e8 Stop logging tracebacks when we're about to reraise
At that point, it's up to the caller to decide whether a stack trace is
appropriate; if the caller decides the connection error is recoverable,
us logging a traceback will only confuse things.

Also, prevent a TypeError during log interpolation by actually using the
argument we were providing.
2018-06-22 11:53:25 -07:00
Tim Burke 3d2a7edc94 Have ProxyKmipClient use a non-root logger 2018-06-22 11:07:50 -07:00
Tim Burke 5ffb5d74f6 Reraise exceptions to preserve stack traces
Otherwise, you can hit errors with tracebacks like

   Traceback (most recent call last):
     ...
     File ".../kmip/pie/client.py", line 1573, in __enter__
       self.open()
     File ".../kmip/pie/client.py", line 135, in open
       raise e
   IOError: [Errno 2] No such file or directory

... which isn't terribly useful; it doesn't give you any information
about *what* file wasn't found. By using a bare `raise`, you preserve
the rest of the stack and get

   Traceback (most recent call last):
     ...
     File ".../kmip/pie/client.py", line 1573, in __enter__
       self.open()
     File ".../kmip/pie/client.py", line 131, in open
       self.proxy.open()
     File ".../kmip/services/kmip_client.py", line 221, in open
       self._create_socket(sock)
     File ".../kmip/services/kmip_client.py", line 246, in _create_socket
       suppress_ragged_eofs=self.suppress_ragged_eofs)
     File ".../eventlet/green/ssl.py", line 379, in wrap_socket
       return GreenSSLSocket(sock, *a, **kw)
     File ".../eventlet/green/ssl.py", line 68, in __init__
       ca_certs, do_handshake_on_connect and six.PY2, *args, **kw)
     File ".../ssl.py", line 558, in __init__
       self._context.load_verify_locations(ca_certs)
   IOError: [Errno 2] No such file or directory

... which makes it clear that it was a problem with the CA certificate
bundle.
2018-06-19 10:40:56 -07:00
Peter Hamilton f9e32552f8 Add client support for custom configuration file paths
This change adds client support for setting custom configuration
file paths, allowing users and developers to place their settings
file wherever they want. All client demo scripts have been updated
to support a '-s' flag that can be used to set the configuration
file for the demo. Client unit tests have also been updated to
include this change.
2018-04-17 14:41:04 -04:00
Peter Hamilton 5b5607a8c7 Add Rekey support to the ProxyKmipClient
This change adds Rekey operation support to the ProxyKmipClient.
The client unit test suite has been updated to cover the new code.

Closes #405
2018-04-15 23:26:13 -04:00
Peter Hamilton 33d1aabf76
Merge pull request #419 from OpenKMIP/bug/fix-create-key-pair-masks
Fix cryptographic usage mask handling for CreateKeyPair
2018-04-11 22:17:00 -04:00
Peter Hamilton 950e98569e Fix cryptographic usage mask handling for CreateKeyPair
This change fixes how the ProxyKmipClient handles cryptographic
usage mask values for the CreateKeyPair operation. Originally,
both Encrypt and Decrypt were set by default for both public and
private keys. This is incorrect behavior for certain algorithms.
Now, only the masks specified by the caller are set on the key
pair.

Fixes #412
2018-04-11 21:51:32 -04:00
Peter Hamilton 25f6cc9e5c Add cryptographic usage mask support for DeriveKey
This change updates the ProxyKmipClient support for the DeriveKey
operation, now allowing the caller to specify a list of
CryptographicUsageMask enumerations to set on the newly derived
key.

Fixes #417
2018-04-11 20:44:20 -04:00
Peter Hamilton 804a59d75d Add Check support to the ProxyKmipClient
This change adds Check operation support to the ProxyKmipClient.
The client unit test suite has been updated to cover the new code.

Partially addresses #405
2018-04-06 19:47:10 -04:00
Peter Hamilton 74f20428f6 Fix a client bug for cryptographic parameter handling
This change fixes a bug with the ProxyKmipClient handling of
cryptographic parameters, specifically handling the case where
no cryptographic parameters are provided for an operation method
call. When no parameters are specified, None is now correctly
propagated through to request handling. A client unit test has
been added to cover this fix.

Fixes #406
2018-04-02 13:03:02 -04:00
Peter Hamilton f145662e1f Update ProxyKmipClient register to support name attributes
This change updates the ProxyKmipClient support for the Register
operation, adding the ability to register Name attributes with
the managed object being registered. This matches the functionality
available when using the Create operation.

Fixes #400
2018-03-22 11:03:03 -04:00
Peter Hamilton 626798b327 Merge pull request #355 from OpenKMIP/feat/remove-client-api
Remove the KmipClient API class
2017-10-24 09:42:24 -04:00
Peter Hamilton c7711c78c7 Merge pull request #354 from OpenKMIP/feat/rename-certificate-type
Rename the CertificateTypeEnum enum to CertificateType
2017-10-24 09:42:03 -04:00
Peter Hamilton fdb9218795 Remove the KmipClient API class
This change removes the redundant KmipClient API class from the
pie package. The ProxyKmipClient is the main client going forward
and there is no need for a generic API against which to develop
new clients. If this is needed in the future, it is trivial to
restore.
2017-10-11 10:45:04 -04:00
Peter Hamilton f5fa9badd0 Update the kmip package to support importing the client
This change updates the root-level kmip package, allowing users
to now import the client directly from the kmip package:

from kmip import KmipClient

The KmipClient is an alias for the ProxyKmipClient located in
kmip.pie.client. This will simplify usage and help obfuscate
internal package details that may change in the future.
2017-10-11 10:19:22 -04:00
Peter Hamilton 179a84b268 Rename the CertificateTypeEnum enum to CertificateType
This change renames the CertificateTypeEnum enumeration to
CertificateType, matching the naming schemes of all other
enumerations. This is a backwards incompatible change and
will break any scripts or programs that use the current
CertificateTypeEnum name.
2017-10-11 08:24:55 -04:00
Peter Hamilton 6df0315d41 Merge pull request #347 from OpenKMIP/feat/add-key-wrapping-data-model
Update the object data model to support storing key wrapping data
2017-10-02 01:19:23 -04:00
Peter Hamilton fc86e1bef4 Update the object data model to support storing key wrapping data
This change updates the KMIP object model to support explicitly
storing key wrapping data attributes. Key wrapping data is treated
externally as a dictionary and is stored as individual fields in
the back end. Various unit tests have been updated and added to
support these additions.
2017-09-30 16:56:02 -04:00
Peter Hamilton 6fa4999cc5 Updating the ProxyKmipClient to support getting wrapped keys
This change updates the ProxyKmipClient, allowing Get operation
calls to retrieve wrapped keys by providing key wrapping
specification information with the request. Unit tests have been
added and updated to reflect this change.
2017-09-30 12:14:14 -04:00
Peter Hamilton 657e1c70fb Add asymmetric usage mask support to the ProxyKmipClient
This change updates ProxyKmipClient support for the CreateKeyPair
operation, adding in optional arguments allowing the user to
specify the cryptographic usage masks for the public and private
keys that will be created. Unit tests have been added to cover
this change.
2017-09-26 17:42:01 -04:00