[xmlsec] MsCrypto SHA2 Signing problem

Aleksey Sanin aleksey at aleksey.com
Sun Jan 29 14:39:36 PST 2017


Please check that you have compiled in RSA-SHA256 support. Another
problem might be with linking libraries. I would suggest to do all
static linking on Windows to avoid problems.

Aleksey

On 1/27/17 5:09 AM, Xavier Portell Martínez wrote:
> Hi,
> 
>  
> 
> I’m trying to digitally sign a XML with MsCrypto and I get the following
> error when calling xmlSecTmplSignatureCreate.
> 
>  
> 
> signNode = xmlSecTmplSignatureCreate(xmlDoc, xmlSecTransformExclC14NId,
> xmlSecTransformRsaSha256Id, NULL);
> 
>  
> 
> func=xmlSecTransformNodeRead:file=\xmlsec\src\transforms.c:line=1307:obj=unknown:subj=xmlSecTransformIdListFindByHref:error=1:xmlsec
> library function
> failed:href=http://www.w3.org/2001/04/xmldsig-more#rsa-sha256
> 
> func=xmlSecTransformCtxNodeRead:file=xmlsec\src\transforms.c
> :line=588:obj=DigestMethod:subj=xmlSecTransformNodeRead:error=1:xmlsec
> library function failed:
> 
> func=xmlSecDSigReferenceCtxProcessNode:file=\llibreries\xmlsec\src\xmldsig.c:line=1350:obj=DigestMethod:subj=xmlSecTransformCtxNodeRead:error=1:xmlsec
> library function failed:
> 
> func=xmlSecDSigCtxProcessReferences:file=\xmlsec\src\xmldsig.c:line=750:obj=Reference:subj=xmlSecDSigReferenceCtxProcessNode:error=1:xmlsec
> library function failed:
> 
> func=xmlSecDSigCtxProcessSignatureNode:file=\xmlsec\src\xmldsig.c:line=512:obj=unknown:subj=xmlSecDSigCtxProcessReferences:error=1:xmlsec
> library function failed:
> 
> func=xmlSecDSigCtxSign:file=\xmlsec\src\xmldsig.c:line=286:obj=unknown:subj=xmlSecDSigCtxSignatureProcessNode:error=1:xmlsec
> library function failed:
> 
>  
> 
>  
> 
> If I use the xmlSecTransformRsaSha1Idtransform it works correct.
> 
>  
> 
> signNode = xmlSecTmplSignatureCreate(xmlDoc, xmlSecTransformExclC14NId,
> xmlSecTransformRsaSha1Id, NULL);
> 
>  
> 
>  
> 
> I’m using latest sources from github and XmlSec is compiled with
> XMLSEC_MSCRYPTO_NT4=1.
> 
>  
> 
> I need to use this compile flag because if it’s not used, when I sign
> with a smart card certificate it fails. Otherwise with a certificate in
> “My” system store it works.
> 
>  
> 
> Here the error log when not compiled with the mentioned flag. Thrown
> when I call xmlSecDSigCtxSign.
> 
>  
> 
> func=xmlSecMSCryptoKeyDataCtxDuplicateKey:file=\xmlsec\src\mscrypto\certkeys.c:line=191:obj=unknown:subj=CryptDuplicateKey:error=4:crypto
> library function failed:MSCrypto error: 120: 0x00000078:
> *ERROR_CALL_NOT_IMPLEMENTED*
> 
>  
> 
> Or with another card.
> 
>  
> 
> func=xmlSecMSCryptoKeyDataCtxDuplicateKey:file=\xmlsec\src\mscrypto\certkeys.c:line=191:obj=unknown:subj=CryptDuplicateKey:error=4:crypto
> library function failed:MSCrypto error: 87: 0x00000057:
> *ERROR_INVALID_PARAMETER*
> 
>  
> 
> Any idea?
> 
> Thank you.
> 
>  
> 
> *Xavier Portell *
> 
> 
> 
> _______________________________________________
> xmlsec mailing list
> xmlsec at aleksey.com
> http://www.aleksey.com/mailman/listinfo/xmlsec
> 


More information about the xmlsec mailing list