如何在wss签名中提供多个引用?

时间:2019-01-23 11:55:20

标签: java xml soap signature

我想用wss签名我的肥皂消息的'body'和'timeStamp'字段。为此,我需要引用两个块,但是如何添加第二个引用。

参考:

image.save(name+'.png')
img = qrcode.make(str(company)+str(idno)+name)   # this info. is added in QR code, also add other things in str function
img.save(str(idno)+'.bmp')


til = Image.open(name+'.png')       #open saved qr code and save it to final image
im = Image.open(str(idno)+'.bmp')
til.paste(im,(600,350))

til.save(name+'.png')

我的xml:

 XMLSignatureFactory sigFactory = XMLSignatureFactory.getInstance();

Reference ref = sigFactory.newReference("#_1",sigFactory.newDigestMethod(DigestMethod.SHA256,
        null));    
SignedInfo signedInfo = sigFactory.newSignedInfo(sigFactory.newCanonicalizationMethod(
    CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec) null), sigFactory
    .newSignatureMethod(SignatureMethod.DSA_SHA1, null), Collections.singletonList(ref));

预期:

<ds:SignedInfo>
<ds:CanonicalizationMethod
 Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:SignatureMethod 
 Algorithm="http://www.w3.org/2000/09/xmldsig#dsa-sha1"/>
<ds:Reference URI="#_1">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>

<ds:DigestValue>xZBNvuJ6LemA19zgxMArFM/m1JlE9dXriHZx/BGD+eQ= 
</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>

0 个答案:

没有答案