计算Soap Header Python中KeyInfo的引用URI

时间:2015-03-09 20:27:00

标签: python cryptography openssl rsa sha1

我正在尝试为我的Soap XML请求生成安全标头,我可以计算摘要值和签名值。我需要在KeyInfo中填充以下URI值 - > SecurityTokenReference - >参考,

<wsse:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#X509-623242F9C597DEB5EB1425871479922117"/>

以下是我计算其余值的方法:

signed_info = canonicalize(signed_info, c14n_exc)
#Sign the SHA1 digest of the signed xml using RSA cipher
pkey = RSA.load_key(private_key, lambda *args, **kwargs: password)
signature = pkey.sign(hashlib.sha1(signed_info).digest())

0 个答案:

没有答案