[xmlsec] xmlSecTmplX509DataAddIssuerSerial

Dmitry Belyavsky beldmit at cryptocom.ru
Thu Dec 15 08:58:09 PST 2005


Greetings!

On Thu, 15 Dec 2005, Aleksey Sanin wrote:

> Oh... Sorry. Yes, in this case you have to add these nodes
> manually... Or create a small path and add these two functions
> and I'll be happy to apply it :)

The patch is attached. Thank you!

> Aleksey
>
>
> Dmitry Belyavsky wrote:
> > Greetings!
> >
> > On Thu, 15 Dec 2005, Aleksey Sanin wrote:
> >
> > > > So after creating this node should I add X509IssuerName and
> > > > X509SerialNumber manually?
> > > No. Everything will be done by xmlsec automatically.
> >
> > Sorry, I don't understand. I want to specify X509IssuerName and
> > X509SerialNumber to find a key I will use to sign a document. What
> > should I do after xmlSecTmplX509DataAddIssuerSerial?
> >
> > Thank you!
> >
>
>

-- 
SY, Dmitry Belyavsky (ICQ UIN 11116575)
-------------- next part --------------
Index: src/templates.c
===================================================================
RCS file: /cvs/xmlsec/src/templates.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
1453a1454,1539
>  * xmlSecTmplX509IssuerSerialAddIssuerName:
>  * @x509IssuerSerialNode: 	the pointer to <dsig:X509IssuerSerial/> node.
>  * @issuerName:		the issuer name (optional).	
>  *
>  * Adds <dsig:X509IssuerName/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
>  *
>  * Returns the pointer to the newly created <dsig:X509IssuerName/> node or
>  * NULL if an error occurs.
>  */
> xmlNodePtr
> xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName) {
> 	xmlNodePtr res;
> 	
> 	xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
> 	
>   if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName,
> 				xmlSecDSigNs) != NULL) {
> 	xmlSecError(XMLSEC_ERRORS_HERE,
> 		    NULL,
> 		    xmlSecErrorsSafeString(xmlSecNodeX509IssuerName),
> 		    XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
> 		    XMLSEC_ERRORS_NO_MESSAGE);
> 	return(NULL);
> 	}
> 
> 	res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509IssuerName, xmlSecDSigNs);
>     if(res == NULL) {
> 	xmlSecError(XMLSEC_ERRORS_HERE,
> 		    NULL,
> 		    "xmlSecAddChild",
> 		    XMLSEC_ERRORS_R_XMLSEC_FAILED,
> 		    "node=%s",
> 		    xmlSecErrorsSafeString(xmlSecNodeX509IssuerName));
> 	return(NULL);	
>     }
> 
> 		if (issuerName != NULL) {
> 			xmlNodeSetContent(res, issuerName);
> 		}
> 		return(res);
> }
> 
> /**
>  * xmlSecTmplX509IssuerSerialAddIssuerName:
>  * @x509IssuerSerialNode: 	the pointer to <dsig:X509IssuerSerial/> node.
>  * @serial:		the serial number (optional).	
>  *
>  * Adds <dsig:X509SerialNumber/> node to the <dsig:X509IssuerSerial/> node @x509IssuerSerialNode.
>  *
>  * Returns the pointer to the newly created <dsig:X509SerialNumber/> node or
>  * NULL if an error occurs.
>  */
> xmlNodePtr
> xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const xmlChar* serial) {
> 	xmlNodePtr res;
> 
> 	xmlSecAssert2(x509IssuerSerialNode != NULL, NULL);
> 
> 	if(xmlSecFindChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber,
> 				xmlSecDSigNs) != NULL) {
> 		xmlSecError(XMLSEC_ERRORS_HERE,
> 				NULL,
> 				xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber),
> 				XMLSEC_ERRORS_R_NODE_ALREADY_PRESENT,
> 				XMLSEC_ERRORS_NO_MESSAGE);
> 		return(NULL);
> 	}
> 
> 	res = xmlSecAddChild(x509IssuerSerialNode, xmlSecNodeX509SerialNumber, xmlSecDSigNs);
> 	if(res == NULL) {
> 		xmlSecError(XMLSEC_ERRORS_HERE,
> 				NULL,
> 				"xmlSecAddChild",
> 				XMLSEC_ERRORS_R_XMLSEC_FAILED,
> 				"node=%s",
> 				xmlSecErrorsSafeString(xmlSecNodeX509SerialNumber));
> 		return(NULL);	
> 	}
> 
> 	if (serial != NULL) {
> 		xmlNodeSetContent(res, serial);
> 	}
> 	return(res);
> }
> 
> /**
Index: include/xmlsec/templates.h
===================================================================
RCS file: /cvs/xmlsec/include/xmlsec/templates.h,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -r1.1.1.1 -r1.3
119a120,121
> XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddIssuerName(xmlNodePtr x509IssuerSerialNode, const xmlChar* issuerName);
> XMLSEC_EXPORT xmlNodePtr xmlSecTmplX509IssuerSerialAddSerialNumber(xmlNodePtr x509IssuerSerialNode, const xmlChar* serial);


More information about the xmlsec mailing list