Commit Graph

176 Commits

Author SHA1 Message Date
Peter Hamilton 86314b346a Add the AttributeReference structure
This change adds the AttributeReference structure, a KMIP 2.0
addition that is used by several attribute-related operations.
A unit test suite is included to cover the new structure.
2019-03-25 13:32:13 -04:00
Peter Hamilton 4ac7b5ed1c Update the DeriveKey payloads to support KMIP 2.0
This change updates the DeriveKey payloads to support KMIP 2.0
features, including swapping out TemplateAttributes for the new
Attributes structure in the request payload and removing all
attribute-related encodings from the response payload. Unit tests
have been added to cover these changes.
2019-03-22 12:39:09 -04:00
Peter Hamilton 487dfc78ab Update the DeriveKey payloads
This change makes minor updates to the DeriveKey payloads, fixing
error messages, comments, and local variable names to comply with
the current payload format. The corresponding unit test suite has
been updated to reflect these changes.

This change prepares the DeriveKey payloads for future updates to
support KMIP 2.0.
2019-03-21 16:11:52 -04:00
Peter Hamilton 6f81d79c53 Update the CreateKeyPair payloads to support KMIP 2.0
This change updates the CreateKeyPair payloads to support KMIP 2.0
features, including swapping out TemplateAttributes for the new
Attributes structure in the request payload and removing all
attribute-related encodings from the response payload. Unit tests
have been added to cover these changes.
2019-03-18 14:38:24 -04:00
Peter Hamilton 1c85295d89 Update utilities to remove use of TemplateAttribute subclasses
This change updates the TemplateAttribute conversion utilities to
remove use of various TemplateAttribute subclasses. This reflects
the usage updates added for CreateKeyPair support. All related
unit tests have been updated to reflect this change.
2019-03-18 13:39:30 -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 fe3095c22b Update the Locate payloads to support KMIP 2.0
This change updates the Locate payloads to support KMIP 2.0
features, including swapping out individual Attribute structures
for the new Attributes structure in the request payload. Unit
tests have been added to cover these changes.
2019-03-12 10:01:18 -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 438ec42574 Add bit mask enumeration utilities
This changes adds several utilities for working with bit mask
enumerations, including functions to compute bit masks from lists
of enumeration values and vice versa. Unit tests have been added
to cover these new utilities.
2019-03-07 17:20:32 -05:00
Peter Hamilton 8e7dae6629 Update the Register payloads to support KMIP 2.0
This change updates the Register payloads to support KMIP 2.0
features, including swapping out TemplateAttributes for the new
Attributes structure in the request payload and removing all
attribute-related encodings from the response payload. Unit tests
have been added to cover these changes.
2019-03-06 15:29:51 -05: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 004ff92ffb Update the Create payloads to support KMIP 2.0
This change updates the Create payloads to support KMIP 2.0
features, including swapping out TemplateAttributes for the new
Attributes structure in the request payload and removing all
attribute-related encodings from the response payload. Unit tests
have been added to cover these changes.
2019-03-01 10:19:25 -05:00
Peter Hamilton b8ca94b518 Add utilities for converting TemplateAttributes and Attributes
This change adds several attribute-related utilities that support
converting TemplateAttribute structures to the new Attributes
structure and back. These utilities will be used in the updated
operation payloads to support seamless KMIP 2.0 encodings without
requiring broad payload internal and external usage changes.

Unit tests have been included to cover the new utility functions.
2019-03-01 08:32:54 -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 54f3688a14 Block Attributes encoding and decoding on non KMIP 2.0 calls
This change adds a check to the read and write methods of the new
Attributes object that raises a new VersionNotSupported exception
if KMIP 2.0 is not the version used for encoding and decoding.
The Attributes object is not defined for older versions of KMIP
and therefore cannot be correctly encoded or decoded in those use
cases.
2019-02-26 08:29:26 -05:00
Peter Hamilton 24f30d46b2 Add OrderedEnum to enable enum value comparisons
This change adds a new Enum subclass, OrderedEnum, that provides
comparison operators allowing for comparisons between enum values.
This will be used going forward with the KMIPVersion enum enabling
version checking on supported or unsupported object types.
2019-02-25 12:50:43 -05:00
Peter Hamilton 2057a48b31 Add KMIP version markers to enumerations 2019-02-22 12:03:43 -05:00
Peter Hamilton bc3e81b577 Add KMIP 2.0-style attribute handling
This change adds a new Attributes object to the object hierarchy,
which replaces TemplateAttributes in KMIP 2.0. The old attribute
components, like the AttributeName and AttributeIndex, are no
longer used and are instead replaced with the KMIP TTLV tag for
the attributes in question. This brings the attribute encoding
process in line with the rest of the KMIP specification.

To support this change, additional attribute and enumeration
utility functions have been added to simply attribute building
and attribute/enumeration validity checking. New test cases
covering this new functionality are also included.
2019-02-22 09:59:05 -05:00
Peter Hamilton e986488ebe Add KMIP 2.0 enumerations 2019-02-15 07:36:53 -05:00
Peter Hamilton dcade2a264 Update object hierarchy read/write to support the KMIP version
This change updates the PyKMIP object hierarchy's read/write
method signatures to support propagation of the KMIP version. The
introduction of KMIP 2.0 introduces future KMIP message encodings
that break backwards compatibility; to support this, PyKMIP must
know what KMIP version is being used when encoding or decoding an
object; the KMIP version residing in the client or server alone
is now insufficient. Prior versions of KMIP, namely 1.0 - 1.4,
have been backwards compatible, obviating the need for the KMIP
version at encode/decode time. Going forward, this is no longer
true.

The PyKMIP client and server have been updated to include the
KMIP version when making calls to read/write, as have the
associated test cases covering this functionality.
2019-02-06 17:06:47 -05:00
Peter Hamilton c012a430aa Fix flake8 warnings to reflect modern Python style 2019-02-01 11:53:18 -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
Peter Hamilton 9a5db6d5e1 Fix pending deprecation warnings caused by dependency upgrades
This change fixes various pending deprecation warnings throughout
the library caused by recent updates to different dependencies.
While PyKMIP no longer directly triggers these warnings, some
dependencies still do when run through the test suite.
2018-11-16 11:42:05 -05:00
Tim Burke f60bae83d0 Secure logging by default
As an application developer, you might expect to be able to turn on
debug logging at the root logger with something like

    logging.basicConfig(level=logging.DEBUG)

However, if the application needed to fetch any secrets from a KMIP
server, these previously would be logged as part of the wire protocol.
Further, any passwords in configs would also get logged at DEBUG.
Applications would need to proactively silence such logging, as in
https://github.com/openstack/swift/commit/12b6d46

Now, we will default the logger level to INFO to suppress the debug
logging. However, seeing the on-wire data may still be useful, for
example when developing a new KMIP server. So, allow developers to
consciously set the logger level to DEBUG.
2018-10-09 14:24:22 -07:00
Peter Hamilton 944186b1ca
Merge pull request #437 from OpenKMIP/feat/use-preset-over-default
Rename the 'default' policy section to 'preset'
2018-05-17 15:32:25 -04:00
Peter Hamilton 008f86cfa9 Rename the 'default' policy section to 'preset'
This change tweaks the format of operation policy files, renaming
the 'default' section of each policy to 'preset'. This reinforces
the idea that this section of the policy is used only when group-
based access control is disabled. It also removes any ambiguity
between this section of the policy and the actual 'default'
policy built into the server.
2018-05-17 13:55:50 -04:00
Peter Hamilton a9afd44a91 Add a better error message when reading unparseable attributes
This change adds a basic error message that gets raised when
attempting to read an unparseable attribute (i.e., an attribute
that is not supported by the library).

Fixes #429
2018-05-17 13:28:11 -04: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 664c9964c8 Add Check support to the payload factories
This change adds Check payload support to the payload factories.
Payload factory unit tests have been updated to account for the
change.
2018-04-17 00:32:20 -04:00
Peter Hamilton cf0ec6c429 Add Rekey support to the payload factories
This change adds Rekey payload support to the payload factories.
Payload factory unit tests have been updated to account for the
change.

Fixes #424
2018-04-15 23:38:37 -04:00
Peter Hamilton a604ae17b3
Merge pull request #420 from OpenKMIP/feat/add-rekey-payloads
Add the request and response payloads for the Rekey operation
2018-04-13 16:04:15 -04:00
Peter Hamilton 9be760a0a1
Merge pull request #416 from OpenKMIP/feat/add-policy-file-monitoring
Integrate policy file monitoring with the server
2018-04-13 09:34:32 -04:00
Peter Hamilton 412b452adf Add the request and response payloads for the Rekey operation
This change adds the request/response payloads for the Rekey
operation. Unit tests are included to cover the new payloads. The
payloads package is also updated to allow direct import of the
Rekey payloads going forward.

Partially addresses #405
2018-04-12 22:34:58 -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 05b5b8411a Integrate policy file monitoring with the server
This change updates the server, integrating policy file monitoring
and restructuring the engine. The top-level server entity now
handles loading policy files using the PolicyDirectoryMonitor
subprocess. A shared memory dictionary is used to share newly
modified policy data across the session threads managed by the
server and used by the engine. The legacy policy loading code in
the engine has been removed.

Unit tests have been added and modified for both the server and
engine to verify the functionality of these modifications.
2018-04-11 13:42:44 -04:00
Peter Hamilton 1a093f141e Update the server session to use the auth plugin framework
This change updates how the server session handles message
processing, adding support for the new authentication plugin
framework. Session unit tests have been updated to account for
this change.
2018-03-30 09:08:39 -04:00
Peter Hamilton 5c5012f524 Add AttestationCredential support
This change adds an implementation of the AttestationCredential
introduced in KMIP 1.2. The underlying Nonce struct is included.
Unit test suites for both objects are provided. Finally, the
Credential struct has also been updated to support the new
credential type.
2018-03-03 09:34:43 -05:00
Peter Hamilton fc2ff5d04c Remove legacy base class code for the original client
This change removes the legacy KMIP base class that was originally
used for the KMIPProxy client. The base class simply defined the
KMIP operation methods that the client should support. It has not
been actively used to guide client development for some time and
now just clutters up the code base. The KMIPProxy class has been
updated to remove any reference to this original base class.
2018-02-26 15:02:42 -05:00
Peter Hamilton 8d492fcda4 Update the Authentication object
This change updates the Authentication object, taking into account
the recent changes made to the Credential object hierarchy. A new
comprehensive unit test suite has been added for the Authentication
object. Usage of the object in the PyKMIP server has also been
updated to reflect these changes.
2018-02-26 10:23:25 -05:00
Peter Hamilton 86b23a9d53 Update the Credential objects
This change updates the implementation of the Credential objects.
The UsernamePassword and Device credentials are now first-class
objects and, along with the base Credential, have been restructured
to match the current struct style. Comprehensive unit test suites
for each class have been added. Additionally, the credential
factory code and its usage in the KMIPProxy class and associated
test suites have been updated to reflect this change.
2018-02-25 10:29:52 -05:00
Peter Hamilton dd4a078cc1 Update the ProtocolVersion implementation
This change updates the implementation of the ProtocolVersion
struct, bringing it inline with the current struct style. All
uses of the struct have been updated to reflect these changes,
as have the struct unit tests.
2018-02-22 13:35:11 -05:00
Peter Hamilton 61347d80b6 Update the server to support group-based operation policies
This change updates the PyKMIP server, allowing it to process and
use group-based operation policies. The server still supports the
original operation policy file format, so no immediate difference
should be apparent to users. Future documentation changes will
explain group-based policy files and how they should be used.
2018-02-19 12:12:40 -05:00
Peter Hamilton b84af4f88d Add payload for the Poll operation
This change adds the request payload for the Poll operation. A unit
test suite for the payload is included. The payload can be imported
directly from the payloads package.
2017-12-08 13:10:34 -05:00
Peter Hamilton 42da7f1d15 Add payloads for the ObtainLease operation
This change adds request and response payloads for the ObtainLease
operation. Unit test suites are included for both payloads and
both payloads can be imported directly from the payloads package.
2017-12-08 11:36:25 -05:00
Peter Hamilton 827b682583 Add payloads for the Recover operation
This change adds request and response payloads for the Recover
operation. Unit test suites are included for both payloads and
both payloads can be imported directly from the payloads package.
2017-12-08 08:43:06 -05:00
Peter Hamilton 53cbab7396 Add payloads for the Check operation
This change adds the request and response payloads needed for the
Check operation. Unit tests have been added to cover the new
payload structures.
2017-12-08 06:26:25 -05:00
Peter Hamilton 4c4bddc521 Add payloads for the GetUsageAllocation operation
This change adds request and response payloads for the
GetUsageAllocation operation. Unit test suites are included for
both payloads and both payloads can be imported directly from the
payloads package.
2017-12-08 05:58:40 -05:00
Peter Hamilton f23dde88cf Add payloads for the Cancel operation
This change adds request and response payloads for the Cancel
operation. Unit test suites are included for both payloads. Both
payloads can be imported directly from the payloads package.
2017-12-08 05:09:44 -05:00
Peter Hamilton 54b1df7726 Remove unused error code
This change removes unused exceptions defined in core/errors.py,
along with the errors.py module itself. The few used items from
this file are migrated over to core/exceptions.py. Any dependent
code is updated, dropping the use of errors.py and adding in the
use of exceptions.py.
2017-12-07 20:59:23 -05:00
Peter Hamilton 0b08301606 Add payloads for the Archive operation
This change adds request and response payloads for the Archive
operation. Unit test suites are included for both payloads and
both payloads can be imported directly from the payloads package.
2017-12-07 19:04:36 -05:00