Please help me to solve the ambiguous call in this code.
fac.newtransform() and fac.new signedinfo() is giving error saying:
reference to
newTransformis ambiguous, both methodnewTransform(String,TransformParameterSpec)inXMLSignatureFactoryand methodnewTransform(String,XMLStructure)inXMLSignatureFactorymatch
How can I call the actual function in XMLSignatureFactory?
XMLSignatureFactory fac =XMLSignatureFactory.getInstance("DOM",
(Provider) Class.forName(providerName).newInstance());
Reference ref =fac.newReference("",fac.newDigestMethod(DigestMethod.SHA1, null),
Collections.singletonList(fac.newTransform(Transform.ENVELOPED, null)),null, null);
SignedInfo si = fac.newSignedInfo
(fac.newCanonicalizationMethod
(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS,
null),
fac.newSignatureMethod(SignatureMethod.DSA_SHA1,
null),
Collections.singletonList(ref));
You must cast the second argument:
newTransform("foo", (XMLStructure) null)
You are getting the ambiguous warning because null is a valid argument to both methods. You need to add the (XMLStructure) cast to tell the compiler the type of the object you are setting to null..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With