Как я могу дать несколько ссылок в подписи wss? - PullRequest
0 голосов
/ 23 января 2019

Я хочу подписать поля 'body' и 'timeStamp' моего мыльного сообщения с помощью wss. Для этого мне нужно сослаться на два блока, но как мне добавить вторую ссылку?

Справка:

 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));

мой xml:

<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>

ожидается:

<SignatureMethod 
 Algorithm="http://www.w3.org/2001/04/xmldsig-more#hmac-sha256"/>
 <Reference URI="#_1">
<Transforms>
    <Transform 
             Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>7gZv94NUII24kIcgDRbFcPw+GYNTMoD/mu6KtILoMm0=</DigestValue>
    </Reference>
    <Reference URI="#uuid-272f781e-e13e-4fbb-9ec0-c95f5ffd1c79-1">
<Transforms>
    <Transform 
     Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<DigestValue>bCtGd3Z5JFHQ9XT4cht4SmGMR06f2fGK/SG8XT/MNfI=</DigestValue>
 </Reference>
 </SignedInfo>
...