2016-05-12 110 views
3

三天來,我一直在拉我的頭髮,試圖圍繞Okta & SAML包紮我的頭。「SignatureError:無法驗證簽名」 - Okta,pySAML2

在我的本地機器(OSX小牛隊),我能夠成功請按下列步驟操作:http://developer.okta.com/docs/guides/pysaml2

工作的事情。

但是將所有內容移動到我們的生產服務器(這是一個CentOS盒子)運行幾乎相同的代碼時,我遇到了這個「SignatureError:無法驗證簽名」錯誤。

Traceback (most recent call last): auth_response = saml_client.parse_authn_request_response(SAMLResponse, entity.BINDING_HTTP_POST) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/client_base.py\", line 599, in parse_authn_request_response binding, **kwargs)

response = response.loads(xmlstr, False, origxml=origxml) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 510, in loads self._loads(xmldata, decode, origxml)

File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/response.py\", line 335, in _loads **args) File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1756, in correctly_signed_response class_name(response), origdoc)

File \"/usr/local/lib/python2.7.11/lib/python2.7/site-packages/saml2/sigver.py\", line 1571, in _check_signature raise SignatureError(\"Failed to verify signature\") SignatureError: Failed to verify signature

我已經在互聯網上尋找解決這個錯誤的方法。我是SAML和Okta的新手。

我的假設是,這與xmlsec1在我們的生產機器上的行爲不同有關。但版本是相同的。有很多依賴關係,所以我不確定問題可能在哪裏。

有沒有人遇到這個錯誤?有關我可能會嘗試的任何想法?

回答

0

處理xmlsec1會非常令人沮喪!

,我建議做的主要事情是enabling debugging in PySAML2,和/或setting the PYSAML2_KEEP_XMLSEC_TMP environment variable,和/或manually enable this code path in sigver.py - 一般的想法是讓一看xmlsec1命令PySAML2呼籲,並已PySAML2周圍留下的臨時文件,這樣你可以自己測試命令。

我記得,過去遇到的大多數問題都涉及到PySAML2找不到xmlsec1二進制文件。 The get_xmlsec_binary() function in sigver.py負責找到xmlsec1二進制文件。我建議你看看get_xmlsec_binary()中的代碼,並確保它在你係統的正確位置。

2

我知道這是有點晚了,但萬一別人運行到這一點:

pysaml2使用python內置的日誌,我定義了一個saml2.sigver處理,這給了很多提供了大量的日誌記錄的信息。在那些日誌中,我發現這個:

Error: unable to load xmlsec-openssl library. Make sure that you have 
this it installed, check shared libraries path (LD_LIBRARY_PATH) 
envornment variable or use "--crypto" option to specify different 
crypto engine. 

原來我需要安裝xmlsec1-openssl。 希望這可以幫助未來的人。