GNOME Bugzilla – Bug 768112
ValueError: String can't be PCKS7-padded in the mock service
Last modified: 2017-11-07 14:46:05 UTC
Hi, I'm (mis)using libsecret's mock service for testing my own code on Travis. It usually works OK, but in some rare case I get this error: python3 ./libsecret/libsecret/mock-service-normal.py Traceback (most recent call last):
+ Trace 236396
retval = candidate_method(self, *args, **keywords)
(secret, content_type) = session.decode_secret(value)
plain = self.algorithm.decrypt(self.key, value[1], value[2])
return aes.strip_PKCS7_padding(decr)
raise ValueError("String ending with %r can't be PCKS7-padded" % s[-1])
I think I just got this error for a second or third time. This time it happened when calling CreateItem method on a collection interface. I don't know much about mock code but I suspect it may be wrong handling of cases where first/last byte of a key is zero (in this case the error will happen approx. one time of 256).
Created attachment 361147 [details] [review] mock: Pad the common secret with zero bytes to make it exactly 128 bytes long I finally found some time to debug this. It happens because the mock implementation does not pad the common DH secret with zero bytes, but my module and libsecret’s own C code do it: https://git.gnome.org/browse/libsecret/tree/egg/egg-dh.c#n340 Attaching a patch to fix this.
Stef: any chance you can commit this patch?
Review of attachment 361147 [details] [review]: Looks good to me!
Please push, I do not have rights :(
Merged to git master.