Re: Pyro4 ver 4.35 hmac key config not symmetric

Irmen de Jong <[email protected]> Sun, 12 Apr 2015 00:39:05 +0200
Newsgroups gmane.comp.python.pyro
Message-ID <[email protected]>
On 10-4-2015 22:23, Katelyn Thode wrote:
> Hello,
> =


Hello Katelyn


> I am having an issue when attempting to set up the hmac key for Pyro4 in =
code.  The
> versions being used are as follows:
> Pyro 4: 4.35
> Python: 2.7.9
> =

> The error message is: =

> Pyro4.errors.SecurityError: hmac key config not symmetric
> =

> The code that is being used is below:
> daemon =3D Pyro4.Daemon(/IP/)
> key =3D str(/self/.get_hmac_key())
> daemon._pyroHmacKey =3D key
> nameServer =3D Pyro4.locateNS(/IP/)
> nameServer._pyroHmacKey =3D key
> uri =3D daemon.register(/self/)
> nameServer.register(name, uri)
> =

> get_hmac_key():
>      key =3D =93test1"
>      msg =3D =93test2"
>      hmac_obj =3D hmac.new(key, msg, hashlib.sha256)
>      hmac_key =3D hmac_obj.hexdigest()
>      returnhmac_key
> =

> The line that the error is thrown at is nameServer.register(name, uri).  =
Please advise
> on what I am doing incorrectly.
> =


I think the problem is in the way you're providing the hmac key to Pyro.
You should not be encoding it / hmac'ing it yourself; just provide the key =
to Pyro
directly. If I understand your code correctly, your key is "test1".
I assume you have started your nameserver with the "-k test1" argument?
So just set _pyroHmacKey=3D"test1".

See
https://pythonhosted.org/Pyro4/security.html#preventing-arbitrary-connectio=
ns-hmac-signature


> Thanks,
> Katelyn

Hope the above helps you to get your code working. Let us know!


Cheers
Irmen


---------------------------------------------------------------------------=
---
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=3DSourceforge_BPM_Camp_5_6_15&utm_medium=3Demail&utm_campaign=3DVA_SF