INTEGRATOR - SOAP Response with SIGNATURE

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
Fabrice.geay
Posts: 21
Joined: Tue Dec 12, 2017 2:06 am
Location: FRANCE
Contact:

INTEGRATOR - SOAP Response with SIGNATURE

Post by Fabrice.geay »

Hy,

I need to put the following fragment in a SOAP response, It was defined in the XSD:
<ds:Signature>
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#_1fa877ec-1c7b-97be-67a1-8d3694963006">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>ecqx3Mh+8z9PU/KqG1A9CZqs/WK2sudl/6BGnctdDxg=</ds:DigestValue>
</ds:Reference>
<ds:Reference URI="#_1fa877ec-1c7b-97be-b413-8d3694963009">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>ecqx3Mh+8z9PU/KqG1A9CZqs/WK2sudl/6BGnctdDxg=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue></ds:SignatureValue>
<ds:KeyInfo Id="_1fa877ec-1c7b-97be-b413-8d3694963009">
<ds:X509Data>
<ds:X509Certificate/>
</ds:X509Data>
</ds:KeyInfo>
</ds:Signature>

But I also need SignatureValue and X509Certificate values but I don't know how I can get this information using a certificat Store ?
I guess I will have to use JAVA.
Best regard

Fabrice GEAY
User avatar
Fabrice.geay
Posts: 21
Joined: Tue Dec 12, 2017 2:06 am
Location: FRANCE
Contact:

Re: INTEGRATOR - SOAP Response with SIGNATURE

Post by Fabrice.geay »

I have found how to set X509Certificate :

CertificateFactory cf = CertificateFactory.getInstance("X.509");
FileInputStream in = new FileInputStream("Path of my cer file");
java.security.cert.Certificate c = cf.generateCertificate(in);
in.close();

t = (X509Certificate) c;
byte[] encodedCertificate = t.getEncoded();
t.checkValidity();
System.out.println("Ce Certificat est valide " + t.getNotAfter() );

String Certif64 = Base64.getEncoder().withoutPadding().encodeToString(encodedCertificate);
System.out.println("Certificat = " + Certif64);

But now i need set "SignatureValue". I have found examples with Input Xml SIGNATURE but not just the "SignatureValue" (A byte array that contains the signature value of the current SignedXml object)
lhyeak
Posts: 1
Joined: Thu Aug 29, 2024 12:24 pm

Re: INTEGRATOR - SOAP Response with SIGNATURE

Post by lhyeak »

Hi Fabrice,

I’m experiencing the same issue. Could you please share how you resolved it?
Post Reply