Commit Graph

810 Commits

Author SHA1 Message Date
Peter Hamilton 5ac0c5d6dd Update the documentation to prepare for the PyKMIP 0.9 release 2019-06-17 15:04:14 -04:00
Peter Hamilton 9fac723b2e Update the server to nominally support KMIP 2.0 2019-06-17 13:09:48 -04:00
Peter Hamilton ffe5d7a86c Updating the Register payloads to properly use protection masks
This change updates the Register payloads to properly use the new
ProtectionStorageMasks structure. Unit tests have been updated to
reflect this change.
2019-05-10 16:08:09 -04:00
Peter Hamilton bc4e4e38bd Updating the Create payloads to properly use protection masks
This change updates the Create payloads to properly use the new
ProtectionStorageMasks structure. Unit tests have been updated to
reflect this change.
2019-05-10 15:27:04 -04:00
Peter Hamilton 7280ccb1eb Update the CreateKeyPair payloads to support protection masks
This change updates the CreateKeyPair payloads to support the new
protection storage masks fields introduced in KMIP 2.0. The payload
unit tests have been updated to reflect these changes.
2019-05-10 14:20:53 -04:00
Peter Hamilton 3b7d9bc21f Update the ResponseHeader to support the server hashed password
This change updates the ResponseHeader to support the new server
hashed password field added in KMIP 2.0. Unit tests have been
added to cover the change.
2019-05-10 09:22:20 -04:00
Peter Hamilton 4a9690165a Update the RequestBatchItem to support the ephemeral field
This change updates the RequestBatchItem to support the new
ephemeral field added in KMIP 2.0. Unit tests have been added to
cover the change.
2019-05-09 12:23:13 -04:00
Peter Hamilton a7f05ab7be Temporarily pin bandit to 1.5.1
A recent regression in bandit 1.6.0 permits the scanning of test
files for vulnerabilities even when those files should be excluded
using the '-x' flag. This change temporarily pins bandit to 1.5.1
in test-requirements.txt to get around this issue in the short
term.

This patch should be undone once bandit 1.6.1 is released, fixing
this issue.
2019-05-09 11:18:25 -04:00
Peter Hamilton cd16b20a6b Add support for the ProtectionStorageMasks structure
This change adds support for the ProtectionStorageMasks structure
which is a new addition in KMIP 2.0. A unit test suite has been
added for the new structure.
2019-05-03 16:48:07 -04:00
Peter Hamilton b4c3980da0 Update the Query payloads to rename Protection Storage Masks
This change makes a simple renaming update to the Query response
payload, correcting how Protection Storage Masks are used and
referenced. All related unit tests have been updated to reflect
this change.
2019-05-03 12:03:16 -04:00
Peter Hamilton a2712e7541 Update the Register payloads to support Protection Storage Masks
This change updates the Register payloads, adding support for
Protection Storage Masks which were added in KMIP 2.0. The
payload unit tests have been updated to reflect this change.
2019-05-03 09:35:42 -04:00
Peter Hamilton cc4c1775d1 Update the Create payloads to support Protection Storage Masks
This change updates the Create payloads, adding support for
Protection Storage Masks which were added in KMIP 2.0. The
payload unit tests have been updated to reflect this change.
2019-04-30 15:51:17 -04:00
Peter Hamilton b51c5b044b Update the Query payloads to support KMIP 2.0
This change updates the Query payloads to support KMIP 2.0, adding
in new response components including server default information
and storage protection masks. Unit tests have been added and
updated to cover these changes.
2019-04-23 18:33:15 -04:00
Peter Hamilton 314dd8761e Update the Query payloads
This change upgrades the Query payloads, fixing error messages,
comments, local variables, and internal payload structure to
bring Query support up to KMIP 1.4 standards, in addition to
compliance with the current payload format. The corresponding
unit test suite has been completely rewritten to reflect these
changes.

This change prepares the Query payloads for future updates to
support KMIP 2.0.
2019-04-23 10:00:46 -04:00
Peter Hamilton b968378eb8 Add the CapabilityInformation structure
This change adds the CapabilityInformation structure, a KMIP 1.3
addition that is used to specify details on capabilities supported
by a KMIP server. A unit test suite is included to cover the new
structure.
2019-04-19 14:06:33 -04:00
Peter Hamilton a778aa4224 Add the ValidationInformation structure
This change adds the ValidationInformation structure, a KMIP 1.3
addition that is used to specify details on formal validation
methods supported by a KMIP server. A unit test suite is included
to cover the new structure.
2019-04-19 08:37:10 -04:00
Peter Hamilton 44cd81d6d1 Update requirements and pin cryptography at 1.4+
This change updates requirements, pinning cryptography>=1.4. This
is due to the use of kbkdf in the server's cryptography engine,
which was not introduced until cryptography 1.4.

Fixes #525
2019-04-15 15:22:45 -04:00
Peter Hamilton b68312119f Add the ProfileInformation structure
This change adds the ProfileInformation structure, a KMIP 1.3
addition that is used to specify details for supported KMIP
profiles. A unit test suite is included to cover the new
structure.
2019-04-15 14:02:43 -04:00
Peter Hamilton 4b19fc81a3 Add the RNGParameters structure
This change adds the RNGParameters structure, a KMIP 1.3 addition
that is used to specify parameters and settings associated with a
specific random number generator. A unit test suite is included
to cover the new structure.
2019-04-12 17:29:25 -04:00
Peter Hamilton 01b724b4e2 Add the DefaultsInformation structure
This change adds the DefaultsInformation structure, a KMIP 2.0
addition that is used to specify default attribute values for
KMIP managed objects. A unit test suite is included to cover the
new structure.
2019-04-12 09:18:26 -04:00
Peter Hamilton dae68f7e46 Add the ObjectDefaults structure
This change adds the ObjectDefaults structure, a KMIP 2.0 addition
that is used to specify default attribute values for KMIP managed
objects. A unit test suite is included to cover the new structure.
2019-04-09 15:09:56 -04:00
Peter Hamilton 790abc85cb Update the GetAttributeList payloads to support KMIP 2.0
This change updates the GetAttributeList payloads to support KMIP
2.0 features, including swapping out Attribute Names for the
Attribute Reference structure in the response payload. Unit tests
have been added to cover these changes.
2019-04-05 15:07:18 -04:00
Peter Hamilton 05f4d7aef4 Update the GetAttributeList payloads
This change makes minor updates to the GetAttributeList 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 GetAttributeList payloads for future
updates to support KMIP 2.0.
2019-04-04 11:12:57 -04:00
Peter Hamilton 35b2381341 Add positional arguments to pytest calls in tox.ini
This change adds a posargs argument to the call to pytest that is
used when invoking unit tests for individual Python versions. This
allows developers to specify which tests or test suites they want
to invoke. For example, use the following to run the unit test
suites related to the GetAttributeList payloads for Python 2.7:

tox -r -e py27 -- -k TestGetAttributeList

Developers can still use tox to run the entire test suite, like
before:

tox -r -e py27
2019-04-04 09:52:07 -04:00
Peter Hamilton 0961687d66 Update the GetAttributes payloads to support KMIP 2.0
This change updates the GetAttributes payloads to support KMIP 2.0
features, including swapping out Attribute Names for the Attribute
Reference structure in the request payload and the Attribute list
for the Attributes structure in the response payload. Unit tests
have been added to cover these changes.
2019-03-29 15:36:00 -04:00
Peter Hamilton 568e87e89e Update the GetAttributes payloads
This change makes minor updates to the GetAttributes 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 GetAttributes payloads for future updates
to support KMIP 2.0.
2019-03-25 14:58:13 -04:00
Andrey Smirnov 42f36d080c Implement simple CLI for GET_ATTRIBUTES operation
Examples:

```
$ kmip/demos/pie/get_attributes.py -s ./vault-client.conf -i ca4a423c-d7a3-8771-028c-58feb78afca3 -a 'State' -a 'Object Type'
2019-03-25 19:28:25,868 - demo - INFO - Successfully retrieved 2 attributes:
2019-03-25 19:28:25,868 - demo - INFO - Attribute State: State.ACTIVE
2019-03-25 19:28:25,868 - demo - INFO - Attribute Object Type: ObjectType.SYMMETRIC_KEY
```

All attributes:

```
$ kmip/demos/pie/get_attributes.py -s ./vault-client.conf -i ca4a423c-d7a3-8771-028c-58feb78afca3
2019-03-25 19:28:29,985 - demo - INFO - Successfully retrieved 8 attributes:
2019-03-25 19:28:29,985 - demo - INFO - Attribute Unique Identifier: ca4a423c-d7a3-8771-028c-58feb78afca3
2019-03-25 19:28:29,985 - demo - INFO - Attribute Object Type: ObjectType.SYMMETRIC_KEY
2019-03-25 19:28:29,985 - demo - INFO - Attribute Cryptographic Algorithm: CryptographicAlgorithm.AES
2019-03-25 19:28:29,985 - demo - INFO - Attribute Cryptographic Length: 256
2019-03-25 19:28:29,985 - demo - INFO - Attribute Cryptographic Usage Mask: 12
2019-03-25 19:28:29,985 - demo - INFO - Attribute State: State.ACTIVE
2019-03-25 19:28:29,985 - demo - INFO - Attribute Initial Date: Mon Mar 25 14:28:44 2019
2019-03-25 19:28:29,985 - demo - INFO - Attribute Last Change Date: Mon Mar 25 14:28:44 2019
```
2019-03-25 13:44:27 -04:00
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 e2f93d49d7 Move the KMIPProtocol from server to services
This change moves the KMIPProtocol class from the server module
to the services module. Because the client uses KMIPProtocol, and
KMIPProtocol lived in the server module, the client would end up
importing server libraries whenever it was used. If there are any
issues with server dependencies, this would cause the client to
fail for no good reason. This change now insulates the client from
the server code base and prevents this case from happening.

See #509
2019-03-21 10:43:55 -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
Andrey Smirnov 1a723f224d Move TLS server handshake down to connection thread
When TLS handshake is performed while in `accept()` call, main thread
might blocked up to network timeout effectively locking out other
clients from being able to establish connection with PyKMIP server.

Easy way to reproduce the problem:

1. Start PyKMIP server

2. Establish TCP connection with `nc -v 127.0.0.1 5696`

3. Attempt to connect (concurrently):
   `openssl s_client -host 127.0.0.1 -port 5696`

Without the fix, `openssl` would be blocked (won't even do initial TLS
handshake) until `nc` connection times out.
2019-03-04 14:58:11 -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
Andrey Smirnov a58a3a3bea Provision CA extension in CA cert
Without that, on modern OpenSSL libs this gives an error:

```
verify error:num=24:invalid CA certificate
```
2019-02-27 08:53:46 -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