Hi, been using PyKMIP a lot for testing the integration with a KMIP server and client, ant it was working fine until I re-started testing yesterday. I'm seeing this happening with all methods (create a key, use a key to encrypt data etc).
I tried with both Jupyter notebooks on Windows and Ubuntu and the same is happening. The code:.
key_name = input("Key name to be created in KMIP Server: ")
from kmip.pie import client
from kmip import enums
c = client.ProxyKmipClient()
with c:
key_id = c.create(
enums.CryptographicAlgorithm.AES,
256,
--
Was supposed to create an AES Key with the name you inserted on the KMIP server. It was working before but now I can only see:
error Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_8468/482820268.py in
7 c = client.ProxyKmipClient()
8 with c:
----> 9 key_id = c.create(
10 enums.CryptographicAlgorithm.AES,
11 256,
~\Anaconda3\lib\site-packages\kmip\pie\client.py in wrapper(self, *args, *kwargs)
39 if not self._is_open:
40 raise exceptions.ClientConnectionNotOpen()
---> 41 return function(self, args, **kwargs)
42 return wrapper
43
~\Anaconda3\lib\site-packages\kmip\pie\client.py in create(self, algorithm, length, operation_policy_name, name, cryptographic_usage_mask)
254
255 # Create the symmetric key and handle the results
--> 256 result = self.proxy.create(enums.ObjectType.SYMMETRIC_KEY, template)
257
258 status = result.result_status.value
~\Anaconda3\lib\site-packages\kmip\core\primitives.py in read_tag(self, istream)
48 # Read in the bytes for the tag
49 tts = istream.read(self.TAG_SIZE)
---> 50 tag = unpack('!I', b'\x00' + tts[0:self.TAG_SIZE])[0]
51
52 enum_tag = enums.Tags(tag)
Hi, been using PyKMIP a lot for testing the integration with a KMIP server and client, ant it was working fine until I re-started testing yesterday. I'm seeing this happening with all methods (create a key, use a key to encrypt data etc).
I tried with both Jupyter notebooks on Windows and Ubuntu and the same is happening. The code:.
key_name = input("Key name to be created in KMIP Server: ")
from kmip.pie import client from kmip import enums c = client.ProxyKmipClient() with c: key_id = c.create( enums.CryptographicAlgorithm.AES, 256,
operation_policy_name='None',
print(key_id)
-- Was supposed to create an AES Key with the name you inserted on the KMIP server. It was working before but now I can only see:
error Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_8468/482820268.py in
7 c = client.ProxyKmipClient()
8 with c:
----> 9 key_id = c.create(
10 enums.CryptographicAlgorithm.AES,
11 256,
~\Anaconda3\lib\site-packages\kmip\pie\client.py in wrapper(self, *args, *kwargs) 39 if not self._is_open: 40 raise exceptions.ClientConnectionNotOpen() ---> 41 return function(self, args, **kwargs) 42 return wrapper 43
~\Anaconda3\lib\site-packages\kmip\pie\client.py in create(self, algorithm, length, operation_policy_name, name, cryptographic_usage_mask) 254 255 # Create the symmetric key and handle the results --> 256 result = self.proxy.create(enums.ObjectType.SYMMETRIC_KEY, template) 257 258 status = result.result_status.value
~\Anaconda3\lib\site-packages\kmip\services\kmip_client.py in create(self, object_type, template_attribute, credential) 428 429 def create(self, object_type, template_attribute, credential=None): --> 430 return self._create(object_type=object_type, 431 template_attribute=template_attribute, 432 credential=credential)
~\Anaconda3\lib\site-packages\kmip\services\kmip_client.py in _create(self, object_type, template_attribute, credential) 1179 message = messages.ResponseMessage() 1180 data = self._receive_message() -> 1181 message.read(data, self.kmip_version) 1182 batch_items = message.batch_items 1183 batch_item = batch_items[0]
~\Anaconda3\lib\site-packages\kmip\core\messages\messages.py in read(self, istream, kmip_version) 518 519 self.response_header = ResponseHeader() --> 520 self.response_header.read(istream, kmip_version=kmip_version) 521 522 kmip_version = contents.protocol_version_to_kmip_version(
~\Anaconda3\lib\site-packages\kmip\core\messages\messages.py in read(self, istream, kmip_version) 206 207 self.batch_count = contents.BatchCount() --> 208 self.batch_count.read(tstream, kmip_version=kmip_version) 209 210 self.is_oversized(tstream)
~\Anaconda3\lib\site-packages\kmip\core\primitives.py in read(self, istream, kmip_version) 226 227 def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): --> 228 super(Integer, self).read(istream, kmip_version=kmip_version) 229 self.read_value(istream) 230
~\Anaconda3\lib\site-packages\kmip\core\primitives.py in read(self, istream, kmip_version) 103 104 def read(self, istream, kmip_version=enums.KMIPVersion.KMIP_1_0): --> 105 self.read_tag(istream) 106 self.read_type(istream) 107 self.read_length(istream)
~\Anaconda3\lib\site-packages\kmip\core\primitives.py in read_tag(self, istream) 48 # Read in the bytes for the tag 49 tts = istream.read(self.TAG_SIZE) ---> 50 tag = unpack('!I', b'\x00' + tts[0:self.TAG_SIZE])[0] 51 52 enum_tag = enums.Tags(tag)
error: unpack requires a buffer of 4 bytes
Anyone is seeing this recently?