我目前正在开发一个WS客户端,需要在将请求发送到服务器之前对其进行签名.我有一个私钥和证书用于此目的,但我正在努力与安全标头.输出XML的预期结构应该是这样的:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-
1.0.xsd"><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="CertId-45..."
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-
1.0.xsd"> ... </wsse:BinarySecurityToken><ds:Signature Id="Signature-13"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-14">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>62...</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
...
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-...">
<wsse:SecurityTokenReference wsu:Id="STRId-..." xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-
wss-wssecurity-utility-1.0.xsd"><wsse:Reference URI="#CertId-..." ValueType="http://docs.oasis-
open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature></wsse:Security></soapenv:Header>
<soapenv:Body wsu:Id="id-14" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
Run Code Online (Sandbox Code Playgroud)
我尝试使用xmlseclibs但我无法弄清楚如何包含所有必需的信息,因为这些示例非常基本.
我想我可以采用DIY方式并手动构建标题,但我希望尽可能简单.
有线索吗?
我目前正在使用SoapClient执行此任务.事情是,我不知道该怎么做.我发送的XML需要签名其内容,我手动完成(使用c14n函数并计算其摘要..).但是,为了对整个身体做同样的事情,我需要访问原始XML(我想),所以我认为这不会起作用.
我没有尝试手动创建SOAP标头,因为我试图避免任何黑客攻击.我正在寻找既易于实现又易于使用的东西.
我的代码目前看起来像这样(将其保持在最低限度以提高可读性):
$context = stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'allow_self_signed' => true,
'ciphers'=>'SSLv3'
)
));
$client = new SoapClient($url, array(
//'connection_timeout' => 100,
/* …Run Code Online (Sandbox Code Playgroud) 我目前正在尝试从我的程序验证引理生成Haskell代码,如下所示:
Lemma the_thing_is_ok : forall (e:Something), Matches e (calculate_value e).
Run Code Online (Sandbox Code Playgroud)
在结束我的部分之后,我做:
Extraction Language Haskell.
Recursive Extraction the_thing_is_ok
Run Code Online (Sandbox Code Playgroud)
它似乎并不是真的很高兴,因为它返回以下错误:
__ = Prelude.error "Logical or arity value used"
Run Code Online (Sandbox Code Playgroud)
我有另一个Lemma似乎确实输出得很好,但我无法弄清楚究竟是什么问题.有关如何解决该错误的任何线索?
我正在从事一些机器人视觉项目,我需要通过颜色进行一些物体识别。我目前正在为此目的使用面具。到目前为止一切顺利,但现在我需要调整某些设置,我想实际看看这些更改如何影响最终结果。
我的第一个想法是,“好吧,在屏幕上打印蒙版”,所以我尝试将蒙版视为表面,但事实证明 PyGame 蒙版无法“blit”到屏幕表面:
TypeError: argument 1 must be pygame.Surface, not pygame.mask.Mask
Run Code Online (Sandbox Code Playgroud)
我目前正在使用 PyGame.mask 操作并猜测蒙版是什么样子,但我认为在屏幕上显示当前蒙版将非常有用。我认为如果我可以将蒙版应用到表面并查看实际识别的内容可能会更好,但蒙版的黑白表示就足够了。我阅读了文档,但不知道如何继续。
另外,我尝试显示的掩码是由 pygame.mask.from_threshold 生成的
有关如何执行此操作的任何线索?
我有一个特定的类,即Animal,以及几个子类Dog,如Cow、Lion、 等。
Animal是一个抽象类,它有一个抽象静态方法eats(Food f)。
所有这些子类都会实现eats,并且根据每种动物的不同,将返回True或False.
我如何迭代每个类别并创建一个新的特定食物Animal类型eats,而无需手动输入每个类别?
例如,我想获得一个Animal吃草类型的对象,而不实际创建一个新的Cow.
查找 的子类Animal可能是一部分,但我更感兴趣的是实际迭代某种类列表并eats在每个类上运行,直到找到一个返回 True 的子类,然后创建该类的一个新对象。
谢谢。
python ×2
class ×1
coq ×1
haskell ×1
mask ×1
php ×1
pygame ×1
soap-client ×1
xml ×1
xmlseclibs ×1