Compare commits
No commits in common. "openkylin/yangtze" and "pristine-tar" have entirely different histories.
openkylin/
...
pristine-t
9
AUTHORS
|
@ -1,9 +0,0 @@
|
|||
Aleksey Sanin <aleksey@aleksey.com>
|
||||
|
||||
Windows port: Igor Zlatkovic <igor@stud.fh-frankfurt.de>
|
||||
Debian port: John Belmonte <jvb@prairienet.org>
|
||||
xmlsec-nss: Tej Arora <tej@netscape.com>, AOL Inc.
|
||||
xmlsec-mscrypto: Wouter Ketting <wsh@xs4all.nl>, Cordys R&D BV
|
||||
xmlsec-mscng: Miklos Vajna <vmiklos@vmiklos.hu>
|
||||
GOST support: Dmitry Belyavsky <beldmit@cryptocom.ru>, Cryptocom LTD (http://www.cryptocom.ru)
|
||||
|
132
Copyright
|
@ -1,132 +0,0 @@
|
|||
xmlsec, xmlsec-openssl, xmlsec-gnutls, xmlsec-gcrypt libraries
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
||||
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Aleksey Sanin shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from him.
|
||||
|
||||
|
||||
xmlsec-nss library
|
||||
------------------------------------------------------------------------------
|
||||
Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
Copyright (c) 2003 America Online, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
Portions of the Software were created using source code and/or APIs
|
||||
governed by the Mozilla Public License (MPL). The MPL is available
|
||||
at http://www.mozilla.org/MPL/MPL-1.1.html. The MPL permits such
|
||||
portions to be distributed with code not governed by MPL, as long
|
||||
as the requirements of MPL are fulfilled for such portions.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
||||
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Aleksey Sanin shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from him.
|
||||
|
||||
|
||||
xmlsec-mscrypto library
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
Copyright (C) 2003 Cordys R&D BV, All rights reserved.
|
||||
Copyright (C) 2007 Roumen Petrov.
|
||||
Copyright (c) 2005-2006 Cryptocom LTD (http://www.cryptocom.ru).
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
||||
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Aleksey Sanin shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from him.
|
||||
|
||||
|
||||
xmlsec-mscng library
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Copyright (C) 2018 Aleksey Sanin. All Rights Reserved.
|
||||
Copyright (C) 2018 Miklos Vajna. All Rights Reserved.
|
||||
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
ALEKSEY SANIN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
||||
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Aleksey Sanin shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from him.
|
||||
|
||||
References
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
* AOL
|
||||
http://www.aleksey.com/pipermail/xmlsec/2003/005488.html
|
||||
http://www.aleksey.com/pipermail/xmlsec/attachments/20030729/0e25648e/attachment.htm
|
||||
|
||||
* Cordys R&D BV
|
||||
http://www.aleksey.com/pipermail/xmlsec/2003/005581.html
|
||||
|
||||
* Cryptocom LTD
|
||||
http://www.aleksey.com/pipermail/xmlsec/2006/007410.html
|
||||
|
176
HACKING
|
@ -1,176 +0,0 @@
|
|||
Rules for commits on the xmlsec module
|
||||
=========================================
|
||||
|
||||
0) DO NOT COMMIT DIRECTLY !
|
||||
If you have a patch send a mail to xmlsec@aleksey.com mailing
|
||||
list (you must be subscribed to the list, go to
|
||||
http://www.aleksey.com/mailman/listinfo/xmlsec to subscribe).
|
||||
|
||||
If there is a problem in xmlsec module that prevents you
|
||||
from building other major components then feel free to patch
|
||||
first and then send a mail. This is an EXCEPTIONAL case and
|
||||
you should be VERY carefull when you are doing this.
|
||||
|
||||
Igor Zlatkovic get an exception for the send before commit rule.
|
||||
|
||||
1) Coding style.
|
||||
- Formatting. Just for clarification, the formating is:
|
||||
|
||||
tab size=8;indentation=4;insert spaces=yes
|
||||
|
||||
- Use explicit "!= NULL", "!= 0", etc. This makes code
|
||||
easier to read and remove warnings on some platform.
|
||||
Example:
|
||||
BAD:
|
||||
if(a)
|
||||
GOOD:
|
||||
if(a != NULL)
|
||||
or
|
||||
if(a != 0)
|
||||
|
||||
- Put figure brackets '{}' even if you have only one operator
|
||||
in "if", "for", etc. This also makes code easier to read and
|
||||
saves a lot of time when you need to quickly change something.
|
||||
Example:
|
||||
BAD:
|
||||
if(a != NULL)
|
||||
xmlFree(a);
|
||||
GOOD:
|
||||
if(a != NULL) {
|
||||
xmlFree(a);
|
||||
}
|
||||
|
||||
- Use round brackets '()' in conditions to show the precedence order.
|
||||
I don't remember what goes first '<<' or '*', do you?
|
||||
Example:
|
||||
BAD:
|
||||
if(privkey == NULL || pubkey == NULL)
|
||||
GOOD:
|
||||
if((privkey == NULL) || (pubkey == NULL))
|
||||
|
||||
- Use round brackets '()' for "return".
|
||||
Example:
|
||||
BAD:
|
||||
return 0;
|
||||
GOOD:
|
||||
return(0);
|
||||
|
||||
- Check for warnings! Use "--enable-pedantic" option
|
||||
for "configure.in" script to enable as much warnings as possible.
|
||||
Your patch should produce no new warnings and if you'll
|
||||
see something that you can fix, then do it.
|
||||
|
||||
- Check for memory leaks. There is a built in support for
|
||||
valgrind (http://devel-home.kde.org/~sewardj/). In order to use it,
|
||||
use "enable_static_linking" option for "configure.in" script to
|
||||
force static linking of xmlsec command line utility and run
|
||||
"make memcheck" from the top xmlsec source folder. The results are printed
|
||||
at the end. More detailed logs could be found in /tmp/test*.log files.
|
||||
|
||||
2) Coding practice
|
||||
- You should trust nobody! Anyone can fool you: user or another application
|
||||
might provide you incorrect data; call to xmlsec or system function might
|
||||
fail with an error code; worse, the same call might fail but the return
|
||||
code is "success" and so on. The patch fixes a lot of places where the
|
||||
original code failed to check input data or function return values.
|
||||
One of my favorite examples is the code that *silently* assumed that
|
||||
base64 decoded value of a RSA public exponent obtained from XML fits
|
||||
in a DWORD. And after that the code did memcpy to copy from xmlSecBuffer
|
||||
to a DWORD variable *without* checking how much data are actualy copied!
|
||||
The trivial DoS attack (at least DoS!!!) is to put very long base64 string
|
||||
in XML file and enjoy the server crash.
|
||||
One of the strongest sides of xmlsec library is that there are very few
|
||||
known ways to crash it (and all of them are related to running the
|
||||
application in an environment with a very limited memory to force a malloc
|
||||
failure). To be a little paranoid is good in this context :)
|
||||
|
||||
- malloc/free vs. xmlMalloc/xmlFree
|
||||
xmlsec library use libxml2 memory management functions. This provides an
|
||||
easy way to replace default memory management functions with custom ones.
|
||||
And this might be very usefull in some cases.
|
||||
Note that crypto library might use a different memory management
|
||||
functions! Be very carefully to do not mix them (i.e. get memory
|
||||
allocated by crypto library function and free it with xmFree).
|
||||
|
||||
- Errors reporting (XMLSEC_ERRORS_R_XMLSEC_FAILED vs. XMLSEC_ERRORS_R_CRYPTO_FAILED)
|
||||
The correct usage rule is:
|
||||
if the failed function starts with "xmlSec" then use
|
||||
xmlSecInternalError() aka XMLSEC_ERRORS_R_XMLSEC_FAILED
|
||||
else if it is xmlMalloc/xmlFree/etc then use
|
||||
xmlSecMallocError() aka XMLSEC_ERRORS_R_MALLOC_FAILED
|
||||
else if the function starts with "xml" or "xslt" (i.e. it comes
|
||||
from libxml or libxslt) then use
|
||||
xmlSecXmlError/xmlSecXmlParserError aka XMLSEC_ERRORS_R_XML_FAILED
|
||||
else if it is related to IO (fopen, fread, fwrite, etc.) then use
|
||||
XMLSEC_ERRORS_R_IO_FAILED
|
||||
else if the function could be used only from xmlsec-crypto (i.e.
|
||||
it is crypto engine related) then use
|
||||
xmlSecOpenSSLError/... aka XMLSEC_ERRORS_R_CRYPTO_FAILED
|
||||
else if there is another reason (invalid data, invalid size, etc.)
|
||||
corresponding error reason should be used
|
||||
else
|
||||
it is something new and should be discussed
|
||||
fi
|
||||
Correct error reason is very important. For example, some applications
|
||||
ignore all the XMLSEC_ERRORS_R_XMLSEC_FAILED errors to get to the bottom of
|
||||
the errors stack and report the actual problem.
|
||||
|
||||
- Errors reporting: "size=%d;error=%d" instead of "size %d, error: %d":
|
||||
It would be great if xmlsec-crypto libraries can follow the error message
|
||||
standard adopted in the other files of xmlsec library:
|
||||
"<name1>=<value1>;<name2>=<value2>;..."
|
||||
This greatly helps when one needs to write a logs parser. For example, to
|
||||
find the reason of memory allocation failures.
|
||||
|
||||
3) Preparing and submitting a patch.
|
||||
If you want to submit a patch please create a pull request on GitHub and then
|
||||
send your pull request along with a short description of the problem or feature
|
||||
you are fixing/implementing to the xmlsec@aleksey.com mailing list
|
||||
(you must be subscribed to the list, go to http://www.aleksey.com/mailman/listinfo/xmlsec to subscribe).
|
||||
If you are fixing a bug, it might be a good idea to create a GitHub ticket first
|
||||
(http://www.aleksey.com/xmlsec/bugs.html) for the record.
|
||||
|
||||
4) Building a release
|
||||
- Cleanup, make sure no other changes are pending
|
||||
- make distclean
|
||||
- git status
|
||||
- Update Changelog
|
||||
- Write about release changes in the release
|
||||
- docs/index.html and docs/news.html
|
||||
- Update release number in
|
||||
- configure.in (2 places at the top)
|
||||
- docs/download.html
|
||||
- Create build
|
||||
- ./autogen.sh
|
||||
- make
|
||||
- Build docs (watch for errors!)
|
||||
- make docs
|
||||
- Commit the "prepare for X.Y.Z" release
|
||||
- git commit -m"prepare for X.Y.Z release" -a
|
||||
- Run tests, make sure everything is OK
|
||||
- make check
|
||||
- Build release
|
||||
- sudo ./scripts/build_release.sh
|
||||
- Extract tar file, make sure it works
|
||||
- cd /tmp
|
||||
- tar xvfz /usr/src/redhat/SOURCE/xmlsec1-X.Y.z.tar.gz
|
||||
- cd xmlsec1-X.Y.z
|
||||
- ./configure
|
||||
- make
|
||||
- make check
|
||||
- Copy tar file to FTP/Web Download
|
||||
- Copy docs/ folder to Web folder
|
||||
- Write an announcement email to xmlsec@aleksey.com
|
||||
- Update freshmeat.net
|
||||
- Relax
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
47
INSTALL
|
@ -1,47 +0,0 @@
|
|||
Compilation
|
||||
|
||||
1. How to compile XMLSec?
|
||||
|
||||
As most UNIX libraries XMLSec follows the "standard":
|
||||
|
||||
gunzip -c xmlsec-xxx.tar.gz | tar xvf -
|
||||
cd xmlsec-xxxx
|
||||
./configure --help
|
||||
|
||||
to see the options, then the compilation/installation proper
|
||||
|
||||
./configure [possible options]
|
||||
make
|
||||
make install
|
||||
|
||||
Probably you may have to rerun ldconfig or similar utility to
|
||||
update your list of installed shared libs. At this point you can check
|
||||
that the library is compiled successfully by running
|
||||
|
||||
make check
|
||||
|
||||
Alternatively there are several community maintained ports to CMake
|
||||
build system:
|
||||
|
||||
* https://github.com/vmiklos/odfsig/tree/master/extern/xmlsec
|
||||
|
||||
* https://github.com/microsoft/vcpkg/tree/master/ports/xmlsec
|
||||
|
||||
|
||||
2.What other libraries are needed to compile/install XMLSec?
|
||||
XMLSec requires following libraries:
|
||||
|
||||
LibXML2 (http://xmlsoft.org): a very powerfull XML parsing and
|
||||
manipulating library
|
||||
LibXSLT (http://xmlsoft.org/XSLT/): a nice XSLT processor based
|
||||
on LibXML2
|
||||
OpenSSL (http://www.openssl.org): well known cryptographic library
|
||||
|
||||
If you are running a Linux system then there is a good chance that
|
||||
you already have all libraries installed. Also XMLSec requires the
|
||||
normal C ANSI API (please report any violation to this rule you may find).
|
||||
|
||||
|
||||
Aleksey Sanin <aleksey@aleksey.com>
|
||||
|
||||
$Id$
|
193
Makefile.am
|
@ -1,193 +0,0 @@
|
|||
NULL =
|
||||
|
||||
SAFE_VERSION = @XMLSEC_VERSION_SAFE@
|
||||
SUBDIRS = include src
|
||||
if XMLSEC_APPS
|
||||
SUBDIRS += apps
|
||||
endif
|
||||
if XMLSEC_MANS
|
||||
SUBDIRS += man
|
||||
endif
|
||||
if XMLSEC_DOCS
|
||||
SUBDIRS += docs
|
||||
endif
|
||||
TEST_APP = apps/xmlsec1$(EXEEXT)
|
||||
DEFAULT_CRYPTO = @XMLSEC_DEFAULT_CRYPTO@
|
||||
|
||||
bin_SCRIPTS = xmlsec1-config
|
||||
pkgconfig_DATA = xmlsec1.pc @XMLSEC_CRYPTO_PC_FILES_LIST@
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
confexecdir = $(libdir)
|
||||
confexec_DATA = xmlsec1Conf.sh
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = xmlsec1.m4
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
DISTCLEANFILES = \
|
||||
xmlsec1Conf.sh \
|
||||
xmlsec1.pc \
|
||||
xmlsec1-openssl.pc \
|
||||
xmlsec1-nss.pc \
|
||||
xmlsec1-gnutls.pc \
|
||||
xmlsec1-gcrypt.pc \
|
||||
xmlsec1-config \
|
||||
xmlsec1.spec \
|
||||
stamp-h2 \
|
||||
stamp-h3 \
|
||||
stamp-h4 \
|
||||
stamp-h5 \
|
||||
$NULL
|
||||
|
||||
EXTRA_DIST = \
|
||||
m4 \
|
||||
examples \
|
||||
scripts \
|
||||
tests \
|
||||
win32 \
|
||||
NEWS \
|
||||
ChangeLog \
|
||||
Copyright \
|
||||
HACKING \
|
||||
xmlsec-openssl.pc.in \
|
||||
xmlsec-nss.pc.in\
|
||||
xmlsec-gnutls.pc.in \
|
||||
xmlsec-gcrypt.pc.in \
|
||||
xmlsec-config.in \
|
||||
xmlsecConf.sh.in \
|
||||
xmlsec.spec.in \
|
||||
xmlsec1Conf.sh \
|
||||
xmlsec1.pc @XMLSEC_CRYPTO_PC_FILES_LIST@ \
|
||||
xmlsec1-config \
|
||||
xmlsec1.spec \
|
||||
xmlsec1.m4 \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_CLEAN = \
|
||||
examples \
|
||||
$(NULL)
|
||||
|
||||
ABS_SRCDIR=@abs_srcdir@
|
||||
ABS_BUILDDIR=@abs_builddir@
|
||||
if XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING
|
||||
PRECHECK_COMMANDS = \
|
||||
cd $(ABS_SRCDIR) \
|
||||
$(NULL)
|
||||
else
|
||||
PRECHECK_COMMANDS= \
|
||||
export LD_LIBRARY_PATH="$(ABS_BUILDDIR)/src/.libs:$$LD_LIBRARY_PATH" ; \
|
||||
for i in $(XMLSEC_CRYPTO_LIST) ; do \
|
||||
export LTDL_LIBRARY_PATH="$(ABS_BUILDDIR)/src/$$i/.libs:$$LTDL_LIBRARY_PATH" ; \
|
||||
done && \
|
||||
cd $(ABS_SRCDIR) \
|
||||
$(NULL)
|
||||
endif
|
||||
CHECK_CRYPTO_LIST = \
|
||||
$(XMLSEC_CRYPTO_LIST) \
|
||||
$(NULL)
|
||||
|
||||
docs: docs-man
|
||||
@(cd docs && $(MAKE) docs)
|
||||
|
||||
docs-clean:
|
||||
@(cd docs && $(MAKE) clean)
|
||||
|
||||
docs-man:
|
||||
@(cd man && $(MAKE) docs)
|
||||
|
||||
check: check-all check-info
|
||||
|
||||
check-all: $(TEST_APP)
|
||||
for crypto in $(CHECK_CRYPTO_LIST) ; do \
|
||||
make check-crypto-$$crypto || exit 1 ; \
|
||||
done
|
||||
|
||||
check-crypto-%: $(TEST_APP)
|
||||
@($(PRECHECK_COMMANDS) && \
|
||||
echo "=================== Checking xmlsec-$* =================================" && \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testKeys.sh \
|
||||
$* \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) der \
|
||||
&& \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testDSig.sh \
|
||||
$* \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) \
|
||||
der \
|
||||
&& \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testEnc.sh \
|
||||
$* \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) \
|
||||
der \
|
||||
; \
|
||||
)
|
||||
|
||||
check-info:
|
||||
@echo "---------------------------- ATTENTION -----------------------------------"
|
||||
@echo "--- Some of the tests use resources located on external HTTP servers. ---"
|
||||
@echo "--- If you have no Internet connection or the external resource is not ---"
|
||||
@echo "--- responding then the test will fail. ---"
|
||||
@echo "---------------------------- ATTENTION -----------------------------------"
|
||||
|
||||
check-keys: $(TEST_APP)
|
||||
@($(PRECHECK_COMMANDS) && \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testKeys.sh \
|
||||
$(DEFAULT_CRYPTO) \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) \
|
||||
der \
|
||||
)
|
||||
|
||||
check-dsig: $(TEST_APP)
|
||||
@($(PRECHECK_COMMANDS) && \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testDSig.sh \
|
||||
$(DEFAULT_CRYPTO) \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) \
|
||||
der \
|
||||
)
|
||||
|
||||
check-enc: $(TEST_APP)
|
||||
@($(PRECHECK_COMMANDS) && \
|
||||
$(SHELL) ./tests/testrun.sh \
|
||||
$(ABS_SRCDIR)/tests/testEnc.sh \
|
||||
$(DEFAULT_CRYPTO) \
|
||||
$(ABS_SRCDIR)/tests \
|
||||
$(ABS_BUILDDIR)/$(TEST_APP) \
|
||||
der \
|
||||
)
|
||||
|
||||
memcheck-res:
|
||||
@grep -i 'ERROR SUMMARY' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
@grep -i 'in use at exit' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
@grep -i 'definitely lost:' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
@grep -i 'indirectly lost:' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
@grep -i 'possibly lost:' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
@grep -i 'still reachable:' /tmp/*.log | sed 's/.*==.*== *//' | sort -u
|
||||
|
||||
memcheck: $(TEST_APP)
|
||||
@(export DEBUG_MEMORY=1 && $(MAKE) check && $(MAKE) memcheck-res)
|
||||
|
||||
perfcheck: $(TEST_APP)
|
||||
@(export PERF_TEST=10 && $(MAKE) check)
|
||||
|
||||
dist-hook:
|
||||
|
||||
cleantar:
|
||||
@($(RM) -f xmlsec*.tar.gz COPYING.LIB)
|
||||
|
||||
tar-release: clean cleantar
|
||||
@(unset CDPATH && $(MAKE) dist)
|
||||
|
||||
rpm: cleantar tar-release
|
||||
@(unset CDPATH && rpmbuild -ta $(distdir).tar.gz)
|
||||
|
||||
rpm-release: clean cleantar rpm
|
||||
|
1274
Makefile.in
23
README
|
@ -1,23 +0,0 @@
|
|||
XMLSec Library
|
||||
----------------------------------------------
|
||||
|
||||
XMLSec library provides C based implementation for major XML Security
|
||||
standards:
|
||||
|
||||
* XML Signature Syntax and Processing
|
||||
https://www.w3.org/TR/xmldsig-core
|
||||
|
||||
* XML Encryption Syntax and Processing
|
||||
https://www.w3.org/TR/xmlenc-core/
|
||||
|
||||
XMLSec is based on well known LibXML (http://xmlsoft.org), LibXSLT
|
||||
(http://xmlsoft.org/XSLT) and OpenSSL (https://www.openssl.org) libraries.
|
||||
|
||||
XMLSec library documentation is available here:
|
||||
|
||||
https://www.aleksey.com/xmlsec/
|
||||
|
||||
This code is released under the MIT Licence see the Copyright file.
|
||||
|
||||
Aleksey Sanin <aleksey@aleksey.com>
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
NULL =
|
||||
|
||||
bin_PROGRAMS = xmlsec1
|
||||
|
||||
XMLSEC_LIBS = $(top_builddir)/src/libxmlsec1.la
|
||||
|
||||
|
||||
# check if we use dynamic loading for xmlsec-crypto or not
|
||||
if XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING
|
||||
|
||||
CRYPTO_DEPS = \
|
||||
$(top_builddir)/src/@XMLSEC_DEFAULT_CRYPTO@/lib$(XMLSEC_CRYPTO_LIB).la \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_INCLUDES = \
|
||||
$(XMLSEC_CRYPTO_CFLAGS) \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LD_FLAGS = \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LD_ADD = \
|
||||
$(XMLSEC_CRYPTO_LIBS) \
|
||||
$(CRYPTO_DEPS) \
|
||||
$(NULL)
|
||||
|
||||
else
|
||||
|
||||
CRYPTO_DEPS = \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_INCLUDES = \
|
||||
-DXMLSEC_CRYPTO_DYNAMIC_LOADING=1
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LD_FLAGS = \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LD_ADD = \
|
||||
$(CRYPTO_DEPS) \
|
||||
$(NULL)
|
||||
|
||||
endif
|
||||
|
||||
AM_CFLAGS = \
|
||||
-DPACKAGE=\"@PACKAGE@\" \
|
||||
-I../include \
|
||||
-I$(top_srcdir)/include \
|
||||
$(XMLSEC_DEFINES) \
|
||||
$(XMLSEC_APP_DEFINES) \
|
||||
$(CRYPTO_INCLUDES) \
|
||||
$(LIBXSLT_CFLAGS) \
|
||||
$(LIBXML_CFLAGS) \
|
||||
$(XMLSEC_DL_INCLUDES) \
|
||||
$(NULL)
|
||||
|
||||
# xmlsec command line utility
|
||||
xmlsec1_SOURCES = \
|
||||
xmlsec.c \
|
||||
crypto.c crypto.h \
|
||||
cmdline.c cmdline.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
xmlsec1_LDFLAGS = \
|
||||
@XMLSEC_STATIC_BINARIES@ \
|
||||
$(CRYPTO_LD_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
xmlsec1_LDADD = \
|
||||
$(LIBXSLT_LIBS) \
|
||||
$(LIBXML_LIBS) \
|
||||
$(CRYPTO_LD_ADD) \
|
||||
$(XMLSEC_LIBS) \
|
||||
$(XMLSEC_DL_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
xmlsec1_DEPENDENCIES = \
|
||||
$(CRYPTO_DEPS) \
|
||||
$(XMLSEC_LIBS) \
|
||||
$(NULL)
|
||||
|
832
apps/Makefile.in
|
@ -1,832 +0,0 @@
|
|||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
bin_PROGRAMS = xmlsec1$(EXEEXT)
|
||||
subdir = apps
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am__objects_1 =
|
||||
am_xmlsec1_OBJECTS = xmlsec.$(OBJEXT) crypto.$(OBJEXT) \
|
||||
cmdline.$(OBJEXT) $(am__objects_1)
|
||||
xmlsec1_OBJECTS = $(am_xmlsec1_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/@XMLSEC_DEFAULT_CRYPTO@/lib$(XMLSEC_CRYPTO_LIB).la \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(am__DEPENDENCIES_1)
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(am__DEPENDENCIES_1)
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(am__DEPENDENCIES_2) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(am__DEPENDENCIES_1)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
xmlsec1_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(xmlsec1_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(xmlsec1_SOURCES)
|
||||
DIST_SOURCES = $(xmlsec1_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CP = @CP@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCRYPT_CFLAGS = @GCRYPT_CFLAGS@
|
||||
GCRYPT_CONFIG_PATH = @GCRYPT_CONFIG_PATH@
|
||||
GCRYPT_CRYPTO_LIB = @GCRYPT_CRYPTO_LIB@
|
||||
GCRYPT_LIBS = @GCRYPT_LIBS@
|
||||
GCRYPT_MIN_VERSION = @GCRYPT_MIN_VERSION@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_CRYPTO_LIB = @GNUTLS_CRYPTO_LIB@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GNUTLS_MIN_VERSION = @GNUTLS_MIN_VERSION@
|
||||
GREP = @GREP@
|
||||
GTKDOC_MKDB = @GTKDOC_MKDB@
|
||||
GTKDOC_MKHTML = @GTKDOC_MKHTML@
|
||||
GTKDOC_SCAN = @GTKDOC_SCAN@
|
||||
HELP2MAN = @HELP2MAN@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBXML_CFLAGS = @LIBXML_CFLAGS@
|
||||
LIBXML_CONFIG = @LIBXML_CONFIG@
|
||||
LIBXML_CONFIG_PATH = @LIBXML_CONFIG_PATH@
|
||||
LIBXML_LIBS = @LIBXML_LIBS@
|
||||
LIBXML_MIN_VERSION = @LIBXML_MIN_VERSION@
|
||||
LIBXSLT_CFLAGS = @LIBXSLT_CFLAGS@
|
||||
LIBXSLT_CONFIG = @LIBXSLT_CONFIG@
|
||||
LIBXSLT_CONFIG_PATH = @LIBXSLT_CONFIG_PATH@
|
||||
LIBXSLT_LIBS = @LIBXSLT_LIBS@
|
||||
LIBXSLT_MIN_VERSION = @LIBXSLT_MIN_VERSION@
|
||||
LIBXSLT_PC_FILE_COND = @LIBXSLT_PC_FILE_COND@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN2HTML = @MAN2HTML@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MOZILLA_MIN_VERSION = @MOZILLA_MIN_VERSION@
|
||||
MSCNG_CFLAGS = @MSCNG_CFLAGS@
|
||||
MSCNG_CRYPTO_LIB = @MSCNG_CRYPTO_LIB@
|
||||
MSCNG_LIBS = @MSCNG_LIBS@
|
||||
MSCRYPTO_CFLAGS = @MSCRYPTO_CFLAGS@
|
||||
MSCRYPTO_CRYPTO_LIB = @MSCRYPTO_CRYPTO_LIB@
|
||||
MSCRYPTO_LIBS = @MSCRYPTO_LIBS@
|
||||
MV = @MV@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
NSPR_CFLAGS = @NSPR_CFLAGS@
|
||||
NSPR_LIBS = @NSPR_LIBS@
|
||||
NSPR_MIN_VERSION = @NSPR_MIN_VERSION@
|
||||
NSPR_PACKAGE = @NSPR_PACKAGE@
|
||||
NSS_CFLAGS = @NSS_CFLAGS@
|
||||
NSS_CRYPTO_LIB = @NSS_CRYPTO_LIB@
|
||||
NSS_LIBS = @NSS_LIBS@
|
||||
NSS_MIN_VERSION = @NSS_MIN_VERSION@
|
||||
NSS_PACKAGE = @NSS_PACKAGE@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
|
||||
OPENSSL_CRYPTO_LIB = @OPENSSL_CRYPTO_LIB@
|
||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||
OPENSSL_MIN_VERSION = @OPENSSL_MIN_VERSION@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TAR = @TAR@
|
||||
VERSION = @VERSION@
|
||||
XMLSEC_APPS = @XMLSEC_APPS@
|
||||
XMLSEC_APP_DEFINES = @XMLSEC_APP_DEFINES@
|
||||
XMLSEC_CFLAGS = @XMLSEC_CFLAGS@
|
||||
XMLSEC_CORE_CFLAGS = @XMLSEC_CORE_CFLAGS@
|
||||
XMLSEC_CORE_LIBS = @XMLSEC_CORE_LIBS@
|
||||
XMLSEC_CRYPTO_CFLAGS = @XMLSEC_CRYPTO_CFLAGS@
|
||||
XMLSEC_CRYPTO_DISABLED_LIST = @XMLSEC_CRYPTO_DISABLED_LIST@
|
||||
XMLSEC_CRYPTO_EXTRA_LDFLAGS = @XMLSEC_CRYPTO_EXTRA_LDFLAGS@
|
||||
XMLSEC_CRYPTO_LIB = @XMLSEC_CRYPTO_LIB@
|
||||
XMLSEC_CRYPTO_LIBS = @XMLSEC_CRYPTO_LIBS@
|
||||
XMLSEC_CRYPTO_LIST = @XMLSEC_CRYPTO_LIST@
|
||||
XMLSEC_CRYPTO_PC_FILES_LIST = @XMLSEC_CRYPTO_PC_FILES_LIST@
|
||||
XMLSEC_DEFAULT_CRYPTO = @XMLSEC_DEFAULT_CRYPTO@
|
||||
XMLSEC_DEFINES = @XMLSEC_DEFINES@
|
||||
XMLSEC_DL_INCLUDES = @XMLSEC_DL_INCLUDES@
|
||||
XMLSEC_DL_LIBS = @XMLSEC_DL_LIBS@
|
||||
XMLSEC_DOCDIR = @XMLSEC_DOCDIR@
|
||||
XMLSEC_DOCS = @XMLSEC_DOCS@
|
||||
XMLSEC_EXTRA_LDFLAGS = @XMLSEC_EXTRA_LDFLAGS@
|
||||
XMLSEC_GCRYPT_CFLAGS = @XMLSEC_GCRYPT_CFLAGS@
|
||||
XMLSEC_GCRYPT_LIBS = @XMLSEC_GCRYPT_LIBS@
|
||||
XMLSEC_GNUTLS_CFLAGS = @XMLSEC_GNUTLS_CFLAGS@
|
||||
XMLSEC_GNUTLS_LIBS = @XMLSEC_GNUTLS_LIBS@
|
||||
XMLSEC_LIBDIR = @XMLSEC_LIBDIR@
|
||||
XMLSEC_LIBS = $(top_builddir)/src/libxmlsec1.la
|
||||
XMLSEC_MANS = @XMLSEC_MANS@
|
||||
XMLSEC_NO_AES = @XMLSEC_NO_AES@
|
||||
XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_DES = @XMLSEC_NO_DES@
|
||||
XMLSEC_NO_DSA = @XMLSEC_NO_DSA@
|
||||
XMLSEC_NO_GCRYPT = @XMLSEC_NO_GCRYPT@
|
||||
XMLSEC_NO_GNUTLS = @XMLSEC_NO_GNUTLS@
|
||||
XMLSEC_NO_GOST = @XMLSEC_NO_GOST@
|
||||
XMLSEC_NO_GOST2012 = @XMLSEC_NO_GOST2012@
|
||||
XMLSEC_NO_HMAC = @XMLSEC_NO_HMAC@
|
||||
XMLSEC_NO_LIBXSLT = @XMLSEC_NO_LIBXSLT@
|
||||
XMLSEC_NO_MD5 = @XMLSEC_NO_MD5@
|
||||
XMLSEC_NO_MSCNG = @XMLSEC_NO_MSCNG@
|
||||
XMLSEC_NO_MSCRYPTO = @XMLSEC_NO_MSCRYPTO@
|
||||
XMLSEC_NO_NSS = @XMLSEC_NO_NSS@
|
||||
XMLSEC_NO_OPENSSL = @XMLSEC_NO_OPENSSL@
|
||||
XMLSEC_NO_RIPEMD160 = @XMLSEC_NO_RIPEMD160@
|
||||
XMLSEC_NO_RSA = @XMLSEC_NO_RSA@
|
||||
XMLSEC_NO_SHA1 = @XMLSEC_NO_SHA1@
|
||||
XMLSEC_NO_SHA224 = @XMLSEC_NO_SHA224@
|
||||
XMLSEC_NO_SHA256 = @XMLSEC_NO_SHA256@
|
||||
XMLSEC_NO_SHA384 = @XMLSEC_NO_SHA384@
|
||||
XMLSEC_NO_SHA512 = @XMLSEC_NO_SHA512@
|
||||
XMLSEC_NO_X509 = @XMLSEC_NO_X509@
|
||||
XMLSEC_NO_XMLDSIG = @XMLSEC_NO_XMLDSIG@
|
||||
XMLSEC_NO_XMLENC = @XMLSEC_NO_XMLENC@
|
||||
XMLSEC_NSS_CFLAGS = @XMLSEC_NSS_CFLAGS@
|
||||
XMLSEC_NSS_LIBS = @XMLSEC_NSS_LIBS@
|
||||
XMLSEC_OPENSSL_CFLAGS = @XMLSEC_OPENSSL_CFLAGS@
|
||||
XMLSEC_OPENSSL_LIBS = @XMLSEC_OPENSSL_LIBS@
|
||||
XMLSEC_PACKAGE = @XMLSEC_PACKAGE@
|
||||
XMLSEC_STATIC_BINARIES = @XMLSEC_STATIC_BINARIES@
|
||||
XMLSEC_VERSION = @XMLSEC_VERSION@
|
||||
XMLSEC_VERSION_INFO = @XMLSEC_VERSION_INFO@
|
||||
XMLSEC_VERSION_MAJOR = @XMLSEC_VERSION_MAJOR@
|
||||
XMLSEC_VERSION_MINOR = @XMLSEC_VERSION_MINOR@
|
||||
XMLSEC_VERSION_SAFE = @XMLSEC_VERSION_SAFE@
|
||||
XMLSEC_VERSION_SUBMINOR = @XMLSEC_VERSION_SUBMINOR@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
NULL =
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@CRYPTO_DEPS = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(NULL)
|
||||
|
||||
|
||||
# check if we use dynamic loading for xmlsec-crypto or not
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@CRYPTO_DEPS = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(top_builddir)/src/@XMLSEC_DEFAULT_CRYPTO@/lib$(XMLSEC_CRYPTO_LIB).la \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(NULL)
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@CRYPTO_INCLUDES = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ -DXMLSEC_CRYPTO_DYNAMIC_LOADING=1
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@CRYPTO_INCLUDES = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(XMLSEC_CRYPTO_CFLAGS) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(NULL)
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@CRYPTO_LD_FLAGS = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(NULL)
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@CRYPTO_LD_FLAGS = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(NULL)
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@CRYPTO_LD_ADD = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(CRYPTO_DEPS) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(NULL)
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@CRYPTO_LD_ADD = \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(XMLSEC_CRYPTO_LIBS) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(CRYPTO_DEPS) \
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_TRUE@ $(NULL)
|
||||
|
||||
AM_CFLAGS = \
|
||||
-DPACKAGE=\"@PACKAGE@\" \
|
||||
-I../include \
|
||||
-I$(top_srcdir)/include \
|
||||
$(XMLSEC_DEFINES) \
|
||||
$(XMLSEC_APP_DEFINES) \
|
||||
$(CRYPTO_INCLUDES) \
|
||||
$(LIBXSLT_CFLAGS) \
|
||||
$(LIBXML_CFLAGS) \
|
||||
$(XMLSEC_DL_INCLUDES) \
|
||||
$(NULL)
|
||||
|
||||
|
||||
# xmlsec command line utility
|
||||
xmlsec1_SOURCES = \
|
||||
xmlsec.c \
|
||||
crypto.c crypto.h \
|
||||
cmdline.c cmdline.h \
|
||||
$(NULL)
|
||||
|
||||
xmlsec1_LDFLAGS = \
|
||||
@XMLSEC_STATIC_BINARIES@ \
|
||||
$(CRYPTO_LD_FLAGS) \
|
||||
$(NULL)
|
||||
|
||||
xmlsec1_LDADD = \
|
||||
$(LIBXSLT_LIBS) \
|
||||
$(LIBXML_LIBS) \
|
||||
$(CRYPTO_LD_ADD) \
|
||||
$(XMLSEC_LIBS) \
|
||||
$(XMLSEC_DL_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
xmlsec1_DEPENDENCIES = \
|
||||
$(CRYPTO_DEPS) \
|
||||
$(XMLSEC_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign apps/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign apps/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
xmlsec1$(EXEEXT): $(xmlsec1_OBJECTS) $(xmlsec1_DEPENDENCIES) $(EXTRA_xmlsec1_DEPENDENCIES)
|
||||
@rm -f xmlsec1$(EXEEXT)
|
||||
$(AM_V_CCLD)$(xmlsec1_LINK) $(xmlsec1_OBJECTS) $(xmlsec1_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmdline.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crypto.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xmlsec.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
|
||||
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
|
||||
@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
@XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING_FALSE@ $(NULL)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
362
apps/cmdline.c
|
@ -1,362 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* XMLSec library
|
||||
*
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "cmdline.h"
|
||||
|
||||
static int xmlSecAppCmdLineMatchParam (const char* argvParam,
|
||||
const char* paramName,
|
||||
int canHaveNameString);
|
||||
static xmlSecAppCmdLineParamPtr xmlSecAppCmdLineParamsListFind (xmlSecAppCmdLineParamPtr* params,
|
||||
xmlSecAppCmdLineParamTopic topics,
|
||||
const char* name);
|
||||
static int xmlSecAppCmdLineParamRead (xmlSecAppCmdLineParamPtr param,
|
||||
const char** argv,
|
||||
int argc,
|
||||
int pos);
|
||||
static int xmlSecAppCmdLineTimeParamRead (const char* str,
|
||||
time_t* t);
|
||||
|
||||
int
|
||||
xmlSecAppCmdLineParamIsSet(xmlSecAppCmdLineParamPtr param) {
|
||||
return(((param != NULL) && (param->value != NULL)) ? 1 : 0);
|
||||
}
|
||||
|
||||
const char*
|
||||
xmlSecAppCmdLineParamGetString(xmlSecAppCmdLineParamPtr param) {
|
||||
if(param->type != xmlSecAppCmdLineParamTypeString) {
|
||||
fprintf(stderr, "Error: parameter \"%s\" is not string.\n", param->fullName);
|
||||
return(NULL);
|
||||
}
|
||||
return((param->value != NULL) ? param->value->strValue : NULL);
|
||||
}
|
||||
|
||||
const char*
|
||||
xmlSecAppCmdLineParamGetStringList(xmlSecAppCmdLineParamPtr param) {
|
||||
if(param->type != xmlSecAppCmdLineParamTypeStringList) {
|
||||
fprintf(stderr, "Error: parameter \"%s\" is not string list.\n", param->fullName);
|
||||
return(NULL);
|
||||
}
|
||||
return((param->value != NULL) ? param->value->strListValue : NULL);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCmdLineParamGetInt(xmlSecAppCmdLineParamPtr param, int def) {
|
||||
if(param->type != xmlSecAppCmdLineParamTypeNumber) {
|
||||
fprintf(stderr, "Error: parameter \"%s\" is not integer.\n", param->fullName);
|
||||
return(def);
|
||||
}
|
||||
return((param->value != NULL) ? param->value->intValue : def);
|
||||
}
|
||||
|
||||
time_t
|
||||
xmlSecAppCmdLineParamGetTime(xmlSecAppCmdLineParamPtr param, time_t def) {
|
||||
if(param->type != xmlSecAppCmdLineParamTypeTime) {
|
||||
fprintf(stderr, "Error: parameter \"%s\" is not time.\n", param->fullName);
|
||||
return(def);
|
||||
}
|
||||
return((param->value != NULL) ? param->value->timeValue : def);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCmdLineParamsListParse(xmlSecAppCmdLineParamPtr* params,
|
||||
xmlSecAppCmdLineParamTopic topics,
|
||||
const char** argv, int argc, int pos) {
|
||||
xmlSecAppCmdLineParamPtr param;
|
||||
int ii;
|
||||
int ret;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(argv != NULL);
|
||||
|
||||
while((pos < argc) && (argv[pos][0] == '-') && (strcmp(argv[pos], XMLSEC_STDOUT_FILENAME) != 0)) {
|
||||
param = xmlSecAppCmdLineParamsListFind(params, topics, argv[pos]);
|
||||
if(param == NULL) {
|
||||
fprintf(stderr, "Error: parameter \"%s\" is not supported or the requested\nfeature might have been disabled during compilation.\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ret = xmlSecAppCmdLineParamRead(param, argv, argc, pos);
|
||||
if(ret < pos) {
|
||||
fprintf(stderr, "Error: failed to parse parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
pos = ret + 1;
|
||||
}
|
||||
|
||||
/* check that all parameters at the end are filenames */
|
||||
for(ii = pos; (ii < argc); ++ii) {
|
||||
if((argv[ii][0] == '-') && (strcmp(argv[pos], XMLSEC_STDOUT_FILENAME) != 0)) {
|
||||
fprintf(stderr, "Error: filename is expected instead of parameter \"%s\".\n", argv[ii]);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* done */
|
||||
return(pos);
|
||||
}
|
||||
|
||||
void
|
||||
xmlSecAppCmdLineParamsListClean(xmlSecAppCmdLineParamPtr* params) {
|
||||
xmlSecAppCmdLineValuePtr tmp;
|
||||
size_t i;
|
||||
|
||||
assert(params != NULL);
|
||||
|
||||
for(i = 0; params[i] != NULL; ++i) {
|
||||
while(params[i]->value != NULL) {
|
||||
tmp = params[i]->value;
|
||||
params[i]->value = params[i]->value->next;
|
||||
xmlSecAppCmdLineValueDestroy(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xmlSecAppCmdLineParamsListPrint(xmlSecAppCmdLineParamPtr* params,
|
||||
xmlSecAppCmdLineParamTopic topics,
|
||||
FILE* output) {
|
||||
size_t i;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(output != NULL);
|
||||
|
||||
for(i = 0; params[i] != NULL; ++i) {
|
||||
if(((params[i]->topics & topics) != 0) && (params[i]->help != NULL)) {
|
||||
fprintf(output, " %s\n", params[i]->help);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xmlSecAppCmdLineValuePtr
|
||||
xmlSecAppCmdLineValueCreate(xmlSecAppCmdLineParamPtr param, int pos) {
|
||||
xmlSecAppCmdLineValuePtr value;
|
||||
|
||||
assert(param != NULL);
|
||||
value = (xmlSecAppCmdLineValuePtr) malloc(sizeof(xmlSecAppCmdLineValue));
|
||||
if(value == NULL) {
|
||||
fprintf(stderr, "Error: malloc failed (%d bytes).\n", (int)sizeof(xmlSecAppCmdLineValue));
|
||||
return(NULL);
|
||||
}
|
||||
memset(value, 0, sizeof(xmlSecAppCmdLineValue));
|
||||
|
||||
value->param = param;
|
||||
value->pos = pos;
|
||||
return(value);
|
||||
}
|
||||
|
||||
void
|
||||
xmlSecAppCmdLineValueDestroy(xmlSecAppCmdLineValuePtr value) {
|
||||
assert(value != NULL);
|
||||
|
||||
if(value->strListValue != NULL) {
|
||||
free((void*)value->strListValue);
|
||||
}
|
||||
free(value);
|
||||
}
|
||||
|
||||
static int
|
||||
xmlSecAppCmdLineMatchParam(const char* argvParam, const char* paramName,
|
||||
int canHaveNameString) {
|
||||
assert(argvParam != NULL);
|
||||
assert(paramName != NULL);
|
||||
|
||||
if(canHaveNameString != 0) {
|
||||
size_t len = strlen(paramName);
|
||||
if((strncmp(argvParam, paramName, len) == 0) &&
|
||||
((argvParam[len] == '\0') || (argvParam[len] == ':'))) {
|
||||
|
||||
return(1);
|
||||
}
|
||||
} else if(strcmp(argvParam, paramName) == 0) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
static xmlSecAppCmdLineParamPtr
|
||||
xmlSecAppCmdLineParamsListFind(xmlSecAppCmdLineParamPtr* params, xmlSecAppCmdLineParamTopic topics,
|
||||
const char* name) {
|
||||
size_t i;
|
||||
int canHaveNameString;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(name != NULL);
|
||||
|
||||
for(i = 0; params[i] != NULL; ++i) {
|
||||
if((params[i]->topics & topics) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
canHaveNameString = ((params[i]->flags & xmlSecAppCmdLineParamFlagParamNameValue) != 0) ? 1 : 0;
|
||||
if((params[i]->fullName != NULL) &&
|
||||
(xmlSecAppCmdLineMatchParam(name, params[i]->fullName, canHaveNameString) == 1)) {
|
||||
|
||||
return(params[i]);
|
||||
}
|
||||
|
||||
if((params[i]->shortName != NULL) &&
|
||||
(xmlSecAppCmdLineMatchParam(name, params[i]->shortName, canHaveNameString) == 1)) {
|
||||
|
||||
return(params[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
xmlSecAppCmdLineParamRead(xmlSecAppCmdLineParamPtr param, const char** argv, int argc, int pos) {
|
||||
xmlSecAppCmdLineValuePtr value;
|
||||
xmlSecAppCmdLineValuePtr prev = NULL;
|
||||
char* buf;
|
||||
|
||||
assert(param != NULL);
|
||||
assert(argv != NULL);
|
||||
assert(pos < argc);
|
||||
|
||||
/* first find the previous value in the list */
|
||||
if((param->flags & xmlSecAppCmdLineParamFlagMultipleValues) != 0) {
|
||||
prev = param->value;
|
||||
while((prev != NULL) && (prev->next != NULL)) {
|
||||
prev = prev->next;
|
||||
}
|
||||
} else if(param->value != NULL) {
|
||||
fprintf(stderr, "Error: only one parameter \"%s\" is allowed.\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* create new value and add to the list */
|
||||
value = xmlSecAppCmdLineValueCreate(param, pos);
|
||||
if(value == NULL) {
|
||||
fprintf(stderr, "Error: failed to create value for parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
if(prev != NULL) {
|
||||
assert(prev->next == NULL);
|
||||
prev->next = value;
|
||||
} else {
|
||||
param->value = value;
|
||||
}
|
||||
|
||||
/* if we can have a string value after the name, parse it */
|
||||
if((param->flags & xmlSecAppCmdLineParamFlagParamNameValue) != 0) {
|
||||
value->paramNameValue = strchr(argv[pos], ':');
|
||||
if(value->paramNameValue != NULL) {
|
||||
++value->paramNameValue;
|
||||
}
|
||||
}
|
||||
|
||||
switch(param->type) {
|
||||
case xmlSecAppCmdLineParamTypeFlag:
|
||||
/* do nothing */
|
||||
break;
|
||||
case xmlSecAppCmdLineParamTypeString:
|
||||
if(pos + 1 >= argc) {
|
||||
fprintf(stderr, "Error: string argument expected for parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
value->strValue = argv[++pos];
|
||||
break;
|
||||
case xmlSecAppCmdLineParamTypeStringList:
|
||||
if(pos + 1 >= argc) {
|
||||
fprintf(stderr, "Error: string list argument expected for parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
value->strValue = argv[++pos];
|
||||
buf = (char*)malloc(strlen(value->strValue) + 2);
|
||||
if(buf == NULL) {
|
||||
fprintf(stderr, "Error: failed to allocate memory (%d bytes).\n", (int)strlen(value->strValue) + 2);
|
||||
return(-1);
|
||||
}
|
||||
memset(buf, 0, strlen(value->strValue) + 2);
|
||||
memcpy(buf, value->strValue, strlen(value->strValue));
|
||||
value->strListValue = buf;
|
||||
while((*buf) != '\0') {
|
||||
if((*buf) == ',') {
|
||||
(*buf) = '\0';
|
||||
}
|
||||
++buf;
|
||||
}
|
||||
break;
|
||||
case xmlSecAppCmdLineParamTypeNumber:
|
||||
if(pos + 1 >= argc) {
|
||||
fprintf(stderr, "Error: integer argument expected for parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
value->strValue = argv[++pos];
|
||||
#ifdef WIN32
|
||||
if(sscanf_s(value->strValue, "%d", &(value->intValue)) != 1) {
|
||||
#else /* WIN32 */
|
||||
if(sscanf(value->strValue, "%d", &(value->intValue)) != 1) {
|
||||
#endif /* WIN32 */
|
||||
fprintf(stderr, "Error: integer argument \"%s\" is invalid.\n", value->strValue);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
case xmlSecAppCmdLineParamTypeTime:
|
||||
if(pos + 1 >= argc) {
|
||||
fprintf(stderr, "Error: time argument expected for parameter \"%s\".\n", argv[pos]);
|
||||
return(-1);
|
||||
}
|
||||
value->strValue = argv[++pos];
|
||||
if(xmlSecAppCmdLineTimeParamRead(value->strValue, &(value->timeValue)) < 0) {
|
||||
fprintf(stderr, "Error: time argument \"%s\" is invalid, expected format is \"YYYY-MM-DD HH:MM:SS\").\n", value->strValue);
|
||||
return(-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return(pos);
|
||||
}
|
||||
|
||||
static int
|
||||
xmlSecAppCmdLineTimeParamRead(const char* str, time_t* t) {
|
||||
struct tm tm;
|
||||
int n;
|
||||
|
||||
if((str == NULL) || (t == NULL)) {
|
||||
return(-1);
|
||||
}
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
tm.tm_isdst = -1;
|
||||
|
||||
#ifdef WIN32
|
||||
n = sscanf_s(str, "%4d-%2d-%2d%*c%2d:%2d:%2d",
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
|
||||
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
|
||||
#else /* WIN32 */
|
||||
n = sscanf(str, "%4d-%2d-%2d%*c%2d:%2d:%2d",
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
|
||||
&tm.tm_hour, &tm.tm_min, &tm.tm_sec);
|
||||
#endif /* WIN32 */
|
||||
if((n != 6) || (tm.tm_year < 1900)
|
||||
|| (tm.tm_mon < 1) || (tm.tm_mon > 12)
|
||||
|| (tm.tm_mday < 1) || (tm.tm_mday > 31)
|
||||
|| (tm.tm_hour < 0) || (tm.tm_hour > 23)
|
||||
|| (tm.tm_min < 0) || (tm.tm_min > 59)
|
||||
|| (tm.tm_sec < 0) || (tm.tm_sec > 61)) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
tm.tm_year -= 1900; /* tm relative format year */
|
||||
tm.tm_mon -= 1; /* tm relative format month */
|
||||
|
||||
(*t) = mktime(&tm);
|
||||
return(0);
|
||||
}
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* XMLSec library
|
||||
*
|
||||
* Command line parsing routines
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#ifndef __XMLSEC_APPS_CMDLINE_H__
|
||||
#define __XMLSEC_APPS_CMDLINE_H__
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct _xmlSecAppCmdLineParam xmlSecAppCmdLineParam,
|
||||
*xmlSecAppCmdLineParamPtr;
|
||||
typedef struct _xmlSecAppCmdLineValue xmlSecAppCmdLineValue,
|
||||
*xmlSecAppCmdLineValuePtr;
|
||||
typedef unsigned int xmlSecAppCmdLineParamTopic;
|
||||
|
||||
#define xmlSecAppCmdLineParamFlagNone 0x0000
|
||||
#define xmlSecAppCmdLineParamFlagParamNameValue 0x0001
|
||||
#define xmlSecAppCmdLineParamFlagMultipleValues 0x0002
|
||||
|
||||
#define XMLSEC_STDOUT_FILENAME "-"
|
||||
|
||||
typedef enum {
|
||||
xmlSecAppCmdLineParamTypeFlag,
|
||||
xmlSecAppCmdLineParamTypeString,
|
||||
xmlSecAppCmdLineParamTypeStringList,
|
||||
xmlSecAppCmdLineParamTypeNumber,
|
||||
xmlSecAppCmdLineParamTypeTime
|
||||
} xmlSecAppCmdLineParamType;
|
||||
|
||||
struct _xmlSecAppCmdLineParam {
|
||||
xmlSecAppCmdLineParamTopic topics;
|
||||
const char* fullName;
|
||||
const char* shortName;
|
||||
const char* help;
|
||||
xmlSecAppCmdLineParamType type;
|
||||
int flags;
|
||||
xmlSecAppCmdLineValuePtr value;
|
||||
};
|
||||
|
||||
int xmlSecAppCmdLineParamIsSet (xmlSecAppCmdLineParamPtr param);
|
||||
const char* xmlSecAppCmdLineParamGetString (xmlSecAppCmdLineParamPtr param);
|
||||
const char* xmlSecAppCmdLineParamGetStringList (xmlSecAppCmdLineParamPtr param);
|
||||
int xmlSecAppCmdLineParamGetInt (xmlSecAppCmdLineParamPtr param,
|
||||
int def);
|
||||
time_t xmlSecAppCmdLineParamGetTime (xmlSecAppCmdLineParamPtr param,
|
||||
time_t def);
|
||||
|
||||
int xmlSecAppCmdLineParamsListParse (xmlSecAppCmdLineParamPtr* params,
|
||||
xmlSecAppCmdLineParamTopic topics,
|
||||
const char** argv,
|
||||
int argc,
|
||||
int pos);
|
||||
void xmlSecAppCmdLineParamsListClean (xmlSecAppCmdLineParamPtr* params);
|
||||
void xmlSecAppCmdLineParamsListPrint (xmlSecAppCmdLineParamPtr* params,
|
||||
xmlSecAppCmdLineParamTopic topic,
|
||||
FILE* output);
|
||||
|
||||
struct _xmlSecAppCmdLineValue {
|
||||
xmlSecAppCmdLineParamPtr param;
|
||||
int pos;
|
||||
const char* paramNameValue;
|
||||
const char* strValue;
|
||||
const char* strListValue;
|
||||
int intValue;
|
||||
time_t timeValue;
|
||||
xmlSecAppCmdLineValuePtr next;
|
||||
};
|
||||
|
||||
|
||||
xmlSecAppCmdLineValuePtr xmlSecAppCmdLineValueCreate (xmlSecAppCmdLineParamPtr param,
|
||||
int pos);
|
||||
void xmlSecAppCmdLineValueDestroy (xmlSecAppCmdLineValuePtr value);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __XMLSEC_APPS_CMDLINE_H__ */
|
||||
|
||||
|
||||
|
366
apps/crypto.c
|
@ -1,366 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* XMLSec library
|
||||
*
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/keys.h>
|
||||
#include <xmlsec/transforms.h>
|
||||
#include <xmlsec/errors.h>
|
||||
|
||||
#include "crypto.h"
|
||||
|
||||
int
|
||||
xmlSecAppCryptoInit(const char* config) {
|
||||
if(xmlSecCryptoAppInit(config) < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppInit failed\n");
|
||||
return(-1);
|
||||
}
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoInit failed\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoShutdown(void) {
|
||||
if(xmlSecCryptoShutdown() < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoShutdown failed\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(xmlSecCryptoAppShutdown() < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppShutdown failed\n");
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrInit(xmlSecKeysMngrPtr mngr) {
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
|
||||
return(xmlSecCryptoAppDefaultKeysMngrInit(mngr));
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrLoad(xmlSecKeysMngrPtr mngr, const char *filename) {
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(filename != NULL, -1);
|
||||
|
||||
return(xmlSecCryptoAppDefaultKeysMngrLoad(mngr, filename));
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrSave(xmlSecKeysMngrPtr mngr, const char *filename, xmlSecKeyDataType type) {
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(filename != NULL, -1);
|
||||
|
||||
return(xmlSecCryptoAppDefaultKeysMngrSave(mngr, filename, type));
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrCertLoad(xmlSecKeysMngrPtr mngr, const char *filename,
|
||||
xmlSecKeyDataFormat format, xmlSecKeyDataType type) {
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(filename != NULL, -1);
|
||||
|
||||
#ifndef XMLSEC_NO_X509
|
||||
return(xmlSecCryptoAppKeysMngrCertLoad(mngr, filename, format, type));
|
||||
#else /* XMLSEC_NO_X509 */
|
||||
return(-1);
|
||||
#endif /* XMLSEC_NO_X509 */
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad(xmlSecKeysMngrPtr mngr,
|
||||
const char* files, const char* pwd,
|
||||
const char* name,
|
||||
xmlSecKeyDataFormat format) {
|
||||
xmlSecKeyPtr key;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(files != NULL, -1);
|
||||
|
||||
/* first is the key file */
|
||||
key = xmlSecCryptoAppKeyLoad(files, format, pwd,
|
||||
xmlSecCryptoAppGetDefaultPwdCallback(), (void*)files);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppKeyLoad failed: file=%s\n",
|
||||
xmlSecErrorsSafeString(files));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(name != NULL) {
|
||||
ret = xmlSecKeySetName(key, BAD_CAST name);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecKeySetName failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef XMLSEC_NO_X509
|
||||
for(files += strlen(files) + 1; (files[0] != '\0'); files += strlen(files) + 1) {
|
||||
ret = xmlSecCryptoAppKeyCertLoad(key, files, format);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppKeyCertLoad failed: file=%s\n",
|
||||
xmlSecErrorsSafeString(files));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
#else /* XMLSEC_NO_X509 */
|
||||
files += strlen(files) + 1;
|
||||
if(files[0] != '\0') {
|
||||
fprintf(stderr, "Error: X509 support is disabled\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_NO_X509 */
|
||||
|
||||
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppDefaultKeysMngrAdoptKey failed\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrEngineKeyAndCertsLoad(xmlSecKeysMngrPtr mngr,
|
||||
const char* engineAndKeyId,
|
||||
const char* certFiles,
|
||||
const char* pwd,
|
||||
const char* name,
|
||||
xmlSecKeyDataFormat keyFormat,
|
||||
xmlSecKeyDataFormat certFormat) {
|
||||
xmlSecKeyPtr key;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(engineAndKeyId != NULL, -1);
|
||||
xmlSecAssert2(certFiles != NULL, -1);
|
||||
|
||||
/* load key */
|
||||
key = xmlSecCryptoAppKeyLoad(engineAndKeyId, keyFormat, pwd,
|
||||
xmlSecCryptoAppGetDefaultPwdCallback(), (void*)engineAndKeyId);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppKeyLoad failed: file=%s\n",
|
||||
xmlSecErrorsSafeString(engineAndKeyId));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(name != NULL) {
|
||||
ret = xmlSecKeySetName(key, BAD_CAST name);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecKeySetName failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* load certs (if any) */
|
||||
#ifndef XMLSEC_NO_X509
|
||||
for(const char *file = certFiles; (file[0] != '\0'); file += strlen(file) + 1) {
|
||||
ret = xmlSecCryptoAppKeyCertLoad(key, file, certFormat);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppKeyCertLoad failed: file=%s\n",
|
||||
xmlSecErrorsSafeString(file));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
#else /* XMLSEC_NO_X509 */
|
||||
if(certFiles[0] != '\0') {
|
||||
fprintf(stderr, "Error: X509 support is disabled\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_NO_X509 */
|
||||
|
||||
/* add key to KM */
|
||||
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppDefaultKeysMngrAdoptKey failed\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad(xmlSecKeysMngrPtr mngr, const char *filename, const char* pwd, const char *name) {
|
||||
xmlSecKeyPtr key;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(filename != NULL, -1);
|
||||
|
||||
#ifndef XMLSEC_NO_X509
|
||||
key = xmlSecCryptoAppKeyLoad(filename, xmlSecKeyDataFormatPkcs12, pwd,
|
||||
xmlSecCryptoAppGetDefaultPwdCallback(), (void*)filename);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppKeyLoad failed: filename=%s\n",
|
||||
xmlSecErrorsSafeString(filename));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(name != NULL) {
|
||||
ret = xmlSecKeySetName(key, BAD_CAST name);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecKeySetName failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppDefaultKeysMngrAdoptKey failed\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
#else /* XMLSEC_NO_X509 */
|
||||
fprintf(stderr, "Error: X509 support is disabled\n");
|
||||
return(-1);
|
||||
#endif /* XMLSEC_NO_X509 */
|
||||
}
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad(xmlSecKeysMngrPtr mngr, const char* keyKlass, const char *filename, const char *name) {
|
||||
xmlSecKeyPtr key;
|
||||
xmlSecKeyDataId dataId;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(keyKlass != NULL, -1);
|
||||
xmlSecAssert2(filename != NULL, -1);
|
||||
|
||||
/* find requested data */
|
||||
dataId = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST keyKlass,
|
||||
xmlSecKeyDataUsageAny);
|
||||
if(dataId == xmlSecKeyDataIdUnknown) {
|
||||
fprintf(stderr, "Error: xmlSecKeyDataIdListFindByName failed keyKlass=%s\n",
|
||||
xmlSecErrorsSafeString(keyKlass));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
key = xmlSecKeyReadBinaryFile(dataId, filename);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecKeyReadBinaryFile failed filename=%s\n",
|
||||
xmlSecErrorsSafeString(filename));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ret = xmlSecKeySetName(key, BAD_CAST name);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecKeySetName failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* finally add it to keys manager */
|
||||
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppDefaultKeysMngrAdoptKey failed\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
xmlSecAppCryptoSimpleKeysMngrKeyGenerate(xmlSecKeysMngrPtr mngr, const char* keyKlassAndSize, const char* name) {
|
||||
xmlSecKeyPtr key;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(mngr != NULL, -1);
|
||||
xmlSecAssert2(keyKlassAndSize != NULL, -1);
|
||||
|
||||
key = xmlSecAppCryptoKeyGenerate(keyKlassAndSize, name, xmlSecKeyDataTypePermanent);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecAppCryptoSimpleKeysMngrKeyGenerate failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ret = xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecCryptoAppDefaultKeysMngrAdoptKey failed\n");
|
||||
xmlSecKeyDestroy(key);
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
xmlSecKeyPtr
|
||||
xmlSecAppCryptoKeyGenerate(const char* keyKlassAndSize, const char* name, xmlSecKeyDataType type) {
|
||||
xmlSecKeyPtr key;
|
||||
char* buf;
|
||||
char* p;
|
||||
int size;
|
||||
int ret;
|
||||
|
||||
xmlSecAssert2(keyKlassAndSize != NULL, NULL);
|
||||
|
||||
buf = (char*) xmlStrdup(BAD_CAST keyKlassAndSize);
|
||||
if(buf == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecStrdupError(keyKlassAndSize) failed\n");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* separate key klass and size */
|
||||
p = strchr(buf, '-');
|
||||
if(p == NULL) {
|
||||
fprintf(stderr, "Error: key size is not specified in the key definition \"%s\"\n",
|
||||
xmlSecErrorsSafeString(buf));
|
||||
xmlFree(buf);
|
||||
return(NULL);
|
||||
}
|
||||
*(p++) = '\0';
|
||||
size = atoi(p);
|
||||
|
||||
key = xmlSecKeyGenerateByName(BAD_CAST buf, size, type);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr, "Error: xmlSecKeyGenerateByName() failed: name=%s;size=%d;type=%d\n",
|
||||
xmlSecErrorsSafeString(buf), size, (int)type);
|
||||
xmlFree(buf);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ret = xmlSecKeySetName(key, BAD_CAST name);
|
||||
if(ret < 0) {
|
||||
fprintf(stderr, "Error: xmlSecKeySetName failed: name=%s\n",
|
||||
xmlSecErrorsSafeString(name));
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlFree(buf);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
xmlFree(buf);
|
||||
return(key);
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* XMLSec library
|
||||
*
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#ifndef __XMLSEC_APPS_CRYPTO_H__
|
||||
#define __XMLSEC_APPS_CRYPTO_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/keys.h>
|
||||
#include <xmlsec/keyinfo.h>
|
||||
#include <xmlsec/keysmngr.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int xmlSecAppCryptoInit (const char* config);
|
||||
int xmlSecAppCryptoShutdown (void);
|
||||
|
||||
xmlSecKeyPtr xmlSecAppCryptoKeyGenerate (const char* keyKlassAndSize,
|
||||
const char* name,
|
||||
xmlSecKeyDataType type);
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* Simple keys manager
|
||||
*
|
||||
****************************************************************************/
|
||||
int xmlSecAppCryptoSimpleKeysMngrInit (xmlSecKeysMngrPtr mngr);
|
||||
int xmlSecAppCryptoSimpleKeysMngrLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* filename);
|
||||
int xmlSecAppCryptoSimpleKeysMngrSave (xmlSecKeysMngrPtr mngr,
|
||||
const char* filename,
|
||||
xmlSecKeyDataType type);
|
||||
int xmlSecAppCryptoSimpleKeysMngrCertLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* filename,
|
||||
xmlSecKeyDataFormat format,
|
||||
xmlSecKeyDataType type);
|
||||
int xmlSecAppCryptoSimpleKeysMngrKeyAndCertsLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* files,
|
||||
const char* pwd,
|
||||
const char* name,
|
||||
xmlSecKeyDataFormat format);
|
||||
int xmlSecAppCryptoSimpleKeysMngrEngineKeyAndCertsLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* engineAndKeyId,
|
||||
const char* certFiles,
|
||||
const char* pwd,
|
||||
const char* name,
|
||||
xmlSecKeyDataFormat keyFormat,
|
||||
xmlSecKeyDataFormat certFormat);
|
||||
int xmlSecAppCryptoSimpleKeysMngrPkcs12KeyLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* filename,
|
||||
const char* pwd,
|
||||
const char* name);
|
||||
int xmlSecAppCryptoSimpleKeysMngrBinaryKeyLoad (xmlSecKeysMngrPtr mngr,
|
||||
const char* keyKlass,
|
||||
const char* filename,
|
||||
const char* name);
|
||||
int xmlSecAppCryptoSimpleKeysMngrKeyGenerate (xmlSecKeysMngrPtr mngr,
|
||||
const char* keyKlassAndSize,
|
||||
const char* name);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __XMLSEC_APPS_CRYPTO_H__ */
|
||||
|
||||
|
||||
|
3084
apps/xmlsec.c
347
compile
|
@ -1,347 +0,0 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2012-10-14.11; # UTC
|
||||
|
||||
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
127
config.h.in
|
@ -1,127 +0,0 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <ansidecl.h> header file. */
|
||||
#undef HAVE_ANSIDECL_H
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#undef HAVE_CTYPE_H
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#undef HAVE_ERRNO_H
|
||||
|
||||
/* Define to 1 if you have the `fprintf' function. */
|
||||
#undef HAVE_FPRINTF
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the `printf' function. */
|
||||
#undef HAVE_PRINTF
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `sprintf' function. */
|
||||
#undef HAVE_SPRINTF
|
||||
|
||||
/* Define to 1 if you have the `sscanf' function. */
|
||||
#undef HAVE_SSCANF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the `strchr' function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the `strrchr' function. */
|
||||
#undef HAVE_STRRCHR
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the `timegm' function. */
|
||||
#undef HAVE_TIMEGM
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `vfprintf' function. */
|
||||
#undef HAVE_VFPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `vsprintf' function. */
|
||||
#undef HAVE_VSPRINTF
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
2452
configure.ac
|
@ -1,37 +0,0 @@
|
|||
xmlsec and libxmlsec for Debian
|
||||
-------------------------------
|
||||
|
||||
The upstream documentation is included with the libxmlsec1-dev package and
|
||||
located at /usr/share/doc/libxmlsec1-dev.
|
||||
|
||||
When developing with the xmlsec library, you have a choice of openssl,
|
||||
gnutls, or nss crypto engines. By using "pkg-config xmlsec1-<engine>" or
|
||||
"xmlsec1-config --crypto=<engine>", you can get the necessary compiler
|
||||
command-line switches for enabling a certain engine.
|
||||
|
||||
If you want to license your application that uses the xmlsec library under
|
||||
the GNU GPL, or want your library that uses the xmlsec library to be GPL-
|
||||
compatible, I suggest using the gnutls engine. Use of the nss crypto engine
|
||||
may also be compatible with the GPL, but see bugs #207024 and #207026.
|
||||
Regarding openssl, there is a bit of controversy about whether it can be
|
||||
considered part of the OS and therefore make use of a loophole in the GPL.
|
||||
(See the xmlsec FAQ in the documentation.) More specifically, debian-legal
|
||||
takes a hard line and does not allow GPL'd packages that link to openssl to
|
||||
exist in main. In the future, support for PGP key types may be added, which
|
||||
would become another reason to go with the gnutls engine.
|
||||
|
||||
Note that the library has a dynamic crypto engine loading feature, but I
|
||||
have not yet enabled it.
|
||||
|
||||
Note that a number of the examples included with the -dev package will
|
||||
not compile successfully under the gnutls engine (due to lack of features
|
||||
compared to openssl), and will fail under both the gnutls and nss engines
|
||||
(due to lack of pem file support, etc.).
|
||||
|
||||
Upstream has promised that they will increment the number in the library name
|
||||
(for example, xmlsec1 -> xmlsec2) whenever a binary incompatibility is
|
||||
introduced, and that it will always match the soname number. For this
|
||||
reason I chose to omit the soname number from package names.
|
||||
|
||||
|
||||
-- John V. Belmonte <jbelmonte@debian.org>
|
|
@ -1,5 +0,0 @@
|
|||
xmlsec1 (1.2.33-ok1) yangtze; urgency=medium
|
||||
|
||||
* Build for openkylin.
|
||||
|
||||
-- rtlhq <nobelxyz@163.com> Tue, 13 Sep 2022 15:49:05 +0800
|
|
@ -1 +0,0 @@
|
|||
11
|
|
@ -1,146 +0,0 @@
|
|||
Source: xmlsec1
|
||||
Section: text
|
||||
Priority: optional
|
||||
Maintainer: openKylin KDE SIG <kde@lists.openkylin.top>
|
||||
Uploaders: rtlhq <nobelxyz@163.com>,
|
||||
Build-Depends:
|
||||
debhelper (>= 11),
|
||||
help2man,
|
||||
libgcrypt20-dev,
|
||||
libgnutls28-dev,
|
||||
libnss3-dev,
|
||||
libssl-dev (>= 1.0.0),
|
||||
libxml2-dev (>= 2.8.0),
|
||||
libxslt1-dev (>= 1.0.20),
|
||||
pkg-config,
|
||||
Build-Depends-Indep:
|
||||
gtk-doc-tools,
|
||||
man2html-base,
|
||||
xsltproc,
|
||||
Standards-Version: 4.1.4
|
||||
Homepage: https://www.aleksey.com/xmlsec/
|
||||
Vcs-Browser: https://gitee.com/openkylin/xmlsec1
|
||||
Vcs-Git: https://gitee.com/openkylin/xmlsec1.git
|
||||
|
||||
Package: libxmlsec1-dev
|
||||
Section: libdevel
|
||||
Architecture: any
|
||||
Depends:
|
||||
libc6-dev,
|
||||
libgcrypt20-dev,
|
||||
libgnutls28-dev,
|
||||
libnss3-dev,
|
||||
libssl-dev (>= 1.0.0),
|
||||
libxml2-dev (>= 2.8.0),
|
||||
libxmlsec1 (= ${binary:Version}),
|
||||
libxmlsec1-gcrypt (= ${binary:Version}),
|
||||
libxmlsec1-gnutls (= ${binary:Version}),
|
||||
libxmlsec1-nss (= ${binary:Version}),
|
||||
libxmlsec1-openssl (= ${binary:Version}),
|
||||
libxslt1-dev (>= 1.0.20),
|
||||
${misc:Depends},
|
||||
Description: Development files for the XML security library
|
||||
The XML Security Library is a C library that implements these XML standards:
|
||||
.
|
||||
* XML Signature
|
||||
* XML Encryption
|
||||
.
|
||||
This package provides development files including documentation, examples,
|
||||
headers, static libraries, and configuration support.
|
||||
|
||||
Package: libxmlsec1
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Multi-Arch: same
|
||||
Breaks: libreoffice-core (<< 1:6.0.5~rc2~)
|
||||
Description: XML security library
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package provides dynamic libraries for use by applications.
|
||||
Specifically, it provides all XML security library functionality
|
||||
except for the cryptography engine.
|
||||
|
||||
Package: libxmlsec1-openssl
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Multi-Arch: same
|
||||
Description: Openssl engine for the XML security library
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package provides dynamic libraries for use by applications.
|
||||
Specifically, it provides the openssl implementation of the XML security
|
||||
library cryptography functions.
|
||||
|
||||
Package: libxmlsec1-gnutls
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Multi-Arch: same
|
||||
Description: Gnutls engine for the XML security library
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package provides dynamic libraries for use by applications.
|
||||
Specifically, it provides the gnutls implementation of the XML security
|
||||
library cryptography functions.
|
||||
|
||||
Package: libxmlsec1-nss
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Multi-Arch: same
|
||||
Description: Nss engine for the XML security library
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package provides dynamic libraries for use by applications.
|
||||
Specifically, it provides the nss implementation of the XML security
|
||||
library cryptography functions.
|
||||
|
||||
Package: libxmlsec1-gcrypt
|
||||
Section: libs
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Multi-Arch: same
|
||||
Description: Gcrypt engine for the XML security library
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package provides dynamic libraries for use by applications.
|
||||
Specifically, it provides the gcrypt implementation of the XML security
|
||||
library cryptography functions.
|
||||
|
||||
Package: xmlsec1
|
||||
Architecture: any
|
||||
Depends:
|
||||
${misc:Depends},
|
||||
${shlibs:Depends},
|
||||
Description: XML security command line processor
|
||||
Xmlsec is a command line tool for signature and encryption transformations
|
||||
of XML data. It is part of the XML Security Library.
|
||||
|
||||
Package: libxmlsec1-doc
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}
|
||||
Replaces: libxmlsec1-dev (<< 1.2.26-2)
|
||||
Breaks: libxmlsec1-dev (<< 1.2.26-2)
|
||||
Description: XML security library -- documentation
|
||||
The XML Security Library implements standards related to secure handling
|
||||
of XML data.
|
||||
.
|
||||
This package contains the documentation for xmlsec1. E.g. the API docs.
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
This package was debianized by John V. Belmonte <jbelmonte@debian.org> on
|
||||
Tue, 11 Feb 2003 14:58:00 -0500.
|
||||
|
||||
It was downloaded from ftp://ftp.aleksey.com/pub/xmlsec/releases/
|
||||
|
||||
Upstream Author: Aleksey Sanin <aleksey@aleksey.com>
|
||||
|
||||
Copyright (C) 2002 Aleksey Sanin. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
DANIEL VEILLARD BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON-
|
||||
NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of Aleksey Sanin shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
ings in this Software without prior written authorization from him.
|
|
@ -1,6 +0,0 @@
|
|||
usr/bin/xmlsec1-config
|
||||
usr/include/*
|
||||
usr/lib/*/lib*.a
|
||||
usr/lib/*/lib*.la
|
||||
usr/lib/*/lib*.so
|
||||
usr/lib/*/pkgconfig/*
|
|
@ -1 +0,0 @@
|
|||
man/xmlsec1-config.1
|
|
@ -1 +0,0 @@
|
|||
usr/share/doc/libxmlsec1-dev/html/api
|
|
@ -1 +0,0 @@
|
|||
usr/share/doc/libxmlsec1-dev/html usr/share/doc/libxmlsec1-doc/html
|
|
@ -1 +0,0 @@
|
|||
usr/lib/*/libxmlsec1-gcrypt.so.*
|
|
@ -1,2 +0,0 @@
|
|||
# upstream promised to change package name whenever bumping the soname
|
||||
package-name-doesnt-match-sonames libxmlsec1-gcrypt1
|
|
@ -1 +0,0 @@
|
|||
usr/lib/*/libxmlsec1-gnutls.so.*
|
|
@ -1,2 +0,0 @@
|
|||
# upstream promised to change package name whenever bumping the soname
|
||||
package-name-doesnt-match-sonames libxmlsec1-gnutls1
|
|
@ -1 +0,0 @@
|
|||
usr/lib/*/libxmlsec1-nss.so.*
|
|
@ -1,2 +0,0 @@
|
|||
# upstream promised to change package name whenever bumping the soname
|
||||
package-name-doesnt-match-sonames libxmlsec1-nss1
|
|
@ -1 +0,0 @@
|
|||
usr/lib/*/libxmlsec1-openssl.so.*
|
|
@ -1,2 +0,0 @@
|
|||
# upstream promised to change package name whenever bumping the soname
|
||||
package-name-doesnt-match-sonames libxmlsec1-openssl1
|
|
@ -1 +0,0 @@
|
|||
usr/lib/*/libxmlsec1.so.*
|
|
@ -1,2 +0,0 @@
|
|||
# upstream promised to change package name whenever bumping the soname
|
||||
package-name-doesnt-match-sonames libxmlsec1-1
|
|
@ -1,346 +0,0 @@
|
|||
diff --git a/tests/testDSig.sh b/tests/testDSig.sh
|
||||
index dd7db69..26b82ec 100755
|
||||
--- a/tests/testDSig.sh
|
||||
+++ b/tests/testDSig.sh
|
||||
@@ -124,15 +124,6 @@ execDSigTest $res_success \
|
||||
# aleksey-xmldsig-01
|
||||
#
|
||||
##########################################################################
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "aleksey-xmldsig-01/signature-two-keynames" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "$priv_key_option:key2 $topfolder/keys/rsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2018" \
|
||||
- "$priv_key_option:key2 $topfolder/keys/rsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2018" \
|
||||
- "$priv_key_option:key2 $topfolder/keys/rsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2018"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"" \
|
||||
"aleksey-xmldsig-01/enveloping-dsa-x509chain" \
|
||||
@@ -534,143 +525,6 @@ execDSigTest $res_success \
|
||||
"$priv_key_option $topfolder/keys/rsakey.$priv_key_format --pwd secret123" \
|
||||
" "
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-external-b64-dsa" \
|
||||
- "base64 sha1 dsa-sha1" \
|
||||
- "dsa" \
|
||||
- " $url_map_xml_stylesheet_b64_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_b64_2005" \
|
||||
- " $url_map_xml_stylesheet_b64_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-external-dsa" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa" \
|
||||
- "$url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005" \
|
||||
- " $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-keyname" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--pubkey-cert-$cert_format:Lugh $topfolder/merlin-xmldsig-twenty-three/certs/lugh-cert.$cert_format $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option:test-dsa $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option:test-dsa $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-x509-crt" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"\
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-x509-sn" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format --untrusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/badb.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"\
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-x509-is" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format --untrusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/macha.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"\
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-x509-ski" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format --untrusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/nemain.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"\
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-retrievalmethod-rawx509crt" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format --untrusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/nemain.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005"\
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format --trusted-$cert_format $topfolder/keys/ca2cert.$cert_format $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature" \
|
||||
- "base64 xpath xslt enveloped-signature c14n-with-comments sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/merlin.$cert_format --verification-time 2005-01-01+10:00:00 $url_map_xml_stylesheet_2005 $url_map_xml_stylesheet_b64_2005" \
|
||||
- "$priv_key_option $topfolder/keys/dsakey.$priv_key_format --pwd secret123 $url_map_xml_stylesheet_2005 $url_map_xml_stylesheet_b64_2005" \
|
||||
- "--trusted-$cert_format $topfolder/keys/cacert.$cert_format --untrusted-$cert_format $topfolder/keys/ca2cert.$cert_format $url_map_xml_stylesheet_2005 $url_map_xml_stylesheet_b64_2005"
|
||||
-
|
||||
-
|
||||
-##########################################################################
|
||||
-#
|
||||
-# merlin-xmlenc-five
|
||||
-#
|
||||
-# While the main operation is signature (and this is why we have these
|
||||
-# tests here instead of testEnc.sh), these tests check the encryption
|
||||
-# key transport/wrapper algorightms
|
||||
-#
|
||||
-##########################################################################
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-ripemd160-hmac-ripemd160-kw-tripledes" \
|
||||
- "ripemd160 hmac-ripemd160 kw-tripledes" \
|
||||
- "hmac des" \
|
||||
- "--keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005" \
|
||||
- "--session-key hmac-192 --keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005" \
|
||||
- "--keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-sha256-hmac-sha256-kw-aes128" \
|
||||
- "sha256 hmac-sha256 kw-aes128" \
|
||||
- "hmac aes" \
|
||||
- "--keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-sha384-hmac-sha384-kw-aes192" \
|
||||
- "sha384 hmac-sha384 kw-aes192" \
|
||||
- "hmac aes" \
|
||||
- "--keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-sha512-hmac-sha512-kw-aes256" \
|
||||
- "sha512 hmac-sha512 kw-aes256" \
|
||||
- "hmac aes" \
|
||||
- "--keys-file $topfolder/merlin-xmlenc-five/keys.xml $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-hmac-sha256-rsa-1_5" \
|
||||
- "sha1 hmac-sha256 rsa-1_5" \
|
||||
- "hmac rsa" \
|
||||
- "$priv_key_option $topfolder/merlin-xmlenc-five/rsapriv.$priv_key_format --pwd secret $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "" \
|
||||
- "merlin-xmlenc-five/encsig-hmac-sha256-rsa-oaep-mgf1p" \
|
||||
- "sha1 hmac-sha256 rsa-oaep-mgf1p" \
|
||||
- "hmac rsa" \
|
||||
- "$priv_key_option $topfolder/merlin-xmlenc-five/rsapriv.$priv_key_format --pwd secret $url_map_xml_stylesheet_2005"
|
||||
-
|
||||
-
|
||||
-
|
||||
##########################################################################
|
||||
#
|
||||
# merlin-exc-c14n-one
|
||||
@@ -730,20 +584,6 @@ execDSigTest $res_success \
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-big" \
|
||||
- "base64 xslt xpath sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--pubkey-cert-$cert_format certs/rsa-cert.$cert_format $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-dsa-detached" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format certs/dsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-dsa-enveloped" \
|
||||
@@ -758,13 +598,6 @@ execDSigTest $res_success \
|
||||
"dsa x509" \
|
||||
"--trusted-$cert_format certs/dsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00"
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-dsa-manifest" \
|
||||
- "sha1 dsa-sha1" \
|
||||
- "dsa x509" \
|
||||
- "--trusted-$cert_format certs/dsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-hmac-md5-c14n-enveloping" \
|
||||
@@ -772,27 +605,6 @@ execDSigTest $res_success \
|
||||
"hmac" \
|
||||
"--hmackey certs/hmackey.bin"
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-hmac-sha1-40-c14n-comments-detached" \
|
||||
- "c14n-with-comments sha1 hmac-sha1" \
|
||||
- "hmac" \
|
||||
- "--hmackey certs/hmackey.bin $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-hmac-sha1-40-exclusive-c14n-comments-detached" \
|
||||
- "exc-c14n-with-comments sha1 hmac-sha1" \
|
||||
- "hmac" \
|
||||
- "--hmackey certs/hmackey.bin $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-hmac-sha1-exclusive-c14n-comments-detached" \
|
||||
- "exc-c14n-with-comments sha1 hmac-sha1" \
|
||||
- "hmac" \
|
||||
- "--hmackey certs/hmackey.bin $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-hmac-sha1-exclusive-c14n-enveloped" \
|
||||
@@ -800,41 +612,6 @@ execDSigTest $res_success \
|
||||
"hmac" \
|
||||
"--hmackey certs/hmackey.bin"
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached-b64-transform" \
|
||||
- "base64 sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached-xpath-transform" \
|
||||
- "xpath sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached-xslt-transform-retrieval-method" \
|
||||
- "xslt sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached-xslt-transform" \
|
||||
- "xslt sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-rsa-enveloped" \
|
||||
@@ -849,48 +626,6 @@ execDSigTest $res_success \
|
||||
"rsa x509" \
|
||||
"--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00"
|
||||
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest-x509-data-cert-chain" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest-x509-data-cert" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest-x509-data-issuer-serial" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --untrusted-$cert_format certs/rsa-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest-x509-data-ski" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --untrusted-$cert_format certs/rsa-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest-x509-data-subject-name" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --untrusted-$cert_format certs/rsa-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
-execDSigTest $res_success \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-manifest" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format --verification-time 2009-01-01+10:00:00 $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_success \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-rsa-xpath-transform-enveloped" \
|
||||
@@ -935,13 +670,6 @@ execDSigTest $res_success \
|
||||
##########################################################################
|
||||
##########################################################################
|
||||
echo "--------- Negative Testing ----------"
|
||||
-execDSigTest $res_fail \
|
||||
- "" \
|
||||
- "merlin-xmldsig-twenty-three/signature-x509-crt-crl" \
|
||||
- "sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format $topfolder/merlin-xmldsig-twenty-three/certs/ca.$cert_format $url_map_xml_stylesheet_2018"
|
||||
-
|
||||
execDSigTest $res_fail \
|
||||
"" \
|
||||
"aleksey-xmldsig-01/enveloping-expired-cert" \
|
||||
@@ -956,13 +684,6 @@ execDSigTest $res_fail \
|
||||
"hmac" \
|
||||
"--enabled-reference-uris empty --hmackey $topfolder/keys/hmackey.bin --dtd-file $topfolder/aleksey-xmldsig-01/dtd-hmac-91.dtd"
|
||||
|
||||
-execDSigTest $res_fail \
|
||||
- "phaos-xmldsig-three" \
|
||||
- "signature-rsa-detached-xslt-transform-bad-retrieval-method" \
|
||||
- "xslt sha1 rsa-sha1" \
|
||||
- "rsa x509" \
|
||||
- "--trusted-$cert_format certs/rsa-ca-cert.$cert_format $url_map_rfc3161"
|
||||
-
|
||||
execDSigTest $res_fail \
|
||||
"phaos-xmldsig-three" \
|
||||
"signature-rsa-enveloped-bad-digest-val" \
|
|
@ -1,3 +0,0 @@
|
|||
skip-failing-tests.patch
|
||||
no-url-map-using-tests.diff
|
||||
source-is-a-bashism.diff
|
|
@ -1,33 +0,0 @@
|
|||
Description: Skip failing tests due to disabled lib plugins
|
||||
Some tests require of dynamic loading of crypto libraries
|
||||
in xmlsec1 apps - we disable this in the build, so only test
|
||||
with the default openssl lib.
|
||||
Author: James Page <james.page@ubuntu.com>
|
||||
Forwarded: not-needed
|
||||
|
||||
diff --git a/tests/testDSig.sh b/tests/testDSig.sh
|
||||
index 5ef44a4..c90f4dd 100755
|
||||
--- a/tests/testDSig.sh
|
||||
+++ b/tests/testDSig.sh
|
||||
@@ -842,7 +842,7 @@ execDSigTest $res_success \
|
||||
# test dynamic signature
|
||||
#
|
||||
##########################################################################
|
||||
-if [ -n "$XMLSEC_TEST_NAME" -a "$XMLSEC_TEST_NAME" = "dsig-dynamic" ]; then
|
||||
+if [ -n "$XMLSEC_TEST_NAME" -a "$XMLSEC_TEST_NAME" = "dsig-dynamic" -a "$crypto" = 'openssl' ]; then
|
||||
echo "Dynamic signature template"
|
||||
printf " Create new signature "
|
||||
echo "$VALGRIND $xmlsec_app sign-tmpl $xmlsec_params --keys-file $keysfile --output $tmpfile" >> $logfile
|
||||
diff --git a/tests/testEnc.sh b/tests/testEnc.sh
|
||||
index 9970e33..f9ab2da 100755
|
||||
--- a/tests/testEnc.sh
|
||||
+++ b/tests/testEnc.sh
|
||||
@@ -366,7 +366,7 @@ execEncTest $res_success \
|
||||
# test dynamicencryption
|
||||
#
|
||||
##########################################################################
|
||||
-if [ -n "$XMLSEC_TEST_NAME" -a "$XMLSEC_TEST_NAME" = "enc-dynamic" ]; then
|
||||
+if [ -n "$XMLSEC_TEST_NAME" -a "$XMLSEC_TEST_NAME" = "enc-dynamic" -a $crypto = 'openssl']; then
|
||||
echo "Dynamic encryption template"
|
||||
printf " Encrypt template "
|
||||
echo "$VALGRIND $xmlsec_app encrypt-tmpl $xmlsec_params --keys-file $keysfile --output $tmpfile" >> $logfile
|
|
@ -1,19 +0,0 @@
|
|||
diff --git a/tests/testrun.sh b/tests/testrun.sh
|
||||
index fe0334c..fb68e3d 100755
|
||||
--- a/tests/testrun.sh
|
||||
+++ b/tests/testrun.sh
|
||||
@@ -1,4 +1,4 @@
|
||||
-#!/bin/sh
|
||||
+#!/bin/bash
|
||||
|
||||
OS_ARCH=`uname -o`
|
||||
OS_KERNEL=`uname -s`
|
||||
@@ -472,7 +472,7 @@ execEncTest() {
|
||||
rm -rf $tmpfile $tmpfile.2 tmpfile.3
|
||||
|
||||
# run tests
|
||||
-source "$testfile"
|
||||
+. "$testfile"
|
||||
|
||||
# print results
|
||||
echo "--- TOTAL OK: $count_success; TOTAL FAILED: $count_fail; TOTAL SKIPPED: $count_skip" >> $logfile
|
|
@ -1,57 +0,0 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
export OFFLINE=1
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_clean:
|
||||
dh_auto_clean
|
||||
if [ -d docs.bak ]; then rm -rf docs; mv docs.bak docs; fi
|
||||
rm -f man/xmlsec1-config.1 man/xmlsec1.1
|
||||
rm -f config.log config.cache config.status
|
||||
|
||||
override_dh_auto_configure:
|
||||
if [ ! -d docs.bak ]; then cp -ra docs docs.bak; fi
|
||||
dh_auto_configure -- \
|
||||
--enable-manpages-build \
|
||||
--with-html-dir=\$${prefix}/share/doc/libxmlsec1-dev/html \
|
||||
--disable-crypto-dl \
|
||||
--disable-apps-crypto-dl \
|
||||
--enable-soap
|
||||
|
||||
override_dh_auto_build-indep:
|
||||
dh_auto_configure -- \
|
||||
--enable-manpages-build \
|
||||
--enable-docs --enable-docs-build \
|
||||
--with-html-dir=\$${prefix}/share/doc/libxmlsec1-dev/html \
|
||||
--disable-crypto-dl \
|
||||
--disable-apps-crypto-dl \
|
||||
--enable-soap
|
||||
dh_auto_build --no-parallel
|
||||
|
||||
override_dh_auto_test:
|
||||
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
|
||||
$(MAKE) check | tee /tmp/tests.log
|
||||
grep -q Fail /tmp/tests.log && (echo "Failures executing unit tests, exiting build"; exit 1) \
|
||||
|| echo "Unit tests completed successfully"
|
||||
endif
|
||||
|
||||
touch build-stamp
|
||||
|
||||
override_dh_install:
|
||||
find debian/tmp/usr/lib -name "*.la" -exec \
|
||||
sed -i -e "s,^dependency_libs=.*,dependency_libs=''," {} +
|
||||
dh_install
|
||||
|
||||
override_dh_installexamples:
|
||||
dh_installexamples examples/*
|
||||
|
||||
override_dh_installdocs:
|
||||
dh_installdocs -X.sgml --all README debian/README.Debian
|
||||
|
||||
override_dh_compress:
|
||||
dh_compress -Xexamples/
|
||||
|
||||
override_dh_makeshlibs:
|
||||
dh_makeshlibs -V
|
|
@ -1 +0,0 @@
|
|||
3.0 (native)
|
|
@ -1,3 +0,0 @@
|
|||
version=2
|
||||
https://www.aleksey.com/xmlsec/download/xmlsec1-([\d\.]+)\.tar\.gz \
|
||||
debian uupdate
|
|
@ -1 +0,0 @@
|
|||
usr/bin/xmlsec1
|
|
@ -1 +0,0 @@
|
|||
man/xmlsec1.1
|
791
depcomp
|
@ -1,791 +0,0 @@
|
|||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2016-01-11.22; # UTC
|
||||
|
||||
# Copyright (C) 1999-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
123
docs/Makefile.am
|
@ -1,123 +0,0 @@
|
|||
NULL =
|
||||
|
||||
SUBDIRS=api
|
||||
|
||||
TARGET_DIR=@XMLSEC_DOCDIR@
|
||||
|
||||
EXTRA_DIST=\
|
||||
$(builddir)/images \
|
||||
$(builddir)/*.html \
|
||||
$(builddir)/*.ico \
|
||||
$(builddir)/xmlsec.xsl \
|
||||
$(builddir)/xmlsec-ga.xsl \
|
||||
$(NULL)
|
||||
|
||||
XMLSEC1_MAN=$(top_builddir)/man/xmlsec1.1
|
||||
XMLSEC_HTML=$(builddir)/xmlsec-man.html
|
||||
|
||||
all:
|
||||
@echo "======= Run 'make docs' in the xmlsec/docs folder to rebuild docs"
|
||||
|
||||
# docs is legacy
|
||||
docs: docs-copy man-docs docs-format
|
||||
|
||||
docs-copy:
|
||||
@( \
|
||||
echo "Copying docs..."; \
|
||||
if [ z"$(srcdir)" != z"$(builddir)" -a z"`uname`" != z"Darwin" ]; \
|
||||
then \
|
||||
$(CP) -ru $(srcdir)/*.html $(srcdir)/*.ico $(srcdir)/images $(builddir)/ ; \
|
||||
(chmod u+w $(builddir)/*.html || true) ; \
|
||||
(chmod u+w $(builddir)/*.ico || true) ; \
|
||||
(chmod -R u+w $(builddir)/images || true) ; \
|
||||
fi \
|
||||
)
|
||||
|
||||
# if we build docs then we also have xsltproc
|
||||
if BUILD_MAN_DOCS
|
||||
man-docs: $(XMLSEC_HTML) docs-copy
|
||||
|
||||
$(XMLSEC_HTML): docs-copy $(XMLSEC1_MAN)
|
||||
$(MAN2HTML) $(XMLSEC1_MAN) | \
|
||||
grep -v '^Content-type: text/html' | \
|
||||
tr "[:cntrl:]" " " > \
|
||||
$(XMLSEC_HTML)
|
||||
else
|
||||
# do nothing, we aready copied this file
|
||||
man-docs:
|
||||
|
||||
endif
|
||||
|
||||
if HAS_XSLTPROC
|
||||
docs-format:
|
||||
@(echo "Formatting html documents"; \
|
||||
for i in `find $(builddir) -name "*.html" -print`; \
|
||||
do \
|
||||
top_folder=`echo $$i | sed 's#/[^/]*$$#/#' | sed 's#\./##' | \
|
||||
sed 's#[^/]*/#../#g'`; \
|
||||
echo "Processing $$i (topfolder='$$top_folder')"; \
|
||||
$(XSLTPROC) --html --stringparam topfolder "$$top_folder" \
|
||||
--output $$i.tmp $(srcdir)/xmlsec.xsl $$i; \
|
||||
if [ $$? != 0 ]; \
|
||||
then \
|
||||
echo "ERROR: processing file $$i"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
mv $$i.tmp $$i; \
|
||||
done)
|
||||
@(echo "Cleaning html documents"; \
|
||||
for i in `find $(builddir) -name "*.html" -print`; \
|
||||
do \
|
||||
echo Cleaning $$i ; \
|
||||
sed 's/\xA0/ /g' $$i > $$i.tmp ; \
|
||||
mv $$i.tmp $$i ; \
|
||||
done)
|
||||
docs-format-ga:
|
||||
@(echo "Formatting html documents to add Google Analytics"; \
|
||||
for i in `find $(builddir) -name "*.html" -print`; \
|
||||
do \
|
||||
echo "Processing $$i"; \
|
||||
$(XSLTPROC) --html --output $$i.tmp $(srcdir)/xmlsec-ga.xsl $$i; \
|
||||
if [ $$? != 0 ]; \
|
||||
then \
|
||||
echo "ERROR: processing file $$i"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
mv $$i.tmp $$i; \
|
||||
done)
|
||||
else
|
||||
# do nothing
|
||||
docs-format:
|
||||
|
||||
endif
|
||||
|
||||
clean-local:
|
||||
-rm -f *.stamp
|
||||
( if [ z"$(srcdir)" != z"$(builddir)" ] ; then \
|
||||
(chmod -R u+w $(builddir)/images || true) && rm -rf $(builddir)/images ; \
|
||||
(chmod -R u+w $(builddir)/src || true) && rm -rf $(builddir)/src ; \
|
||||
(for i in `find $(builddir) -name "*.html" -print` ; do \
|
||||
echo "Removing files '$$i' ... " ; \
|
||||
chmod -R u+w $$i && rm -f $$i ; \
|
||||
done ) ; \
|
||||
(for i in `find $(builddir) -name "*.ico" -print` ; do \
|
||||
echo "Removing files '$$i' ... " ; \
|
||||
chmod -R u+w $$i && rm -f $$i ; \
|
||||
done ) ; \
|
||||
fi ; )
|
||||
|
||||
distclean-local: clean-local
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/images
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/api
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/api/images
|
||||
-@INSTALL@ -m 0644 $(builddir)/*.html $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(builddir)/*.ico $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(builddir)/images/*.gif $(builddir)/images/*.png $(DESTDIR)$(TARGET_DIR)/images
|
||||
-@INSTALL@ -m 0644 $(builddir)/api/*.html $(builddir)/api/*.png $(builddir)/api/*.sgml $(DESTDIR)$(TARGET_DIR)/api
|
||||
-@INSTALL@ -m 0644 $(builddir)/api/images/*.png $(DESTDIR)$(TARGET_DIR)/api/images
|
||||
|
||||
uninstall-local:
|
||||
@rm -rf $(DESTDIR)$(TARGET_DIR)
|
848
docs/Makefile.in
|
@ -1,848 +0,0 @@
|
|||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = docs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
distdir
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CP = @CP@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCRYPT_CFLAGS = @GCRYPT_CFLAGS@
|
||||
GCRYPT_CONFIG_PATH = @GCRYPT_CONFIG_PATH@
|
||||
GCRYPT_CRYPTO_LIB = @GCRYPT_CRYPTO_LIB@
|
||||
GCRYPT_LIBS = @GCRYPT_LIBS@
|
||||
GCRYPT_MIN_VERSION = @GCRYPT_MIN_VERSION@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_CRYPTO_LIB = @GNUTLS_CRYPTO_LIB@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GNUTLS_MIN_VERSION = @GNUTLS_MIN_VERSION@
|
||||
GREP = @GREP@
|
||||
GTKDOC_MKDB = @GTKDOC_MKDB@
|
||||
GTKDOC_MKHTML = @GTKDOC_MKHTML@
|
||||
GTKDOC_SCAN = @GTKDOC_SCAN@
|
||||
HELP2MAN = @HELP2MAN@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBXML_CFLAGS = @LIBXML_CFLAGS@
|
||||
LIBXML_CONFIG = @LIBXML_CONFIG@
|
||||
LIBXML_CONFIG_PATH = @LIBXML_CONFIG_PATH@
|
||||
LIBXML_LIBS = @LIBXML_LIBS@
|
||||
LIBXML_MIN_VERSION = @LIBXML_MIN_VERSION@
|
||||
LIBXSLT_CFLAGS = @LIBXSLT_CFLAGS@
|
||||
LIBXSLT_CONFIG = @LIBXSLT_CONFIG@
|
||||
LIBXSLT_CONFIG_PATH = @LIBXSLT_CONFIG_PATH@
|
||||
LIBXSLT_LIBS = @LIBXSLT_LIBS@
|
||||
LIBXSLT_MIN_VERSION = @LIBXSLT_MIN_VERSION@
|
||||
LIBXSLT_PC_FILE_COND = @LIBXSLT_PC_FILE_COND@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN2HTML = @MAN2HTML@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MOZILLA_MIN_VERSION = @MOZILLA_MIN_VERSION@
|
||||
MSCNG_CFLAGS = @MSCNG_CFLAGS@
|
||||
MSCNG_CRYPTO_LIB = @MSCNG_CRYPTO_LIB@
|
||||
MSCNG_LIBS = @MSCNG_LIBS@
|
||||
MSCRYPTO_CFLAGS = @MSCRYPTO_CFLAGS@
|
||||
MSCRYPTO_CRYPTO_LIB = @MSCRYPTO_CRYPTO_LIB@
|
||||
MSCRYPTO_LIBS = @MSCRYPTO_LIBS@
|
||||
MV = @MV@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
NSPR_CFLAGS = @NSPR_CFLAGS@
|
||||
NSPR_LIBS = @NSPR_LIBS@
|
||||
NSPR_MIN_VERSION = @NSPR_MIN_VERSION@
|
||||
NSPR_PACKAGE = @NSPR_PACKAGE@
|
||||
NSS_CFLAGS = @NSS_CFLAGS@
|
||||
NSS_CRYPTO_LIB = @NSS_CRYPTO_LIB@
|
||||
NSS_LIBS = @NSS_LIBS@
|
||||
NSS_MIN_VERSION = @NSS_MIN_VERSION@
|
||||
NSS_PACKAGE = @NSS_PACKAGE@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
|
||||
OPENSSL_CRYPTO_LIB = @OPENSSL_CRYPTO_LIB@
|
||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||
OPENSSL_MIN_VERSION = @OPENSSL_MIN_VERSION@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TAR = @TAR@
|
||||
VERSION = @VERSION@
|
||||
XMLSEC_APPS = @XMLSEC_APPS@
|
||||
XMLSEC_APP_DEFINES = @XMLSEC_APP_DEFINES@
|
||||
XMLSEC_CFLAGS = @XMLSEC_CFLAGS@
|
||||
XMLSEC_CORE_CFLAGS = @XMLSEC_CORE_CFLAGS@
|
||||
XMLSEC_CORE_LIBS = @XMLSEC_CORE_LIBS@
|
||||
XMLSEC_CRYPTO_CFLAGS = @XMLSEC_CRYPTO_CFLAGS@
|
||||
XMLSEC_CRYPTO_DISABLED_LIST = @XMLSEC_CRYPTO_DISABLED_LIST@
|
||||
XMLSEC_CRYPTO_EXTRA_LDFLAGS = @XMLSEC_CRYPTO_EXTRA_LDFLAGS@
|
||||
XMLSEC_CRYPTO_LIB = @XMLSEC_CRYPTO_LIB@
|
||||
XMLSEC_CRYPTO_LIBS = @XMLSEC_CRYPTO_LIBS@
|
||||
XMLSEC_CRYPTO_LIST = @XMLSEC_CRYPTO_LIST@
|
||||
XMLSEC_CRYPTO_PC_FILES_LIST = @XMLSEC_CRYPTO_PC_FILES_LIST@
|
||||
XMLSEC_DEFAULT_CRYPTO = @XMLSEC_DEFAULT_CRYPTO@
|
||||
XMLSEC_DEFINES = @XMLSEC_DEFINES@
|
||||
XMLSEC_DL_INCLUDES = @XMLSEC_DL_INCLUDES@
|
||||
XMLSEC_DL_LIBS = @XMLSEC_DL_LIBS@
|
||||
XMLSEC_DOCDIR = @XMLSEC_DOCDIR@
|
||||
XMLSEC_DOCS = @XMLSEC_DOCS@
|
||||
XMLSEC_EXTRA_LDFLAGS = @XMLSEC_EXTRA_LDFLAGS@
|
||||
XMLSEC_GCRYPT_CFLAGS = @XMLSEC_GCRYPT_CFLAGS@
|
||||
XMLSEC_GCRYPT_LIBS = @XMLSEC_GCRYPT_LIBS@
|
||||
XMLSEC_GNUTLS_CFLAGS = @XMLSEC_GNUTLS_CFLAGS@
|
||||
XMLSEC_GNUTLS_LIBS = @XMLSEC_GNUTLS_LIBS@
|
||||
XMLSEC_LIBDIR = @XMLSEC_LIBDIR@
|
||||
XMLSEC_LIBS = @XMLSEC_LIBS@
|
||||
XMLSEC_MANS = @XMLSEC_MANS@
|
||||
XMLSEC_NO_AES = @XMLSEC_NO_AES@
|
||||
XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_DES = @XMLSEC_NO_DES@
|
||||
XMLSEC_NO_DSA = @XMLSEC_NO_DSA@
|
||||
XMLSEC_NO_GCRYPT = @XMLSEC_NO_GCRYPT@
|
||||
XMLSEC_NO_GNUTLS = @XMLSEC_NO_GNUTLS@
|
||||
XMLSEC_NO_GOST = @XMLSEC_NO_GOST@
|
||||
XMLSEC_NO_GOST2012 = @XMLSEC_NO_GOST2012@
|
||||
XMLSEC_NO_HMAC = @XMLSEC_NO_HMAC@
|
||||
XMLSEC_NO_LIBXSLT = @XMLSEC_NO_LIBXSLT@
|
||||
XMLSEC_NO_MD5 = @XMLSEC_NO_MD5@
|
||||
XMLSEC_NO_MSCNG = @XMLSEC_NO_MSCNG@
|
||||
XMLSEC_NO_MSCRYPTO = @XMLSEC_NO_MSCRYPTO@
|
||||
XMLSEC_NO_NSS = @XMLSEC_NO_NSS@
|
||||
XMLSEC_NO_OPENSSL = @XMLSEC_NO_OPENSSL@
|
||||
XMLSEC_NO_RIPEMD160 = @XMLSEC_NO_RIPEMD160@
|
||||
XMLSEC_NO_RSA = @XMLSEC_NO_RSA@
|
||||
XMLSEC_NO_SHA1 = @XMLSEC_NO_SHA1@
|
||||
XMLSEC_NO_SHA224 = @XMLSEC_NO_SHA224@
|
||||
XMLSEC_NO_SHA256 = @XMLSEC_NO_SHA256@
|
||||
XMLSEC_NO_SHA384 = @XMLSEC_NO_SHA384@
|
||||
XMLSEC_NO_SHA512 = @XMLSEC_NO_SHA512@
|
||||
XMLSEC_NO_X509 = @XMLSEC_NO_X509@
|
||||
XMLSEC_NO_XMLDSIG = @XMLSEC_NO_XMLDSIG@
|
||||
XMLSEC_NO_XMLENC = @XMLSEC_NO_XMLENC@
|
||||
XMLSEC_NSS_CFLAGS = @XMLSEC_NSS_CFLAGS@
|
||||
XMLSEC_NSS_LIBS = @XMLSEC_NSS_LIBS@
|
||||
XMLSEC_OPENSSL_CFLAGS = @XMLSEC_OPENSSL_CFLAGS@
|
||||
XMLSEC_OPENSSL_LIBS = @XMLSEC_OPENSSL_LIBS@
|
||||
XMLSEC_PACKAGE = @XMLSEC_PACKAGE@
|
||||
XMLSEC_STATIC_BINARIES = @XMLSEC_STATIC_BINARIES@
|
||||
XMLSEC_VERSION = @XMLSEC_VERSION@
|
||||
XMLSEC_VERSION_INFO = @XMLSEC_VERSION_INFO@
|
||||
XMLSEC_VERSION_MAJOR = @XMLSEC_VERSION_MAJOR@
|
||||
XMLSEC_VERSION_MINOR = @XMLSEC_VERSION_MINOR@
|
||||
XMLSEC_VERSION_SAFE = @XMLSEC_VERSION_SAFE@
|
||||
XMLSEC_VERSION_SUBMINOR = @XMLSEC_VERSION_SUBMINOR@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
NULL =
|
||||
SUBDIRS = api
|
||||
TARGET_DIR = @XMLSEC_DOCDIR@
|
||||
EXTRA_DIST = \
|
||||
$(builddir)/images \
|
||||
$(builddir)/*.html \
|
||||
$(builddir)/*.ico \
|
||||
$(builddir)/xmlsec.xsl \
|
||||
$(builddir)/xmlsec-ga.xsl \
|
||||
$(NULL)
|
||||
|
||||
XMLSEC1_MAN = $(top_builddir)/man/xmlsec1.1
|
||||
XMLSEC_HTML = $(builddir)/xmlsec-man.html
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign docs/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-local \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-data-local
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-local
|
||||
|
||||
.MAKE: $(am__recursive_targets) install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \
|
||||
check-am clean clean-generic clean-libtool clean-local \
|
||||
cscopelist-am ctags ctags-am distclean distclean-generic \
|
||||
distclean-libtool distclean-local distclean-tags distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-data-local install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
installdirs-am maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am tags tags-am uninstall uninstall-am uninstall-local
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
all:
|
||||
@echo "======= Run 'make docs' in the xmlsec/docs folder to rebuild docs"
|
||||
|
||||
# docs is legacy
|
||||
docs: docs-copy man-docs docs-format
|
||||
|
||||
docs-copy:
|
||||
@( \
|
||||
echo "Copying docs..."; \
|
||||
if [ z"$(srcdir)" != z"$(builddir)" -a z"`uname`" != z"Darwin" ]; \
|
||||
then \
|
||||
$(CP) -ru $(srcdir)/*.html $(srcdir)/*.ico $(srcdir)/images $(builddir)/ ; \
|
||||
(chmod u+w $(builddir)/*.html || true) ; \
|
||||
(chmod u+w $(builddir)/*.ico || true) ; \
|
||||
(chmod -R u+w $(builddir)/images || true) ; \
|
||||
fi \
|
||||
)
|
||||
|
||||
# if we build docs then we also have xsltproc
|
||||
@BUILD_MAN_DOCS_TRUE@man-docs: $(XMLSEC_HTML) docs-copy
|
||||
|
||||
@BUILD_MAN_DOCS_TRUE@$(XMLSEC_HTML): docs-copy $(XMLSEC1_MAN)
|
||||
@BUILD_MAN_DOCS_TRUE@ $(MAN2HTML) $(XMLSEC1_MAN) | \
|
||||
@BUILD_MAN_DOCS_TRUE@ grep -v '^Content-type: text/html' | \
|
||||
@BUILD_MAN_DOCS_TRUE@ tr "[:cntrl:]" " " > \
|
||||
@BUILD_MAN_DOCS_TRUE@ $(XMLSEC_HTML)
|
||||
# do nothing, we aready copied this file
|
||||
@BUILD_MAN_DOCS_FALSE@man-docs:
|
||||
|
||||
@HAS_XSLTPROC_TRUE@docs-format:
|
||||
@HAS_XSLTPROC_TRUE@ @(echo "Formatting html documents"; \
|
||||
@HAS_XSLTPROC_TRUE@ for i in `find $(builddir) -name "*.html" -print`; \
|
||||
@HAS_XSLTPROC_TRUE@ do \
|
||||
@HAS_XSLTPROC_TRUE@ top_folder=`echo $$i | sed 's#/[^/]*$$#/#' | sed 's#\./##' | \
|
||||
@HAS_XSLTPROC_TRUE@ sed 's#[^/]*/#../#g'`; \
|
||||
@HAS_XSLTPROC_TRUE@ echo "Processing $$i (topfolder='$$top_folder')"; \
|
||||
@HAS_XSLTPROC_TRUE@ $(XSLTPROC) --html --stringparam topfolder "$$top_folder" \
|
||||
@HAS_XSLTPROC_TRUE@ --output $$i.tmp $(srcdir)/xmlsec.xsl $$i; \
|
||||
@HAS_XSLTPROC_TRUE@ if [ $$? != 0 ]; \
|
||||
@HAS_XSLTPROC_TRUE@ then \
|
||||
@HAS_XSLTPROC_TRUE@ echo "ERROR: processing file $$i"; \
|
||||
@HAS_XSLTPROC_TRUE@ exit 1; \
|
||||
@HAS_XSLTPROC_TRUE@ fi; \
|
||||
@HAS_XSLTPROC_TRUE@ mv $$i.tmp $$i; \
|
||||
@HAS_XSLTPROC_TRUE@ done)
|
||||
@HAS_XSLTPROC_TRUE@ @(echo "Cleaning html documents"; \
|
||||
@HAS_XSLTPROC_TRUE@ for i in `find $(builddir) -name "*.html" -print`; \
|
||||
@HAS_XSLTPROC_TRUE@ do \
|
||||
@HAS_XSLTPROC_TRUE@ echo Cleaning $$i ; \
|
||||
@HAS_XSLTPROC_TRUE@ sed 's/\xA0/ /g' $$i > $$i.tmp ; \
|
||||
@HAS_XSLTPROC_TRUE@ mv $$i.tmp $$i ; \
|
||||
@HAS_XSLTPROC_TRUE@ done)
|
||||
@HAS_XSLTPROC_TRUE@docs-format-ga:
|
||||
@HAS_XSLTPROC_TRUE@ @(echo "Formatting html documents to add Google Analytics"; \
|
||||
@HAS_XSLTPROC_TRUE@ for i in `find $(builddir) -name "*.html" -print`; \
|
||||
@HAS_XSLTPROC_TRUE@ do \
|
||||
@HAS_XSLTPROC_TRUE@ echo "Processing $$i"; \
|
||||
@HAS_XSLTPROC_TRUE@ $(XSLTPROC) --html --output $$i.tmp $(srcdir)/xmlsec-ga.xsl $$i; \
|
||||
@HAS_XSLTPROC_TRUE@ if [ $$? != 0 ]; \
|
||||
@HAS_XSLTPROC_TRUE@ then \
|
||||
@HAS_XSLTPROC_TRUE@ echo "ERROR: processing file $$i"; \
|
||||
@HAS_XSLTPROC_TRUE@ exit 1; \
|
||||
@HAS_XSLTPROC_TRUE@ fi; \
|
||||
@HAS_XSLTPROC_TRUE@ mv $$i.tmp $$i; \
|
||||
@HAS_XSLTPROC_TRUE@ done)
|
||||
# do nothing
|
||||
@HAS_XSLTPROC_FALSE@docs-format:
|
||||
|
||||
clean-local:
|
||||
-rm -f *.stamp
|
||||
( if [ z"$(srcdir)" != z"$(builddir)" ] ; then \
|
||||
(chmod -R u+w $(builddir)/images || true) && rm -rf $(builddir)/images ; \
|
||||
(chmod -R u+w $(builddir)/src || true) && rm -rf $(builddir)/src ; \
|
||||
(for i in `find $(builddir) -name "*.html" -print` ; do \
|
||||
echo "Removing files '$$i' ... " ; \
|
||||
chmod -R u+w $$i && rm -f $$i ; \
|
||||
done ) ; \
|
||||
(for i in `find $(builddir) -name "*.ico" -print` ; do \
|
||||
echo "Removing files '$$i' ... " ; \
|
||||
chmod -R u+w $$i && rm -f $$i ; \
|
||||
done ) ; \
|
||||
fi ; )
|
||||
|
||||
distclean-local: clean-local
|
||||
|
||||
install-data-local:
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/images
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/api
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/api/images
|
||||
-@INSTALL@ -m 0644 $(builddir)/*.html $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(builddir)/*.ico $(DESTDIR)$(TARGET_DIR)
|
||||
-@INSTALL@ -m 0644 $(builddir)/images/*.gif $(builddir)/images/*.png $(DESTDIR)$(TARGET_DIR)/images
|
||||
-@INSTALL@ -m 0644 $(builddir)/api/*.html $(builddir)/api/*.png $(builddir)/api/*.sgml $(DESTDIR)$(TARGET_DIR)/api
|
||||
-@INSTALL@ -m 0644 $(builddir)/api/images/*.png $(DESTDIR)$(TARGET_DIR)/api/images
|
||||
|
||||
uninstall-local:
|
||||
@rm -rf $(DESTDIR)$(TARGET_DIR)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -1,280 +0,0 @@
|
|||
#
|
||||
#
|
||||
#
|
||||
NULL=
|
||||
MODULE=xmlsec
|
||||
SOURCE_DIR=$(top_srcdir)/src
|
||||
SOURCE_DIR2=$(top_builddir)/src
|
||||
INCLUDE_DIR=$(top_srcdir)/include
|
||||
INCLUDE_DIR2=$(top_builddir)/include
|
||||
|
||||
|
||||
SCAN_DIR=$(builddir)
|
||||
SGML_DIR=$(builddir)/sgml.tmp
|
||||
EXAMPLES_DIR=$(SGML_DIR)/examples
|
||||
SOURCE_CODE_DIR=$(builddir)/code
|
||||
|
||||
GTKDOC_MKDB_OUTPUT_DIR=$(builddir)/xml
|
||||
|
||||
# We need to copy some files to make gkdoc happy that
|
||||
# everything is in one folder
|
||||
MAIN_SGML_FILE=$(SGML_DIR)/xmlsec.sgml
|
||||
MAIN_SGML_SRC_FILE=$(srcdir)/src/xmlsec.sgml
|
||||
|
||||
SGML_CHAPTERS_DIR=$(SGML_DIR)/chapters
|
||||
SGML_CHAPTERS_SRC_DIR=$(srcdir)/src/chapters
|
||||
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(srcdir)/src \
|
||||
$(srcdir)/images \
|
||||
$(srcdir)/style.css \
|
||||
$(NULL)
|
||||
|
||||
SOURCE_FILES_TO_COPY = \
|
||||
$(srcdir)/src \
|
||||
$(srcdir)/images \
|
||||
$(srcdir)/style.css \
|
||||
$(srcdir)/*.html \
|
||||
$(srcdir)/*.png \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LIBS_LIST = \
|
||||
openssl \
|
||||
nss \
|
||||
gnutls \
|
||||
gcrypt \
|
||||
mscrypto \
|
||||
mscng \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# We need to pre-process original source files
|
||||
# because gtkdoc does not understand some C features
|
||||
#
|
||||
SOURCE_CODE_FILES=\
|
||||
$(shell find $(SOURCE_DIR) -name '*.c' -print ) \
|
||||
$(shell find $(SOURCE_DIR2) -name '*.c' -print ) \
|
||||
$(shell find $(INCLUDE_DIR) -name '*.h' -a ! -name "symbols.h" -print ) \
|
||||
$(shell find $(INCLUDE_DIR2) -name '*.h' -a ! -name "symbols.h" -print )
|
||||
|
||||
EXAMPLES_SOURCE_DIR=$(top_srcdir)/examples
|
||||
EXAMPLES_SOURCE_FILES=\
|
||||
$(shell find $(EXAMPLES_SOURCE_DIR) -name '*.c' -print) \
|
||||
$(shell find $(EXAMPLES_SOURCE_DIR) -name '*.xml' -print)
|
||||
|
||||
#
|
||||
# This script removes gtkdoc crap from final html
|
||||
#
|
||||
REMOVE_GTKDOCLINK=$(top_srcdir)/scripts/remove-gtkdoclink.pl
|
||||
|
||||
# docs is legacy
|
||||
all: docs
|
||||
|
||||
|
||||
# if build API docs, then we also have xsltproc
|
||||
if BUILD_API_DOCS
|
||||
docs: html-cleanup
|
||||
|
||||
else
|
||||
docs:
|
||||
@( \
|
||||
echo "Copying api-docs..."; \
|
||||
if [ z"$(srcdir)" != z"$(builddir)" -a z"`uname`" != z"Darwin" ]; \
|
||||
then \
|
||||
$(CP) -ru $(SOURCE_FILES_TO_COPY) $(builddir)/ ; \
|
||||
fi \
|
||||
)
|
||||
endif
|
||||
|
||||
html-cleanup: html
|
||||
@( echo "Cleaning up result files"; \
|
||||
$(PERL) $(REMOVE_GTKDOCLINK) `find . -name "*.html" -print` \
|
||||
)
|
||||
|
||||
# need to cleanup "bad" chars
|
||||
html: sgml $(MAIN_SGML_FILE) $(SGML_CHAPTERS_DIR) xmlsec-index
|
||||
$(GTKDOC_MKHTML) xmlsec $(MAIN_SGML_FILE)
|
||||
|
||||
$(SGML_CHAPTERS_DIR): $(SGML_CHAPTERS_SRC_DIR) $(SGML_CHAPTERS_DIR)/.sentinel
|
||||
$(CP) -ru $(SGML_CHAPTERS_SRC_DIR)/* $(SGML_CHAPTERS_DIR)
|
||||
|
||||
$(MAIN_SGML_FILE): $(MAIN_SGML_SRC_FILE)
|
||||
$(CP) -u $(MAIN_SGML_SRC_FILE) $(MAIN_SGML_FILE)
|
||||
#
|
||||
# Prepeare sgml files from sources for each library. We are also
|
||||
# doing some "magic" here by automatically adding links to XML DSig and
|
||||
# XML Enc specification, we also remove "Ptr" from the end of the link
|
||||
# targets to make more references.
|
||||
#
|
||||
# We also fix a bunch of stupid errors from gtkdoc
|
||||
#
|
||||
sgml: sgml-base
|
||||
(for i in `find $(SGML_DIR) -name "*.sgml" -or -name "*.xml" -print` ; do \
|
||||
echo "Fixing up '$$i'" ; \
|
||||
cat $$i | \
|
||||
sed 's!\(<dsig:\)\([^/]*\)\(\/>\)!\<dsig:\2\/\>!g' | \
|
||||
sed 's!\(<enc:\)\([^/]*\)\(\/>\)!\<enc:\2\/\>!g' | \
|
||||
sed 's!\(<dsig:\)\(\w*\)\(>\)!\<dsig:\2\/\>!g' | \
|
||||
sed 's!\(<enc:\)\(\w*\)\(>\)!\<enc:\2\/\>!g' | \
|
||||
sed 's!\(<dsig:\)\([^/]*\)\(\/>\)!<ulink URL=\"http://www.w3.org/TR/xmldsig-core/#sec-\2\">\1\2\3</ulink>!g' | \
|
||||
sed 's!\(<enc:\)\([^/]*\)\(\/>\)!<ulink URL=\"http://www.w3.org/TR/xmlenc-core/#sec-\2\">\1\2\3</ulink>!g' | \
|
||||
sed 's!<para \/>!<para></para>!g' | \
|
||||
sed 's!linkend=\"\(.*\)Ptr\"!linkend=\"\1\"!g' | \
|
||||
sed 's!<colspec [^/]*\/>!!g' | \
|
||||
sed 's!<programlisting language="C"!<programlisting!g' | \
|
||||
sed 's!\%gtkdocentities;!!g' | \
|
||||
$(PERL) -pe 's!title>\n!title>!g' | \
|
||||
$(PERL) -pe 's!title>\n!title>!g' | \
|
||||
$(PERL) -pe 's!<\/title><\/refsect1>\n!<\/title><para><\/para><\/refsect1>!g' | \
|
||||
$(PERL) -pe 's!para>\n!para>!g' > \
|
||||
$$i.tmp; \
|
||||
mv -f $$i.tmp $$i; \
|
||||
done);
|
||||
|
||||
# gtkdoc-mkdb doesn't support --output-dir thus we have to "hack" it a litle bit
|
||||
sgml-base: scan $(SGML_DIR)/.sentinel
|
||||
@( \
|
||||
echo "Create DocBook files for xmlsec-core" ; \
|
||||
rm -rf $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/base ; \
|
||||
$(GTKDOC_MKDB) --module=xmlsec \
|
||||
--xml-mode \
|
||||
--main-sgml-file=$(SGML_DIR)/xmlsec-base.sgml \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/base \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/base ; \
|
||||
mv $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/base ; \
|
||||
);
|
||||
@(for i in $(CRYPTO_LIBS_LIST) ; do \
|
||||
echo "Create DocBook files for xmlsec-$$i" ; \
|
||||
rm -rf $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/$$i ; \
|
||||
$(GTKDOC_MKDB) --module=xmlsec-$$i \
|
||||
--xml-mode \
|
||||
--main-sgml-file=$(SGML_DIR)/xmlsec-$$i.sgml \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/$$i \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/$$i ; \
|
||||
mv $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/$$i ; \
|
||||
done);
|
||||
|
||||
scan: SOURCE_CODEs example_sources
|
||||
@( \
|
||||
echo "Scanning source code for xmlsec-core" ; \
|
||||
$(GTKDOC_SCAN) --module=xmlsec \
|
||||
--rebuild-sections \
|
||||
--output-dir=$(SCAN_DIR) \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/base \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/base ; \
|
||||
);
|
||||
@(for i in $(CRYPTO_LIBS_LIST) ; do \
|
||||
echo "Scanning source code for xmlsec-$$i" ; \
|
||||
$(GTKDOC_SCAN) --module=xmlsec-$$i \
|
||||
--rebuild-sections \
|
||||
--output-dir=$(SCAN_DIR) \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/$$i \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/$$i ; \
|
||||
done);
|
||||
|
||||
#
|
||||
# Prepare source files by coping them to "code" folder and
|
||||
# removing XMLSEC_EXPORT_* stuff that makes gtkdoc crazy
|
||||
#
|
||||
SOURCE_CODEs: $(SOURCE_CODE_FILES) $(SOURCE_CODE_DIR)/.sentinel SOURCE_CODEs_cleanup
|
||||
@echo "Preprocessing source files into '$(SOURCE_CODE_DIR)' ..."
|
||||
@mkdir -p $(SOURCE_CODE_DIR)/src/base $(SOURCE_CODE_DIR)/include/xmlsec/base
|
||||
@( \
|
||||
for i in $(SOURCE_CODE_FILES) ; do \
|
||||
folder_name=`echo "$$i" | \
|
||||
sed 's#$(top_srcdir)/##' | \
|
||||
sed 's#$(top_builddir)/##' | \
|
||||
sed 's#/[^/]*$$##'`; \
|
||||
file_name=`echo "$$i" | \
|
||||
sed 's#.*/##'`; \
|
||||
mkdir -p "$(SOURCE_CODE_DIR)/$$folder_name"; \
|
||||
cat "$$i" | \
|
||||
sed 's/#if.*//' | \
|
||||
sed 's/#el.*//' | \
|
||||
sed 's/#end.*//' | \
|
||||
sed 's/XMLSEC_CRYPTO_EXPORT//' | \
|
||||
sed 's/XMLSEC_EXPORT_VAR//' | \
|
||||
sed 's/XMLSEC_EXPORT//' | \
|
||||
sed 's/XMLSEC_ERRORS_PRINTF_ATTRIBUTE//' > \
|
||||
$(SOURCE_CODE_DIR)/$$folder_name/$$file_name; \
|
||||
done);
|
||||
-@mv -f $(SOURCE_CODE_DIR)/src/*.c $(SOURCE_CODE_DIR)/src/base
|
||||
-@mv -f $(SOURCE_CODE_DIR)/include/xmlsec/*.h $(SOURCE_CODE_DIR)/include/xmlsec/base
|
||||
-@rm -f $(SOURCE_CODE_DIR)/include/xmlsec/*/symbols.h
|
||||
|
||||
SOURCE_CODEs_cleanup: $(SOURCE_CODE_DIR)/.sentinel
|
||||
@rm -rf $(SOURCE_CODE_DIR)/*
|
||||
|
||||
#
|
||||
# Create index for all functions. For macros and defines need to add -CAPS suffix
|
||||
#
|
||||
xmlsec-index: scan $(SGML_DIR)/.sentinel
|
||||
@grep -h '<NAME>.*</NAME>' $(SCAN_DIR)/xmlsec-*decl.txt | \
|
||||
grep -v '<NAME>extern</NAME>' | \
|
||||
sort -u | \
|
||||
sed 's#_#-#g' | \
|
||||
sed 's#<NAME>\([^-]*\)-\([^<]*\)</NAME>#<listitem><para><link linkend=\"\1-\2-CAPS\">\1-\2</link></para></listitem>#g' | \
|
||||
sed 's#<NAME>\([^<]*\)</NAME>#<listitem><para><link linkend=\"\1\">\1</link></para></listitem>#g' > \
|
||||
$(SGML_DIR)/xmlsec-index.sgml
|
||||
|
||||
#
|
||||
# The following code converts C example file to sgml RefEntry files.
|
||||
# We get file title from a string "XML Security Library example: ..."
|
||||
# which is usually placed at the top of the file. Also all "unsafe" xml
|
||||
# characters (<, >, &) are escaped.
|
||||
#
|
||||
example_sources: $(EXAMPLES_DIR)/.sentinel
|
||||
@echo "Preprocessing example source files into '$(EXAMPLES_DIR)' ..."
|
||||
@rm -rf $(EXAMPLES_DIR)/*
|
||||
@(for i in $(EXAMPLES_SOURCE_FILES) ; do \
|
||||
file_name=`echo $$i | sed 's#.*/##' | sed 's#\..*$$##'`; \
|
||||
file_ext=`echo $$i | sed 's#.*/##' | sed 's#.*\.##'`; \
|
||||
echo Converting $$file_name.$$file_ext to $$file_name.sgml ...; \
|
||||
file_title=`cat $$i | grep 'XML Security Library example: ' | sed 's#^.*: *##'`; \
|
||||
echo "<sect2 id=\"xmlsec-example-$$file_name\" >" > \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
echo "<title>$$file_name.$$file_ext</title><para><informalexample><programlisting>" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
cat $$i | \
|
||||
sed "s#&#\&#g" | \
|
||||
sed "s#<#\<#g" | \
|
||||
sed "s#>#\>#g" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
echo "</programlisting></informalexample></para></sect2>" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
done);
|
||||
|
||||
# A single pattern rule will create all appropriate folders as required
|
||||
# otherwise make (annoyingly) deletes it
|
||||
.PRECIOUS: %/.sentinel
|
||||
%/.sentinel:
|
||||
@echo "Creating folder '${@D}' ..."
|
||||
mkdir -p ${@D}
|
||||
touch $@
|
||||
|
||||
dist-hook:
|
||||
@cp -p $(srcdir)/*.html $(srcdir)/*.png $(distdir)/
|
||||
(for i in `find $(distdir) -name ".sentinel" -print` ; do \
|
||||
echo "Removing some files '$$i' before dist ... " ; \
|
||||
rm $$i ; \
|
||||
done )
|
||||
(for i in `find $(distdir) -name "*.sgml.bak" -print` ; do \
|
||||
echo "Removing some files '$$i' before dist ... " ; \
|
||||
rm "$$i" ; \
|
||||
done ; )
|
||||
|
||||
clean-local:
|
||||
-rm -rf $(SOURCE_CODE_DIR) $(EXAMPLES_DIR) $(SCAN_DIR)/*.txt $(SGML_DIR) $(GTKDOC_MKDB_OUTPUT_DIR)
|
||||
-rm -f *.stamp *.types index.sgml
|
||||
@( if [ z"$(builddir)" != z"$(srcdir)" ] ; then \
|
||||
(chmod -R u+w $(builddir)/src || true) && rm -rf $(builddir)/src ; \
|
||||
(chmod -R u+w $(builddir)/images || true) && rm -rf $(builddir)/images ; \
|
||||
(chmod -R u+w $(builddir)/*.png || true) && rm -rf $(builddir)/*.png ; \
|
||||
fi ; )
|
||||
|
||||
distclean-local: clean-local
|
||||
|
||||
maintainer-clean-local: clean-local
|
||||
-rm -f *.html
|
||||
|
|
@ -1,829 +0,0 @@
|
|||
# Makefile.in generated by automake 1.15.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2017 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = docs/api
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CP = @CP@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GCRYPT_CFLAGS = @GCRYPT_CFLAGS@
|
||||
GCRYPT_CONFIG_PATH = @GCRYPT_CONFIG_PATH@
|
||||
GCRYPT_CRYPTO_LIB = @GCRYPT_CRYPTO_LIB@
|
||||
GCRYPT_LIBS = @GCRYPT_LIBS@
|
||||
GCRYPT_MIN_VERSION = @GCRYPT_MIN_VERSION@
|
||||
GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
|
||||
GNUTLS_CRYPTO_LIB = @GNUTLS_CRYPTO_LIB@
|
||||
GNUTLS_LIBS = @GNUTLS_LIBS@
|
||||
GNUTLS_MIN_VERSION = @GNUTLS_MIN_VERSION@
|
||||
GREP = @GREP@
|
||||
GTKDOC_MKDB = @GTKDOC_MKDB@
|
||||
GTKDOC_MKHTML = @GTKDOC_MKHTML@
|
||||
GTKDOC_SCAN = @GTKDOC_SCAN@
|
||||
HELP2MAN = @HELP2MAN@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBXML_CFLAGS = @LIBXML_CFLAGS@
|
||||
LIBXML_CONFIG = @LIBXML_CONFIG@
|
||||
LIBXML_CONFIG_PATH = @LIBXML_CONFIG_PATH@
|
||||
LIBXML_LIBS = @LIBXML_LIBS@
|
||||
LIBXML_MIN_VERSION = @LIBXML_MIN_VERSION@
|
||||
LIBXSLT_CFLAGS = @LIBXSLT_CFLAGS@
|
||||
LIBXSLT_CONFIG = @LIBXSLT_CONFIG@
|
||||
LIBXSLT_CONFIG_PATH = @LIBXSLT_CONFIG_PATH@
|
||||
LIBXSLT_LIBS = @LIBXSLT_LIBS@
|
||||
LIBXSLT_MIN_VERSION = @LIBXSLT_MIN_VERSION@
|
||||
LIBXSLT_PC_FILE_COND = @LIBXSLT_PC_FILE_COND@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MAN2HTML = @MAN2HTML@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
MOZILLA_MIN_VERSION = @MOZILLA_MIN_VERSION@
|
||||
MSCNG_CFLAGS = @MSCNG_CFLAGS@
|
||||
MSCNG_CRYPTO_LIB = @MSCNG_CRYPTO_LIB@
|
||||
MSCNG_LIBS = @MSCNG_LIBS@
|
||||
MSCRYPTO_CFLAGS = @MSCRYPTO_CFLAGS@
|
||||
MSCRYPTO_CRYPTO_LIB = @MSCRYPTO_CRYPTO_LIB@
|
||||
MSCRYPTO_LIBS = @MSCRYPTO_LIBS@
|
||||
MV = @MV@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
NSPR_CFLAGS = @NSPR_CFLAGS@
|
||||
NSPR_LIBS = @NSPR_LIBS@
|
||||
NSPR_MIN_VERSION = @NSPR_MIN_VERSION@
|
||||
NSPR_PACKAGE = @NSPR_PACKAGE@
|
||||
NSS_CFLAGS = @NSS_CFLAGS@
|
||||
NSS_CRYPTO_LIB = @NSS_CRYPTO_LIB@
|
||||
NSS_LIBS = @NSS_LIBS@
|
||||
NSS_MIN_VERSION = @NSS_MIN_VERSION@
|
||||
NSS_PACKAGE = @NSS_PACKAGE@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
|
||||
OPENSSL_CRYPTO_LIB = @OPENSSL_CRYPTO_LIB@
|
||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||
OPENSSL_MIN_VERSION = @OPENSSL_MIN_VERSION@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
PERL = @PERL@
|
||||
PKG_CONFIG = @PKG_CONFIG@
|
||||
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
|
||||
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
|
||||
RANLIB = @RANLIB@
|
||||
RM = @RM@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
TAR = @TAR@
|
||||
VERSION = @VERSION@
|
||||
XMLSEC_APPS = @XMLSEC_APPS@
|
||||
XMLSEC_APP_DEFINES = @XMLSEC_APP_DEFINES@
|
||||
XMLSEC_CFLAGS = @XMLSEC_CFLAGS@
|
||||
XMLSEC_CORE_CFLAGS = @XMLSEC_CORE_CFLAGS@
|
||||
XMLSEC_CORE_LIBS = @XMLSEC_CORE_LIBS@
|
||||
XMLSEC_CRYPTO_CFLAGS = @XMLSEC_CRYPTO_CFLAGS@
|
||||
XMLSEC_CRYPTO_DISABLED_LIST = @XMLSEC_CRYPTO_DISABLED_LIST@
|
||||
XMLSEC_CRYPTO_EXTRA_LDFLAGS = @XMLSEC_CRYPTO_EXTRA_LDFLAGS@
|
||||
XMLSEC_CRYPTO_LIB = @XMLSEC_CRYPTO_LIB@
|
||||
XMLSEC_CRYPTO_LIBS = @XMLSEC_CRYPTO_LIBS@
|
||||
XMLSEC_CRYPTO_LIST = @XMLSEC_CRYPTO_LIST@
|
||||
XMLSEC_CRYPTO_PC_FILES_LIST = @XMLSEC_CRYPTO_PC_FILES_LIST@
|
||||
XMLSEC_DEFAULT_CRYPTO = @XMLSEC_DEFAULT_CRYPTO@
|
||||
XMLSEC_DEFINES = @XMLSEC_DEFINES@
|
||||
XMLSEC_DL_INCLUDES = @XMLSEC_DL_INCLUDES@
|
||||
XMLSEC_DL_LIBS = @XMLSEC_DL_LIBS@
|
||||
XMLSEC_DOCDIR = @XMLSEC_DOCDIR@
|
||||
XMLSEC_DOCS = @XMLSEC_DOCS@
|
||||
XMLSEC_EXTRA_LDFLAGS = @XMLSEC_EXTRA_LDFLAGS@
|
||||
XMLSEC_GCRYPT_CFLAGS = @XMLSEC_GCRYPT_CFLAGS@
|
||||
XMLSEC_GCRYPT_LIBS = @XMLSEC_GCRYPT_LIBS@
|
||||
XMLSEC_GNUTLS_CFLAGS = @XMLSEC_GNUTLS_CFLAGS@
|
||||
XMLSEC_GNUTLS_LIBS = @XMLSEC_GNUTLS_LIBS@
|
||||
XMLSEC_LIBDIR = @XMLSEC_LIBDIR@
|
||||
XMLSEC_LIBS = @XMLSEC_LIBS@
|
||||
XMLSEC_MANS = @XMLSEC_MANS@
|
||||
XMLSEC_NO_AES = @XMLSEC_NO_AES@
|
||||
XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_APPS_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_CRYPTO_DYNAMIC_LOADING = @XMLSEC_NO_CRYPTO_DYNAMIC_LOADING@
|
||||
XMLSEC_NO_DES = @XMLSEC_NO_DES@
|
||||
XMLSEC_NO_DSA = @XMLSEC_NO_DSA@
|
||||
XMLSEC_NO_GCRYPT = @XMLSEC_NO_GCRYPT@
|
||||
XMLSEC_NO_GNUTLS = @XMLSEC_NO_GNUTLS@
|
||||
XMLSEC_NO_GOST = @XMLSEC_NO_GOST@
|
||||
XMLSEC_NO_GOST2012 = @XMLSEC_NO_GOST2012@
|
||||
XMLSEC_NO_HMAC = @XMLSEC_NO_HMAC@
|
||||
XMLSEC_NO_LIBXSLT = @XMLSEC_NO_LIBXSLT@
|
||||
XMLSEC_NO_MD5 = @XMLSEC_NO_MD5@
|
||||
XMLSEC_NO_MSCNG = @XMLSEC_NO_MSCNG@
|
||||
XMLSEC_NO_MSCRYPTO = @XMLSEC_NO_MSCRYPTO@
|
||||
XMLSEC_NO_NSS = @XMLSEC_NO_NSS@
|
||||
XMLSEC_NO_OPENSSL = @XMLSEC_NO_OPENSSL@
|
||||
XMLSEC_NO_RIPEMD160 = @XMLSEC_NO_RIPEMD160@
|
||||
XMLSEC_NO_RSA = @XMLSEC_NO_RSA@
|
||||
XMLSEC_NO_SHA1 = @XMLSEC_NO_SHA1@
|
||||
XMLSEC_NO_SHA224 = @XMLSEC_NO_SHA224@
|
||||
XMLSEC_NO_SHA256 = @XMLSEC_NO_SHA256@
|
||||
XMLSEC_NO_SHA384 = @XMLSEC_NO_SHA384@
|
||||
XMLSEC_NO_SHA512 = @XMLSEC_NO_SHA512@
|
||||
XMLSEC_NO_X509 = @XMLSEC_NO_X509@
|
||||
XMLSEC_NO_XMLDSIG = @XMLSEC_NO_XMLDSIG@
|
||||
XMLSEC_NO_XMLENC = @XMLSEC_NO_XMLENC@
|
||||
XMLSEC_NSS_CFLAGS = @XMLSEC_NSS_CFLAGS@
|
||||
XMLSEC_NSS_LIBS = @XMLSEC_NSS_LIBS@
|
||||
XMLSEC_OPENSSL_CFLAGS = @XMLSEC_OPENSSL_CFLAGS@
|
||||
XMLSEC_OPENSSL_LIBS = @XMLSEC_OPENSSL_LIBS@
|
||||
XMLSEC_PACKAGE = @XMLSEC_PACKAGE@
|
||||
XMLSEC_STATIC_BINARIES = @XMLSEC_STATIC_BINARIES@
|
||||
XMLSEC_VERSION = @XMLSEC_VERSION@
|
||||
XMLSEC_VERSION_INFO = @XMLSEC_VERSION_INFO@
|
||||
XMLSEC_VERSION_MAJOR = @XMLSEC_VERSION_MAJOR@
|
||||
XMLSEC_VERSION_MINOR = @XMLSEC_VERSION_MINOR@
|
||||
XMLSEC_VERSION_SAFE = @XMLSEC_VERSION_SAFE@
|
||||
XMLSEC_VERSION_SUBMINOR = @XMLSEC_VERSION_SUBMINOR@
|
||||
XSLTPROC = @XSLTPROC@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
runstatedir = @runstatedir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
NULL =
|
||||
MODULE = xmlsec
|
||||
SOURCE_DIR = $(top_srcdir)/src
|
||||
SOURCE_DIR2 = $(top_builddir)/src
|
||||
INCLUDE_DIR = $(top_srcdir)/include
|
||||
INCLUDE_DIR2 = $(top_builddir)/include
|
||||
SCAN_DIR = $(builddir)
|
||||
SGML_DIR = $(builddir)/sgml.tmp
|
||||
EXAMPLES_DIR = $(SGML_DIR)/examples
|
||||
SOURCE_CODE_DIR = $(builddir)/code
|
||||
GTKDOC_MKDB_OUTPUT_DIR = $(builddir)/xml
|
||||
|
||||
# We need to copy some files to make gkdoc happy that
|
||||
# everything is in one folder
|
||||
MAIN_SGML_FILE = $(SGML_DIR)/xmlsec.sgml
|
||||
MAIN_SGML_SRC_FILE = $(srcdir)/src/xmlsec.sgml
|
||||
SGML_CHAPTERS_DIR = $(SGML_DIR)/chapters
|
||||
SGML_CHAPTERS_SRC_DIR = $(srcdir)/src/chapters
|
||||
EXTRA_DIST = \
|
||||
$(srcdir)/src \
|
||||
$(srcdir)/images \
|
||||
$(srcdir)/style.css \
|
||||
$(NULL)
|
||||
|
||||
SOURCE_FILES_TO_COPY = \
|
||||
$(srcdir)/src \
|
||||
$(srcdir)/images \
|
||||
$(srcdir)/style.css \
|
||||
$(srcdir)/*.html \
|
||||
$(srcdir)/*.png \
|
||||
$(NULL)
|
||||
|
||||
CRYPTO_LIBS_LIST = \
|
||||
openssl \
|
||||
nss \
|
||||
gnutls \
|
||||
gcrypt \
|
||||
mscrypto \
|
||||
mscng \
|
||||
$(NULL)
|
||||
|
||||
|
||||
#
|
||||
# We need to pre-process original source files
|
||||
# because gtkdoc does not understand some C features
|
||||
#
|
||||
SOURCE_CODE_FILES = \
|
||||
$(shell find $(SOURCE_DIR) -name '*.c' -print ) \
|
||||
$(shell find $(SOURCE_DIR2) -name '*.c' -print ) \
|
||||
$(shell find $(INCLUDE_DIR) -name '*.h' -a ! -name "symbols.h" -print ) \
|
||||
$(shell find $(INCLUDE_DIR2) -name '*.h' -a ! -name "symbols.h" -print )
|
||||
|
||||
EXAMPLES_SOURCE_DIR = $(top_srcdir)/examples
|
||||
EXAMPLES_SOURCE_FILES = \
|
||||
$(shell find $(EXAMPLES_SOURCE_DIR) -name '*.c' -print) \
|
||||
$(shell find $(EXAMPLES_SOURCE_DIR) -name '*.xml' -print)
|
||||
|
||||
|
||||
#
|
||||
# This script removes gtkdoc crap from final html
|
||||
#
|
||||
REMOVE_GTKDOCLINK = $(top_srcdir)/scripts/remove-gtkdoclink.pl
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/api/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --foreign docs/api/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-local mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-local
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic \
|
||||
maintainer-clean-local
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
clean-local cscopelist-am ctags-am dist-hook distclean \
|
||||
distclean-generic distclean-libtool distclean-local distdir \
|
||||
dvi dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic maintainer-clean-local mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# docs is legacy
|
||||
all: docs
|
||||
|
||||
# if build API docs, then we also have xsltproc
|
||||
@BUILD_API_DOCS_TRUE@docs: html-cleanup
|
||||
|
||||
@BUILD_API_DOCS_FALSE@docs:
|
||||
@BUILD_API_DOCS_FALSE@ @( \
|
||||
@BUILD_API_DOCS_FALSE@ echo "Copying api-docs..."; \
|
||||
@BUILD_API_DOCS_FALSE@ if [ z"$(srcdir)" != z"$(builddir)" -a z"`uname`" != z"Darwin" ]; \
|
||||
@BUILD_API_DOCS_FALSE@ then \
|
||||
@BUILD_API_DOCS_FALSE@ $(CP) -ru $(SOURCE_FILES_TO_COPY) $(builddir)/ ; \
|
||||
@BUILD_API_DOCS_FALSE@ fi \
|
||||
@BUILD_API_DOCS_FALSE@ )
|
||||
|
||||
html-cleanup: html
|
||||
@( echo "Cleaning up result files"; \
|
||||
$(PERL) $(REMOVE_GTKDOCLINK) `find . -name "*.html" -print` \
|
||||
)
|
||||
|
||||
# need to cleanup "bad" chars
|
||||
html: sgml $(MAIN_SGML_FILE) $(SGML_CHAPTERS_DIR) xmlsec-index
|
||||
$(GTKDOC_MKHTML) xmlsec $(MAIN_SGML_FILE)
|
||||
|
||||
$(SGML_CHAPTERS_DIR): $(SGML_CHAPTERS_SRC_DIR) $(SGML_CHAPTERS_DIR)/.sentinel
|
||||
$(CP) -ru $(SGML_CHAPTERS_SRC_DIR)/* $(SGML_CHAPTERS_DIR)
|
||||
|
||||
$(MAIN_SGML_FILE): $(MAIN_SGML_SRC_FILE)
|
||||
$(CP) -u $(MAIN_SGML_SRC_FILE) $(MAIN_SGML_FILE)
|
||||
#
|
||||
# Prepeare sgml files from sources for each library. We are also
|
||||
# doing some "magic" here by automatically adding links to XML DSig and
|
||||
# XML Enc specification, we also remove "Ptr" from the end of the link
|
||||
# targets to make more references.
|
||||
#
|
||||
# We also fix a bunch of stupid errors from gtkdoc
|
||||
#
|
||||
sgml: sgml-base
|
||||
(for i in `find $(SGML_DIR) -name "*.sgml" -or -name "*.xml" -print` ; do \
|
||||
echo "Fixing up '$$i'" ; \
|
||||
cat $$i | \
|
||||
sed 's!\(<dsig:\)\([^/]*\)\(\/>\)!\<dsig:\2\/\>!g' | \
|
||||
sed 's!\(<enc:\)\([^/]*\)\(\/>\)!\<enc:\2\/\>!g' | \
|
||||
sed 's!\(<dsig:\)\(\w*\)\(>\)!\<dsig:\2\/\>!g' | \
|
||||
sed 's!\(<enc:\)\(\w*\)\(>\)!\<enc:\2\/\>!g' | \
|
||||
sed 's!\(<dsig:\)\([^/]*\)\(\/>\)!<ulink URL=\"http://www.w3.org/TR/xmldsig-core/#sec-\2\">\1\2\3</ulink>!g' | \
|
||||
sed 's!\(<enc:\)\([^/]*\)\(\/>\)!<ulink URL=\"http://www.w3.org/TR/xmlenc-core/#sec-\2\">\1\2\3</ulink>!g' | \
|
||||
sed 's!<para \/>!<para></para>!g' | \
|
||||
sed 's!linkend=\"\(.*\)Ptr\"!linkend=\"\1\"!g' | \
|
||||
sed 's!<colspec [^/]*\/>!!g' | \
|
||||
sed 's!<programlisting language="C"!<programlisting!g' | \
|
||||
sed 's!\%gtkdocentities;!!g' | \
|
||||
$(PERL) -pe 's!title>\n!title>!g' | \
|
||||
$(PERL) -pe 's!title>\n!title>!g' | \
|
||||
$(PERL) -pe 's!<\/title><\/refsect1>\n!<\/title><para><\/para><\/refsect1>!g' | \
|
||||
$(PERL) -pe 's!para>\n!para>!g' > \
|
||||
$$i.tmp; \
|
||||
mv -f $$i.tmp $$i; \
|
||||
done);
|
||||
|
||||
# gtkdoc-mkdb doesn't support --output-dir thus we have to "hack" it a litle bit
|
||||
sgml-base: scan $(SGML_DIR)/.sentinel
|
||||
@( \
|
||||
echo "Create DocBook files for xmlsec-core" ; \
|
||||
rm -rf $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/base ; \
|
||||
$(GTKDOC_MKDB) --module=xmlsec \
|
||||
--xml-mode \
|
||||
--main-sgml-file=$(SGML_DIR)/xmlsec-base.sgml \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/base \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/base ; \
|
||||
mv $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/base ; \
|
||||
);
|
||||
@(for i in $(CRYPTO_LIBS_LIST) ; do \
|
||||
echo "Create DocBook files for xmlsec-$$i" ; \
|
||||
rm -rf $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/$$i ; \
|
||||
$(GTKDOC_MKDB) --module=xmlsec-$$i \
|
||||
--xml-mode \
|
||||
--main-sgml-file=$(SGML_DIR)/xmlsec-$$i.sgml \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/$$i \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/$$i ; \
|
||||
mv $(GTKDOC_MKDB_OUTPUT_DIR) $(SGML_DIR)/$$i ; \
|
||||
done);
|
||||
|
||||
scan: SOURCE_CODEs example_sources
|
||||
@( \
|
||||
echo "Scanning source code for xmlsec-core" ; \
|
||||
$(GTKDOC_SCAN) --module=xmlsec \
|
||||
--rebuild-sections \
|
||||
--output-dir=$(SCAN_DIR) \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/base \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/base ; \
|
||||
);
|
||||
@(for i in $(CRYPTO_LIBS_LIST) ; do \
|
||||
echo "Scanning source code for xmlsec-$$i" ; \
|
||||
$(GTKDOC_SCAN) --module=xmlsec-$$i \
|
||||
--rebuild-sections \
|
||||
--output-dir=$(SCAN_DIR) \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/src/$$i \
|
||||
--source-dir=$(SOURCE_CODE_DIR)/include/xmlsec/$$i ; \
|
||||
done);
|
||||
|
||||
#
|
||||
# Prepare source files by coping them to "code" folder and
|
||||
# removing XMLSEC_EXPORT_* stuff that makes gtkdoc crazy
|
||||
#
|
||||
SOURCE_CODEs: $(SOURCE_CODE_FILES) $(SOURCE_CODE_DIR)/.sentinel SOURCE_CODEs_cleanup
|
||||
@echo "Preprocessing source files into '$(SOURCE_CODE_DIR)' ..."
|
||||
@mkdir -p $(SOURCE_CODE_DIR)/src/base $(SOURCE_CODE_DIR)/include/xmlsec/base
|
||||
@( \
|
||||
for i in $(SOURCE_CODE_FILES) ; do \
|
||||
folder_name=`echo "$$i" | \
|
||||
sed 's#$(top_srcdir)/##' | \
|
||||
sed 's#$(top_builddir)/##' | \
|
||||
sed 's#/[^/]*$$##'`; \
|
||||
file_name=`echo "$$i" | \
|
||||
sed 's#.*/##'`; \
|
||||
mkdir -p "$(SOURCE_CODE_DIR)/$$folder_name"; \
|
||||
cat "$$i" | \
|
||||
sed 's/#if.*//' | \
|
||||
sed 's/#el.*//' | \
|
||||
sed 's/#end.*//' | \
|
||||
sed 's/XMLSEC_CRYPTO_EXPORT//' | \
|
||||
sed 's/XMLSEC_EXPORT_VAR//' | \
|
||||
sed 's/XMLSEC_EXPORT//' | \
|
||||
sed 's/XMLSEC_ERRORS_PRINTF_ATTRIBUTE//' > \
|
||||
$(SOURCE_CODE_DIR)/$$folder_name/$$file_name; \
|
||||
done);
|
||||
-@mv -f $(SOURCE_CODE_DIR)/src/*.c $(SOURCE_CODE_DIR)/src/base
|
||||
-@mv -f $(SOURCE_CODE_DIR)/include/xmlsec/*.h $(SOURCE_CODE_DIR)/include/xmlsec/base
|
||||
-@rm -f $(SOURCE_CODE_DIR)/include/xmlsec/*/symbols.h
|
||||
|
||||
SOURCE_CODEs_cleanup: $(SOURCE_CODE_DIR)/.sentinel
|
||||
@rm -rf $(SOURCE_CODE_DIR)/*
|
||||
|
||||
#
|
||||
# Create index for all functions. For macros and defines need to add -CAPS suffix
|
||||
#
|
||||
xmlsec-index: scan $(SGML_DIR)/.sentinel
|
||||
@grep -h '<NAME>.*</NAME>' $(SCAN_DIR)/xmlsec-*decl.txt | \
|
||||
grep -v '<NAME>extern</NAME>' | \
|
||||
sort -u | \
|
||||
sed 's#_#-#g' | \
|
||||
sed 's#<NAME>\([^-]*\)-\([^<]*\)</NAME>#<listitem><para><link linkend=\"\1-\2-CAPS\">\1-\2</link></para></listitem>#g' | \
|
||||
sed 's#<NAME>\([^<]*\)</NAME>#<listitem><para><link linkend=\"\1\">\1</link></para></listitem>#g' > \
|
||||
$(SGML_DIR)/xmlsec-index.sgml
|
||||
|
||||
#
|
||||
# The following code converts C example file to sgml RefEntry files.
|
||||
# We get file title from a string "XML Security Library example: ..."
|
||||
# which is usually placed at the top of the file. Also all "unsafe" xml
|
||||
# characters (<, >, &) are escaped.
|
||||
#
|
||||
example_sources: $(EXAMPLES_DIR)/.sentinel
|
||||
@echo "Preprocessing example source files into '$(EXAMPLES_DIR)' ..."
|
||||
@rm -rf $(EXAMPLES_DIR)/*
|
||||
@(for i in $(EXAMPLES_SOURCE_FILES) ; do \
|
||||
file_name=`echo $$i | sed 's#.*/##' | sed 's#\..*$$##'`; \
|
||||
file_ext=`echo $$i | sed 's#.*/##' | sed 's#.*\.##'`; \
|
||||
echo Converting $$file_name.$$file_ext to $$file_name.sgml ...; \
|
||||
file_title=`cat $$i | grep 'XML Security Library example: ' | sed 's#^.*: *##'`; \
|
||||
echo "<sect2 id=\"xmlsec-example-$$file_name\" >" > \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
echo "<title>$$file_name.$$file_ext</title><para><informalexample><programlisting>" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
cat $$i | \
|
||||
sed "s#&#\&#g" | \
|
||||
sed "s#<#\<#g" | \
|
||||
sed "s#>#\>#g" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
echo "</programlisting></informalexample></para></sect2>" >> \
|
||||
$(EXAMPLES_DIR)/$$file_name.sgml; \
|
||||
done);
|
||||
|
||||
# A single pattern rule will create all appropriate folders as required
|
||||
# otherwise make (annoyingly) deletes it
|
||||
.PRECIOUS: %/.sentinel
|
||||
%/.sentinel:
|
||||
@echo "Creating folder '${@D}' ..."
|
||||
mkdir -p ${@D}
|
||||
touch $@
|
||||
|
||||
dist-hook:
|
||||
@cp -p $(srcdir)/*.html $(srcdir)/*.png $(distdir)/
|
||||
(for i in `find $(distdir) -name ".sentinel" -print` ; do \
|
||||
echo "Removing some files '$$i' before dist ... " ; \
|
||||
rm $$i ; \
|
||||
done )
|
||||
(for i in `find $(distdir) -name "*.sgml.bak" -print` ; do \
|
||||
echo "Removing some files '$$i' before dist ... " ; \
|
||||
rm "$$i" ; \
|
||||
done ; )
|
||||
|
||||
clean-local:
|
||||
-rm -rf $(SOURCE_CODE_DIR) $(EXAMPLES_DIR) $(SCAN_DIR)/*.txt $(SGML_DIR) $(GTKDOC_MKDB_OUTPUT_DIR)
|
||||
-rm -f *.stamp *.types index.sgml
|
||||
@( if [ z"$(builddir)" != z"$(srcdir)" ] ; then \
|
||||
(chmod -R u+w $(builddir)/src || true) && rm -rf $(builddir)/src ; \
|
||||
(chmod -R u+w $(builddir)/images || true) && rm -rf $(builddir)/images ; \
|
||||
(chmod -R u+w $(builddir)/*.png || true) && rm -rf $(builddir)/*.png ; \
|
||||
fi ; )
|
||||
|
||||
distclean-local: clean-local
|
||||
|
||||
maintainer-clean-local: clean-local
|
||||
-rm -f *.html
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 5.9 KiB |
|
@ -1,349 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>XML Security Library Reference Manual: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<meta name="description" content="This manual documents the interfaces of the xmlsec library and has some short notes to help get you up to speed with using the library.">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="next" href="xmlsec-notes.html" title="Part I. XML Security Library Tutorial">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<div class="book">
|
||||
<div class="titlepage">
|
||||
<div>
|
||||
<div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">XML Security Library Reference Manual</p></th></tr></table></div>
|
||||
<div><div class="authorgroup"><div class="author">
|
||||
<h3 class="author">
|
||||
<span class="firstname">Aleksey</span> <span class="surname">Sanin</span>
|
||||
</h3>
|
||||
<div class="affiliation"><div class="address"><p><br>
|
||||
<code class="email"><<a class="email" href="mailto:aleksey@aleksey.com">aleksey@aleksey.com</a>></code><br>
|
||||
</p></div></div>
|
||||
</div></div></div>
|
||||
<div><p class="copyright">Copyright © 2002-2017 Aleksey Sanin</p></div>
|
||||
<div><div class="legalnotice">
|
||||
<a name="id-1.1.4"></a><p>Permission is granted to make and distribute verbatim
|
||||
copies of this manual provided the copyright notice and this
|
||||
permission notice are preserved on all copies.</p>
|
||||
<p>Permission is granted to copy and distribute modified
|
||||
versions of this manual under the conditions for verbatim
|
||||
copying, provided also that the entire resulting derived work is
|
||||
distributed under the terms of a permission notice identical to
|
||||
this one.</p>
|
||||
<p>Permission is granted to copy and distribute translations
|
||||
of this manual into another language, under the above conditions
|
||||
for modified versions.</p>
|
||||
</div></div>
|
||||
<div><div class="abstract">
|
||||
<p class="title"><b>Abstract</b></p>
|
||||
<p>This manual documents the interfaces of the xmlsec
|
||||
library and has some short notes to help get you up to speed
|
||||
with using the library.</p>
|
||||
</div></div>
|
||||
</div>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="toc"><dl class="toc">
|
||||
<dt><span class="part"><a href="xmlsec-notes.html">I. XML Security Library Tutorial</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-overview.html">Overview.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-structure.html">XML Security Library Structure.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-compiling.html">Building the application with XML Security Library.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-compiling.html#xmlsec-notes-compiling-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-include-files.html">Include files.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-compiling-unix.html">Compiling and linking on Unix.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-compiling-windows.html">Compiling and linking on Windows.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-compiling-others.html">Compiling and linking on other systems.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-init-shutdown.html">Initialization and shutdown.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-sign-encrypt.html">Signing and encrypting documents.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-sign-encrypt.html#xmlsec-notes-sign-encrypt-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-sign.html">Signing a document.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-encrypt.html">Encrypting data.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-templates.html">Creating dynamic templates.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-templates.html#xmlsec-notes-templates-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-dynamic-signature-templates.html">Creating dynamic signature templates.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-dynamic-encryption-templates.html">Creating dynamic encryption templates.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-verify-decrypt.html">Verifing and decrypting documents.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-verify-decrypt.html#xmlsec-notes-verify-decrypt-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-verify.html">Verifying a signed document</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-decrypt.html">Decrypting an encrypted document</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-keys.html">Keys.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-keysmngr.html">Keys manager.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-keysmngr.html#xmlsec-notes-keysmngr-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-simple-keys-store.html">Simple keys store.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-keys-manager-sign-enc.html">Using keys manager for signatures/encryption.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-keys-mngr-verify-decrypt.html">Using keys manager for verification/decryption.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-custom-keys-store.html">Implementing a custom keys store.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-x509.html">Using X509 Certificates.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-x509.html#xmlsec-notes-x509-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-sign-x509.html">Signing data with X509 certificate.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-verify-x509.html">Verifing document signed with X509 certificates.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-transforms.html">Transforms and transforms chain.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-contexts.html">Using context objects.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-notes-new-crypto.html">Adding support for new cryptographic library.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto.html#xmlsec-notes-new-crypto-overview">Overview.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-skeleton.html">Creating a framework from the skeleton.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-functions.html">xmlSecCryptoApp* functions.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-klasses.html">Klasses and objects.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-transforms.html">Cryptographic transforms.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-keys.html">Keys data and keys data stores.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-simple-keys-mngr.html">Default keys manager.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-notes-new-crypto-sharing-results.html">Sharing the results.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-examples.html">Examples.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect1"><a href="xmlsec-examples.html#xmlsec-examples-overview">XML Security Library Examples.</a></span></dt>
|
||||
<dt><span class="sect1"><a href="xmlsec-examples-sign-template-file.html">Signing a template file.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-template-file.html#xmlsec-example-sign1">sign1.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-template-file.html#xmlsec-example-sign1-tmpl">sign1-tmpl.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-template-file.html#xmlsec-example-sign1-res">sign1-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-examples-sign-dynamimc-template.html">Signing a dynamicaly created template.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-dynamimc-template.html#xmlsec-example-sign2">sign2.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-dynamimc-template.html#xmlsec-example-sign2-doc">sign2-doc.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-dynamimc-template.html#xmlsec-example-sign2-res">sign2-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-examples-sign-x509.html">Signing with X509 certificate.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-x509.html#xmlsec-example-sign3">sign3.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-x509.html#xmlsec-example-sign3-doc">sign3-doc.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-examples-sign-x509.html#xmlsec-example-sign3-res">sign3-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-verify-with-key.html">Verifying a signature with a single key.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-verify-with-key.html#xmlsec-example-verify1">verify1.c</a></span></dt></dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-verify-with-keys-mngr.html">Verifying a signature with keys manager.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-verify-with-keys-mngr.html#xmlsec-example-verify2">verify2.c</a></span></dt></dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-verify-with-x509.html">Verifying a signature with X509 certificates.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-verify-with-x509.html#xmlsec-example-verify3">verify3.c</a></span></dt></dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-verify-with-restrictions.html">Verifying a signature with additional restrictions.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-verify-with-restrictions.html#xmlsec-example-verify4">verify4.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-verify-with-restrictions.html#xmlsec-example-verify4-tmpl">verify4-tmpl.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-verify-with-restrictions.html#xmlsec-example-verify4-res">verify4-res.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-verify-with-restrictions.html#xmlsec-example-verify4-bad-tmpl">verify4-bad-tmpl.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-verify-with-restrictions.html#xmlsec-example-verify4-bad-res">verify4-bad-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-encrypt-template-file.html">Encrypting data with a template file.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-template-file.html#xmlsec-example-encrypt1">encrypt1.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-template-file.html#xmlsec-example-encrypt1-tmpl">encrypt1-tmpl.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-template-file.html#xmlsec-example-encrypt1-res">encrypt1-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-encrypt-dynamic-template.html">Encrypting data with a dynamicaly created template.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-dynamic-template.html#xmlsec-example-encrypt2">encrypt2.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-dynamic-template.html#xmlsec-example-encrypt2-doc">encrypt2-doc.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-dynamic-template.html#xmlsec-example-encrypt2-res">encrypt2-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-encrypt-with-session-key.html">Encrypting data with a session key.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-with-session-key.html#xmlsec-example-encrypt3">encrypt3.c</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-with-session-key.html#xmlsec-example-encrypt3-doc">encrypt3-doc.xml</a></span></dt>
|
||||
<dt><span class="sect2"><a href="xmlsec-encrypt-with-session-key.html#xmlsec-example-encrypt3-res">encrypt3-res.xml</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-decrypt-with-signle-key.html">Decrypting data with a single key.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-decrypt-with-signle-key.html#xmlsec-example-decrypt1">decrypt1.c</a></span></dt></dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-decrypt-with-keys-mngr.html">Decrypting data with keys manager.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-decrypt-with-keys-mngr.html#xmlsec-example-decrypt2">decrypt2.c</a></span></dt></dl></dd>
|
||||
<dt><span class="sect1"><a href="xmlsec-custom-keys-manager.html">Writing a custom keys manager.</a></span></dt>
|
||||
<dd><dl><dt><span class="sect2"><a href="xmlsec-custom-keys-manager.html#xmlsec-example-decrypt3">decrypt3.c</a></span></dt></dl></dd>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-signature-klasses.html">APPENDIX A. XML Security Library Signature Klasses.</a></span></dt>
|
||||
<dt><span class="chapter"><a href="xmlsec-encryption-klasses.html">APPENDIX B. XML Security Library Encryption Klasses.</a></span></dt>
|
||||
</dl></dd>
|
||||
<dt><span class="part"><a href="xmlsec-reference.html">II. XML Security Library API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt><span class="chapter"><a href="xmlsec-ref.html">XML Security Core Library API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-app.html">app</a></span><span class="refpurpose"> — Crypto-engine independent application support functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-base64.html">base64</a></span><span class="refpurpose"> — Base64 encoding/decoding functions and base64 transform implementation.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-bn.html">bn</a></span><span class="refpurpose"> — Big numbers support functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-buffer.html">buffer</a></span><span class="refpurpose"> — Binary memory buffer functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-dl.html">dl</a></span><span class="refpurpose"> — Dynamic crypto-engine library loading functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-errors.html">errors</a></span><span class="refpurpose"> — Error reporting and logging functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-io.html">io</a></span><span class="refpurpose"> — Input/output functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-keyinfo.html">keyinfo</a></span><span class="refpurpose"> — <dsig:KeyInfo/> node parser functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-keysdata.html">keysdata</a></span><span class="refpurpose"> — Crypto key data object functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-keys.html">keys</a></span><span class="refpurpose"> — Crypto key object functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-keysmngr.html">keysmngr</a></span><span class="refpurpose"> — Keys manager object functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-list.html">list</a></span><span class="refpurpose"> — Generic list structure functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-membuf.html">membuf</a></span><span class="refpurpose"> — Memory buffer transform functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nodeset.html">nodeset</a></span><span class="refpurpose"> — XML nodes set functions</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-parser.html">parser</a></span><span class="refpurpose"> — XML parser functions and the XML parser transform implementation.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-templates.html">templates</a></span><span class="refpurpose"> — XML signature and encryption template functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-transforms.html">transforms</a></span><span class="refpurpose"> — Transform object functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-version.html">version</a></span><span class="refpurpose"> — Version macros.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-xmldsig.html">xmldsig</a></span><span class="refpurpose"> — XML Digital Signature functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-xmlenc.html">xmlenc</a></span><span class="refpurpose"> — XML Encryption support.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-xmlsec.html">xmlsec</a></span><span class="refpurpose"> — Utility functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-xmltree.html">xmltree</a></span><span class="refpurpose"> — XML tree functions.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-x509.html">x509</a></span><span class="refpurpose"> — <dsig:X509Certificate/> node parser functions.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-openssl-ref.html">XML Security Library for OpenSLL API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-openssl-app.html">app</a></span><span class="refpurpose"> — Application support functions for OpenSSL.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-openssl-bn.html">bn</a></span><span class="refpurpose"> — Big numbers (BIGNUM) support functions implementation for OpenSSL.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-openssl-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for OpenSSL.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-openssl-evp.html">evp</a></span><span class="refpurpose"> — Private/public (EVP) keys implementation for OpenSSL.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-openssl-x509.html">x509</a></span><span class="refpurpose"> — X509 certificates implementation for OpenSSL.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-gnutls-ref.html">XML Security Library for GnuTLS API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-gnutls-app.html">app</a></span><span class="refpurpose"> — Application support functions for GnuTLS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-gnutls-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for GnuTLS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-gnutls-x509.html">x509</a></span><span class="refpurpose"> — X509 certificates implementation for GnuTLS.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-gcrypt-ref.html">XML Security Library for GCrypt API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-gcrypt-app.html">app</a></span><span class="refpurpose"> — Application support functions for GCrypt.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-gcrypt-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for GCrypt.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-nss-ref.html">XML Security Library for NSS API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-app.html">app</a></span><span class="refpurpose"> — Application support functions for NSS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-bignum.html">bignum</a></span><span class="refpurpose"> — Big numbers support functions implementation for NSS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for NSS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-keysstore.html">keysstore</a></span><span class="refpurpose"> — Keys store implementation for NSS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-pkikeys.html">pkikeys</a></span><span class="refpurpose"> — Private/public keys implementation for NSS.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-nss-x509.html">x509</a></span><span class="refpurpose"> — X509 certificates implementation for NSS.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-mscrypto-ref.html">XML Security Library for Microsoft Crypto API Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscrypto-app.html">app</a></span><span class="refpurpose"> — Application support functions for Microsoft Crypto API.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscrypto-certkeys.html">certkeys</a></span><span class="refpurpose"> — Certificate keys support functions for Microsoft Crypto API.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscrypto-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for Microsoft Crypto API.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscrypto-keysstore.html">keysstore</a></span><span class="refpurpose"> — Keys store implementation for Microsoft Crypto API.</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscrypto-x509.html">x509</a></span><span class="refpurpose"> — X509 certificates implementation for Microsoft Crypto API.</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-msccng-ref.html">XML Security Library for Microsoft Cryptography API: Next Generation (CNG) Reference.</a></span></dt>
|
||||
<dd><dl>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscng-app.html">app</a></span><span class="refpurpose"> — Application support functions for Microsoft Cryptography API: Next Generation (CNG).</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscng-certkeys.html">certkeys</a></span><span class="refpurpose"> — Certificate keys support functions for Microsoft Cryptography API: Next Generation (CNG).</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscng-crypto.html">crypto</a></span><span class="refpurpose"> — Crypto transforms implementation for Microsoft Cryptography API: Next Generation (CNG).</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscng-keysstore.html">keysstore</a></span><span class="refpurpose"> — Keys store implementation for Microsoft Cryptography API: Next Generation (CNG).</span>
|
||||
</dt>
|
||||
<dt>
|
||||
<span class="refentrytitle"><a href="xmlsec-mscng-x509.html">x509</a></span><span class="refpurpose"> — X509 certificates implementation for Microsoft Cryptography API: Next Generation (CNG).</span>
|
||||
</dt>
|
||||
</dl></dd>
|
||||
<dt><span class="chapter"><a href="xmlsec-index.html">XML Security Library Reference Index</a></span></dt>
|
||||
</dl></dd>
|
||||
</dl></div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 334 B |
Before Width: | Height: | Size: 185 B |
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 184 B |
|
@ -1,252 +0,0 @@
|
|||
<chapter id="xmlsec-notes-compiling">
|
||||
<title>Building the application with XML Security Library.</title>
|
||||
<sect1 id="xmlsec-notes-compiling-overview">
|
||||
<title>Overview.</title>
|
||||
<para>Compiling and linking application with XML Security
|
||||
Library requires specifying correct compilation flags, library files
|
||||
and paths to include and library files. As we discussed before,
|
||||
XML Security Library consist of the core xmlsec library and several
|
||||
xmlsec-crypto libraries. Application has a choice of selecting crypto
|
||||
library at link time or dynamicaly loading it at run time. Please note,
|
||||
that loading crypto engines dynamicaly may introduce security problems
|
||||
on some platforms.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-include-files" >
|
||||
<title>Include files.</title>
|
||||
<para>In order to use XML Security Library an application should include
|
||||
one or more of the following files:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-XMLSEC">xmlsec/xmlsec.h</link> -
|
||||
XML Security Library initialization and shutdown functions;
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-XMLDSIG">xmlsec/xmldsig.h</link> -
|
||||
XML Digital Signature functions;</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-XMLENC">xmlsec/xmlenc.h</link> -
|
||||
XML Encryption functions;</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-XMLTREE">xmlsec/xmltree.h</link> -
|
||||
helper functions for XML documents manipulation;
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-TEMPLATES">xmlsec/templates.h</link> -
|
||||
helper functions for dynamic XML Digital Signature and
|
||||
XML Encryption templates creation;
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><link linkend="XMLSEC-CRYPTO">xmlsec/crypto.h</link> -
|
||||
automatic XML Security Crypto Library selection.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>If necessary, the application should also include LibXML,
|
||||
LibXSLT and crypto library header files.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Example includes file section.</title>
|
||||
<programlisting><![CDATA[
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmldsig.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/templates.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-compiling-unix" >
|
||||
<title>Compiling and linking on Unix.</title>
|
||||
<para>There are several ways to get necessary compilation
|
||||
and linking information on Unix and application can use
|
||||
any of these methods to do crypto engine selection either
|
||||
at linking or run time.
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>PKG_CHECK_MODULES() macro
|
||||
<example>
|
||||
<title>Using PKG_CHECK_MODULES() macro in a configure.in file
|
||||
to select crypto engine (openssl) at linking time.</title>
|
||||
<programlisting><![CDATA[
|
||||
dnl
|
||||
dnl Check for xmlsec and friends
|
||||
dnl
|
||||
PKG_CHECK_MODULES(XMLSEC, xmlsec1-openssl >= 1.0.0 xml2 libxslt,,exit)
|
||||
CFLAGS="$CFLAGS $XMLSEC_CFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $XMLSEC_LIBS"
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Using PKG_CHECK_MODULES() macro in a configure.in file
|
||||
to enable dynamical loading of xmlsec-crypto library.</title>
|
||||
<programlisting><![CDATA[
|
||||
dnl
|
||||
dnl Check for xmlsec and friends
|
||||
dnl
|
||||
PKG_CHECK_MODULES(XMLSEC, xmlsec1 >= 1.0.0 xml2 libxslt,,exit)
|
||||
CFLAGS="$CFLAGS $XMLSEC_CFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS"
|
||||
LDFLAGS="$LDFLAGS $XMLSEC_LIBS"
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
</para></listitem>
|
||||
|
||||
|
||||
<listitem><para>pkg-config script
|
||||
<example>
|
||||
<title>Using pkg-config script in a Makefile
|
||||
to select crypto engine (nss) at linking time.</title>
|
||||
<programlisting><![CDATA[
|
||||
PROGRAM = test
|
||||
PROGRAM_FILES = test.c
|
||||
|
||||
CFLAGS += -g $(shell pkg-config --cflags xmlsec1-nss)
|
||||
LDFLAGS += -g
|
||||
LIBS += $(shell pkg-config --libs xmlsec1-nss)
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
%: %.c
|
||||
$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)
|
||||
|
||||
clean:
|
||||
@rm -rf $(PROGRAM)
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<example>
|
||||
<title>Using pkg-config script in a Makefile
|
||||
to enable dynamical loading of xmlsec-crypto library.</title>
|
||||
<programlisting><![CDATA[
|
||||
PROGRAM = test
|
||||
PROGRAM_FILES = test.c
|
||||
|
||||
CFLAGS += -g $(shell pkg-config --cflags xmlsec1)
|
||||
LDFLAGS += -g
|
||||
LIBS += $(shell pkg-config --libs xmlsec1)
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
%: %.c
|
||||
$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)
|
||||
|
||||
clean:
|
||||
@rm -rf $(PROGRAM)
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
</para></listitem>
|
||||
<listitem><para>xmlsec1-config script
|
||||
<example>
|
||||
<title>Using xmlsec1-config script in a Makefile
|
||||
to select crypto engine (e.g. gnutls) at linking time.</title>
|
||||
<programlisting><![CDATA[
|
||||
PROGRAM = test
|
||||
PROGRAM_FILES = test.c
|
||||
|
||||
CFLAGS += -g $(shell xmlsec1-config --crypto gnutls --cflags)
|
||||
LDFLAGS += -g
|
||||
LIBS += $(shell xmlsec1-config --crypto gnutls --libs)
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
%: %.c
|
||||
$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)
|
||||
|
||||
clean:
|
||||
@rm -rf $(PROGRAM)
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Using xmlsec1-config script in a Makefile
|
||||
to enable dynamical loading of xmlsec-crypto library.</title>
|
||||
<programlisting><![CDATA[
|
||||
PROGRAM = test
|
||||
PROGRAM_FILES = test.c
|
||||
|
||||
CFLAGS += -g $(shell xmlsec1-config --cflags)
|
||||
LDFLAGS += -g
|
||||
LIBS += $(shell xmlsec1-config --libs)
|
||||
|
||||
all: $(PROGRAM)
|
||||
|
||||
%: %.c
|
||||
$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)
|
||||
|
||||
clean:
|
||||
@rm -rf $(PROGRAM)
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-compiling-windows" >
|
||||
<title>Compiling and linking on Windows.</title>
|
||||
<para>On Windows there is no such simple and elegant solution.
|
||||
Please check <filename>README</filename> file in <filename>win32</filename>
|
||||
folder of the library package for latest instructions.
|
||||
However, there are few general things, that you need to remember:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<emphasis>All libraries linked to your application must be compiled
|
||||
with the same Microsoft Runtime Libraries.</emphasis>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<emphasis>Static linking with XML Security Library requires
|
||||
additional global defines:</emphasis>
|
||||
<informalexample><programlisting>
|
||||
#define LIBXML_STATIC
|
||||
#define LIBXSLT_STATIC
|
||||
#define XMLSEC_STATIC
|
||||
</programlisting></informalexample>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
If you do not want to dynamicaly load xmlsec-crypto library
|
||||
and prefer to select crypto engine at linking then you should
|
||||
link your application with xmlsec and at least one of
|
||||
xmlsec-crypto libraries.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
In order to enable dynamic loading for xmlsec-crypto library
|
||||
you should add additional global define:
|
||||
<informalexample><programlisting>
|
||||
#define XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
</programlisting></informalexample>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-compiling-others">
|
||||
<title>Compiling and linking on other systems.</title>
|
||||
<para>Well, nothing is impossible, it's only software (you managed to
|
||||
compile the library itself, do you?).
|
||||
I'll be happy to include in this manual your expirience with
|
||||
compiling and linking applications with XML Security Library
|
||||
on other platforms (if you would like to share it).
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -1,325 +0,0 @@
|
|||
<chapter id="xmlsec-notes-templates">
|
||||
<title>Creating dynamic templates.</title>
|
||||
<sect1 id="xmlsec-notes-templates-overview">
|
||||
<title>Overview.</title>
|
||||
<para>The XML Security Library uses templates to describe
|
||||
how and what data should be signed or encrypted. The template
|
||||
is a regular XML file. You can create templates in advance
|
||||
using your favorite XML files editor, load them from a file
|
||||
and use for creating signature or encrypting data. You can
|
||||
also create templates dynamicaly. The XML Security Library
|
||||
provides helper functions to quickly create dynamic templates
|
||||
inside your application.</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-dynamic-signature-templates">
|
||||
<title>Creating dynamic signature templates.</title>
|
||||
<para>The signature template has structure similar
|
||||
to the XML Digital Signature structure as it is described in
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core">specification</ulink>.
|
||||
The only difference is that some nodes (for example,
|
||||
<dsig:DigestValue/> or <SignatureValue/>)
|
||||
are empty. The XML Security Library sets the content of these
|
||||
nodes after doing necessary calculations.
|
||||
</para>
|
||||
<figure>
|
||||
<title>XML Digital Signature structure</title>
|
||||
<programlisting>
|
||||
<dsig:Signature ID?>
|
||||
<dsig:SignedInfo>
|
||||
<dsig:CanonicalizationMethod Algorithm />
|
||||
<dsig:SignatureMethod Algorithm />
|
||||
(<dsig:Reference URI? >
|
||||
(<dsig:Transforms>
|
||||
(<dsig:Transform Algorithm />)+
|
||||
</dsig:Transforms>)?
|
||||
<dsig:DigestMethod Algorithm >
|
||||
<dsig:DigestValue>
|
||||
</dsig:Reference>)+
|
||||
</dsig:SignedInfo>
|
||||
<dsig:SignatureValue>
|
||||
(<dsig:KeyInfo>
|
||||
<dsig:KeyName>?
|
||||
<dsig:KeyValue>?
|
||||
<dsig:RetrievalMethod>?
|
||||
<dsig:X509Data>?
|
||||
<dsig:PGPData>?
|
||||
<enc:EncryptedKey>?
|
||||
<enc:AgreementMethod>?
|
||||
<dsig:KeyName>?
|
||||
<dsig:RetrievalMethod>?
|
||||
<*>?
|
||||
</dsig:KeyInfo>)?
|
||||
(<dsig:Object ID?>)*
|
||||
</dsig:Signature>
|
||||
</programlisting>
|
||||
</figure>
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating dynamic signature template.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* sign_file:
|
||||
* @xml_file: the XML file name.
|
||||
* @key_file: the PEM private key file name.
|
||||
*
|
||||
* Signs the #xml_file using private key from #key_file and dynamicaly
|
||||
* created enveloped signature template.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
sign_file(const char* xml_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr signNode = NULL;
|
||||
xmlNodePtr refNode = NULL;
|
||||
xmlNodePtr keyInfoNode = NULL;
|
||||
xmlSecDSigCtxPtr dsigCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(xml_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load doc file */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create signature template for RSA-SHA1 enveloped signature */
|
||||
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
|
||||
xmlSecTransformRsaSha1Id, NULL);
|
||||
if(signNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to create signature template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:Signature/> node to the doc */
|
||||
xmlAddChild(xmlDocGetRootElement(doc), signNode);
|
||||
|
||||
/* add reference */
|
||||
refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id,
|
||||
NULL, NULL, NULL);
|
||||
if(refNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add reference to signature template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add enveloped transform */
|
||||
if(xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the signed document */
|
||||
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
|
||||
if(keyInfoNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key name\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create signature context, we don't need keys manager in this example */
|
||||
dsigCtx = xmlSecDSigCtxCreate(NULL);
|
||||
if(dsigCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create signature context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load private key, assuming that there is not password */
|
||||
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(dsigCtx->signKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* sign the template */
|
||||
if(xmlSecDSigCtxSign(dsigCtx, signNode) < 0) {
|
||||
fprintf(stderr,"Error: signature failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print signed document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(dsigCtx != NULL) {
|
||||
xmlSecDSigCtxDestroy(dsigCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-sign2">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-dynamic-encryption-templates">
|
||||
<title>Creating dynamic encryption templates.</title>
|
||||
<para>The encryption template has structure similar
|
||||
to the XML Encryption structure as it is described in
|
||||
<ulink URL="http://www.w3.org/TR/xmlenc-core">specification</ulink>.
|
||||
The only difference is that some nodes (for example,
|
||||
<enc:CipherValue/>)
|
||||
are empty. The XML Security Library sets the content of these
|
||||
nodes after doing necessary calculations.
|
||||
</para>
|
||||
<figure>
|
||||
<title>XML Encryption structure</title>
|
||||
<programlisting>
|
||||
<enc:EncryptedData Id? Type? MimeType? Encoding?>
|
||||
<enc:EncryptionMethod Algorithm />?
|
||||
(<dsig:KeyInfo>
|
||||
<dsig:KeyName>?
|
||||
<dsig:KeyValue>?
|
||||
<dsig:RetrievalMethod>?
|
||||
<dsig:X509Data>?
|
||||
<dsig:PGPData>?
|
||||
<enc:EncryptedKey>?
|
||||
<enc:AgreementMethod>?
|
||||
<dsig:KeyName>?
|
||||
<dsig:RetrievalMethod>?
|
||||
<*>?
|
||||
</dsig:KeyInfo>)?
|
||||
<enc:CipherData>
|
||||
<enc:CipherValue>?
|
||||
<enc:CipherReference URI?>?
|
||||
</enc:CipherData>
|
||||
<enc:EncryptionProperties>?
|
||||
</enc:EncryptedData>
|
||||
</programlisting>
|
||||
</figure>
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating dynamic encrytion template.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* encrypt_file:
|
||||
* @xml_file: the encryption template file name.
|
||||
* @key_file: the Triple DES key file.
|
||||
*
|
||||
* Encrypts #xml_file using a dynamicaly created template and DES key from
|
||||
* #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
encrypt_file(const char* xml_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr encDataNode = NULL;
|
||||
xmlNodePtr keyInfoNode = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(xml_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption template to encrypt XML file and replace
|
||||
* its content with encryption result */
|
||||
encDataNode = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
|
||||
NULL, xmlSecTypeEncElement, NULL, NULL);
|
||||
if(encDataNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to create encryption template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we want to put encrypted data in the <enc:CipherValue/> node */
|
||||
if(xmlSecTmplEncDataEnsureCipherValue(encDataNode) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add CipherValue node\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the signed document */
|
||||
keyInfoNode = xmlSecTmplEncDataEnsureKeyInfo(encDataNode, NULL);
|
||||
if(keyInfoNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key name\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key, assuming that there is not password */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* encrypt the data */
|
||||
if(xmlSecEncCtxXmlEncrypt(encCtx, encDataNode, xmlDocGetRootElement(doc)) < 0) {
|
||||
fprintf(stderr,"Error: encryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we template is inserted in the doc */
|
||||
encDataNode = NULL;
|
||||
|
||||
/* print encrypted data with document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(encDataNode != NULL) {
|
||||
xmlFreeNode(encDataNode);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-encrypt2">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -1,102 +0,0 @@
|
|||
<chapter id="xmlsec-examples">
|
||||
<title>Examples.</title>
|
||||
<sect1 id="xmlsec-examples-overview" >
|
||||
<title>XML Security Library Examples.</title>
|
||||
<para>This section contains several examples of using XML Security Library
|
||||
to sign, veiryf, encrypt or decrypt XML documents.</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-examples-sign-template-file">
|
||||
<title>Signing a template file.</title>
|
||||
|
||||
&xmlsec-example-sign1;
|
||||
&xmlsec-example-sign1-tmpl;
|
||||
&xmlsec-example-sign1-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-examples-sign-dynamimc-template">
|
||||
<title>Signing a dynamicaly created template.</title>
|
||||
|
||||
&xmlsec-example-sign2;
|
||||
&xmlsec-example-sign2-doc;
|
||||
&xmlsec-example-sign2-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-examples-sign-x509">
|
||||
<title>Signing with X509 certificate.</title>
|
||||
|
||||
&xmlsec-example-sign3;
|
||||
&xmlsec-example-sign3-doc;
|
||||
&xmlsec-example-sign3-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-verify-with-key">
|
||||
<title>Verifying a signature with a single key.</title>
|
||||
|
||||
&xmlsec-example-verify1;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-verify-with-keys-mngr">
|
||||
<title>Verifying a signature with keys manager.</title>
|
||||
|
||||
&xmlsec-example-verify2;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-verify-with-x509">
|
||||
<title>Verifying a signature with X509 certificates.</title>
|
||||
|
||||
&xmlsec-example-verify3;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-verify-with-restrictions">
|
||||
<title>Verifying a signature with additional restrictions.</title>
|
||||
|
||||
&xmlsec-example-verify4;
|
||||
&xmlsec-example-verify4-tmpl;
|
||||
&xmlsec-example-verify4-res;
|
||||
&xmlsec-example-verify4-bad-tmpl;
|
||||
&xmlsec-example-verify4-bad-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-encrypt-template-file">
|
||||
<title>Encrypting data with a template file.</title>
|
||||
|
||||
&xmlsec-example-encrypt1;
|
||||
&xmlsec-example-encrypt1-tmpl;
|
||||
&xmlsec-example-encrypt1-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-encrypt-dynamic-template">
|
||||
<title>Encrypting data with a dynamicaly created template.</title>
|
||||
|
||||
&xmlsec-example-encrypt2;
|
||||
&xmlsec-example-encrypt2-doc;
|
||||
&xmlsec-example-encrypt2-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-encrypt-with-session-key">
|
||||
<title>Encrypting data with a session key.</title>
|
||||
|
||||
&xmlsec-example-encrypt3;
|
||||
&xmlsec-example-encrypt3-doc;
|
||||
&xmlsec-example-encrypt3-res;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-decrypt-with-signle-key">
|
||||
<title>Decrypting data with a single key.</title>
|
||||
|
||||
&xmlsec-example-decrypt1;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-decrypt-with-keys-mngr">
|
||||
<title>Decrypting data with keys manager.</title>
|
||||
|
||||
&xmlsec-example-decrypt2;
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-custom-keys-manager">
|
||||
<title>Writing a custom keys manager.</title>
|
||||
|
||||
&xmlsec-example-decrypt3;
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -1,104 +0,0 @@
|
|||
<chapter id="xmlsec-notes-init-shutdown">
|
||||
<title>Initialization and shutdown.</title>
|
||||
<para>XML Security Library initialization/shutdown
|
||||
process includes initialization and shutdown of the
|
||||
dependent libraries:
|
||||
<itemizedlist>
|
||||
<listitem><para>libxml library;</para></listitem>
|
||||
<listitem><para>libxslt library;</para></listitem>
|
||||
<listitem><para>crypto library (OpenSSL, GnuTLS, GCrypt, NSS, ...);</para></listitem>
|
||||
<listitem><para>xmlsec library
|
||||
(<link linkend="xmlSecInit">xmlSecInit</link>
|
||||
and <link linkend="xmlSecShutdown">xmlSecShutdown</link>
|
||||
functions);
|
||||
</para></listitem>
|
||||
<listitem><para>xmlsec-crypto library
|
||||
(<link linkend="xmlSecCryptoDLLoadLibrary">xmlSecCryptoDLLoadLibrary</link>
|
||||
to load xmlsec-crypto library dynamicaly if needed,
|
||||
<link linkend="xmlSecCryptoInit">xmlSecCryptoInit</link>
|
||||
and <link linkend="xmlSecCryptoShutdown">xmlSecCryptoShutdown</link>
|
||||
functions);
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
xmlsec-crypto library also provides a convinient functions
|
||||
<link linkend="xmlSecAppCryptoInit">xmlSecAppCryptoInit</link>
|
||||
and <link linkend="xmlSecAppCryptoShutdown">xmlSecAppCryptoShutdown</link>
|
||||
to initialize the crypto library itself but application can do it
|
||||
by itself.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Initializing application.</title>
|
||||
<programlisting><![CDATA[
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<example>
|
||||
<title>Shutting down application.</title>
|
||||
<programlisting><![CDATA[
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</chapter>
|
|
@ -1,462 +0,0 @@
|
|||
<chapter id="xmlsec-notes-new-crypto">
|
||||
<title>Adding support for new cryptographic library.</title>
|
||||
<sect1 id="xmlsec-notes-new-crypto-overview">
|
||||
<title>Overview.</title>
|
||||
<para>XML Security Library can support practicaly any cryptographic
|
||||
library. Currently, it has "out-of-the-box" support for OpenSSL,
|
||||
MSCrypto, NSS, GnuTLS and GCrypt. If your favorite library is not supported yet then
|
||||
you can write necessary code yourself. If you and your company
|
||||
(university, ...) are willing to share the results of your work I would
|
||||
be happy to add support for new libraries to the main XML Security
|
||||
Library distribution.</para>
|
||||
<para>
|
||||
The XML Security Library
|
||||
<link linkend="xmlsec-notes-structure">separates</link>
|
||||
the cryptographic library (engine)
|
||||
specific code in an "xmlsec-<crypto>" library (where "<crypto>" is
|
||||
"openssl", "mscrypt", "gnutls", "gcrypt", "nss", etc.) which includes following items:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
xmlSecCryptoApp* functions.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Cryptographic transforms and keys data implementation.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Keys store support (X509, PGP, etc.).
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
In this chapter, we will discuss
|
||||
a task of creating "xmlsec-mycrypto" library that provides support
|
||||
for your favorite "MyCrypto" cryptographic library.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-skeleton">
|
||||
<title>Creating a framework from the skeleton.</title>
|
||||
<para>
|
||||
The XML Security Library contains a "skeleton" for creating new
|
||||
"xmlsec-<crypto>" libraries. In order to create "xmlsec-mycrypto"
|
||||
library framework, do the following (this example assumes that you
|
||||
are using *nix system, adjust the commands if you are using something else):
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Copy src/skeleton and include/xmlsec/skeleton folders to src/mycrypto and
|
||||
include/xmlsec/mycrypto folders:
|
||||
<example>
|
||||
<title>Coping skeleton folders:</title>
|
||||
<programlisting><![CDATA[
|
||||
cp -r src/skeleton src/mycrypto
|
||||
cp -r include/xmlsec/skeleton include/xmlsec/mycrypto
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Replace "skeleton" with "mycrypto" in the copied files (note that there
|
||||
are different possible cases here):
|
||||
<example>
|
||||
<title>Replacing "skeleton" with "mycrypto".</title>
|
||||
<programlisting><![CDATA[
|
||||
for i in `ls include/xmlsec/mycrypto/* src/mycrypto/*`; do
|
||||
echo Processing $i ..;
|
||||
sed 's/skeleton/mycrypto/g' $i | \
|
||||
sed 's/SKELETON/MYCRYPTO/g' | \
|
||||
sed 's/Skeleton/MyCrypto/g' > $i.tmp;
|
||||
mv $i.tmp $i;
|
||||
done
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Add "xmlsec-mycrypto" library to the "include/xmlsec/crypto.h" file:
|
||||
<example>
|
||||
<title>Modifying include/xmlsec/crypto.h file.</title>
|
||||
<programlisting><![CDATA[
|
||||
...
|
||||
#ifdef XMLSEC_CRYPTO_MYCRYPTO
|
||||
#include <xmlsec/mycrypto/app.h>
|
||||
#include <xmlsec/mycrypto/crypto.h>
|
||||
#include <xmlsec/mycrypto/symbols.h>
|
||||
#else /* XMLSEC_CRYPTO_MYCRYPTO */
|
||||
...
|
||||
#endif /* XMLSEC_CRYPTO_MYCRYPTO */
|
||||
...
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Add "xmlsec-crypto" library to the configure.in file (for *nix systems;
|
||||
for Windows you need to modify win32/confgure.js and win32/Makefile.msvc
|
||||
files, see win32/README.txt for details):
|
||||
<example>
|
||||
<title>Modifying configure.in file.</title>
|
||||
<programlisting><![CDATA[
|
||||
dnl ==========================================================================
|
||||
dnl See if we can find MyCrypto
|
||||
dnl ==========================================================================
|
||||
XMLSEC_MYCRYPTO_DEFINES=""
|
||||
MYCRYPTO_CONFIG="mycrypto-config" # TODO
|
||||
XMLSEC_NO_MYCRYPTO="1"
|
||||
MYCRYPTO_MIN_VERSION="0.0.0" # TODO
|
||||
MYCRYPTO_VERSION=""
|
||||
MYCRYPTO_PREFIX=""
|
||||
MYCRYPTO_CFLAGS=""
|
||||
MYCRYPTO_LIBS=""
|
||||
MYCRYPTO_LDADDS=""
|
||||
AC_MSG_CHECKING(for mycrypto libraries >= $MYCRYPTO_MIN_VERSION)
|
||||
AC_ARG_WITH(mycrypto, [ --with-mycrypto=[PFX] mycrypto location])
|
||||
if test "$with_mycrypto" = "no" ; then
|
||||
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST mycrypto"
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
if test "$with_mycrypto" != "" ; then
|
||||
MYCRYPTO_PREFIX=$with_mycrypto
|
||||
MYCRYPTO_CONFIG=$MYCRYPTO_PREFIX/bin/$MYCRYPTO_CONFIG
|
||||
fi
|
||||
if ! $MYCRYPTO_CONFIG --version > /dev/null 2>&1 ; then
|
||||
if test "$with_mycrypto" != "" ; then
|
||||
AC_MSG_ERROR(Unable to find mycrypto at '$with_mycrypto')
|
||||
fi
|
||||
else
|
||||
vers=`$MYCRYPTO_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
minvers=`echo $MYCRYPTO_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
|
||||
if test "$vers" -ge "$minvers" ; then
|
||||
MYCRYPTO_LIBS="`$MYCRYPTO_CONFIG --libs`"
|
||||
MYCRYPTO_CFLAGS="`$MYCRYPTO_CONFIG --cflags`"
|
||||
MYCRYPTO_VERSION="`$MYCRYPTO_CONFIG --version`"
|
||||
XMLSEC_NO_MYCRYPTO="0"
|
||||
else
|
||||
AC_MSG_ERROR(You need at least mycrypto $MYCRYPTO_MIN_VERSION for this version of $PACKAGE)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl update crypt libraries list
|
||||
if test "z$XMLSEC_NO_MYCRYPTO" = "z0" ; then
|
||||
dnl first crypto library is default one
|
||||
if test "z$XMLSEC_CRYPTO" = "z" ; then
|
||||
XMLSEC_CRYPTO="mycrypto"
|
||||
XMLSEC_CRYPTO_LIB="xmlsec1-mycrypto"
|
||||
XMLSEC_CRYPTO_CFLAGS="$MYCRYPTO_CFLAGS -DXMLSEC_CRYPTO_MYCRYPTO=1"
|
||||
XMLSEC_CRYPTO_LIBS="$MYCRYPTO_LIBS"
|
||||
XMLSEC_CRYPTO_LDADDS="$MYCRYPTO_LDADDS"
|
||||
fi
|
||||
XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST mycrypto"
|
||||
AC_MSG_RESULT(yes ('$MYCRYPTO_VERSION'))
|
||||
else
|
||||
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST mycrypto"
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(XMLSEC_NO_MYCRYPTO)
|
||||
AC_SUBST(MYCRYPTO_MIN_VERSION)
|
||||
AC_SUBST(MYCRYPTO_VERSION)
|
||||
AC_SUBST(MYCRYPTO_CONFIG)
|
||||
AC_SUBST(MYCRYPTO_PREFIX)
|
||||
AC_SUBST(MYCRYPTO_CFLAGS)
|
||||
AC_SUBST(MYCRYPTO_LIBS)
|
||||
AC_SUBST(MYCRYPTO_LDADDS)
|
||||
AC_SUBST(XMLSEC_MYCRYPTO_DEFINES)
|
||||
|
||||
...
|
||||
AC_OUTPUT([
|
||||
...
|
||||
include/xmlsec/mycrypto/Makefile
|
||||
src/mycrypto/Makefile
|
||||
...
|
||||
])
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
<listitem><para>Modify "xmlsec.spec.in" file to create "xmlsec-mycrypto"
|
||||
RPM (if necessary).
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
By now you should be able to sucessfuly compile XML Security Library
|
||||
with MyCrypto library (we disable all other libraries to make sure
|
||||
that xmlsec command line utility is linked against xmlsec-mycrypto
|
||||
library):
|
||||
<example>
|
||||
<title>Compiling the results.</title>
|
||||
<programlisting><![CDATA[
|
||||
./autogen.sh --without-openssl --without-nss --without-gnutls --without-gcrypt \
|
||||
--with-mycrypto=$HOME --disable-tmpl-tests
|
||||
make
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-functions">
|
||||
<title>xmlSecCryptoApp* functions.</title>
|
||||
<para>
|
||||
The XML Security Library allows application to load multiple
|
||||
"xmlsec-<crypto> libraries. To prevent symbol conflicts,
|
||||
all "xmlsec-mycrypto" library names MUST start with "xmlSecMyCrypto".
|
||||
However, in some applications (for example, the xmlsec command line
|
||||
utility) that can use any crypto library, would prefer to
|
||||
use a generic function names where possible.
|
||||
The "include/xmlsec/crypto.h" and "include/xmlsec/mycrypto/symbols.h"
|
||||
include files do the magic by mapping "xmlSecMyCrypto*" to
|
||||
"xmlSecCrypto*" names using "XMLSEC_CRYPTO_*" defines.
|
||||
</para>
|
||||
<para>
|
||||
In order to build xmlsec command line utility, the
|
||||
"xmlsec-<crypto>" library must implement several functions.
|
||||
The stubs for all these functions are provided in the "skeleton"
|
||||
we've created. While these functions are not required to be
|
||||
implemented by "xmlsec-<crypto>" library, you should consider
|
||||
doing so (if possible) to simplify testing (thru xmlsec command line
|
||||
utility) and application development.
|
||||
</para>
|
||||
<para>
|
||||
In adition to xmlSecCryptoApp* functions, the xmlsec-<crypto>
|
||||
library MUST implement following xmlSecCrypto* functions:
|
||||
<table>
|
||||
<title>xmlSecCrypto* functions.</title>
|
||||
<tgroup cols="2"><tbody>
|
||||
<row><entry>xmlSecCryptoInit()</entry>
|
||||
<entry>Initializes xmlsec-<crypto> library: registers cryptographic
|
||||
transforms implemented by the library, keys, etc.
|
||||
Please note, that the application might want to intialize
|
||||
the cryprographic library by itself. The default cryprographic
|
||||
library initialization (for example, used by xmlsec utility)
|
||||
is implemented in xmlSecCryptoAppInit() function.
|
||||
</entry></row>
|
||||
<row><entry>xmlSecCryptoShutdown()</entry>
|
||||
<entry>Shuts down xmlsec-<crypto> library.
|
||||
Please note, that the application might want to shutdown
|
||||
the cryprographic library by itself. The default cryprographic
|
||||
library shutdown (for example, used by xmlsec utility)
|
||||
is implemented in xmlSecCryptoAppShutdown() function.
|
||||
</entry></row>
|
||||
<row><entry>xmlSecCryptoKeysMngrInit()</entry>
|
||||
<entry>Adds keys stores implemented by the xmlsec-<crypto> library
|
||||
to the keys manager object.
|
||||
</entry></row>
|
||||
</tbody></tgroup></table>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-klasses">
|
||||
<title>Klasses and objects.</title>
|
||||
<para>The XML Security Library is written in C but it uses some OOP techniques:
|
||||
the objects in the library have "klasses" and there is "klasses" inheritance.
|
||||
(see <link linkend="xmlsec-signature-klasses">signature</link> and
|
||||
<link linkend="xmlsec-encryption-klasses">encryption</link> klasses
|
||||
diagrams). The "klass" is different from C++ "class" (btw, this is
|
||||
one of the reasons why it is spelled differently). The idea of "klasses"
|
||||
used in XML Security Library are close to one in the GLIB/GTK/GNOME
|
||||
and many other C projects. If you ever seen an OOP code written in C
|
||||
you should find everything familiar.
|
||||
</para>
|
||||
<para>XML Security Library "klass" includes three main parts:
|
||||
<itemizedlist>
|
||||
<listitem><para>"Klass" declaration structure that defines "klass" interfaces
|
||||
and global constant data (for example, the human-readable name of
|
||||
the "klass").
|
||||
<example>
|
||||
<title>Base transform "klass" and its child XPath transform "klass" structure.</title>
|
||||
<programlisting><![CDATA[
|
||||
struct _xmlSecTransformKlass {
|
||||
/* data */
|
||||
size_t klassSize;
|
||||
size_t objSize;
|
||||
const xmlChar* name;
|
||||
const xmlChar* href;
|
||||
xmlSecTransformUsage usage;
|
||||
|
||||
/* methods */
|
||||
xmlSecTransformInitializeMethod initialize;
|
||||
xmlSecTransformFinalizeMethod finalize;
|
||||
|
||||
xmlSecTransformNodeReadMethod readNode;
|
||||
xmlSecTransformNodeWriteMethod writeNode;
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
...
|
||||
|
||||
static xmlSecTransformKlass xmlSecTransformXPathKlass = {
|
||||
/* klass/object sizes */
|
||||
sizeof(xmlSecTransformKlass), /* size_t klassSize */
|
||||
xmlSecXPathTransformSize, /* size_t objSize */
|
||||
|
||||
xmlSecNameXPath, /* const xmlChar* name; */
|
||||
xmlSecXPathNs, /* const xmlChar* href; */
|
||||
xmlSecTransformUsageDSigTransform, /* xmlSecTransformUsage usage; */
|
||||
|
||||
xmlSecTransformXPathInitialize, /* xmlSecTransformInitializeMethod initialize; */
|
||||
xmlSecTransformXPathFinalize, /* xmlSecTransformFinalizeMethod finalize; */
|
||||
xmlSecTransformXPathNodeRead, /* xmlSecTransformNodeReadMethod readNode; */
|
||||
NULL, /* xmlSecTransformNodeWriteMethod writeNode; */
|
||||
|
||||
...
|
||||
};
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>"Klass" id which is simply a pointer to the "klass"
|
||||
declaration strucutre. "Klass" id is used to bind "klass" objects
|
||||
to the "klass" declaration and to pass "klass" strucutre to functions.
|
||||
<example>
|
||||
<title>Base transform "klass" id declaration and its child XPath transform "klass" id implementation.</title>
|
||||
<programlisting><![CDATA[
|
||||
typedef const struct _xmlSecTransformKlass xmlSecTransformKlass, *xmlSecTransformId;
|
||||
|
||||
...
|
||||
|
||||
#define xmlSecTransformXPathId xmlSecTransformXPathGetKlass()
|
||||
|
||||
...
|
||||
|
||||
xmlSecTransformId
|
||||
xmlSecTransformXPathGetKlass(void) {
|
||||
return(&xmlSecTransformXPathKlass);
|
||||
}
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>"Klass" object structure that contains object specific
|
||||
data. The child object specific data are placed after the parent "klass"
|
||||
object data.
|
||||
<example>
|
||||
<title>Base transform object strucutre and its child XPath transform object.</title>
|
||||
<programlisting><![CDATA[
|
||||
struct _xmlSecTransform {
|
||||
xmlSecTransformId id;
|
||||
xmlSecTransformOperation operation;
|
||||
xmlSecTransformStatus status;
|
||||
xmlNodePtr hereNode;
|
||||
|
||||
/* transforms chain */
|
||||
xmlSecTransformPtr next;
|
||||
xmlSecTransformPtr prev;
|
||||
|
||||
...
|
||||
};
|
||||
|
||||
...
|
||||
|
||||
/******************************************************************************
|
||||
*
|
||||
* XPath/XPointer transforms
|
||||
*
|
||||
* xmlSecPtrList with XPath expressions is located after xmlSecTransform structure
|
||||
*
|
||||
*****************************************************************************/
|
||||
#define xmlSecXPathTransformSize \
|
||||
(sizeof(xmlSecTransform) + sizeof(xmlSecPtrList))
|
||||
#define xmlSecXPathTransformGetDataList(transform) \
|
||||
((xmlSecTransformCheckSize((transform), xmlSecXPathTransformSize)) ? \
|
||||
(xmlSecPtrListPtr)(((unsigned char*)(transform)) + sizeof(xmlSecTransform)) : \
|
||||
(xmlSecPtrListPtr)NULL)
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-transforms">
|
||||
<title>Cryptographic transforms.</title>
|
||||
<para>The cryptographic transforms (digests, signatures and encryption)
|
||||
implementation is the main goal of "xmlsec-<crypto>" library.
|
||||
Most of the cryptographic <link linkend="xmlsec-notes-transforms">transforms</link>
|
||||
use default <structfield>pushBin</structfield> and <structfield>popBin</structfield>
|
||||
methods and provide custom <link linkend="xmlSecTransformExecuteMethod">execute</link> method.
|
||||
The binary transform <link linkend="xmlSecTransformExecuteMethod">execute</link> method
|
||||
processes data from the input buffer
|
||||
<structfield>inBuf</structfield> and pushes results to
|
||||
<structfield>outBuf</structfield>. The transform should try to
|
||||
consume and remove data from <structfield>inBuf</structfield> buffer
|
||||
as soon as the data became available. However, it might happen
|
||||
that current data size in the input buffer is not enough (for example,
|
||||
RSA-PKCS1 algorithm requires that all the data are available in
|
||||
one buffer). In this case, transform might keep the data in the
|
||||
input buffer till the next call to
|
||||
<link linkend="xmlSecTransformExecuteMethod">execute</link>
|
||||
method. The "last" parameter of the
|
||||
<link linkend="xmlSecTransformExecuteMethod">execute</link>
|
||||
indicates that transform MUST process all the data in the input buffer
|
||||
and return as much as possible in the output buffer. The
|
||||
<link linkend="xmlSecTransformExecuteMethod">execute</link> method
|
||||
might be called multiple times with non-zero "last" parameter until
|
||||
the transforms returns nothing
|
||||
in the output buffer. In addition, the transform implementation is
|
||||
responsible for managing the transform <structfield>status</structfield>
|
||||
variable.
|
||||
<table>
|
||||
<title>Typical transform status managing.</title>
|
||||
<tgroup cols="2"><tbody>
|
||||
<row><entry>xmlSecTransformStatusNone</entry>
|
||||
<entry>Transform initializes itself (for example, cipher transform
|
||||
generates or reads IV) and sets <structfield>status</structfield>
|
||||
variable to xmlSecTransformStatusWorking.</entry></row>
|
||||
<row><entry>xmlSecTransformStatusWorking</entry>
|
||||
<entry>Transform process the next (if "last" parameter is zero) or
|
||||
last block of data (if "last" parameter is non-zero).
|
||||
When transform returns all the data, it sets the
|
||||
<structfield>status</structfield> variable to
|
||||
xmlSecTransformStatusFinished.</entry></row>
|
||||
<row><entry>xmlSecTransformStatusFinished</entry>
|
||||
<entry>Transform returns no data to indicate that it finished
|
||||
processing.</entry></row>
|
||||
</tbody></tgroup></table>
|
||||
</para>
|
||||
<para>In adition to <link linkend="xmlSecTransformExecuteMethod">execute</link>
|
||||
methods, signature, hmac or digest transforms
|
||||
MUST implement <link linkend="xmlSecTransformVerifyMethod">verify</link> method.
|
||||
The <link linkend="xmlSecTransformVerifyMethod">verify</link> method is called
|
||||
after transform execution is finished. The
|
||||
<link linkend="xmlSecTransformVerifyMethod">verify</link> method implementation
|
||||
must set the "status" member to <link linkend="xmlSecTransformStatusOk">xmlSecTransformStatusOk</link>
|
||||
if signature, hmac or digest is successfully verified or to
|
||||
<link linkend="xmlSecTransformStatusFail">xmlSecTransformStatusFail</link>
|
||||
otherwise.
|
||||
</para>
|
||||
<para>The transforms that require a key (signature or encryption
|
||||
transforms, for example) MUST imlpement
|
||||
<link linkend="xmlSecTransformSetKeyRequirementsMethod">setKeyReq</link>
|
||||
(prepares the <link linkend="xmlSecKeyReq">key requirements</link>
|
||||
for key search) and
|
||||
<link linkend="xmlSecTransformSetKeyMethod">setKey</link>
|
||||
(sets the key in the transform) methods.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-keys">
|
||||
<title>Keys data and keys data stores.</title>
|
||||
<para>
|
||||
There are two key data types: key value data (for example, AES, DES, DSA,
|
||||
HMAC or RSA key data) and others (for example, key name, X509 or PGP data).
|
||||
The key data implementation should implement at least one of
|
||||
<link linkend="xmlSecKeyDataXmlReadMethod">xmlRead</link>
|
||||
or <link linkend="xmlSecKeyDataBinReadMethod">binRead</link> methods.
|
||||
</para>
|
||||
<para>TODO</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-simple-keys-mngr">
|
||||
<title>Default keys manager.</title>
|
||||
<para>Any "xmlsec-<crypto>" library implementation must provide
|
||||
a default keys store. The XML Security Library has a built-in flat
|
||||
list based <link linkend="xmlSecSimpleKeysStoreId">simple keys
|
||||
store</link> which could be used if cryptographic library does not
|
||||
have one itself.
|
||||
</para>
|
||||
</sect1>
|
||||
<sect1 id="xmlsec-notes-new-crypto-sharing-results">
|
||||
<title>Sharing the results.</title>
|
||||
<para>If you implemented support for new cryptographic library
|
||||
(or extended an existing one) and both you and your company/university/...
|
||||
are willing to share the code I would be glad to add your work
|
||||
to XML Security Library. Many people will thank you for this
|
||||
and will use your library. Of course, you'll get all the credits
|
||||
for your work.
|
||||
</para>
|
||||
<para>The best way to submit your enchancements is to send a pull request
|
||||
through <ulink URL="https://github.com/lsh123/xmlsec">GitHub</ulink>.
|
||||
I will try to review and merge your pool request as soon as possible.
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
|
|
@ -1,286 +0,0 @@
|
|||
<chapter id="xmlsec-notes-sign-encrypt">
|
||||
<title>Signing and encrypting documents.</title>
|
||||
<sect1 id="xmlsec-notes-sign-encrypt-overview">
|
||||
<title>Overview.</title>
|
||||
<para>XML Security Library performs signature or encryption by processing
|
||||
input xml or binary data and a template that specifies a signature or
|
||||
encryption skeleton: the transforms, algorithms, the key selection
|
||||
process. A template has the same structure as the desired result but
|
||||
some of the nodes are empty. XML Security Library gets the key for
|
||||
signature/encryption from keys managers using the information from
|
||||
the template, does necessary computations and puts the results in
|
||||
the template. Signature or encryption context controls the whole
|
||||
process and stores the required temporary data.
|
||||
<figure>
|
||||
<title>The signature or encryption processing model.</title>
|
||||
<graphic fileref="images/sign-enc-model.png" align="center"></graphic>
|
||||
</figure>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-sign" >
|
||||
<title>Signing a document.</title>
|
||||
<para>The typical signature process includes following steps:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Prepare data for signature.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create or load signature template and select start
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-Signature"><dsig:Signature/></ulink>
|
||||
node.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create signature context <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
using <link linkend="xmlSecDSigCtxCreate">xmlSecDSigCtxCreate</link> or
|
||||
<link linkend="xmlSecDSigCtxInitialize">xmlSecDSigCtxInitialize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Load signature key in <link linkend="xmlSecKeysMngr">keys manager</link>
|
||||
or generate a session key and set it in the signature context
|
||||
(<structfield>signKey</structfield> member of
|
||||
<link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link> structure).
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Sign data by calling <link linkend="xmlSecDSigCtxSign">xmlSecDSigCtxSign</link>
|
||||
function.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Check returned value and consume signed data.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Destroy signature context <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
using <link linkend="xmlSecDSigCtxDestroy">xmlSecDSigCtxDestroy</link> or
|
||||
<link linkend="xmlSecDSigCtxFinalize">xmlSecDSigCtxFinalize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Signing a template.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* sign_file:
|
||||
* @tmpl_file: the signature template file name.
|
||||
* @key_file: the PEM private key file name.
|
||||
*
|
||||
* Signs the #tmpl_file using private key from #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
sign_file(const char* tmpl_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecDSigCtxPtr dsigCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(tmpl_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(tmpl_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create signature context, we don't need keys manager in this example */
|
||||
dsigCtx = xmlSecDSigCtxCreate(NULL);
|
||||
if(dsigCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create signature context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load private key, assuming that there is not password */
|
||||
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(dsigCtx->signKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* sign the template */
|
||||
if(xmlSecDSigCtxSign(dsigCtx, node) < 0) {
|
||||
fprintf(stderr,"Error: signature failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print signed document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(dsigCtx != NULL) {
|
||||
xmlSecDSigCtxDestroy(dsigCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-sign1">Full program listing</link></simpara>
|
||||
<simpara><link linkend="xmlsec-example-sign1-tmpl">Simple signature template file</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-encrypt">
|
||||
<title>Encrypting data.</title>
|
||||
<para>The typical encryption process includes following steps:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Prepare data for encryption.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create or load encryption template and select start
|
||||
<enc:EncryptedData/> node.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create encryption context <link linkend="xmlSecEncCtx">xmlSecEncCtx</link>
|
||||
using <link linkend="xmlSecEncCtxCreate">xmlSecEncCtxCreate</link> or
|
||||
<link linkend="xmlSecEncCtxInitialize">xmlSecEncCtxInitialize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Load encryption key in <link linkend="xmlSecKeysMngr">keys manager</link>
|
||||
or generate a session key and set it in the encryption context
|
||||
(<structfield>encKey</structfield> member of
|
||||
<link linkend="xmlSecEncCtx">xmlSecEncCtx</link> structure).
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Encrypt data by calling one of the following functions:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecEncCtxBinaryEncrypt">xmlSecEncCtxBinaryEncrypt</link>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecEncCtxXmlEncrypt">xmlSecEncCtxXmlEncrypt</link>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecEncCtxUriEncrypt">xmlSecEncCtxUriEncrypt</link>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Check returned value and if necessary consume encrypted data.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Destroy encryption context <link linkend="xmlSecEncCtx">xmlSecEncCtx</link>
|
||||
using <link linkend="xmlSecEncCtxDestroy">xmlSecEncCtxDestroy</link> or
|
||||
<link linkend="xmlSecEncCtxFinalize">xmlSecEncCtxFinalize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Encrypting binary data with a template.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* encrypt_file:
|
||||
* @tmpl_file: the encryption template file name.
|
||||
* @key_file: the Triple DES key file.
|
||||
* @data: the binary data to encrypt.
|
||||
* @dataSize: the binary data size.
|
||||
*
|
||||
* Encrypts binary #data using template from #tmpl_file and DES key from
|
||||
* #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
encrypt_file(const char* tmpl_file, const char* key_file, const unsigned char* data, size_t dataSize) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(tmpl_file);
|
||||
assert(key_file);
|
||||
assert(data);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(tmpl_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* encrypt the data */
|
||||
if(xmlSecEncCtxBinaryEncrypt(encCtx, node, data, dataSize) < 0) {
|
||||
fprintf(stderr,"Error: encryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print encrypted data with document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-encrypt1">Full program listing</link></simpara>
|
||||
<simpara><link linkend="xmlsec-example-encrypt1-tmpl">Simple encryption template file</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
<chapter id="xmlsec-notes-contexts">
|
||||
<title>Using context objects.</title>
|
||||
<para>The great flexibility of XML Digital Signature and XML Encryption
|
||||
specification is one of the most interesting and in the same time,
|
||||
most dangerouse feature for an application developer.
|
||||
For example, XPath and XSLT transform can make it very difficult
|
||||
to find out what exactly was signed by just looking at the
|
||||
transforms and the input data. Many protocols based on
|
||||
XML Digital Signature and XML Encryption restrict allowed
|
||||
key data types, allowed transforms or possible input data.
|
||||
For example, signature in a simple SAML Response should have only
|
||||
one <dsig:Reference/> element with an empty or NULL
|
||||
URI attribute and only one enveloped transform.
|
||||
XML Security Library uses "context" objects to let application
|
||||
enable or disable particular features, return the result
|
||||
data and the information collected during the processing.
|
||||
Also all the context objects defined in XML Security library have
|
||||
a special <structfield>userData</structfield> member which could
|
||||
be used by application to pass application specific data around.
|
||||
XML Security Library never use this field.
|
||||
The application creates a new
|
||||
<link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
or <link linkend="xmlSecEncCtx">xmlSecEncCtx</link> object for each
|
||||
operation, sets necessary options and consumes result returned
|
||||
in the context after signature, verification, encryption or decryption.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>SAML signature validation.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* verify_file:
|
||||
* @mngr: the pointer to keys manager.
|
||||
* @xml_file: the signed XML file name.
|
||||
*
|
||||
* Verifies XML signature in #xml_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
verify_file(xmlSecKeysMngrPtr mngr, const char* xml_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecDSigCtxPtr dsigCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(mngr);
|
||||
assert(xml_file);
|
||||
|
||||
/* load file */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create signature context */
|
||||
dsigCtx = xmlSecDSigCtxCreate(mngr);
|
||||
if(dsigCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create signature context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* limit the Reference URI attributes to empty or NULL */
|
||||
dsigCtx->enabledReferenceUris = xmlSecTransformUriTypeEmpty;
|
||||
|
||||
/* limit allowed transforms for signature and reference processing */
|
||||
if((xmlSecDSigCtxEnableSignatureTransform(dsigCtx, xmlSecTransformInclC14NId) < 0) ||
|
||||
(xmlSecDSigCtxEnableSignatureTransform(dsigCtx, xmlSecTransformExclC14NId) < 0) ||
|
||||
(xmlSecDSigCtxEnableSignatureTransform(dsigCtx, xmlSecTransformSha1Id) < 0) ||
|
||||
(xmlSecDSigCtxEnableSignatureTransform(dsigCtx, xmlSecTransformRsaSha1Id) < 0)) {
|
||||
|
||||
fprintf(stderr,"Error: failed to limit allowed signature transforms\n");
|
||||
goto done;
|
||||
}
|
||||
if((xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformInclC14NId) < 0) ||
|
||||
(xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformExclC14NId) < 0) ||
|
||||
(xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformSha1Id) < 0) ||
|
||||
(xmlSecDSigCtxEnableReferenceTransform(dsigCtx, xmlSecTransformEnvelopedId) < 0)) {
|
||||
|
||||
fprintf(stderr,"Error: failed to limit allowed reference transforms\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* in addition, limit possible key data to valid X509 certificates only */
|
||||
if(xmlSecPtrListAdd(&(dsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecKeyDataX509Id) < 0) {
|
||||
fprintf(stderr,"Error: failed to limit allowed key data\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Verify signature */
|
||||
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
|
||||
fprintf(stderr,"Error: signature verify\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* check that we have only one Reference */
|
||||
if((dsigCtx->status == xmlSecDSigStatusSucceeded) &&
|
||||
(xmlSecPtrListGetSize(&(dsigCtx->signedInfoReferences)) != 1)) {
|
||||
|
||||
fprintf(stderr,"Error: only one reference is allowed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print verification result to stdout */
|
||||
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
|
||||
fprintf(stdout, "Signature is OK\n");
|
||||
} else {
|
||||
fprintf(stdout, "Signature is INVALID\n");
|
||||
}
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(dsigCtx != NULL) {
|
||||
xmlSecDSigCtxDestroy(dsigCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<chapter id="xmlsec-notes-keys">
|
||||
<title>Keys.</title>
|
||||
<para>A key in XML Security Library is a representation of the
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-KeyInfo"><dsig:KeyInfo/></ulink>
|
||||
element and consist of several key data objects.
|
||||
The "value" key data usually contains raw key material (or handlers to
|
||||
key material) required to execute particular crypto transform. Other
|
||||
key data objects may contain any additional information about the key.
|
||||
All the key data objects in the key are associated with the same key
|
||||
material. For example, if a DSA key material has both an X509
|
||||
certificate and a PGP data associated with it then such a key can
|
||||
have a DSA key "value" and two key data objects for X509 certificate
|
||||
and PGP key data.
|
||||
</para>
|
||||
<figure>
|
||||
<title>The key structure.</title>
|
||||
<graphic fileref="images/key.png" align="center"></graphic>
|
||||
</figure>
|
||||
<para>XML Security Library has several "invisible" key data classes.
|
||||
These classes never show up in the keys data list of a key but are used for
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-KeyInfo"><dsig:KeyInfo/></ulink>
|
||||
children processing (<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-KeyName"><dsig:KeyName/></ulink>,
|
||||
<enc:EncryptedKey/>, ...). As with transforms, application might
|
||||
add any new key data objects or replace the default ones.
|
||||
</para>
|
||||
</chapter>
|
|
@ -1,592 +0,0 @@
|
|||
<chapter id="xmlsec-notes-keysmngr">
|
||||
<title>Keys manager.</title>
|
||||
<sect1 id="xmlsec-notes-keysmngr-overview">
|
||||
<title>Overview.</title>
|
||||
<para>Processing some of the key data objects require additional
|
||||
information which is global across the application (or in the
|
||||
particular area of the application). For example, X509 certificates
|
||||
processing require a common list of trusted certificates to be
|
||||
available. XML Security Library keeps all the common information
|
||||
for key data processing in a a collection of key data stores called
|
||||
"keys manager".
|
||||
</para>
|
||||
<figure>
|
||||
<title>The keys manager structure.</title>
|
||||
<graphic fileref="images/keysmngr.png" align="center"></graphic>
|
||||
</figure>
|
||||
<para>Keys manager has a special "keys store" which lists the keys
|
||||
known to the application. This "keys store" is used by XML Security
|
||||
Library to lookup keys by name, type and crypto algorithm (for example,
|
||||
during
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-KeyName"><dsig:KeyName/></ulink>
|
||||
processing). The XML Security Library
|
||||
provides default simple "flat list" based implementation of a default keys
|
||||
store. The application can replace it with any other keys store
|
||||
(for example, based on an SQL database).
|
||||
</para>
|
||||
<para>Keys manager is the only object in XML Security Library which
|
||||
is supposed to be shared by many different operations. Usually keys
|
||||
manager is initialized once at the application startup and later is
|
||||
used by XML Security library routines in "read-only" mode. If
|
||||
application or crypto function need to modify any of the key data
|
||||
stores inside keys manager then proper synchronization must be
|
||||
implemented. In the same time, application can create a new keys
|
||||
manager each time it needs to perform XML signature, verification,
|
||||
encryption or decryption.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-simple-keys-store">
|
||||
<title>Simple keys store.</title>
|
||||
<para>
|
||||
XML Security Library has a built-in simple keys store
|
||||
implemented using a keys list. You can use it in your application
|
||||
if you have a small number of keys. However, this might be not a
|
||||
best option from performance point of view if you have a lot of keys.
|
||||
In this case, you probably should implement your own keys store
|
||||
using an SQL database or some other keys storage.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Initializing keys manager and loading keys from PEM files.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* load_keys:
|
||||
* @files: the list of filenames.
|
||||
* @files_size: the number of filenames in #files.
|
||||
*
|
||||
* Creates default keys manager and load PEM keys from #files in it.
|
||||
* The caller is responsible for destroing returned keys manager using
|
||||
* @xmlSecKeysMngrDestroy.
|
||||
*
|
||||
* Returns the pointer to newly created keys manager or NULL if an error
|
||||
* occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
load_keys(char** files, int files_size) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
xmlSecKeyPtr key;
|
||||
int i;
|
||||
|
||||
assert(files);
|
||||
assert(files_size > 0);
|
||||
|
||||
/* create and initialize keys manager, we use a default list based
|
||||
* keys manager, implement your own xmlSecKeysStore klass if you need
|
||||
* something more sophisticated
|
||||
*/
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
return(NULL);
|
||||
}
|
||||
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for(i = 0; i < files_size; ++i) {
|
||||
assert(files[i]);
|
||||
|
||||
/* load key */
|
||||
key = xmlSecCryptoAppKeyLoad(files[i], xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load pem key from \"%s\"\n", files[i]);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add key to keys manager, from now on keys manager is responsible
|
||||
* for destroying key
|
||||
*/
|
||||
if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
|
||||
fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(mngr);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-verify2">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-keys-manager-sign-enc">
|
||||
<title>Using keys manager for signatures/encryption.</title>
|
||||
<para>Instead of specifiying signature or encryption key in the
|
||||
corresponding context object (<structfield>signKey</structfield>
|
||||
member of <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
structure or <structfield>encKey</structfield> member of
|
||||
<link linkend="xmlSecEncCtx">xmlSecEncCtx</link> structure),
|
||||
the application can use keys manager to select the
|
||||
signature or encryption key. This is especialy useful
|
||||
when you are encrypting or signing something with a session key
|
||||
which is by itself should be encrypted. The key for the
|
||||
session key encryption in the
|
||||
<ulink URL="http://www.w3.org/TR/xmlenc-core/#sec-EncryptedKey"><EncryptedKey/></ulink>
|
||||
node could be selected using
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-KeyName"><dsig:KeyName/></ulink>
|
||||
node in the template.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Encrypting file using a session key and a permanent key from keys manager.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* load_rsa_keys:
|
||||
* @key_file: the key filename.
|
||||
*
|
||||
* Creates default keys manager and load RSA key from #key_file in it.
|
||||
* The caller is responsible for destroing returned keys manager using
|
||||
* @xmlSecKeysMngrDestroy.
|
||||
*
|
||||
* Returns the pointer to newly created keys manager or NULL if an error
|
||||
* occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
load_rsa_keys(char* key_file) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
xmlSecKeyPtr key;
|
||||
|
||||
assert(key_file);
|
||||
|
||||
/* create and initialize keys manager, we use a default list based
|
||||
* keys manager, implement your own xmlSecKeysStore klass if you need
|
||||
* something more sophisticated
|
||||
*/
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
return(NULL);
|
||||
}
|
||||
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* load private RSA key */
|
||||
key = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load rsa key from file \"%s\"\n", key_file);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(key, BAD_CAST key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add key to keys manager, from now on keys manager is responsible
|
||||
* for destroying key
|
||||
*/
|
||||
if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
|
||||
fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", key_file);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(mngr);
|
||||
}
|
||||
|
||||
/**
|
||||
* encrypt_file:
|
||||
* @mngr: the pointer to keys manager.
|
||||
* @xml_file: the encryption template file name.
|
||||
* @key_name: the RSA key name.
|
||||
*
|
||||
* Encrypts #xml_file using a dynamicaly created template, a session DES key
|
||||
* and an RSA key from keys manager.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
encrypt_file(xmlSecKeysMngrPtr mngr, const char* xml_file, const char* key_name) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr encDataNode = NULL;
|
||||
xmlNodePtr keyInfoNode = NULL;
|
||||
xmlNodePtr encKeyNode = NULL;
|
||||
xmlNodePtr keyInfoNode2 = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(mngr);
|
||||
assert(xml_file);
|
||||
assert(key_name);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption template to encrypt XML file and replace
|
||||
* its content with encryption result */
|
||||
encDataNode = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
|
||||
NULL, xmlSecTypeEncElement, NULL, NULL);
|
||||
if(encDataNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to create encryption template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we want to put encrypted data in the <enc:CipherValue/> node */
|
||||
if(xmlSecTmplEncDataEnsureCipherValue(encDataNode) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add CipherValue node\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> */
|
||||
keyInfoNode = xmlSecTmplEncDataEnsureKeyInfo(encDataNode, NULL);
|
||||
if(keyInfoNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <enc:EncryptedKey/> to store the encrypted session key */
|
||||
encKeyNode = xmlSecTmplKeyInfoAddEncryptedKey(keyInfoNode,
|
||||
xmlSecTransformRsaOaepId,
|
||||
NULL, NULL, NULL);
|
||||
if(encKeyNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we want to put encrypted key in the <enc:CipherValue/> node */
|
||||
if(xmlSecTmplEncDataEnsureCipherValue(encKeyNode) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add CipherValue node\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to <enc:EncryptedKey/> */
|
||||
keyInfoNode2 = xmlSecTmplEncDataEnsureKeyInfo(encKeyNode, NULL);
|
||||
if(keyInfoNode2 == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name so we can lookup key when needed */
|
||||
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode2, key_name) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key name\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context */
|
||||
encCtx = xmlSecEncCtxCreate(mngr);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* generate a Triple DES key */
|
||||
encCtx->encKey = xmlSecKeyGenerate(xmlSecKeyDataDesId, 192, xmlSecKeyDataTypeSession);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to generate session des key\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* encrypt the data */
|
||||
if(xmlSecEncCtxXmlEncrypt(encCtx, encDataNode, xmlDocGetRootElement(doc)) < 0) {
|
||||
fprintf(stderr,"Error: encryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we template is inserted in the doc */
|
||||
encDataNode = NULL;
|
||||
|
||||
/* print encrypted data with document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(encDataNode != NULL) {
|
||||
xmlFreeNode(encDataNode);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-encrypt3">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-keys-mngr-verify-decrypt">
|
||||
<title>Using keys manager for verification/decryption.</title>
|
||||
<para>If more than one key could be used for signature or encryption,
|
||||
then using <structfield>signKey</structfield> member of
|
||||
<link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link> structure or
|
||||
<structfield>encKey</structfield> member of
|
||||
<link linkend="xmlSecEncCtx">xmlSecEncCtx</link> structure
|
||||
is not possible. Instead, the application should load known keys in
|
||||
the keys manager and use <dsig:KeyName/> element to specify
|
||||
the key name.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Initializing keys manager and loading DES keys from binary files.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* load_des_keys:
|
||||
* @files: the list of filenames.
|
||||
* @files_size: the number of filenames in #files.
|
||||
*
|
||||
* Creates default keys manager and load DES keys from #files in it.
|
||||
* The caller is responsible for destroing returned keys manager using
|
||||
* @xmlSecKeysMngrDestroy.
|
||||
*
|
||||
* Returns the pointer to newly created keys manager or NULL if an error
|
||||
* occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
load_des_keys(char** files, int files_size) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
xmlSecKeyPtr key;
|
||||
int i;
|
||||
|
||||
assert(files);
|
||||
assert(files_size > 0);
|
||||
|
||||
/* create and initialize keys manager, we use a default list based
|
||||
* keys manager, implement your own xmlSecKeysStore klass if you need
|
||||
* something more sophisticated
|
||||
*/
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
return(NULL);
|
||||
}
|
||||
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for(i = 0; i < files_size; ++i) {
|
||||
assert(files[i]);
|
||||
|
||||
/* load DES key */
|
||||
key = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, files[i]);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", files[i]);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add key to keys manager, from now on keys manager is responsible
|
||||
* for destroying key
|
||||
*/
|
||||
if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
|
||||
fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(mngr);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-decrypt2">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-custom-keys-store">
|
||||
<title>Implementing a custom keys store.</title>
|
||||
<para>In many cases, a default built-in list based keys store
|
||||
is not good enough. For example, XML Security Library (and
|
||||
the built-in default keys store) have no synchronization and
|
||||
you'll need to implement a custom keys store if you want to
|
||||
add or remove keys while other threads use the store.</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Creating a custom keys manager.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* create_files_keys_mngr:
|
||||
*
|
||||
* Creates a files based keys manager: we assume that key name is
|
||||
* the key file name,
|
||||
*
|
||||
* Returns pointer to newly created keys manager or NULL if an error occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
create_files_keys_mngr(void) {
|
||||
xmlSecKeyStorePtr keysStore;
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
|
||||
/* create files based keys store */
|
||||
keysStore = xmlSecKeyStoreCreate(files_keys_store_get_klass());
|
||||
if(keysStore == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys store.\n");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* create keys manager */
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
xmlSecKeyStoreDestroy(keysStore);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add store to keys manager, from now on keys manager destroys the store if needed */
|
||||
if(xmlSecKeysMngrAdoptKeysStore(mngr, keysStore) < 0) {
|
||||
fprintf(stderr, "Error: failed to add keys store to keys manager.\n");
|
||||
xmlSecKeyStoreDestroy(keysStore);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* initialize crypto library specific data in keys manager */
|
||||
if(xmlSecCryptoKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize crypto data in keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set the get key callback */
|
||||
mngr->getKey = xmlSecKeysMngrGetKey;
|
||||
return(mngr);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Files Keys Store: we assume that key's name (content of the
|
||||
* <dsig:KeyName/> element is a name of the file with a key.
|
||||
* Attention: this probably not a good solution for high traffic systems.
|
||||
*
|
||||
***************************************************************************/
|
||||
static xmlSecKeyPtr files_keys_store_find_key (xmlSecKeyStorePtr store,
|
||||
const xmlChar* name,
|
||||
xmlSecKeyInfoCtxPtr keyInfoCtx);
|
||||
static xmlSecKeyStoreKlass files_keys_store_klass = {
|
||||
sizeof(xmlSecKeyStoreKlass),
|
||||
sizeof(xmlSecKeyStore),
|
||||
BAD_CAST "files-based-keys-store", /* const xmlChar* name; */
|
||||
NULL, /* xmlSecKeyStoreInitializeMethod initialize; */
|
||||
NULL, /* xmlSecKeyStoreFinalizeMethod finalize; */
|
||||
files_keys_store_find_key, /* xmlSecKeyStoreFindKeyMethod findKey; */
|
||||
|
||||
/* reserved for the future */
|
||||
NULL, /* void* reserved0; */
|
||||
NULL, /* void* reserved1; */
|
||||
};
|
||||
|
||||
/**
|
||||
* files_keys_store_get_klass:
|
||||
*
|
||||
* The files based keys store klass: we assume that key name is the
|
||||
* key file name,
|
||||
*
|
||||
* Returns files based keys store klass.
|
||||
*/
|
||||
xmlSecKeyStoreId
|
||||
files_keys_store_get_klass(void) {
|
||||
return(&files_keys_store_klass);
|
||||
}
|
||||
|
||||
/**
|
||||
* files_keys_store_find_key:
|
||||
* @store: the pointer to default keys store.
|
||||
* @name: the desired key name.
|
||||
* @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
|
||||
*
|
||||
* Lookups key in the @store.
|
||||
*
|
||||
* Returns pointer to key or NULL if key not found or an error occurs.
|
||||
*/
|
||||
static xmlSecKeyPtr
|
||||
files_keys_store_find_key(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) {
|
||||
xmlSecKeyPtr key;
|
||||
const xmlChar* p;
|
||||
|
||||
assert(store);
|
||||
assert(keyInfoCtx);
|
||||
|
||||
/* it's possible to do not have the key name or desired key type
|
||||
* but we could do nothing in this case */
|
||||
if((name == NULL) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataIdUnknown)){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* we don't want to open files in a folder other than "current";
|
||||
* to prevent it limit the characters in the key name to alpha/digit,
|
||||
* '.', '-' or '_'.
|
||||
*/
|
||||
for(p = name; (*p) != '\0'; ++p) {
|
||||
if(!isalnum((*p)) && ((*p) != '.') && ((*p) != '-') && ((*p) != '_')) {
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if((keyInfoCtx->keyReq.keyId == xmlSecKeyDataDsaId) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataRsaId)) {
|
||||
/* load key from a pem file, if key is not found then it's an error (is it?) */
|
||||
key = xmlSecCryptoAppKeyLoad(name, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load pem key from \"%s\"\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
} else {
|
||||
/* otherwise it's a binary key, if key is not found then it's an error (is it?) */
|
||||
key = xmlSecKeyReadBinaryFile(keyInfoCtx->keyReq.keyId, name);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load key from binary file \"%s\"\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* set key name */
|
||||
if(xmlSecKeySetName(key, name) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", name);
|
||||
xmlSecKeyDestroy(key);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(key);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-decrypt3">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -1,67 +0,0 @@
|
|||
<chapter id="xmlsec-notes-transforms">
|
||||
<title>Transforms and transforms chain.</title>
|
||||
<para>XML Digital Signature and XML Encryption standards are
|
||||
very flexible and provide an XML developer many different ways to
|
||||
sign or encrypt any part (or even parts) of an XML document.
|
||||
The key for such great flexibility is the "transforms" model.
|
||||
Transform is defined as a method of pre-processing binary or XML data
|
||||
before calculating digest or signature. XML Security Library extends
|
||||
this definition and names "transform" any operation performed on
|
||||
the data: reading data from an URI, xml parsing, xml transformation,
|
||||
calculation digest, encrypting or decrypting. Each XML Security Library
|
||||
transform provides at least one of the following callbacks:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecTransformPushBinMethod">push binary data</link>;
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecTransformPushXmlMethod">push xml data</link>;
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecTransformPopBinMethod">pop binary data</link>;
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecTransformPopXmlMethod">pop xml data</link>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>One additional <link linkend="xmlSecTransformExecuteMethod">execute</link>
|
||||
callback was added to simplify the development and reduce code size.
|
||||
This callback is used by default
|
||||
implementations of the four external callbacks from the list above.
|
||||
For example, most of the crypto transforms could be implemented by
|
||||
just implementing one "execute" callback and using default push/pop
|
||||
binary data callbacks. However, in some cases using push/pop callbacks
|
||||
directly is more efficient.
|
||||
</para>
|
||||
<figure>
|
||||
<title>The XML Security Library transform.</title>
|
||||
<graphic fileref="images/transform.png" align="center"></graphic>
|
||||
</figure>
|
||||
<para>XML Security Library constructs transforms chain according to the
|
||||
signature/encryption template or signed/encrypted document.
|
||||
If necessary, XML Security Library inserts XML parser or defaul
|
||||
canonicalization to ensure that the output data type (binary or XML)
|
||||
of previous transform matches the input of the next transform.
|
||||
</para>
|
||||
<para>The data are processed by pushing through or poping from the chain
|
||||
depending on the transforms in the chain. For example, then binary
|
||||
data chunk is pushed through a binary-to-binary transform, it
|
||||
processes this chunk and pushes the result to the next transform
|
||||
in the chain.
|
||||
</para>
|
||||
<figure>
|
||||
<title>Transforms chain created for <dsig:Reference/> element processing.</title>
|
||||
<graphic fileref="images/transforms-chain.png" align="center"></graphic>
|
||||
</figure>
|
||||
|
||||
<para>
|
||||
<example>
|
||||
<title>Walking through transforms chain.</title>
|
||||
<programlisting><![CDATA[
|
||||
TODO
|
||||
]]></programlisting>
|
||||
</example>
|
||||
</para>
|
||||
</chapter>
|
||||
|
|
@ -1,197 +0,0 @@
|
|||
<chapter id="xmlsec-notes-x509">
|
||||
<title>Using X509 Certificates.</title>
|
||||
<sect1 id="xmlsec-notes-x509-overview">
|
||||
<title>Overview.</title>
|
||||
<para>X509 certificate is one of many possible keys data object that can be
|
||||
associated with a key. Application may read and write X509 data
|
||||
from/to XML file. The X509 certificates management policies significantly
|
||||
vary from one crypto library to another. The examples in this chapter
|
||||
were tested with OpenSSL and they might be broken if anither crypto
|
||||
engine is used. Check API reference documentation for more specific
|
||||
information about your crypto engine.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-sign-x509" >
|
||||
<title>Signing data with X509 certificate.</title>
|
||||
<para>To sign a file using X509 certificate,
|
||||
an application need to associate the certificate (or certificates)
|
||||
with the private key using one of the following functions:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecOpenSSLAppKeyCertLoad">xmlSecOpenSSLAppKeyCertLoad</link> - loads
|
||||
certificate from a file and adds to the key;
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecOpenSSLAppPkcs12Load">xmlSecOpenSSLAppPkcs12Load</link> -
|
||||
loads private key and all the certificates associated with it from a PKCS12 file;
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
<link linkend="xmlSecKeyAdoptData">xmlSecKeyAdoptData</link> - low level
|
||||
function to add key data (including X509 key data) to the key.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
<example>
|
||||
<title>Loading private key and X509 certificate.</title>
|
||||
<programlisting><![CDATA[
|
||||
/* load private key, assuming that there is not password */
|
||||
key = xmlSecCryptoAppKeyLoad(key_file, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load private pem key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load certificate and add to the key */
|
||||
if(xmlSecCryptoAppKeyCertLoad(key, cert_file, xmlSecKeyDataFormatPem) < 0) {
|
||||
fprintf(stderr,"Error: failed to load pem certificate \"%s\"\n", cert_file);
|
||||
goto done;
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-sign3">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
<para>Next step is to prepare signature template with <dsig:X509Data/>
|
||||
child of the <dsig:KeyInfo/> element. When XML Security Library finds
|
||||
this node in the template, it automaticaly creates <dsig:X509Certificate/>
|
||||
children of the <dsig:X509Data/> element and writes to result XML document
|
||||
all the certificates associated with the signature key.
|
||||
<example>
|
||||
<title>Dynamicaly creating a signature template for signing document using X509 certificate.</title>
|
||||
<programlisting><![CDATA[
|
||||
/* create signature template for RSA-SHA1 enveloped signature */
|
||||
signNode = xmlSecTmplSignatureCreate(doc, xmlSecTransformExclC14NId,
|
||||
xmlSecTransformRsaSha1Id, NULL);
|
||||
if(signNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to create signature template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:Signature/> node to the doc */
|
||||
xmlAddChild(xmlDocGetRootElement(doc), signNode);
|
||||
|
||||
/* add reference */
|
||||
refNode = xmlSecTmplSignatureAddReference(signNode, xmlSecTransformSha1Id,
|
||||
NULL, NULL, NULL);
|
||||
if(refNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add reference to signature template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add enveloped transform */
|
||||
if(xmlSecTmplReferenceAddTransform(refNode, xmlSecTransformEnvelopedId) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add enveloped transform to reference\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> and <dsig:X509Data/> */
|
||||
keyInfoNode = xmlSecTmplSignatureEnsureKeyInfo(signNode, NULL);
|
||||
if(keyInfoNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(xmlSecTmplKeyInfoAddX509Data(keyInfoNode) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add X509Data node\n");
|
||||
goto done;
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-sign3">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-verify-x509" >
|
||||
<title>Verifing document signed with X509 certificates.</title>
|
||||
<para>
|
||||
If the document is signed with an X509 certificate then the signature
|
||||
verification consist of two steps:
|
||||
<itemizedlist>
|
||||
<listitem><para>Creating and verifing X509 certificates chain.
|
||||
</para></listitem>
|
||||
<listitem><para>Verifing signature itself using key exrtacted from
|
||||
a certificate verified on previous step.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
Certificates chain is constructed from certificates in a way that
|
||||
each certificate in the chain is signed with previous one:
|
||||
<figure>
|
||||
<title>Certificates chain.</title>
|
||||
<programlisting>
|
||||
Certificate A (signed with B) <- Certificate B (signed with C) <- ... <- Root Certificate (signed by itself)
|
||||
</programlisting>
|
||||
</figure>
|
||||
At the end of the chain there is a "Root Certificate" which
|
||||
is signed by itself. There is no way to verify the validity of the
|
||||
root certificate and application have to "trust" it
|
||||
(another name for root certificates is "trusted" certificates).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Application can use <link linkend="xmlSecCryptoAppKeysMngrCertLoad">xmlSecCryptoAppKeysMngrCertLoad</link>
|
||||
function to load both "trusted" and "un-trusted"
|
||||
certificates. However, the selection of "trusted"
|
||||
certificates is very sensitive process and this function might be
|
||||
not implemented for some crypto engines. In this case, the
|
||||
"trusted" certificates list is loaded during initialization
|
||||
or specified in crypto engine configuration files.
|
||||
Check XML Security Library API reference for more details.
|
||||
<example>
|
||||
<title>Loading trusted X509 certificate.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* load_trusted_certs:
|
||||
* @files: the list of filenames.
|
||||
* @files_size: the number of filenames in #files.
|
||||
*
|
||||
* Creates simple keys manager and load trusted certificates from PEM #files.
|
||||
* The caller is responsible for destroing returned keys manager using
|
||||
* @xmlSecKeysMngrDestroy.
|
||||
*
|
||||
* Returns the pointer to newly created keys manager or NULL if an error
|
||||
* occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
load_trusted_certs(char** files, int files_size) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
int i;
|
||||
|
||||
assert(files);
|
||||
assert(files_size > 0);
|
||||
|
||||
/* create and initialize keys manager, we use a simple list based
|
||||
* keys manager, implement your own xmlSecKeysStore klass if you need
|
||||
* something more sophisticated
|
||||
*/
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
return(NULL);
|
||||
}
|
||||
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for(i = 0; i < files_size; ++i) {
|
||||
assert(files[i]);
|
||||
|
||||
/* load trusted cert */
|
||||
if(xmlSecCryptoAppKeysMngrCertLoad(mngr, files[i], xmlSecKeyDataFormatPem, xmlSecKeyDataTypeTrusted) < 0) {
|
||||
fprintf(stderr,"Error: failed to load pem certificate from \"%s\"\n", files[i]);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(mngr);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-verify3">Full program listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
<chapter id="xmlsec-notes-verify-decrypt">
|
||||
<title>Verifing and decrypting documents.</title>
|
||||
<sect1 id="xmlsec-notes-verify-decrypt-overview">
|
||||
<title>Overview.</title>
|
||||
<para>Since the template is just an XML file, it might be created in advance
|
||||
and saved in a file. It's also possible for application to create
|
||||
templates without using XML Security Library functions. Also in some
|
||||
cases template should be inserted in the signed or encrypted data
|
||||
(for example, if you want to create an enveloped or enveloping
|
||||
signature).</para>
|
||||
<para>Signature verification and data decryption do not require template
|
||||
because all the necessary information is provided in the signed or
|
||||
encrypted document.
|
||||
<figure>
|
||||
<title>The verification or decryption processing model.</title>
|
||||
<graphic fileref="images/verif-dec-model.png" align="center"></graphic>
|
||||
</figure>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-verify" >
|
||||
<title>Verifying a signed document</title>
|
||||
<para>The typical signature verification process includes following steps:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Load keys, X509 certificates, etc. in the <link linkend="xmlSecKeysMngr">keys manager</link> .
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create signature context <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
using <link linkend="xmlSecDSigCtxCreate">xmlSecDSigCtxCreate</link> or
|
||||
<link linkend="xmlSecDSigCtxInitialize">xmlSecDSigCtxInitialize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Select start verification
|
||||
<ulink URL="http://www.w3.org/TR/xmldsig-core/#sec-Signature"><dsig:Signature/></ulink>
|
||||
node in the signed XML document.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Verify signature by calling <link linkend="xmlSecDSigCtxVerify">xmlSecDSigCtxVerify</link>
|
||||
function.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Check returned value and verification status (<structfield>status</structfield>
|
||||
member of <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link> structure).
|
||||
If necessary, consume returned data from the <link linkend="xmlSecDSigCtx">context</link>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Destroy signature context <link linkend="xmlSecDSigCtx">xmlSecDSigCtx</link>
|
||||
using <link linkend="xmlSecDSigCtxDestroy">xmlSecDSigCtxDestroy</link> or
|
||||
<link linkend="xmlSecDSigCtxFinalize">xmlSecDSigCtxFinalize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Verifying a document.</title>
|
||||
<programlisting><![CDATA[
|
||||
/**
|
||||
* verify_file:
|
||||
* @xml_file: the signed XML file name.
|
||||
* @key_file: the PEM public key file name.
|
||||
*
|
||||
* Verifies XML signature in #xml_file using public key from #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
verify_file(const char* xml_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecDSigCtxPtr dsigCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(xml_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load file */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeSignature, xmlSecDSigNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create signature context, we don't need keys manager in this example */
|
||||
dsigCtx = xmlSecDSigCtxCreate(NULL);
|
||||
if(dsigCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create signature context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load public key */
|
||||
dsigCtx->signKey = xmlSecCryptoAppKeyLoad(key_file,xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(dsigCtx->signKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(dsigCtx->signKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Verify signature */
|
||||
if(xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
|
||||
fprintf(stderr,"Error: signature verify\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print verification result to stdout */
|
||||
if(dsigCtx->status == xmlSecDSigStatusSucceeded) {
|
||||
fprintf(stdout, "Signature is OK\n");
|
||||
} else {
|
||||
fprintf(stdout, "Signature is INVALID\n");
|
||||
}
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(dsigCtx != NULL) {
|
||||
xmlSecDSigCtxDestroy(dsigCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-verify1">Full Program Listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="xmlsec-notes-decrypt" >
|
||||
<title>Decrypting an encrypted document</title>
|
||||
<para>The typical decryption process includes following steps:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
Load keys, X509 certificates, etc. in the <link linkend="xmlSecKeysMngr">keys manager</link> .
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Create encryption context <link linkend="xmlSecEncCtx">xmlSecEncCtx</link>
|
||||
using <link linkend="xmlSecEncCtxCreate">xmlSecEncCtxCreate</link> or
|
||||
<link linkend="xmlSecEncCtxInitialize">xmlSecEncCtxInitialize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Select start decryption <enc:EncryptedData> node.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Decrypt by calling <link linkend="xmlSecEncCtxDecrypt">xmlSecencCtxDecrypt</link>
|
||||
function.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Check returned value and if necessary consume encrypted data.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
Destroy encryption context <link linkend="xmlSecEncCtx">xmlSecEncCtx</link>
|
||||
using <link linkend="xmlSecEncCtxDestroy">xmlSecEncCtxDestroy</link> or
|
||||
<link linkend="xmlSecEncCtxFinalize">xmlSecEncCtxFinalize</link>
|
||||
functions.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
<title>Decrypting a document.</title>
|
||||
<programlisting><![CDATA[
|
||||
int
|
||||
decrypt_file(const char* enc_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(enc_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(enc_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* decrypt the data */
|
||||
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
|
||||
fprintf(stderr,"Error: decryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print decrypted data to stdout */
|
||||
if(encCtx->resultReplaced != 0) {
|
||||
fprintf(stdout, "Decrypted XML data:\n");
|
||||
xmlDocDump(stdout, doc);
|
||||
} else {
|
||||
fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
|
||||
if(xmlSecBufferGetData(encCtx->result) != NULL) {
|
||||
fwrite(xmlSecBufferGetData(encCtx->result),
|
||||
1,
|
||||
xmlSecBufferGetSize(encCtx->result),
|
||||
stdout);
|
||||
}
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
]]></programlisting>
|
||||
<simpara><link linkend="xmlsec-example-decrypt1">Full Program Listing</link></simpara>
|
||||
</example>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
|
@ -1,334 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "
|
||||
http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
<!ENTITY chapter-compiling-and-linking SYSTEM "chapters/compiling-and-linking.sgml">
|
||||
<!ENTITY chapter-init-and-shutdown SYSTEM "chapters/init-and-shutdown.sgml">
|
||||
<!ENTITY chapter-sign-and-encrypt SYSTEM "chapters/sign-and-encrypt.sgml">
|
||||
<!ENTITY chapter-verify-and-decrypt SYSTEM "chapters/verify-and-decrypt.sgml">
|
||||
<!ENTITY chapter-creating-templates SYSTEM "chapters/creating-templates.sgml">
|
||||
<!ENTITY chapter-using-keys SYSTEM "chapters/using-keys.sgml">
|
||||
<!ENTITY chapter-using-keysmngr SYSTEM "chapters/using-keysmngr.sgml">
|
||||
<!ENTITY chapter-using-x509-certs SYSTEM "chapters/using-x509-certs.sgml">
|
||||
<!ENTITY chapter-using-transforms SYSTEM "chapters/using-transforms.sgml">
|
||||
<!ENTITY chapter-using-contexts SYSTEM "chapters/using-contexts.sgml">
|
||||
<!ENTITY chapter-new-crypto SYSTEM "chapters/new-crypto.sgml">
|
||||
<!ENTITY chapter-examples SYSTEM "chapters/examples.sgml">
|
||||
|
||||
<!ENTITY xmlsec-index SYSTEM "xmlsec-index.sgml">
|
||||
|
||||
<!ENTITY xmlsec-app "base/app.xml">
|
||||
<!ENTITY xmlsec-base64 "base/base64.xml">
|
||||
<!ENTITY xmlsec-bn "base/bn.xml">
|
||||
<!ENTITY xmlsec-buffer "base/buffer.xml">
|
||||
<!ENTITY xmlsec-dl "base/dl.xml">
|
||||
<!ENTITY xmlsec-errors "base/errors.xml">
|
||||
<!ENTITY xmlsec-io "base/io.xml">
|
||||
<!ENTITY xmlsec-keyinfo "base/keyinfo.xml">
|
||||
<!ENTITY xmlsec-keysdata "base/keysdata.xml">
|
||||
<!ENTITY xmlsec-keys "base/keys.xml">
|
||||
<!ENTITY xmlsec-keysmngr "base/keysmngr.xml">
|
||||
<!ENTITY xmlsec-list "base/list.xml">
|
||||
<!ENTITY xmlsec-membuf "base/membuf.xml">
|
||||
<!ENTITY xmlsec-nodeset "base/nodeset.xml">
|
||||
<!ENTITY xmlsec-parser "base/parser.xml">
|
||||
<!ENTITY xmlsec-templates "base/templates.xml">
|
||||
<!ENTITY xmlsec-transforms "base/transforms.xml">
|
||||
<!ENTITY xmlsec-version "base/version.xml">
|
||||
<!ENTITY xmlsec-x509 "base/x509.xml">
|
||||
<!ENTITY xmlsec-xmldsig "base/xmldsig.xml">
|
||||
<!ENTITY xmlsec-xmlenc "base/xmlenc.xml">
|
||||
<!ENTITY xmlsec-xmlsec "base/xmlsec.xml">
|
||||
<!ENTITY xmlsec-xmltree "base/xmltree.xml">
|
||||
|
||||
<!ENTITY xmlsec-openssl-app "openssl/app.xml">
|
||||
<!ENTITY xmlsec-openssl-bn "openssl/bn.xml">
|
||||
<!ENTITY xmlsec-openssl-crypto "openssl/crypto.xml">
|
||||
<!ENTITY xmlsec-openssl-evp "openssl/evp.xml">
|
||||
<!ENTITY xmlsec-openssl-x509 "openssl/x509.xml">
|
||||
|
||||
<!ENTITY xmlsec-gnutls-app "gnutls/app.xml">
|
||||
<!ENTITY xmlsec-gnutls-crypto "gnutls/crypto.xml">
|
||||
<!ENTITY xmlsec-gnutls-x509 "gnutls/x509.xml">
|
||||
|
||||
<!ENTITY xmlsec-gcrypt-app "gcrypt/app.xml">
|
||||
<!ENTITY xmlsec-gcrypt-crypto "gcrypt/crypto.xml">
|
||||
|
||||
<!ENTITY xmlsec-nss-app "nss/app.xml">
|
||||
<!ENTITY xmlsec-nss-bignum "nss/bignum.xml">
|
||||
<!ENTITY xmlsec-nss-crypto "nss/crypto.xml">
|
||||
<!ENTITY xmlsec-nss-keysstore "nss/keysstore.xml">
|
||||
<!ENTITY xmlsec-nss-pkikeys "nss/pkikeys.xml">
|
||||
<!ENTITY xmlsec-nss-x509 "nss/x509.xml">
|
||||
|
||||
<!ENTITY xmlsec-mscrypto-app "mscrypto/app.xml">
|
||||
<!ENTITY xmlsec-mscrypto-certkeys "mscrypto/certkeys.xml">
|
||||
<!ENTITY xmlsec-mscrypto-crypto "mscrypto/crypto.xml">
|
||||
<!ENTITY xmlsec-mscrypto-keysstore "mscrypto/keysstore.xml">
|
||||
<!ENTITY xmlsec-mscrypto-x509 "mscrypto/x509.xml">
|
||||
|
||||
<!ENTITY xmlsec-mscng-app "mscng/app.xml">
|
||||
<!ENTITY xmlsec-mscng-certkeys "mscng/certkeys.xml">
|
||||
<!ENTITY xmlsec-mscng-crypto "mscng/crypto.xml">
|
||||
<!ENTITY xmlsec-mscng-keysstore "mscng/keysstore.xml">
|
||||
<!ENTITY xmlsec-mscng-x509 "mscng/x509.xml">
|
||||
|
||||
<!ENTITY xmlsec-example-sign1 SYSTEM "examples/sign1.sgml">
|
||||
<!ENTITY xmlsec-example-sign2 SYSTEM "examples/sign2.sgml">
|
||||
<!ENTITY xmlsec-example-sign3 SYSTEM "examples/sign3.sgml">
|
||||
|
||||
<!ENTITY xmlsec-example-verify1 SYSTEM "examples/verify1.sgml">
|
||||
<!ENTITY xmlsec-example-verify2 SYSTEM "examples/verify2.sgml">
|
||||
<!ENTITY xmlsec-example-verify3 SYSTEM "examples/verify3.sgml">
|
||||
<!ENTITY xmlsec-example-verify4 SYSTEM "examples/verify4.sgml">
|
||||
|
||||
<!ENTITY xmlsec-example-encrypt1 SYSTEM "examples/encrypt1.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt2 SYSTEM "examples/encrypt2.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt3 SYSTEM "examples/encrypt3.sgml">
|
||||
|
||||
<!ENTITY xmlsec-example-decrypt1 SYSTEM "examples/decrypt1.sgml">
|
||||
<!ENTITY xmlsec-example-decrypt2 SYSTEM "examples/decrypt2.sgml">
|
||||
<!ENTITY xmlsec-example-decrypt3 SYSTEM "examples/decrypt3.sgml">
|
||||
|
||||
<!ENTITY xmlsec-example-sign1-tmpl SYSTEM "examples/sign1-tmpl.sgml">
|
||||
<!ENTITY xmlsec-example-sign1-res SYSTEM "examples/sign1-res.sgml">
|
||||
<!ENTITY xmlsec-example-sign2-doc SYSTEM "examples/sign2-doc.sgml">
|
||||
<!ENTITY xmlsec-example-sign2-res SYSTEM "examples/sign2-res.sgml">
|
||||
<!ENTITY xmlsec-example-sign3-doc SYSTEM "examples/sign3-doc.sgml">
|
||||
<!ENTITY xmlsec-example-sign3-res SYSTEM "examples/sign3-res.sgml">
|
||||
<!ENTITY xmlsec-example-verify4-res SYSTEM "examples/verify4-res.sgml">
|
||||
<!ENTITY xmlsec-example-verify4-tmpl SYSTEM "examples/verify4-tmpl.sgml">
|
||||
<!ENTITY xmlsec-example-verify4-bad-res SYSTEM "examples/verify4-bad-res.sgml">
|
||||
<!ENTITY xmlsec-example-verify4-bad-tmpl SYSTEM "examples/verify4-bad-tmpl.sgml">
|
||||
|
||||
<!ENTITY xmlsec-example-encrypt1-tmpl SYSTEM "examples/encrypt1-tmpl.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt1-res SYSTEM "examples/encrypt1-res.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt2-doc SYSTEM "examples/encrypt2-doc.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt2-res SYSTEM "examples/encrypt2-res.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt3-doc SYSTEM "examples/encrypt3-doc.sgml">
|
||||
<!ENTITY xmlsec-example-encrypt3-res SYSTEM "examples/encrypt3-res.sgml">
|
||||
]>
|
||||
<book id="index" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<bookinfo>
|
||||
<title>XML Security Library Reference Manual</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<firstname>Aleksey</firstname>
|
||||
<surname>Sanin</surname>
|
||||
<affiliation>
|
||||
<address>
|
||||
<email>aleksey@aleksey.com</email>
|
||||
</address>
|
||||
</affiliation>
|
||||
</author>
|
||||
</authorgroup>
|
||||
<copyright>
|
||||
<year>2002-2017</year>
|
||||
<holder>Aleksey Sanin</holder>
|
||||
</copyright>
|
||||
<legalnotice>
|
||||
<para>Permission is granted to make and distribute verbatim
|
||||
copies of this manual provided the copyright notice and this
|
||||
permission notice are preserved on all copies.</para>
|
||||
<para>Permission is granted to copy and distribute modified
|
||||
versions of this manual under the conditions for verbatim
|
||||
copying, provided also that the entire resulting derived work is
|
||||
distributed under the terms of a permission notice identical to
|
||||
this one.</para>
|
||||
|
||||
<para>Permission is granted to copy and distribute translations
|
||||
of this manual into another language, under the above conditions
|
||||
for modified versions.</para>
|
||||
</legalnotice>
|
||||
|
||||
<abstract>
|
||||
<para>This manual documents the interfaces of the xmlsec
|
||||
library and has some short notes to help get you up to speed
|
||||
with using the library.</para>
|
||||
</abstract>
|
||||
</bookinfo>
|
||||
|
||||
<part id="xmlsec-notes">
|
||||
<title>XML Security Library Tutorial</title>
|
||||
<chapter id="xmlsec-notes-overview">
|
||||
<title>Overview.</title>
|
||||
<para>XML Security Library provides support for XML Digital Signature
|
||||
and XML Encryption. It is based on LibXML/LibXSLT and can use
|
||||
practicaly any crypto library (currently there is "out of the box"
|
||||
support for OpenSSL, Microsoft Crypto API, Microsoft Cryptography API:
|
||||
Next Generation (CNG), GnuTLS, GCrypt and NSS).
|
||||
</para>
|
||||
</chapter>
|
||||
<chapter id="xmlsec-notes-structure">
|
||||
<title>XML Security Library Structure.</title>
|
||||
<para>In order to provide the an ability to use different crypto engines,
|
||||
the XML Security Library is splitted in two parts: core library (xmlsec)
|
||||
and crypto library (xmlsec-openssl, xmlsec-mscrypt, xmlsec-mscng, xmlsec-gnutls,
|
||||
xmlsec-gcrypt, xmlsec-nss, ...).
|
||||
<figure>
|
||||
<title>The library structure and dependencies.</title>
|
||||
<graphic fileref="images/structure.png" align="center"></graphic>
|
||||
</figure>
|
||||
</para>
|
||||
<para>The core library has no dependency on any crypto library and provides
|
||||
implementation of all the engines as well as support for all the non
|
||||
crypto transforms (xml parser, c14n transforms, xpath and xslt
|
||||
transforms,...). The XML Security Crypto library provides
|
||||
implementations for crypto transforms, crypto keys data and key
|
||||
data stores. Application is linked with particular XML Security
|
||||
Crypto library (or even libraries), but the actual application
|
||||
code might be general enough so switching crypto engine would be
|
||||
a matter of changing several #include directives.</para>
|
||||
</chapter>
|
||||
|
||||
&chapter-compiling-and-linking;
|
||||
&chapter-init-and-shutdown;
|
||||
&chapter-sign-and-encrypt;
|
||||
&chapter-creating-templates;
|
||||
&chapter-verify-and-decrypt;
|
||||
&chapter-using-keys;
|
||||
&chapter-using-keysmngr;
|
||||
&chapter-using-x509-certs;
|
||||
&chapter-using-transforms;
|
||||
&chapter-using-contexts;
|
||||
&chapter-new-crypto;
|
||||
&chapter-examples;
|
||||
|
||||
<chapter id="xmlsec-signature-klasses">
|
||||
<title>APPENDIX A. XML Security Library Signature Klasses.</title>
|
||||
<figure>
|
||||
<title>XML Security Library Signature Klasses.</title>
|
||||
<graphic fileref="images/signature-structure.png" align="center"></graphic>
|
||||
</figure>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-encryption-klasses">
|
||||
<title>APPENDIX B. XML Security Library Encryption Klasses.</title>
|
||||
<figure>
|
||||
<title>XML Security Library Encryption Klasses.</title>
|
||||
<graphic fileref="images/encryption-structure.png" align="center"></graphic>
|
||||
</figure>
|
||||
</chapter>
|
||||
</part>
|
||||
|
||||
<part id="xmlsec-reference">
|
||||
<title>XML Security Library API Reference.</title>
|
||||
|
||||
<chapter id="xmlsec-ref">
|
||||
<title>XML Security Core Library API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec. All
|
||||
the public interfaces are documented here. This reference guide is
|
||||
build by extracting comments from the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-app;"/>
|
||||
<xi:include href="&xmlsec-base64;"/>
|
||||
<xi:include href="&xmlsec-bn;"/>
|
||||
<xi:include href="&xmlsec-buffer;"/>
|
||||
<xi:include href="&xmlsec-dl;"/>
|
||||
<xi:include href="&xmlsec-errors;"/>
|
||||
<xi:include href="&xmlsec-io;"/>
|
||||
<xi:include href="&xmlsec-keyinfo;"/>
|
||||
<xi:include href="&xmlsec-keysdata;"/>
|
||||
<xi:include href="&xmlsec-keys;"/>
|
||||
<xi:include href="&xmlsec-keysmngr;"/>
|
||||
<xi:include href="&xmlsec-list;"/>
|
||||
<xi:include href="&xmlsec-membuf;"/>
|
||||
<xi:include href="&xmlsec-nodeset;"/>
|
||||
<xi:include href="&xmlsec-parser;"/>
|
||||
<xi:include href="&xmlsec-templates;"/>
|
||||
<xi:include href="&xmlsec-transforms;"/>
|
||||
<xi:include href="&xmlsec-version;"/>
|
||||
<xi:include href="&xmlsec-xmldsig;"/>
|
||||
<xi:include href="&xmlsec-xmlenc;"/>
|
||||
<xi:include href="&xmlsec-xmlsec;"/>
|
||||
<xi:include href="&xmlsec-xmltree;"/>
|
||||
<xi:include href="&xmlsec-x509;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-openssl-ref">
|
||||
<title>XML Security Library for OpenSLL API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-openssl. All
|
||||
the public interfaces are documented here. This reference guide is
|
||||
build by extracting comments from the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-openssl-app;"/>
|
||||
<xi:include href="&xmlsec-openssl-bn;"/>
|
||||
<xi:include href="&xmlsec-openssl-crypto;"/>
|
||||
<xi:include href="&xmlsec-openssl-evp;"/>
|
||||
<xi:include href="&xmlsec-openssl-x509;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-gnutls-ref">
|
||||
<title>XML Security Library for GnuTLS API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-gnutls. All
|
||||
the public interfaces are documented here. This reference guide is
|
||||
build by extracting comments from the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-gnutls-app;"/>
|
||||
<xi:include href="&xmlsec-gnutls-crypto;"/>
|
||||
<xi:include href="&xmlsec-gnutls-x509;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-gcrypt-ref">
|
||||
<title>XML Security Library for GCrypt API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-gcrypt. All
|
||||
the public interfaces are documented here. This reference guide is
|
||||
build by extracting comments from the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-gcrypt-app;"/>
|
||||
<xi:include href="&xmlsec-gcrypt-crypto;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-nss-ref">
|
||||
<title>XML Security Library for NSS API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-nss. All
|
||||
the public interfaces are documented here. This reference guide is
|
||||
build by extracting comments from the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-nss-app;"/>
|
||||
<xi:include href="&xmlsec-nss-bignum;"/>
|
||||
<xi:include href="&xmlsec-nss-crypto;"/>
|
||||
<xi:include href="&xmlsec-nss-keysstore;"/>
|
||||
<xi:include href="&xmlsec-nss-pkikeys;"/>
|
||||
<xi:include href="&xmlsec-nss-x509;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-mscrypto-ref">
|
||||
<title>XML Security Library for Microsoft Crypto API Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-mscrypto (based on
|
||||
Microsoft Crypto API). All the public interfaces are documented here.
|
||||
This reference guide is build by extracting comments from the code sources.
|
||||
</para>
|
||||
|
||||
<xi:include href="&xmlsec-mscrypto-app;"/>
|
||||
<xi:include href="&xmlsec-mscrypto-certkeys;"/>
|
||||
<xi:include href="&xmlsec-mscrypto-crypto;"/>
|
||||
<xi:include href="&xmlsec-mscrypto-keysstore;"/>
|
||||
<xi:include href="&xmlsec-mscrypto-x509;"/>
|
||||
</chapter>
|
||||
|
||||
|
||||
<chapter id="xmlsec-msccng-ref">
|
||||
<title>XML Security Library for Microsoft Cryptography API: Next Generation (CNG) Reference.</title>
|
||||
<para>This section contains the API reference for xmlsec-mscng (based on
|
||||
<a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa376210(v=vs.85).aspx">Microsoft
|
||||
Cryptography API: Next Generation (CNG)</a>). All the public interfaces are
|
||||
documented here. This reference guide is build by extracting comments from
|
||||
the code sources. </para>
|
||||
|
||||
<xi:include href="&xmlsec-mscng-app;"/>
|
||||
<xi:include href="&xmlsec-mscng-certkeys;"/>
|
||||
<xi:include href="&xmlsec-mscng-crypto;"/>
|
||||
<xi:include href="&xmlsec-mscng-keysstore;"/>
|
||||
<xi:include href="&xmlsec-mscng-x509;"/>
|
||||
</chapter>
|
||||
|
||||
<chapter id="xmlsec-index">
|
||||
<title>XML Security Library Reference Index</title>
|
||||
<para>
|
||||
<itemizedlist>
|
||||
&xmlsec-index;
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</chapter>
|
||||
</part>
|
||||
</book>
|
|
@ -1,479 +0,0 @@
|
|||
body
|
||||
{
|
||||
font-family: cantarell, sans-serif;
|
||||
}
|
||||
.synopsis, .classsynopsis
|
||||
{
|
||||
/* tango:aluminium 1/2 */
|
||||
background: #eeeeec;
|
||||
background: rgba(238, 238, 236, 0.5);
|
||||
border: solid 1px rgb(238, 238, 236);
|
||||
padding: 0.5em;
|
||||
}
|
||||
.programlisting
|
||||
{
|
||||
/* tango:sky blue 0/1 */
|
||||
/* fallback for no rgba support */
|
||||
background: #e6f3ff;
|
||||
border: solid 1px #729fcf;
|
||||
background: rgba(114, 159, 207, 0.1);
|
||||
border: solid 1px rgba(114, 159, 207, 0.2);
|
||||
padding: 0.5em;
|
||||
}
|
||||
.variablelist
|
||||
{
|
||||
padding: 4px;
|
||||
margin-left: 3em;
|
||||
}
|
||||
.variablelist td:first-child
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div.gallery-float
|
||||
{
|
||||
float: left;
|
||||
padding: 10px;
|
||||
}
|
||||
div.gallery-float img
|
||||
{
|
||||
border-style: none;
|
||||
}
|
||||
div.gallery-spacer
|
||||
{
|
||||
clear: both;
|
||||
}
|
||||
|
||||
a, a:visited
|
||||
{
|
||||
text-decoration: none;
|
||||
/* tango:sky blue 2 */
|
||||
color: #3465a4;
|
||||
}
|
||||
a:hover
|
||||
{
|
||||
text-decoration: underline;
|
||||
/* tango:sky blue 1 */
|
||||
color: #729fcf;
|
||||
}
|
||||
|
||||
div.informaltable table
|
||||
{
|
||||
border-collapse: separate;
|
||||
border-spacing: 1em 0.3em;
|
||||
border: none;
|
||||
}
|
||||
|
||||
div.informaltable table td, div.informaltable table th
|
||||
{
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.function_type,
|
||||
.variable_type,
|
||||
.property_type,
|
||||
.signal_type,
|
||||
.parameter_name,
|
||||
.struct_member_name,
|
||||
.union_member_name,
|
||||
.define_keyword,
|
||||
.datatype_keyword,
|
||||
.typedef_keyword
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* dim non-primary columns */
|
||||
.c_punctuation,
|
||||
.function_type,
|
||||
.variable_type,
|
||||
.property_type,
|
||||
.signal_type,
|
||||
.define_keyword,
|
||||
.datatype_keyword,
|
||||
.typedef_keyword,
|
||||
.property_flags,
|
||||
.signal_flags,
|
||||
.parameter_annotations,
|
||||
.enum_member_annotations,
|
||||
.struct_member_annotations,
|
||||
.union_member_annotations
|
||||
{
|
||||
color: #888a85;
|
||||
}
|
||||
|
||||
.function_type a,
|
||||
.function_type a:visited,
|
||||
.function_type a:hover,
|
||||
.property_type a,
|
||||
.property_type a:visited,
|
||||
.property_type a:hover,
|
||||
.signal_type a,
|
||||
.signal_type a:visited,
|
||||
.signal_type a:hover,
|
||||
.signal_flags a,
|
||||
.signal_flags a:visited,
|
||||
.signal_flags a:hover
|
||||
{
|
||||
color: #729fcf;
|
||||
}
|
||||
|
||||
td p
|
||||
{
|
||||
margin: 0.25em;
|
||||
}
|
||||
|
||||
div.table table
|
||||
{
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
/* tango:aluminium 3 */
|
||||
border: solid 1px #babdb6;
|
||||
}
|
||||
|
||||
div.table table td, div.table table th
|
||||
{
|
||||
/* tango:aluminium 3 */
|
||||
border: solid 1px #babdb6;
|
||||
padding: 3px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div.table table th
|
||||
{
|
||||
/* tango:aluminium 2 */
|
||||
background-color: #d3d7cf;
|
||||
}
|
||||
|
||||
h4
|
||||
{
|
||||
color: #555753;
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
hr
|
||||
{
|
||||
/* tango:aluminium 1 */
|
||||
color: #d3d7cf;
|
||||
background: #d3d7cf;
|
||||
border: none 0px;
|
||||
height: 1px;
|
||||
clear: both;
|
||||
margin: 2.0em 0em 2.0em 0em;
|
||||
}
|
||||
|
||||
dl.toc dt
|
||||
{
|
||||
padding-bottom: 0.25em;
|
||||
}
|
||||
|
||||
dl.toc > dt
|
||||
{
|
||||
padding-top: 0.25em;
|
||||
padding-bottom: 0.25em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
dl.toc > dl
|
||||
{
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.parameter
|
||||
{
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.footer
|
||||
{
|
||||
padding-top: 3.5em;
|
||||
/* tango:aluminium 3 */
|
||||
color: #babdb6;
|
||||
text-align: center;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
.informalfigure,
|
||||
.figure
|
||||
{
|
||||
margin: 1em;
|
||||
}
|
||||
|
||||
.informalexample,
|
||||
.example
|
||||
{
|
||||
margin-top: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.warning
|
||||
{
|
||||
/* tango:orange 0/1 */
|
||||
background: #ffeed9;
|
||||
background: rgba(252, 175, 62, 0.1);
|
||||
border-color: #ffb04f;
|
||||
border-color: rgba(252, 175, 62, 0.2);
|
||||
}
|
||||
.note
|
||||
{
|
||||
/* tango:chameleon 0/0.5 */
|
||||
background: #d8ffb2;
|
||||
background: rgba(138, 226, 52, 0.1);
|
||||
border-color: #abf562;
|
||||
border-color: rgba(138, 226, 52, 0.2);
|
||||
}
|
||||
div.blockquote
|
||||
{
|
||||
border-color: #eeeeec;
|
||||
}
|
||||
.note, .warning, div.blockquote
|
||||
{
|
||||
padding: 0.5em;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
margin: 2em;
|
||||
}
|
||||
.note p, .warning p
|
||||
{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.warning h3.title,
|
||||
div.note h3.title
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
|
||||
p + div.section
|
||||
{
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
div.refnamediv,
|
||||
div.refsynopsisdiv,
|
||||
div.refsect1,
|
||||
div.refsect2,
|
||||
div.toc,
|
||||
div.section
|
||||
{
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
/* blob links */
|
||||
h2 .extralinks, h3 .extralinks
|
||||
{
|
||||
float: right;
|
||||
/* tango:aluminium 3 */
|
||||
color: #babdb6;
|
||||
font-size: 80%;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.lineart
|
||||
{
|
||||
color: #d3d7cf;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.annotation
|
||||
{
|
||||
/* tango:aluminium 5 */
|
||||
color: #555753;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.structfield
|
||||
{
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
acronym,abbr
|
||||
{
|
||||
border-bottom: 1px dotted gray;
|
||||
}
|
||||
|
||||
/* code listings */
|
||||
|
||||
.listing_code .programlisting .normal,
|
||||
.listing_code .programlisting .normal a,
|
||||
.listing_code .programlisting .number,
|
||||
.listing_code .programlisting .cbracket,
|
||||
.listing_code .programlisting .symbol { color: #555753; }
|
||||
.listing_code .programlisting .comment,
|
||||
.listing_code .programlisting .linenum { color: #babdb6; } /* tango: aluminium 3 */
|
||||
.listing_code .programlisting .function,
|
||||
.listing_code .programlisting .function a,
|
||||
.listing_code .programlisting .preproc { color: #204a87; } /* tango: sky blue 3 */
|
||||
.listing_code .programlisting .string { color: #ad7fa8; } /* tango: plum */
|
||||
.listing_code .programlisting .keyword,
|
||||
.listing_code .programlisting .usertype,
|
||||
.listing_code .programlisting .type,
|
||||
.listing_code .programlisting .type a { color: #4e9a06; } /* tango: chameleon 3 */
|
||||
|
||||
.listing_frame {
|
||||
/* tango:sky blue 1 */
|
||||
border: solid 1px #729fcf;
|
||||
border: solid 1px rgba(114, 159, 207, 0.2);
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.listing_lines, .listing_code {
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
padding: 0.5em;
|
||||
}
|
||||
.listing_lines {
|
||||
/* tango:sky blue 0.5 */
|
||||
background: #a6c5e3;
|
||||
background: rgba(114, 159, 207, 0.2);
|
||||
/* tango:aluminium 6 */
|
||||
color: #2e3436;
|
||||
}
|
||||
.listing_code {
|
||||
/* tango:sky blue 0 */
|
||||
background: #e6f3ff;
|
||||
background: rgba(114, 159, 207, 0.1);
|
||||
}
|
||||
.listing_code .programlisting {
|
||||
/* override from previous */
|
||||
border: none 0px;
|
||||
padding: 0px;
|
||||
background: none;
|
||||
}
|
||||
.listing_lines pre, .listing_code pre {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
@media screen {
|
||||
/* these have a <sup> as a first child, but since there are no parent selectors
|
||||
* we can't use that. */
|
||||
a.footnote
|
||||
{
|
||||
position: relative;
|
||||
top: 0em ! important;
|
||||
}
|
||||
/* this is needed so that the local anchors are displayed below the naviagtion */
|
||||
div.footnote a[name], div.refnamediv a[name], div.refsect1 a[name], div.refsect2 a[name], div.index a[name], div.glossary a[name], div.sect1 a[name]
|
||||
{
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
top:-5em;
|
||||
}
|
||||
/* this seems to be a bug in the xsl style sheets when generating indexes */
|
||||
div.index div.index
|
||||
{
|
||||
top: 0em;
|
||||
}
|
||||
/* make space for the fixed navigation bar and add space at the bottom so that
|
||||
* link targets appear somewhat close to top
|
||||
*/
|
||||
body
|
||||
{
|
||||
padding-top: 2.5em;
|
||||
padding-bottom: 500px;
|
||||
max-width: 60em;
|
||||
}
|
||||
p
|
||||
{
|
||||
max-width: 60em;
|
||||
}
|
||||
/* style and size the navigation bar */
|
||||
table.navigation#top
|
||||
{
|
||||
position: fixed;
|
||||
background: #e2e2e2;
|
||||
border-bottom: solid 1px #babdb6;
|
||||
border-spacing: 5px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
table.navigation#top td
|
||||
{
|
||||
padding-left: 6px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
.navigation a, .navigation a:visited
|
||||
{
|
||||
/* tango:sky blue 3 */
|
||||
color: #204a87;
|
||||
}
|
||||
.navigation a:hover
|
||||
{
|
||||
/* tango:sky blue 2 */
|
||||
color: #3465a4;
|
||||
}
|
||||
td.shortcuts
|
||||
{
|
||||
/* tango:sky blue 2 */
|
||||
color: #3465a4;
|
||||
font-size: 80%;
|
||||
white-space: nowrap;
|
||||
}
|
||||
td.shortcuts .dim
|
||||
{
|
||||
color: #babdb6;
|
||||
}
|
||||
.navigation .title
|
||||
{
|
||||
font-size: 80%;
|
||||
max-width: none;
|
||||
margin: 0px;
|
||||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
@media screen and (min-width: 60em) {
|
||||
/* screen larger than 60em */
|
||||
body { margin: auto; }
|
||||
}
|
||||
@media screen and (max-width: 60em) {
|
||||
/* screen less than 60em */
|
||||
#nav_hierarchy { display: none; }
|
||||
#nav_interfaces { display: none; }
|
||||
#nav_prerequisites { display: none; }
|
||||
#nav_derived_interfaces { display: none; }
|
||||
#nav_implementations { display: none; }
|
||||
#nav_child_properties { display: none; }
|
||||
#nav_style_properties { display: none; }
|
||||
#nav_index { display: none; }
|
||||
#nav_glossary { display: none; }
|
||||
.gallery_image { display: none; }
|
||||
.property_flags { display: none; }
|
||||
.signal_flags { display: none; }
|
||||
.parameter_annotations { display: none; }
|
||||
.enum_member_annotations { display: none; }
|
||||
.struct_member_annotations { display: none; }
|
||||
.union_member_annotations { display: none; }
|
||||
/* now that a column is hidden, optimize space */
|
||||
col.parameters_name { width: auto; }
|
||||
col.parameters_description { width: auto; }
|
||||
col.struct_members_name { width: auto; }
|
||||
col.struct_members_description { width: auto; }
|
||||
col.enum_members_name { width: auto; }
|
||||
col.enum_members_description { width: auto; }
|
||||
col.union_members_name { width: auto; }
|
||||
col.union_members_description { width: auto; }
|
||||
.listing_lines { display: none; }
|
||||
}
|
||||
@media print {
|
||||
table.navigation {
|
||||
visibility: collapse;
|
||||
display: none;
|
||||
}
|
||||
div.titlepage table.navigation {
|
||||
visibility: visible;
|
||||
display: table;
|
||||
background: #e2e2e2;
|
||||
border: solid 1px #babdb6;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 3em;
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 288 B |
BIN
docs/api/up.png
Before Width: | Height: | Size: 186 B |
|
@ -1,495 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>base64: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-ref.html" title="XML Security Core Library API Reference.">
|
||||
<link rel="prev" href="xmlsec-app.html" title="app">
|
||||
<link rel="next" href="xmlsec-bn.html" title="bn">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts">
|
||||
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
|
||||
<a href="#xmlsec-base64.description" class="shortcut">Description</a></span>
|
||||
</td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-ref.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-app.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-bn.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="refentry">
|
||||
<a name="xmlsec-base64"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv"><table width="100%"><tr>
|
||||
<td valign="top">
|
||||
<h2><span class="refentrytitle"><a name="xmlsec-base64.top_of_page"></a>base64</span></h2>
|
||||
<p>base64 — Base64 encoding/decoding functions and base64 transform implementation.</p>
|
||||
</td>
|
||||
<td class="gallery_image" valign="top" align="right"></td>
|
||||
</tr></table></div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.stability-level"></a><h2>Stability Level</h2>
|
||||
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.functions"></a><h2>Functions</h2>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64GetDefaultLineSize" title="xmlSecBase64GetDefaultLineSize ()">xmlSecBase64GetDefaultLineSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64SetDefaultLineSize" title="xmlSecBase64SetDefaultLineSize ()">xmlSecBase64SetDefaultLineSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">xmlSecBase64CtxPtr</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxCreate" title="xmlSecBase64CtxCreate ()">xmlSecBase64CtxCreate</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxDestroy" title="xmlSecBase64CtxDestroy ()">xmlSecBase64CtxDestroy</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxInitialize" title="xmlSecBase64CtxInitialize ()">xmlSecBase64CtxInitialize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxFinalize" title="xmlSecBase64CtxFinalize ()">xmlSecBase64CtxFinalize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxUpdate" title="xmlSecBase64CtxUpdate ()">xmlSecBase64CtxUpdate</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64CtxFinal" title="xmlSecBase64CtxFinal ()">xmlSecBase64CtxFinal</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">xmlChar</span></font> *
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64Encode" title="xmlSecBase64Encode ()">xmlSecBase64Encode</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-base64.html#xmlSecBase64Decode" title="xmlSecBase64Decode ()">xmlSecBase64Decode</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.other"></a><h2>Types and Values</h2>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="define_keyword">#define</td>
|
||||
<td class="function_name"><a class="link" href="xmlsec-base64.html#XMLSEC-BASE64-LINESIZE:CAPS" title="XMLSEC_BASE64_LINESIZE">XMLSEC_BASE64_LINESIZE</a></td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.description"></a><h2>Description</h2>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.functions_details"></a><h2>Functions</h2>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64GetDefaultLineSize"></a><h3>xmlSecBase64GetDefaultLineSize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBase64GetDefaultLineSize (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
|
||||
<p>Gets the current default line size.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64GetDefaultLineSize.returns"></a><h4>Returns</h4>
|
||||
<p> the current default line size.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64SetDefaultLineSize"></a><h3>xmlSecBase64SetDefaultLineSize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBase64SetDefaultLineSize (<em class="parameter"><code><font><span class="type">int</span></font> columns</code></em>);</pre>
|
||||
<p>Sets the current default line size.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64SetDefaultLineSize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>columns</p></td>
|
||||
<td class="parameter_description"><p>number of columns</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxCreate"></a><h3>xmlSecBase64CtxCreate ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">xmlSecBase64CtxPtr</span></font>
|
||||
xmlSecBase64CtxCreate (<em class="parameter"><code><font><span class="type">int</span></font> encode</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">int</span></font> columns</code></em>);</pre>
|
||||
<p>Allocates and initializes new base64 context.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxCreate.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>encode</p></td>
|
||||
<td class="parameter_description"><p>the encode/decode flag (1 - encode, 0 - decode)</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>columns</p></td>
|
||||
<td class="parameter_description"><p>the max line length.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxCreate.returns"></a><h4>Returns</h4>
|
||||
<p> a pointer to newly created <font><span class="type">xmlSecBase64Ctx</span></font> structure
|
||||
or NULL if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxDestroy"></a><h3>xmlSecBase64CtxDestroy ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBase64CtxDestroy (<em class="parameter"><code><font><span class="type">xmlSecBase64CtxPtr</span></font> ctx</code></em>);</pre>
|
||||
<p>Destroys base64 context.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxDestroy.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>ctx</p></td>
|
||||
<td class="parameter_description"><p>the pointer to <font><span class="type">xmlSecBase64Ctx</span></font> structure.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxInitialize"></a><h3>xmlSecBase64CtxInitialize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBase64CtxInitialize (<em class="parameter"><code><font><span class="type">xmlSecBase64CtxPtr</span></font> ctx</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">int</span></font> encode</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">int</span></font> columns</code></em>);</pre>
|
||||
<p>Initializes new base64 context.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxInitialize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>ctx</p></td>
|
||||
<td class="parameter_description"><p>the pointer to <font><span class="type">xmlSecBase64Ctx</span></font> structure,</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>encode</p></td>
|
||||
<td class="parameter_description"><p>the encode/decode flag (1 - encode, 0 - decode)</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>columns</p></td>
|
||||
<td class="parameter_description"><p>the max line length.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxInitialize.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success and a negative value otherwise.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxFinalize"></a><h3>xmlSecBase64CtxFinalize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBase64CtxFinalize (<em class="parameter"><code><font><span class="type">xmlSecBase64CtxPtr</span></font> ctx</code></em>);</pre>
|
||||
<p>Frees all the resources allocated by <em class="parameter"><code>ctx</code></em>
|
||||
.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxFinalize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>ctx</p></td>
|
||||
<td class="parameter_description"><p>the pointer to <font><span class="type">xmlSecBase64Ctx</span></font> structure,</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxUpdate"></a><h3>xmlSecBase64CtxUpdate ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBase64CtxUpdate (<em class="parameter"><code><font><span class="type">xmlSecBase64CtxPtr</span></font> ctx</code></em>,
|
||||
<em class="parameter"><code>const <a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *in</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> inSize</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *out</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> outSize</code></em>);</pre>
|
||||
<p>Encodes or decodes the next piece of data from input buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxUpdate.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>ctx</p></td>
|
||||
<td class="parameter_description"><p>the pointer to <font><span class="type">xmlSecBase64Ctx</span></font> structure</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>in</p></td>
|
||||
<td class="parameter_description"><p>the input buffer</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>inSize</p></td>
|
||||
<td class="parameter_description"><p>the input buffer size</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>out</p></td>
|
||||
<td class="parameter_description"><p>the output buffer</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>outSize</p></td>
|
||||
<td class="parameter_description"><p>the output buffer size</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxUpdate.returns"></a><h4>Returns</h4>
|
||||
<p> the number of bytes written to output buffer or
|
||||
-1 if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64CtxFinal"></a><h3>xmlSecBase64CtxFinal ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBase64CtxFinal (<em class="parameter"><code><font><span class="type">xmlSecBase64CtxPtr</span></font> ctx</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *out</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> outSize</code></em>);</pre>
|
||||
<p>Encodes or decodes the last piece of data stored in the context
|
||||
and finalizes the result.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxFinal.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>ctx</p></td>
|
||||
<td class="parameter_description"><p>the pointer to <font><span class="type">xmlSecBase64Ctx</span></font> structure</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>out</p></td>
|
||||
<td class="parameter_description"><p>the output buffer</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>outSize</p></td>
|
||||
<td class="parameter_description"><p>the output buffer size</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64CtxFinal.returns"></a><h4>Returns</h4>
|
||||
<p> the number of bytes written to output buffer or
|
||||
-1 if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64Encode"></a><h3>xmlSecBase64Encode ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">xmlChar</span></font> *
|
||||
xmlSecBase64Encode (<em class="parameter"><code>const <a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> len</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">int</span></font> columns</code></em>);</pre>
|
||||
<p>Encodes the data from input buffer and allocates the string for the result.
|
||||
The caller is responsible for freeing returned buffer using
|
||||
<font><code class="function">xmlFree()</code></font> function.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64Encode.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the input buffer.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>len</p></td>
|
||||
<td class="parameter_description"><p>the input buffer size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>columns</p></td>
|
||||
<td class="parameter_description"><p>the output max line length (if 0 then no line breaks
|
||||
would be inserted)</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64Encode.returns"></a><h4>Returns</h4>
|
||||
<p> newly allocated string with base64 encoded data
|
||||
or NULL if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBase64Decode"></a><h3>xmlSecBase64Decode ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBase64Decode (<em class="parameter"><code>const <font><span class="type">xmlChar</span></font> *str</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> len</code></em>);</pre>
|
||||
<p>Decodes input base64 encoded string and puts result into
|
||||
the output buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64Decode.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>str</p></td>
|
||||
<td class="parameter_description"><p>the input buffer with base64 encoded string</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the output buffer</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>len</p></td>
|
||||
<td class="parameter_description"><p>the output buffer size</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBase64Decode.returns"></a><h4>Returns</h4>
|
||||
<p> the number of bytes written to the output buffer or
|
||||
a negative value if an error occurs</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-base64.other_details"></a><h2>Types and Values</h2>
|
||||
<div class="refsect2">
|
||||
<a name="XMLSEC-BASE64-LINESIZE:CAPS"></a><h3>XMLSEC_BASE64_LINESIZE</h3>
|
||||
<pre class="programlisting">#define XMLSEC_BASE64_LINESIZE 64
|
||||
</pre>
|
||||
<p>The default maximum base64 encoded line size.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,961 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>buffer: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-ref.html" title="XML Security Core Library API Reference.">
|
||||
<link rel="prev" href="xmlsec-bn.html" title="bn">
|
||||
<link rel="next" href="xmlsec-dl.html" title="dl">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts">
|
||||
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
|
||||
<a href="#xmlsec-buffer.description" class="shortcut">Description</a></span>
|
||||
</td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-ref.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-bn.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-dl.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="refentry">
|
||||
<a name="xmlsec-buffer"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv"><table width="100%"><tr>
|
||||
<td valign="top">
|
||||
<h2><span class="refentrytitle"><a name="xmlsec-buffer.top_of_page"></a>buffer</span></h2>
|
||||
<p>buffer — Binary memory buffer functions.</p>
|
||||
</td>
|
||||
<td class="gallery_image" valign="top" align="right"></td>
|
||||
</tr></table></div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.stability-level"></a><h2>Stability Level</h2>
|
||||
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.functions"></a><h2>Functions</h2>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferSetDefaultAllocMode" title="xmlSecBufferSetDefaultAllocMode ()">xmlSecBufferSetDefaultAllocMode</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="returnvalue">xmlSecBufferPtr</span></a>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferCreate" title="xmlSecBufferCreate ()">xmlSecBufferCreate</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferDestroy" title="xmlSecBufferDestroy ()">xmlSecBufferDestroy</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferInitialize" title="xmlSecBufferInitialize ()">xmlSecBufferInitialize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferFinalize" title="xmlSecBufferFinalize ()">xmlSecBufferFinalize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="returnvalue">xmlSecByte</span></a> *
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferGetData" title="xmlSecBufferGetData ()">xmlSecBufferGetData</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferSetData" title="xmlSecBufferSetData ()">xmlSecBufferSetData</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="returnvalue">xmlSecSize</span></a>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferGetSize" title="xmlSecBufferGetSize ()">xmlSecBufferGetSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferSetSize" title="xmlSecBufferSetSize ()">xmlSecBufferSetSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="returnvalue">xmlSecSize</span></a>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferGetMaxSize" title="xmlSecBufferGetMaxSize ()">xmlSecBufferGetMaxSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferSetMaxSize" title="xmlSecBufferSetMaxSize ()">xmlSecBufferSetMaxSize</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">void</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferEmpty" title="xmlSecBufferEmpty ()">xmlSecBufferEmpty</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferAppend" title="xmlSecBufferAppend ()">xmlSecBufferAppend</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferPrepend" title="xmlSecBufferPrepend ()">xmlSecBufferPrepend</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferRemoveHead" title="xmlSecBufferRemoveHead ()">xmlSecBufferRemoveHead</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferRemoveTail" title="xmlSecBufferRemoveTail ()">xmlSecBufferRemoveTail</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferReadFile" title="xmlSecBufferReadFile ()">xmlSecBufferReadFile</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferBase64NodeContentRead" title="xmlSecBufferBase64NodeContentRead ()">xmlSecBufferBase64NodeContentRead</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferBase64NodeContentWrite" title="xmlSecBufferBase64NodeContentWrite ()">xmlSecBufferBase64NodeContentWrite</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">xmlOutputBufferPtr</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferCreateOutputBuffer" title="xmlSecBufferCreateOutputBuffer ()">xmlSecBufferCreateOutputBuffer</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.other"></a><h2>Types and Values</h2>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="datatype_keyword">enum</td>
|
||||
<td class="function_name"><a class="link" href="xmlsec-buffer.html#xmlSecAllocMode" title="enum xmlSecAllocMode">xmlSecAllocMode</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="datatype_keyword">struct</td>
|
||||
<td class="function_name"><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer">xmlSecBuffer</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.description"></a><h2>Description</h2>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.functions_details"></a><h2>Functions</h2>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferSetDefaultAllocMode"></a><h3>xmlSecBufferSetDefaultAllocMode ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBufferSetDefaultAllocMode (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecAllocMode" title="enum xmlSecAllocMode"><span class="type">xmlSecAllocMode</span></a> defAllocMode</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> defInitialSize</code></em>);</pre>
|
||||
<p>Sets new global default allocation mode and minimal intial size.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetDefaultAllocMode.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>defAllocMode</p></td>
|
||||
<td class="parameter_description"><p>the new default buffer allocation mode.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>defInitialSize</p></td>
|
||||
<td class="parameter_description"><p>the new default buffer minimal intial size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferCreate"></a><h3>xmlSecBufferCreate ()</h3>
|
||||
<pre class="programlisting"><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="returnvalue">xmlSecBufferPtr</span></a>
|
||||
xmlSecBufferCreate (<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Allocates and initializes new memory buffer with given size.
|
||||
Caller is responsible for calling <a class="link" href="xmlsec-buffer.html#xmlSecBufferDestroy" title="xmlSecBufferDestroy ()"><span class="type">xmlSecBufferDestroy</span></a> function
|
||||
to free the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferCreate.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the intial size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferCreate.returns"></a><h4>Returns</h4>
|
||||
<p> pointer to newly allocated buffer or NULL if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferDestroy"></a><h3>xmlSecBufferDestroy ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBufferDestroy (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Destroys buffer object created with <a class="link" href="xmlsec-buffer.html#xmlSecBufferCreate" title="xmlSecBufferCreate ()"><span class="type">xmlSecBufferCreate</span></a> function.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferDestroy.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferInitialize"></a><h3>xmlSecBufferInitialize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferInitialize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Initializes buffer object <em class="parameter"><code>buf</code></em>
|
||||
. Caller is responsible for calling
|
||||
<a class="link" href="xmlsec-buffer.html#xmlSecBufferFinalize" title="xmlSecBufferFinalize ()"><span class="type">xmlSecBufferFinalize</span></a> function to free allocated resources.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferInitialize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the initial buffer size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferInitialize.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferFinalize"></a><h3>xmlSecBufferFinalize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBufferFinalize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Frees allocated resource for a buffer initialized with <a class="link" href="xmlsec-buffer.html#xmlSecBufferInitialize" title="xmlSecBufferInitialize ()"><span class="type">xmlSecBufferInitialize</span></a>
|
||||
function.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferFinalize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferGetData"></a><h3>xmlSecBufferGetData ()</h3>
|
||||
<pre class="programlisting"><a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="returnvalue">xmlSecByte</span></a> *
|
||||
xmlSecBufferGetData (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Gets pointer to buffer's data.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetData.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetData.returns"></a><h4>Returns</h4>
|
||||
<p> pointer to buffer's data.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferSetData"></a><h3>xmlSecBufferSetData ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferSetData (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code>const <a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *data</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Sets the value of the buffer to <em class="parameter"><code>data</code></em>
|
||||
.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetData.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>data</p></td>
|
||||
<td class="parameter_description"><p>the data.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the data size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetData.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferGetSize"></a><h3>xmlSecBufferGetSize ()</h3>
|
||||
<pre class="programlisting"><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="returnvalue">xmlSecSize</span></a>
|
||||
xmlSecBufferGetSize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Gets the current buffer data size.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetSize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetSize.returns"></a><h4>Returns</h4>
|
||||
<p> the current data size.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferSetSize"></a><h3>xmlSecBufferSetSize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferSetSize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Sets new buffer data size. If necessary, buffer grows to
|
||||
have at least <em class="parameter"><code>size</code></em>
|
||||
bytes.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetSize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the new data size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetSize.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferGetMaxSize"></a><h3>xmlSecBufferGetMaxSize ()</h3>
|
||||
<pre class="programlisting"><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="returnvalue">xmlSecSize</span></a>
|
||||
xmlSecBufferGetMaxSize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Gets the maximum (allocated) buffer size.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetMaxSize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferGetMaxSize.returns"></a><h4>Returns</h4>
|
||||
<p> the maximum (allocated) buffer size.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferSetMaxSize"></a><h3>xmlSecBufferSetMaxSize ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferSetMaxSize (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Sets new buffer maximum size. If necessary, buffer grows to
|
||||
have at least <em class="parameter"><code>size</code></em>
|
||||
bytes.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetMaxSize.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the new maximum size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferSetMaxSize.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferEmpty"></a><h3>xmlSecBufferEmpty ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">void</span></font>
|
||||
xmlSecBufferEmpty (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Empties the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferEmpty.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferAppend"></a><h3>xmlSecBufferAppend ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferAppend (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code>const <a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *data</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Appends the <em class="parameter"><code>data</code></em>
|
||||
after the current data stored in the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferAppend.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>data</p></td>
|
||||
<td class="parameter_description"><p>the data.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the data size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferAppend.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferPrepend"></a><h3>xmlSecBufferPrepend ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferPrepend (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code>const <a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *data</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Prepends the <em class="parameter"><code>data</code></em>
|
||||
before the current data stored in the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferPrepend.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>data</p></td>
|
||||
<td class="parameter_description"><p>the data.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the data size.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferPrepend.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferRemoveHead"></a><h3>xmlSecBufferRemoveHead ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferRemoveHead (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Removes <em class="parameter"><code>size</code></em>
|
||||
bytes from the beginning of the current buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferRemoveHead.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the number of bytes to be removed.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferRemoveHead.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferRemoveTail"></a><h3>xmlSecBufferRemoveTail ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferRemoveTail (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> size</code></em>);</pre>
|
||||
<p>Removes <em class="parameter"><code>size</code></em>
|
||||
bytes from the end of current buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferRemoveTail.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>size</p></td>
|
||||
<td class="parameter_description"><p>the number of bytes to be removed.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferRemoveTail.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferReadFile"></a><h3>xmlSecBufferReadFile ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferReadFile (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code>const <font><span class="type">char</span></font> *filename</code></em>);</pre>
|
||||
<p>Reads the content of the file <em class="parameter"><code>filename</code></em>
|
||||
in the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferReadFile.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>filename</p></td>
|
||||
<td class="parameter_description"><p>the filename.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferReadFile.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferBase64NodeContentRead"></a><h3>xmlSecBufferBase64NodeContentRead ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferBase64NodeContentRead (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">xmlNodePtr</span></font> node</code></em>);</pre>
|
||||
<p>Reads the content of the <em class="parameter"><code>node</code></em>
|
||||
, base64 decodes it and stores the
|
||||
result in the buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferBase64NodeContentRead.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>node</p></td>
|
||||
<td class="parameter_description"><p>the pointer to node.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferBase64NodeContentRead.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferBase64NodeContentWrite"></a><h3>xmlSecBufferBase64NodeContentWrite ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecBufferBase64NodeContentWrite (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">xmlNodePtr</span></font> node</code></em>,
|
||||
<em class="parameter"><code><font><span class="type">int</span></font> columns</code></em>);</pre>
|
||||
<p>Sets the content of the <em class="parameter"><code>node</code></em>
|
||||
to the base64 encoded buffer data.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferBase64NodeContentWrite.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer object.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>node</p></td>
|
||||
<td class="parameter_description"><p>the pointer to a node.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="parameter_name"><p>columns</p></td>
|
||||
<td class="parameter_description"><p>the max line size for base64 encoded data.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferBase64NodeContentWrite.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBufferCreateOutputBuffer"></a><h3>xmlSecBufferCreateOutputBuffer ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">xmlOutputBufferPtr</span></font>
|
||||
xmlSecBufferCreateOutputBuffer (<em class="parameter"><code><a class="link" href="xmlsec-buffer.html#xmlSecBuffer" title="struct xmlSecBuffer"><span class="type">xmlSecBufferPtr</span></a> buf</code></em>);</pre>
|
||||
<p>Creates new LibXML output buffer to store data in the <em class="parameter"><code>buf</code></em>
|
||||
. Caller is
|
||||
responsible for destroying <em class="parameter"><code>buf</code></em>
|
||||
when processing is done.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferCreateOutputBuffer.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>buf</p></td>
|
||||
<td class="parameter_description"><p>the pointer to buffer.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBufferCreateOutputBuffer.returns"></a><h4>Returns</h4>
|
||||
<p> pointer to newly allocated output buffer or NULL if an error
|
||||
occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-buffer.other_details"></a><h2>Types and Values</h2>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecAllocMode"></a><h3>enum xmlSecAllocMode</h3>
|
||||
<p>The memory allocation mode (used by <em class="parameter"><code>xmlSecBuffer</code></em>
|
||||
and <em class="parameter"><code>xmlSecList</code></em>
|
||||
).</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecAllocMode.members"></a><h4>Members</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="enum_member_name"><p><a name="xmlSecAllocModeExact"></a>xmlSecAllocModeExact</p></td>
|
||||
<td class="enum_member_description"><p>the memory allocation mode that minimizes total
|
||||
allocated memory size.</p></td>
|
||||
<td class="enum_member_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="enum_member_name"><p><a name="xmlSecAllocModeDouble"></a>xmlSecAllocModeDouble</p></td>
|
||||
<td class="enum_member_description"><p>the memory allocation mode that tries to minimize
|
||||
the number of malloc calls.</p></td>
|
||||
<td class="enum_member_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecBuffer"></a><h3>struct xmlSecBuffer</h3>
|
||||
<pre class="programlisting">struct xmlSecBuffer {
|
||||
xmlSecByte* data;
|
||||
xmlSecSize size;
|
||||
xmlSecSize maxSize;
|
||||
xmlSecAllocMode allocMode;
|
||||
};
|
||||
</pre>
|
||||
<p>Binary data buffer.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecBuffer.members"></a><h4>Members</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="struct_member_name"><p><a class="link" href="xmlsec-xmlsec.html#xmlSecByte" title="xmlSecByte"><span class="type">xmlSecByte</span></a> *<em class="structfield"><code><a name="xmlSecBuffer.data"></a>data</code></em>;</p></td>
|
||||
<td class="struct_member_description"><p>the pointer to buffer data.</p></td>
|
||||
<td class="struct_member_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="struct_member_name"><p><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> <em class="structfield"><code><a name="xmlSecBuffer.size"></a>size</code></em>;</p></td>
|
||||
<td class="struct_member_description"><p>the current data size.</p></td>
|
||||
<td class="struct_member_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="struct_member_name"><p><a class="link" href="xmlsec-xmlsec.html#xmlSecSize" title="xmlSecSize"><span class="type">xmlSecSize</span></a> <em class="structfield"><code><a name="xmlSecBuffer.maxSize"></a>maxSize</code></em>;</p></td>
|
||||
<td class="struct_member_description"><p>the max data size (allocated buffer size).</p></td>
|
||||
<td class="struct_member_annotations"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="struct_member_name"><p><a class="link" href="xmlsec-buffer.html#xmlSecAllocMode" title="enum xmlSecAllocMode"><span class="type">xmlSecAllocMode</span></a> <em class="structfield"><code><a name="xmlSecBuffer.allocMode"></a>allocMode</code></em>;</p></td>
|
||||
<td class="struct_member_description"><p>the buffer memory allocation mode.</p></td>
|
||||
<td class="struct_member_annotations"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,407 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Writing a custom keys manager.: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-examples.html" title="Examples.">
|
||||
<link rel="prev" href="xmlsec-decrypt-with-keys-mngr.html" title="Decrypting data with keys manager.">
|
||||
<link rel="next" href="xmlsec-signature-klasses.html" title="APPENDIX A. XML Security Library Signature Klasses.">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts"></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-decrypt-with-keys-mngr.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-signature-klasses.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="sect1">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="xmlsec-custom-keys-manager"></a>Writing a custom keys manager.</h2></div></div></div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-decrypt3"></a>decrypt3.c</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
/**
|
||||
* XML Security Library example: Decrypting an encrypted file using a custom keys manager.
|
||||
*
|
||||
* Decrypts encrypted XML file using a custom files based keys manager.
|
||||
* We assume that key's name in <dsig:KeyName/> element is just
|
||||
* key's file name in the current folder.
|
||||
*
|
||||
* Usage:
|
||||
* ./decrypt3 <xml-enc>
|
||||
*
|
||||
* Example:
|
||||
* ./decrypt3 encrypt1-res.xml
|
||||
* ./decrypt3 encrypt2-res.xml
|
||||
*
|
||||
* This is free software; see Copyright file in the source
|
||||
* distribution for preciese wording.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/security.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
xmlSecKeyStoreId files_keys_store_get_klass(void);
|
||||
xmlSecKeysMngrPtr create_files_keys_mngr(void);
|
||||
int decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file);
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 2) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <enc-file>\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init libxslt */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
/* disable everything */
|
||||
xsltSecPrefs = xsltNewSecurityPrefs();
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid);
|
||||
xsltSetDefaultSecurityPrefs(xsltSecPrefs);
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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 and/or LTDL_LIBRARY_PATH) environment variables.\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* create keys manager and load keys */
|
||||
mngr = create_files_keys_mngr();
|
||||
if(mngr == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(decrypt_file(mngr, argv[1]) < 0) {
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* destroy keys manager */
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltFreeSecurityPrefs(xsltSecPrefs);
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* decrypt_file:
|
||||
* @mngr: the pointer to keys manager.
|
||||
* @enc_file: the encrypted XML file name.
|
||||
*
|
||||
* Decrypts the XML file #enc_file using DES key from #key_file and
|
||||
* prints results to stdout.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(mngr);
|
||||
assert(enc_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(enc_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context */
|
||||
encCtx = xmlSecEncCtxCreate(mngr);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* decrypt the data */
|
||||
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
|
||||
fprintf(stderr,"Error: decryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print decrypted data to stdout */
|
||||
if(encCtx->resultReplaced != 0) {
|
||||
fprintf(stdout, "Decrypted XML data:\n");
|
||||
xmlDocDump(stdout, doc);
|
||||
} else {
|
||||
fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
|
||||
if(xmlSecBufferGetData(encCtx->result) != NULL) {
|
||||
fwrite(xmlSecBufferGetData(encCtx->result),
|
||||
1,
|
||||
xmlSecBufferGetSize(encCtx->result),
|
||||
stdout);
|
||||
}
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* create_files_keys_mngr:
|
||||
*
|
||||
* Creates a files based keys manager: we assume that key name is
|
||||
* the key file name,
|
||||
*
|
||||
* Returns pointer to newly created keys manager or NULL if an error occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
create_files_keys_mngr(void) {
|
||||
xmlSecKeyStorePtr keysStore;
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
|
||||
/* create files based keys store */
|
||||
keysStore = xmlSecKeyStoreCreate(files_keys_store_get_klass());
|
||||
if(keysStore == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys store.\n");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* create keys manager */
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
xmlSecKeyStoreDestroy(keysStore);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add store to keys manager, from now on keys manager destroys the store if needed */
|
||||
if(xmlSecKeysMngrAdoptKeysStore(mngr, keysStore) < 0) {
|
||||
fprintf(stderr, "Error: failed to add keys store to keys manager.\n");
|
||||
xmlSecKeyStoreDestroy(keysStore);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* initialize crypto library specific data in keys manager */
|
||||
if(xmlSecCryptoKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize crypto data in keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set the get key callback */
|
||||
mngr->getKey = xmlSecKeysMngrGetKey;
|
||||
return(mngr);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Files Keys Store: we assume that key's name (content of the
|
||||
* <dsig:KeyName/> element is a name of the file with a key (in the
|
||||
* current folder).
|
||||
* Attention: this probably not a good solution for high traffic systems.
|
||||
*
|
||||
***************************************************************************/
|
||||
static xmlSecKeyPtr files_keys_store_find_key (xmlSecKeyStorePtr store,
|
||||
const xmlChar* name,
|
||||
xmlSecKeyInfoCtxPtr keyInfoCtx);
|
||||
static xmlSecKeyStoreKlass files_keys_store_klass = {
|
||||
sizeof(xmlSecKeyStoreKlass),
|
||||
sizeof(xmlSecKeyStore),
|
||||
BAD_CAST "files-based-keys-store", /* const xmlChar* name; */
|
||||
NULL, /* xmlSecKeyStoreInitializeMethod initialize; */
|
||||
NULL, /* xmlSecKeyStoreFinalizeMethod finalize; */
|
||||
files_keys_store_find_key, /* xmlSecKeyStoreFindKeyMethod findKey; */
|
||||
|
||||
/* reserved for the future */
|
||||
NULL, /* void* reserved0; */
|
||||
NULL, /* void* reserved1; */
|
||||
};
|
||||
|
||||
/**
|
||||
* files_keys_store_get_klass:
|
||||
*
|
||||
* The files based keys store klass: we assume that key name is the
|
||||
* key file name,
|
||||
*
|
||||
* Returns files based keys store klass.
|
||||
*/
|
||||
xmlSecKeyStoreId
|
||||
files_keys_store_get_klass(void) {
|
||||
return(&files_keys_store_klass);
|
||||
}
|
||||
|
||||
/**
|
||||
* files_keys_store_find_key:
|
||||
* @store: the pointer to simple keys store.
|
||||
* @name: the desired key name.
|
||||
* @keyInfoCtx: the pointer to <dsig:KeyInfo/> node processing context.
|
||||
*
|
||||
* Lookups key in the @store. The caller is responsible for destroying
|
||||
* returned key with #xmlSecKeyDestroy function.
|
||||
*
|
||||
* Returns pointer to key or NULL if key not found or an error occurs.
|
||||
*/
|
||||
static xmlSecKeyPtr
|
||||
files_keys_store_find_key(xmlSecKeyStorePtr store, const xmlChar* name, xmlSecKeyInfoCtxPtr keyInfoCtx) {
|
||||
xmlSecKeyPtr key;
|
||||
const xmlChar* p;
|
||||
|
||||
assert(store);
|
||||
assert(keyInfoCtx);
|
||||
|
||||
/* it's possible to do not have the key name or desired key type
|
||||
* but we could do nothing in this case */
|
||||
if((name == NULL) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataIdUnknown)){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* we don't want to open files in a folder other than "current";
|
||||
* to prevent it limit the characters in the key name to alpha/digit,
|
||||
* '.', '-' or '_'.
|
||||
*/
|
||||
for(p = name; (*p) != '\0'; ++p) {
|
||||
if(!isalnum((*p)) && ((*p) != '.') && ((*p) != '-') && ((*p) != '_')) {
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if((keyInfoCtx->keyReq.keyId == xmlSecKeyDataDsaId) || (keyInfoCtx->keyReq.keyId == xmlSecKeyDataRsaId)) {
|
||||
/* load key from a pem file, if key is not found then it's an error (is it?) */
|
||||
key = xmlSecCryptoAppKeyLoad(name, xmlSecKeyDataFormatPem, NULL, NULL, NULL);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load public pem key from \"%s\"\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
} else {
|
||||
/* otherwise it's a binary key, if key is not found then it's an error (is it?) */
|
||||
key = xmlSecKeyReadBinaryFile(keyInfoCtx->keyReq.keyId, name);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load key from binary file \"%s\"\n", name);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* set key name */
|
||||
if(xmlSecKeySetName(key, name) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", name);
|
||||
xmlSecKeyDestroy(key);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(key);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,328 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Decrypting data with keys manager.: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-examples.html" title="Examples.">
|
||||
<link rel="prev" href="xmlsec-decrypt-with-signle-key.html" title="Decrypting data with a single key.">
|
||||
<link rel="next" href="xmlsec-custom-keys-manager.html" title="Writing a custom keys manager.">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts"></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-decrypt-with-signle-key.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-custom-keys-manager.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="sect1">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="xmlsec-decrypt-with-keys-mngr"></a>Decrypting data with keys manager.</h2></div></div></div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-decrypt2"></a>decrypt2.c</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
/**
|
||||
* XML Security Library example: Decrypting an encrypted file using keys manager.
|
||||
*
|
||||
* Decrypts encrypted XML file using keys manager and a list of
|
||||
* DES key from a binary file
|
||||
*
|
||||
* Usage:
|
||||
* ./decrypt2 <xml-enc> <des-key-file1> [<des-key-file2> [...]]
|
||||
*
|
||||
* Example:
|
||||
* ./decrypt2 encrypt1-res.xml deskey.bin
|
||||
* ./decrypt2 encrypt2-res.xml deskey.bin
|
||||
*
|
||||
* This is free software; see Copyright file in the source
|
||||
* distribution for preciese wording.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/security.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
xmlSecKeysMngrPtr load_des_keys(char** files, int files_size);
|
||||
int decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file);
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <enc-file> <key-file1> [<key-file2> [...]]\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init libxslt */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
/* disable everything */
|
||||
xsltSecPrefs = xsltNewSecurityPrefs();
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid);
|
||||
xsltSetDefaultSecurityPrefs(xsltSecPrefs);
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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 and/or LTDL_LIBRARY_PATH) environment variables.\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* create keys manager and load keys */
|
||||
mngr = load_des_keys(&(argv[2]), argc - 2);
|
||||
if(mngr == NULL) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(decrypt_file(mngr, argv[1]) < 0) {
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* destroy keys manager */
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltFreeSecurityPrefs(xsltSecPrefs);
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* load_des_keys:
|
||||
* @files: the list of filenames.
|
||||
* @files_size: the number of filenames in #files.
|
||||
*
|
||||
* Creates simple keys manager and load DES keys from #files in it.
|
||||
* The caller is responsible for destroying returned keys manager using
|
||||
* @xmlSecKeysMngrDestroy.
|
||||
*
|
||||
* Returns the pointer to newly created keys manager or NULL if an error
|
||||
* occurs.
|
||||
*/
|
||||
xmlSecKeysMngrPtr
|
||||
load_des_keys(char** files, int files_size) {
|
||||
xmlSecKeysMngrPtr mngr;
|
||||
xmlSecKeyPtr key;
|
||||
int i;
|
||||
|
||||
assert(files);
|
||||
assert(files_size > 0);
|
||||
|
||||
/* create and initialize keys manager, we use a simple list based
|
||||
* keys manager, implement your own xmlSecKeysStore klass if you need
|
||||
* something more sophisticated
|
||||
*/
|
||||
mngr = xmlSecKeysMngrCreate();
|
||||
if(mngr == NULL) {
|
||||
fprintf(stderr, "Error: failed to create keys manager.\n");
|
||||
return(NULL);
|
||||
}
|
||||
if(xmlSecCryptoAppDefaultKeysMngrInit(mngr) < 0) {
|
||||
fprintf(stderr, "Error: failed to initialize keys manager.\n");
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
for(i = 0; i < files_size; ++i) {
|
||||
assert(files[i]);
|
||||
|
||||
/* load DES key */
|
||||
key = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, files[i]);
|
||||
if(key == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", files[i]);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(key, BAD_CAST files[i]) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* add key to keys manager, from now on keys manager is responsible
|
||||
* for destroying key
|
||||
*/
|
||||
if(xmlSecCryptoAppDefaultKeysMngrAdoptKey(mngr, key) < 0) {
|
||||
fprintf(stderr,"Error: failed to add key from \"%s\" to keys manager\n", files[i]);
|
||||
xmlSecKeyDestroy(key);
|
||||
xmlSecKeysMngrDestroy(mngr);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(mngr);
|
||||
}
|
||||
|
||||
/**
|
||||
* decrypt_file:
|
||||
* @mngr: the pointer to keys manager.
|
||||
* @enc_file: the encrypted XML file name.
|
||||
*
|
||||
* Decrypts the XML file #enc_file using DES key from #key_file and
|
||||
* prints results to stdout.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
decrypt_file(xmlSecKeysMngrPtr mngr, const char* enc_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(mngr);
|
||||
assert(enc_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(enc_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context */
|
||||
encCtx = xmlSecEncCtxCreate(mngr);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* decrypt the data */
|
||||
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
|
||||
fprintf(stderr,"Error: decryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print decrypted data to stdout */
|
||||
if(encCtx->resultReplaced != 0) {
|
||||
fprintf(stdout, "Decrypted XML data:\n");
|
||||
xmlDocDump(stdout, doc);
|
||||
} else {
|
||||
fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
|
||||
if(xmlSecBufferGetData(encCtx->result) != NULL) {
|
||||
fwrite(xmlSecBufferGetData(encCtx->result),
|
||||
1,
|
||||
xmlSecBufferGetSize(encCtx->result),
|
||||
stdout);
|
||||
}
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,258 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Decrypting data with a single key.: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-examples.html" title="Examples.">
|
||||
<link rel="prev" href="xmlsec-encrypt-with-session-key.html" title="Encrypting data with a session key.">
|
||||
<link rel="next" href="xmlsec-decrypt-with-keys-mngr.html" title="Decrypting data with keys manager.">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts"></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-encrypt-with-session-key.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-decrypt-with-keys-mngr.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="sect1">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="xmlsec-decrypt-with-signle-key"></a>Decrypting data with a single key.</h2></div></div></div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-decrypt1"></a>decrypt1.c</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
/**
|
||||
* XML Security Library example: Decrypting an encrypted file using a single key.
|
||||
*
|
||||
* Decrypts encrypted XML file using a single DES key from a binary file
|
||||
*
|
||||
* Usage:
|
||||
* ./decrypt1 <xml-enc> <des-key-file>
|
||||
*
|
||||
* Example:
|
||||
* ./decrypt1 encrypt1-res.xml deskey.bin
|
||||
* ./decrypt1 encrypt2-res.xml deskey.bin
|
||||
*
|
||||
* This is free software; see Copyright file in the source
|
||||
* distribution for preciese wording.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/security.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
int decrypt_file(const char* enc_file, const char* key_file);
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <enc-file> <key-file>\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init libxslt */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
/* disable everything */
|
||||
xsltSecPrefs = xsltNewSecurityPrefs();
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid);
|
||||
xsltSetDefaultSecurityPrefs(xsltSecPrefs);
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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 and/or LTDL_LIBRARY_PATH) environment variables.\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(decrypt_file(argv[1], argv[2]) < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* decrypt_file:
|
||||
* @enc_file: the encrypted XML file name.
|
||||
* @key_file: the Triple DES key file.
|
||||
*
|
||||
* Decrypts the XML file #enc_file using DES key from #key_file and
|
||||
* prints results to stdout.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
decrypt_file(const char* enc_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(enc_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(enc_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", enc_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* decrypt the data */
|
||||
if((xmlSecEncCtxDecrypt(encCtx, node) < 0) || (encCtx->result == NULL)) {
|
||||
fprintf(stderr,"Error: decryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print decrypted data to stdout */
|
||||
if(encCtx->resultReplaced != 0) {
|
||||
fprintf(stdout, "Decrypted XML data:\n");
|
||||
xmlDocDump(stdout, doc);
|
||||
} else {
|
||||
fprintf(stdout, "Decrypted binary data (%d bytes):\n", xmlSecBufferGetSize(encCtx->result));
|
||||
if(xmlSecBufferGetData(encCtx->result) != NULL) {
|
||||
fwrite(xmlSecBufferGetData(encCtx->result),
|
||||
1,
|
||||
xmlSecBufferGetSize(encCtx->result),
|
||||
stdout);
|
||||
}
|
||||
}
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,302 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>dl: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-ref.html" title="XML Security Core Library API Reference.">
|
||||
<link rel="prev" href="xmlsec-buffer.html" title="buffer">
|
||||
<link rel="next" href="xmlsec-errors.html" title="errors">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts">
|
||||
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
|
||||
<a href="#xmlsec-dl.description" class="shortcut">Description</a></span>
|
||||
</td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-ref.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-buffer.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-errors.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="refentry">
|
||||
<a name="xmlsec-dl"></a><div class="titlepage"></div>
|
||||
<div class="refnamediv"><table width="100%"><tr>
|
||||
<td valign="top">
|
||||
<h2><span class="refentrytitle"><a name="xmlsec-dl.top_of_page"></a>dl</span></h2>
|
||||
<p>dl — Dynamic crypto-engine library loading functions.</p>
|
||||
</td>
|
||||
<td class="gallery_image" valign="top" align="right"></td>
|
||||
</tr></table></div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-dl.stability-level"></a><h2>Stability Level</h2>
|
||||
<a href="http://foldoc.org/Stable"><span class="acronym">Stable</span></a>, unless otherwise indicated
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-dl.functions"></a><h2>Functions</h2>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms" title="xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms ()">xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLInit" title="xmlSecCryptoDLInit ()">xmlSecCryptoDLInit</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLShutdown" title="xmlSecCryptoDLShutdown ()">xmlSecCryptoDLShutdown</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLLoadLibrary" title="xmlSecCryptoDLLoadLibrary ()">xmlSecCryptoDLLoadLibrary</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">xmlSecCryptoDLFunctionsPtr</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLGetLibraryFunctions" title="xmlSecCryptoDLGetLibraryFunctions ()">xmlSecCryptoDLGetLibraryFunctions</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLUnloadLibrary" title="xmlSecCryptoDLUnloadLibrary ()">xmlSecCryptoDLUnloadLibrary</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">int</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLSetFunctions" title="xmlSecCryptoDLSetFunctions ()">xmlSecCryptoDLSetFunctions</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="function_type">
|
||||
<font><span class="returnvalue">xmlSecCryptoDLFunctionsPtr</span></font>
|
||||
</td>
|
||||
<td class="function_name">
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLGetFunctions" title="xmlSecCryptoDLGetFunctions ()">xmlSecCryptoDLGetFunctions</a> <span class="c_punctuation">()</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-dl.description"></a><h2>Description</h2>
|
||||
<p></p>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-dl.functions_details"></a><h2>Functions</h2>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms"></a><h3>xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms
|
||||
(<em class="parameter"><code><font><span class="type">xmlSecCryptoDLFunctionsPtr</span></font> functions</code></em>);</pre>
|
||||
<p>Registers the key data and transforms klasses from <em class="parameter"><code>functions</code></em>
|
||||
table in xmlsec.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>functions</p></td>
|
||||
<td class="parameter_description"><p>the functions table.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLFunctionsRegisterKeyDataAndTransforms.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLInit"></a><h3>xmlSecCryptoDLInit ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLInit (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
|
||||
<p>Initializes dynamic loading engine. This is an internal function
|
||||
and should not be called by application directly.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLInit.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLShutdown"></a><h3>xmlSecCryptoDLShutdown ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLShutdown (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
|
||||
<p>Shutdowns dynamic loading engine. This is an internal function
|
||||
and should not be called by application directly.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLShutdown.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLLoadLibrary"></a><h3>xmlSecCryptoDLLoadLibrary ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLLoadLibrary (<em class="parameter"><code>const <font><span class="type">xmlChar</span></font> *crypto</code></em>);</pre>
|
||||
<p>Loads the xmlsec-$crypto library. This function is NOT thread safe,
|
||||
application MUST NOT call <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLLoadLibrary" title="xmlSecCryptoDLLoadLibrary ()"><span class="type">xmlSecCryptoDLLoadLibrary</span></a>, <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLGetLibraryFunctions" title="xmlSecCryptoDLGetLibraryFunctions ()"><span class="type">xmlSecCryptoDLGetLibraryFunctions</span></a>,
|
||||
and <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLUnloadLibrary" title="xmlSecCryptoDLUnloadLibrary ()"><span class="type">xmlSecCryptoDLUnloadLibrary</span></a> functions from multiple threads.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLLoadLibrary.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>crypto</p></td>
|
||||
<td class="parameter_description"><p>the desired crypto library name ("openssl", "nss", ...). If NULL
|
||||
then the default crypto engine will be used.</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLLoadLibrary.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLGetLibraryFunctions"></a><h3>xmlSecCryptoDLGetLibraryFunctions ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">xmlSecCryptoDLFunctionsPtr</span></font>
|
||||
xmlSecCryptoDLGetLibraryFunctions (<em class="parameter"><code>const <font><span class="type">xmlChar</span></font> *crypto</code></em>);</pre>
|
||||
<p>Loads the xmlsec-$crypto library and gets global crypto functions/transforms/keys data/keys store
|
||||
table. This function is NOT thread safe, application MUST NOT call <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLLoadLibrary" title="xmlSecCryptoDLLoadLibrary ()"><span class="type">xmlSecCryptoDLLoadLibrary</span></a>,
|
||||
<a class="link" href="xmlsec-dl.html#xmlSecCryptoDLGetLibraryFunctions" title="xmlSecCryptoDLGetLibraryFunctions ()"><span class="type">xmlSecCryptoDLGetLibraryFunctions</span></a>, and <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLUnloadLibrary" title="xmlSecCryptoDLUnloadLibrary ()"><span class="type">xmlSecCryptoDLUnloadLibrary</span></a> functions from multiple threads.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLGetLibraryFunctions.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>crypto</p></td>
|
||||
<td class="parameter_description"><p>the desired crypto library name ("openssl", "nss", ...).</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLGetLibraryFunctions.returns"></a><h4>Returns</h4>
|
||||
<p> the table or NULL if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLUnloadLibrary"></a><h3>xmlSecCryptoDLUnloadLibrary ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLUnloadLibrary (<em class="parameter"><code>const <font><span class="type">xmlChar</span></font> *crypto</code></em>);</pre>
|
||||
<p>Unloads the xmlsec-$crypto library. All pointers to this library
|
||||
functions tables became invalid. This function is NOT thread safe,
|
||||
application MUST NOT call <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLLoadLibrary" title="xmlSecCryptoDLLoadLibrary ()"><span class="type">xmlSecCryptoDLLoadLibrary</span></a>, <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLGetLibraryFunctions" title="xmlSecCryptoDLGetLibraryFunctions ()"><span class="type">xmlSecCryptoDLGetLibraryFunctions</span></a>,
|
||||
and <a class="link" href="xmlsec-dl.html#xmlSecCryptoDLUnloadLibrary" title="xmlSecCryptoDLUnloadLibrary ()"><span class="type">xmlSecCryptoDLUnloadLibrary</span></a> functions from multiple threads.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLUnloadLibrary.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>crypto</p></td>
|
||||
<td class="parameter_description"><p>the desired crypto library name ("openssl", "nss", ...).</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLUnloadLibrary.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLSetFunctions"></a><h3>xmlSecCryptoDLSetFunctions ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">int</span></font>
|
||||
xmlSecCryptoDLSetFunctions (<em class="parameter"><code><font><span class="type">xmlSecCryptoDLFunctionsPtr</span></font> functions</code></em>);</pre>
|
||||
<p>Sets global crypto functions/transforms/keys data/keys store table.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLSetFunctions.parameters"></a><h4>Parameters</h4>
|
||||
<div class="informaltable"><table class="informaltable" width="100%" border="0">
|
||||
<colgroup>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody><tr>
|
||||
<td class="parameter_name"><p>functions</p></td>
|
||||
<td class="parameter_description"><p>the new table</p></td>
|
||||
<td class="parameter_annotations"> </td>
|
||||
</tr></tbody>
|
||||
</table></div>
|
||||
</div>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLSetFunctions.returns"></a><h4>Returns</h4>
|
||||
<p> 0 on success or a negative value if an error occurs.</p>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="refsect2">
|
||||
<a name="xmlSecCryptoDLGetFunctions"></a><h3>xmlSecCryptoDLGetFunctions ()</h3>
|
||||
<pre class="programlisting"><font><span class="returnvalue">xmlSecCryptoDLFunctionsPtr</span></font>
|
||||
xmlSecCryptoDLGetFunctions (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
|
||||
<p>Gets global crypto functions/transforms/keys data/keys store table.</p>
|
||||
<div class="refsect3">
|
||||
<a name="xmlSecCryptoDLGetFunctions.returns"></a><h4>Returns</h4>
|
||||
<p> the table.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="refsect1">
|
||||
<a name="xmlsec-dl.other_details"></a><h2>Types and Values</h2>
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,314 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Encrypting data with a dynamicaly created template.: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-examples.html" title="Examples.">
|
||||
<link rel="prev" href="xmlsec-encrypt-template-file.html" title="Encrypting data with a template file.">
|
||||
<link rel="next" href="xmlsec-encrypt-with-session-key.html" title="Encrypting data with a session key.">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts"></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-encrypt-template-file.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-encrypt-with-session-key.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="sect1">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="xmlsec-encrypt-dynamic-template"></a>Encrypting data with a dynamicaly created template.</h2></div></div></div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt2"></a>encrypt2.c</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
/**
|
||||
* XML Security Library example: Encrypting XML file with a dynamicaly created template.
|
||||
*
|
||||
* Encrypts XML file using a dynamicaly created template file and a DES key
|
||||
* from a binary file
|
||||
*
|
||||
* Usage:
|
||||
* ./encrypt2 <xml-doc> <des-key-file>
|
||||
*
|
||||
* Example:
|
||||
* ./encrypt2 encrypt2-doc.xml deskey.bin > encrypt2-res.xml
|
||||
*
|
||||
* The result could be decrypted with decrypt1 example:
|
||||
* ./decrypt1 encrypt2-res.xml deskey.bin
|
||||
*
|
||||
* This is free software; see Copyright file in the source
|
||||
* distribution for preciese wording.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/security.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/templates.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
int encrypt_file(const char* xml_file, const char* key_file);
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <xml-file> <key-file>\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init libxslt */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
/* disable everything */
|
||||
xsltSecPrefs = xsltNewSecurityPrefs();
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid);
|
||||
xsltSetDefaultSecurityPrefs(xsltSecPrefs);
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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 and/or LTDL_LIBRARY_PATH) environment variables.\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(encrypt_file(argv[1], argv[2]) < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltFreeSecurityPrefs(xsltSecPrefs);
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* encrypt_file:
|
||||
* @xml_file: the encryption template file name.
|
||||
* @key_file: the Triple DES key file.
|
||||
*
|
||||
* Encrypts #xml_file using a dynamicaly created template and DES key from
|
||||
* #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
encrypt_file(const char* xml_file, const char* key_file) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr encDataNode = NULL;
|
||||
xmlNodePtr keyInfoNode = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(xml_file);
|
||||
assert(key_file);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(xml_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", xml_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption template to encrypt XML file and replace
|
||||
* its content with encryption result */
|
||||
encDataNode = xmlSecTmplEncDataCreate(doc, xmlSecTransformDes3CbcId,
|
||||
NULL, xmlSecTypeEncElement, NULL, NULL);
|
||||
if(encDataNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to create encryption template\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we want to put encrypted data in the <enc:CipherValue/> node */
|
||||
if(xmlSecTmplEncDataEnsureCipherValue(encDataNode) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add CipherValue node\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add <dsig:KeyInfo/> and <dsig:KeyName/> nodes to put key name in the signed document */
|
||||
keyInfoNode = xmlSecTmplEncDataEnsureKeyInfo(encDataNode, NULL);
|
||||
if(keyInfoNode == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key info\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if(xmlSecTmplKeyInfoAddKeyName(keyInfoNode, NULL) == NULL) {
|
||||
fprintf(stderr, "Error: failed to add key name\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key, assuming that there is not password */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* encrypt the data */
|
||||
if(xmlSecEncCtxXmlEncrypt(encCtx, encDataNode, xmlDocGetRootElement(doc)) < 0) {
|
||||
fprintf(stderr,"Error: encryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* we template is inserted in the doc */
|
||||
encDataNode = NULL;
|
||||
|
||||
/* print encrypted data with document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(encDataNode != NULL) {
|
||||
xmlFreeNode(encDataNode);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt2-doc"></a>encrypt2-doc.xml</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
XML Security Library example: Original XML doc file before encryption (encrypt2 example).
|
||||
-->
|
||||
<Envelope xmlns="urn:envelope">
|
||||
<Data>
|
||||
Hello, World!
|
||||
</Data>
|
||||
</Envelope>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt2-res"></a>encrypt2-res.xml</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
XML Security Library example: Encrypted XML file (encrypt2 example).
|
||||
-->
|
||||
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#" Type="http://www.w3.org/2001/04/xmlenc#Element">
|
||||
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
|
||||
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
<KeyName>deskey.bin</KeyName>
|
||||
</KeyInfo>
|
||||
<CipherData>
|
||||
<CipherValue>WXlDyktaADlUe+PywKwS3KdKlahCteEKxi/hRlHcXNQlGwNGrYKy8aQ6dLtX1bKg
|
||||
IgL/XoAQN3B27zD91b1ZLGh6QQ9CjnVD98+hYJ9TPp4piPnII4vGUA==</CipherValue>
|
||||
</CipherData>
|
||||
</EncryptedData>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,292 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>Encrypting data with a template file.: XML Security Library Reference Manual</title>
|
||||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||||
<link rel="home" href="index.html" title="XML Security Library Reference Manual">
|
||||
<link rel="up" href="xmlsec-examples.html" title="Examples.">
|
||||
<link rel="prev" href="xmlsec-verify-with-restrictions.html" title="Verifying a signature with additional restrictions.">
|
||||
<link rel="next" href="xmlsec-encrypt-dynamic-template.html" title="Encrypting data with a dynamicaly created template.">
|
||||
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
|
||||
<link rel="stylesheet" href="style.css" type="text/css">
|
||||
</head>
|
||||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||||
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
|
||||
<td width="100%" align="left" class="shortcuts"></td>
|
||||
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
|
||||
<td><a accesskey="u" href="xmlsec-examples.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
|
||||
<td><a accesskey="p" href="xmlsec-verify-with-restrictions.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
|
||||
<td><a accesskey="n" href="xmlsec-encrypt-dynamic-template.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
|
||||
</tr></table>
|
||||
<div class="sect1">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="xmlsec-encrypt-template-file"></a>Encrypting data with a template file.</h2></div></div></div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt1"></a>encrypt1.c</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
/**
|
||||
* XML Security Library example: Encrypting data using a template file.
|
||||
*
|
||||
* Encrypts binary data using a template file and a DES key from a binary file
|
||||
*
|
||||
* Usage:
|
||||
* ./encrypt1 <xml-tmpl> <des-key-file>
|
||||
*
|
||||
* Example:
|
||||
* ./encrypt1 encrypt1-tmpl.xml deskey.bin > encrypt1-res.xml
|
||||
*
|
||||
* The result could be decrypted with decrypt1 example:
|
||||
* ./decrypt1 encrypt1-res.xml deskey.bin
|
||||
*
|
||||
* This is free software; see Copyright file in the source
|
||||
* distribution for preciese wording.
|
||||
*
|
||||
* Copyright (C) 2002-2016 Aleksey Sanin <aleksey@aleksey.com>. All Rights Reserved.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
#include <libxslt/xslt.h>
|
||||
#include <libxslt/security.h>
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
#include <xmlsec/xmlsec.h>
|
||||
#include <xmlsec/xmltree.h>
|
||||
#include <xmlsec/xmlenc.h>
|
||||
#include <xmlsec/crypto.h>
|
||||
|
||||
int encrypt_file(const char* tmpl_file, const char* key_file,
|
||||
const unsigned char* data, size_t dataSize);
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
static const char secret_data[] = "Big secret";
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltSecurityPrefsPtr xsltSecPrefs = NULL;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
assert(argv);
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr, "Error: wrong number of arguments.\n");
|
||||
fprintf(stderr, "Usage: %s <tmpl-file> <key-file>\n", argv[0]);
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* Init libxml and libxslt libraries */
|
||||
xmlInitParser();
|
||||
LIBXML_TEST_VERSION
|
||||
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
|
||||
xmlSubstituteEntitiesDefault(1);
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xmlIndentTreeOutput = 1;
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init libxslt */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
/* disable everything */
|
||||
xsltSecPrefs = xsltNewSecurityPrefs();
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_FILE, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_CREATE_DIRECTORY, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_READ_NETWORK, xsltSecurityForbid);
|
||||
xsltSetSecurityPrefs(xsltSecPrefs, XSLT_SECPREF_WRITE_NETWORK, xsltSecurityForbid);
|
||||
xsltSetDefaultSecurityPrefs(xsltSecPrefs);
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
|
||||
/* Init xmlsec library */
|
||||
if(xmlSecInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Check loaded library version */
|
||||
if(xmlSecCheckVersion() != 1) {
|
||||
fprintf(stderr, "Error: loaded xmlsec library version is not compatible.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Load default crypto engine if we are supporting dynamic
|
||||
* loading for xmlsec-crypto libraries. Use the crypto library
|
||||
* name ("openssl", "nss", etc.) to load corresponding
|
||||
* xmlsec-crypto library.
|
||||
*/
|
||||
#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING
|
||||
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 and/or LTDL_LIBRARY_PATH) environment variables.\n");
|
||||
return(-1);
|
||||
}
|
||||
#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */
|
||||
|
||||
/* Init crypto library */
|
||||
if(xmlSecCryptoAppInit(NULL) < 0) {
|
||||
fprintf(stderr, "Error: crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Init xmlsec-crypto library */
|
||||
if(xmlSecCryptoInit() < 0) {
|
||||
fprintf(stderr, "Error: xmlsec-crypto initialization failed.\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
if(encrypt_file(argv[1], argv[2], secret_data, strlen(secret_data)) < 0) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* Shutdown xmlsec-crypto library */
|
||||
xmlSecCryptoShutdown();
|
||||
|
||||
/* Shutdown crypto library */
|
||||
xmlSecCryptoAppShutdown();
|
||||
|
||||
/* Shutdown xmlsec library */
|
||||
xmlSecShutdown();
|
||||
|
||||
/* Shutdown libxslt/libxml */
|
||||
#ifndef XMLSEC_NO_XSLT
|
||||
xsltFreeSecurityPrefs(xsltSecPrefs);
|
||||
xsltCleanupGlobals();
|
||||
#endif /* XMLSEC_NO_XSLT */
|
||||
xmlCleanupParser();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* encrypt_file:
|
||||
* @tmpl_file: the encryption template file name.
|
||||
* @key_file: the Triple DES key file.
|
||||
* @data: the binary data to encrypt.
|
||||
* @dataSize: the binary data size.
|
||||
*
|
||||
* Encrypts binary #data using template from #tmpl_file and DES key from
|
||||
* #key_file.
|
||||
*
|
||||
* Returns 0 on success or a negative value if an error occurs.
|
||||
*/
|
||||
int
|
||||
encrypt_file(const char* tmpl_file, const char* key_file,
|
||||
const unsigned char* data, size_t dataSize) {
|
||||
xmlDocPtr doc = NULL;
|
||||
xmlNodePtr node = NULL;
|
||||
xmlSecEncCtxPtr encCtx = NULL;
|
||||
int res = -1;
|
||||
|
||||
assert(tmpl_file);
|
||||
assert(key_file);
|
||||
assert(data);
|
||||
|
||||
/* load template */
|
||||
doc = xmlParseFile(tmpl_file);
|
||||
if ((doc == NULL) || (xmlDocGetRootElement(doc) == NULL)){
|
||||
fprintf(stderr, "Error: unable to parse file \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* find start node */
|
||||
node = xmlSecFindNode(xmlDocGetRootElement(doc), xmlSecNodeEncryptedData, xmlSecEncNs);
|
||||
if(node == NULL) {
|
||||
fprintf(stderr, "Error: start node not found in \"%s\"\n", tmpl_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* create encryption context, we don't need keys manager in this example */
|
||||
encCtx = xmlSecEncCtxCreate(NULL);
|
||||
if(encCtx == NULL) {
|
||||
fprintf(stderr,"Error: failed to create encryption context\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* load DES key, assuming that there is not password */
|
||||
encCtx->encKey = xmlSecKeyReadBinaryFile(xmlSecKeyDataDesId, key_file);
|
||||
if(encCtx->encKey == NULL) {
|
||||
fprintf(stderr,"Error: failed to load des key from binary file \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* set key name to the file name, this is just an example! */
|
||||
if(xmlSecKeySetName(encCtx->encKey, key_file) < 0) {
|
||||
fprintf(stderr,"Error: failed to set key name for key from \"%s\"\n", key_file);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* encrypt the data */
|
||||
if(xmlSecEncCtxBinaryEncrypt(encCtx, node, data, dataSize) < 0) {
|
||||
fprintf(stderr,"Error: encryption failed\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* print encrypted data with document to stdout */
|
||||
xmlDocDump(stdout, doc);
|
||||
|
||||
/* success */
|
||||
res = 0;
|
||||
|
||||
done:
|
||||
|
||||
/* cleanup */
|
||||
if(encCtx != NULL) {
|
||||
xmlSecEncCtxDestroy(encCtx);
|
||||
}
|
||||
|
||||
if(doc != NULL) {
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
return(res);
|
||||
}
|
||||
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt1-tmpl"></a>encrypt1-tmpl.xml</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
XML Security Library example: Simple encryption template file for encrypt1 example.
|
||||
-->
|
||||
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#">
|
||||
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
|
||||
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
<KeyName/>
|
||||
</KeyInfo>
|
||||
<CipherData>
|
||||
<CipherValue></CipherValue>
|
||||
</CipherData>
|
||||
</EncryptedData>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<div class="titlepage"><div><div><h3 class="title">
|
||||
<a name="xmlsec-example-encrypt1-res"></a>encrypt1-res.xml</h3></div></div></div>
|
||||
<div class="informalexample"><pre class="programlisting">
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
XML Security Library example: Encrypted binary data (encrypt1 example).
|
||||
-->
|
||||
<EncryptedData xmlns="http://www.w3.org/2001/04/xmlenc#">
|
||||
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
|
||||
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
|
||||
<KeyName>deskey.bin</KeyName>
|
||||
</KeyInfo>
|
||||
<CipherData>
|
||||
<CipherValue>t6JVBMihIgRyiK8AS8AX5NcXTfkdXPTK</CipherValue>
|
||||
</CipherData>
|
||||
</EncryptedData>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<hr>Generated by GTK-Doc V1.27</div>
|
||||
</body>
|
||||
</html>
|