[xmlsec] MsCrypto SHA2 Signing problem

Xavier Portell Martínez xportell at ccfc.cat
Fri Jan 27 05:09:17 PST 2017


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=unk
nown: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:o
bj=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 xmlSecTransformRsaSha1Id transform 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 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.aleksey.com/pipermail/xmlsec/attachments/20170127/045a81d4/attachment.html>


More information about the xmlsec mailing list