You need to put the x509 nodes inside x509data node. > xmlSecTmplX509DataAddIssuerSerial(X509DataNode); > xmlSecTmplX509DataAddSubjectName(X509DataNode); > xmlSecTmplX509DataAddSKI(X509DataNode); > xmlSecTmplX509DataAddCertificate(X509DataNode); > xmlSecTmplX509DataAddCRL(X509DataNode); Aleksey