summaryrefslogtreecommitdiff
path: root/examples/sign3.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sign3.c')
-rw-r--r--examples/sign3.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/examples/sign3.c b/examples/sign3.c
index 847daa09..adadac1f 100644
--- a/examples/sign3.c
+++ b/examples/sign3.c
@@ -100,7 +100,7 @@ main(int argc, char **argv) {
if(xmlSecCryptoDLLoadLibrary(NULL) < 0) {
fprintf(stderr, "Error: unable to load default xmlsec-crypto library. Make sure\n"
"that you have it installed and check shared libraries path\n"
- "(LD_LIBRARY_PATH) envornment variable.\n");
+ "(LD_LIBRARY_PATH and/or LTDL_LIBRARY_PATH) environment variables.\n");
return(-1);
}
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
@@ -158,6 +158,7 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
xmlNodePtr signNode = NULL;
xmlNodePtr refNode = NULL;
xmlNodePtr keyInfoNode = NULL;
+ xmlNodePtr x509DataNode = NULL;
xmlSecDSigCtxPtr dsigCtx = NULL;
int res = -1;
@@ -204,11 +205,22 @@ sign_file(const char* xml_file, const char* key_file, const char* cert_file) {
goto done;
}
- if(xmlSecTmplKeyInfoAddX509Data(keyInfoNode) == NULL) {
+ x509DataNode = xmlSecTmplKeyInfoAddX509Data(keyInfoNode);
+ if(x509DataNode == NULL) {
fprintf(stderr, "Error: failed to add X509Data node\n");
goto done;
}
+ if(xmlSecTmplX509DataAddSubjectName(x509DataNode) == NULL) {
+ fprintf(stderr, "Error: failed to add X509SubjectName node\n");
+ goto done;
+ }
+
+ if(xmlSecTmplX509DataAddCertificate(x509DataNode) == NULL) {
+ fprintf(stderr, "Error: failed to add X509Certificate node\n");
+ goto done;
+ }
+
/* create signature context, we don't need keys manager in this example */
dsigCtx = xmlSecDSigCtxCreate(NULL);
if(dsigCtx == NULL) {