[cpp-xml-security] branch main updated: Update for 3.0, remove XKMS, NSS, WinCAPI, Xalan support.
Scott Cantor
cantor.2 at osu.edu
Tue Oct 8 18:05:31 UTC 2024
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-xml-security.
View the commit online:
http://git.shibboleth.net/view/?p=cpp-xml-security.git;a=commit;h=54aea139aae2331b691d9b12cd4d9a2ff3b884bb
The following commit(s) were added to refs/heads/main by this push:
new 54aea139 Update for 3.0, remove XKMS, NSS, WinCAPI, Xalan support.
54aea139 is described below
commit 54aea139aae2331b691d9b12cd4d9a2ff3b884bb
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 8 14:05:26 2024 -0400
Update for 3.0, remove XKMS, NSS, WinCAPI, Xalan support.
---
.gitignore | 61 +
NOTICE.txt | 2 +-
configure.ac | 95 +-
xsec/Makefile.am | 214 +-
xsec/canon/XSECC14n20010315.cpp | 110 -
xsec/canon/XSECC14n20010315.hpp | 9 -
xsec/dsig/DSIGReference.cpp | 2 -
xsec/dsig/DSIGTransformBase64.cpp | 24 -
xsec/dsig/DSIGTransformEnvelope.cpp | 16 -
xsec/dsig/DSIGTransformXPath.cpp | 19 -
xsec/dsig/DSIGTransformXPathFilter.cpp | 15 -
xsec/dsig/DSIGTransformXSL.cpp | 32 -
xsec/dsig/DSIGXPathHere.cpp | 87 -
xsec/dsig/DSIGXPathHere.hpp | 132 -
xsec/enc/NSS/NSSCryptoHash.cpp | 171 -
xsec/enc/NSS/NSSCryptoHash.hpp | 162 -
xsec/enc/NSS/NSSCryptoHashHMAC.cpp | 296 --
xsec/enc/NSS/NSSCryptoHashHMAC.hpp | 173 -
xsec/enc/NSS/NSSCryptoKeyDSA.cpp | 631 ---
xsec/enc/NSS/NSSCryptoKeyDSA.hpp | 261 --
xsec/enc/NSS/NSSCryptoKeyHMAC.cpp | 91 -
xsec/enc/NSS/NSSCryptoKeyHMAC.hpp | 131 -
xsec/enc/NSS/NSSCryptoKeyRSA.cpp | 708 ---
xsec/enc/NSS/NSSCryptoKeyRSA.hpp | 291 --
xsec/enc/NSS/NSSCryptoProvider.cpp | 364 --
xsec/enc/NSS/NSSCryptoProvider.hpp | 301 --
xsec/enc/NSS/NSSCryptoSymmetricKey.cpp | 616 ---
xsec/enc/NSS/NSSCryptoSymmetricKey.hpp | 303 --
xsec/enc/NSS/NSSCryptoX509.cpp | 257 --
xsec/enc/NSS/NSSCryptoX509.hpp | 151 -
xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp | 3 +-
xsec/enc/WinCAPI/WinCAPICryptoHash.cpp | 161 -
xsec/enc/WinCAPI/WinCAPICryptoHash.hpp | 172 -
xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.cpp | 420 --
xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp | 194 -
xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.cpp | 777 ----
xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp | 303 --
xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.cpp | 125 -
xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp | 191 -
xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp | 843 ----
xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp | 336 --
xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp | 399 --
xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp | 369 --
xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.cpp | 756 ----
xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp | 344 --
xsec/enc/WinCAPI/WinCAPICryptoX509.cpp | 215 -
xsec/enc/WinCAPI/WinCAPICryptoX509.hpp | 164 -
xsec/enc/XSECCryptoProvider.hpp | 3 +-
xsec/enc/XSECCryptoUtils.cpp | 323 --
xsec/enc/XSECCryptoUtils.hpp | 18 -
xsec/framework/XSECConfig.hpp.in | 9 -
xsec/framework/XSECDefs.hpp | 22 -
xsec/framework/XSECEnv.cpp | 38 +-
xsec/framework/XSECEnv.hpp | 29 +-
xsec/framework/XSECError.cpp | 6 -
xsec/framework/XSECException.hpp | 10 +-
xsec/framework/XSECProvider.cpp | 26 +-
xsec/framework/XSECProvider.hpp | 23 -
xsec/framework/XSECVersion.hpp | 4 +-
xsec/framework/XSECW32Config.hpp | 21 -
xsec/framework/version.rc | 24 +-
xsec/samples/simpleDecrypt.cpp | 16 -
xsec/samples/simpleEncrypt.cpp | 12 -
xsec/samples/simpleHMAC.cpp | 14 -
xsec/samples/simpleValidate.cpp | 12 -
xsec/tools/checksig/checksig.cpp | 144 -
xsec/tools/cipher/XencInteropResolver.cpp | 22 -
xsec/tools/cipher/cipher.cpp | 109 +-
xsec/tools/siginf/siginf.cpp | 27 -
xsec/tools/templatesign/templatesign.cpp | 365 --
xsec/tools/threadTest/threadtest.cpp | 15 +-
xsec/tools/txfmout/txfmout.cpp | 23 -
xsec/tools/xklient/xklient.cpp | 4779 --------------------
xsec/tools/xtest/xtest.cpp | 353 +-
xsec/transformers/TXFMXPath.cpp | 579 ---
xsec/transformers/TXFMXPath.hpp | 114 -
xsec/transformers/TXFMXPathFilter.cpp | 658 ---
xsec/transformers/TXFMXPathFilter.hpp | 110 -
xsec/transformers/TXFMXSL.cpp | 238 -
xsec/transformers/TXFMXSL.hpp | 121 -
xsec/utils/XSECDOMUtils.cpp | 13 -
xsec/utils/XSECDOMUtils.hpp | 4 +-
xsec/utils/XSECNameSpaceExpander.hpp | 6 -
xsec/utils/XSECPlatformUtils.cpp | 27 +-
xsec/utils/XSECSOAPRequestor.hpp | 103 -
xsec/utils/XSECSOAPRequestorSimple.cpp | 318 --
xsec/utils/XSECSOAPRequestorSimple.hpp | 146 -
.../unixutils/XSECSOAPRequestorSimpleUnix.cpp | 356 --
.../winutils/XSECSOAPRequestorSimpleWin32.cpp | 400 --
xsec/xkms/XKMSAuthentication.hpp | 159 -
xsec/xkms/XKMSCompoundRequest.hpp | 233 -
xsec/xkms/XKMSCompoundResult.hpp | 322 --
xsec/xkms/XKMSConstants.cpp | 1833 --------
xsec/xkms/XKMSConstants.hpp | 158 -
xsec/xkms/XKMSKeyBinding.hpp | 111 -
xsec/xkms/XKMSKeyBindingAbstractType.hpp | 376 --
xsec/xkms/XKMSLocateRequest.hpp | 132 -
xsec/xkms/XKMSLocateResult.hpp | 142 -
xsec/xkms/XKMSMessageAbstractType.hpp | 311 --
xsec/xkms/XKMSMessageFactory.hpp | 1047 -----
xsec/xkms/XKMSNotBoundAuthentication.hpp | 135 -
xsec/xkms/XKMSPendingRequest.hpp | 132 -
xsec/xkms/XKMSPrototypeKeyBinding.hpp | 155 -
xsec/xkms/XKMSQueryKeyBinding.hpp | 94 -
xsec/xkms/XKMSRSAKeyPair.hpp | 183 -
xsec/xkms/XKMSRecoverKeyBinding.hpp | 103 -
xsec/xkms/XKMSRecoverRequest.hpp | 160 -
xsec/xkms/XKMSRecoverResult.hpp | 206 -
xsec/xkms/XKMSRegisterRequest.hpp | 190 -
xsec/xkms/XKMSRegisterResult.hpp | 206 -
xsec/xkms/XKMSReissueKeyBinding.hpp | 103 -
xsec/xkms/XKMSReissueRequest.hpp | 194 -
xsec/xkms/XKMSReissueResult.hpp | 144 -
xsec/xkms/XKMSRequestAbstractType.hpp | 274 --
xsec/xkms/XKMSRespondWith.hpp | 127 -
xsec/xkms/XKMSResponseMechanism.hpp | 126 -
xsec/xkms/XKMSResult.hpp | 86 -
xsec/xkms/XKMSResultType.hpp | 228 -
xsec/xkms/XKMSRevokeKeyBinding.hpp | 102 -
xsec/xkms/XKMSRevokeRequest.hpp | 187 -
xsec/xkms/XKMSRevokeResult.hpp | 143 -
xsec/xkms/XKMSStatus.hpp | 177 -
xsec/xkms/XKMSStatusRequest.hpp | 128 -
xsec/xkms/XKMSStatusResult.hpp | 176 -
xsec/xkms/XKMSUnverifiedKeyBinding.hpp | 93 -
xsec/xkms/XKMSUseKeyWith.hpp | 137 -
xsec/xkms/XKMSValidateRequest.hpp | 132 -
xsec/xkms/XKMSValidateResult.hpp | 145 -
xsec/xkms/XKMSValidityInterval.hpp | 140 -
xsec/xkms/impl/XKMSAuthenticationImpl.cpp | 252 --
xsec/xkms/impl/XKMSAuthenticationImpl.hpp | 111 -
xsec/xkms/impl/XKMSCompoundRequestImpl.cpp | 256 --
xsec/xkms/impl/XKMSCompoundRequestImpl.hpp | 129 -
xsec/xkms/impl/XKMSCompoundResultImpl.cpp | 310 --
xsec/xkms/impl/XKMSCompoundResultImpl.hpp | 150 -
xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.cpp | 521 ---
xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.hpp | 207 -
xsec/xkms/impl/XKMSKeyBindingImpl.cpp | 132 -
xsec/xkms/impl/XKMSKeyBindingImpl.hpp | 84 -
xsec/xkms/impl/XKMSLocateRequestImpl.cpp | 173 -
xsec/xkms/impl/XKMSLocateRequestImpl.hpp | 101 -
xsec/xkms/impl/XKMSLocateResultImpl.cpp | 190 -
xsec/xkms/impl/XKMSLocateResultImpl.hpp | 107 -
xsec/xkms/impl/XKMSMessageAbstractTypeImpl.cpp | 455 --
xsec/xkms/impl/XKMSMessageAbstractTypeImpl.hpp | 168 -
xsec/xkms/impl/XKMSMessageFactoryImpl.cpp | 1236 -----
xsec/xkms/impl/XKMSMessageFactoryImpl.hpp | 286 --
xsec/xkms/impl/XKMSNotBoundAuthentication.cpp | 186 -
xsec/xkms/impl/XKMSNotBoundAuthenticationImpl.hpp | 94 -
xsec/xkms/impl/XKMSPendingRequestImpl.cpp | 165 -
xsec/xkms/impl/XKMSPendingRequestImpl.hpp | 96 -
xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.cpp | 195 -
xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.hpp | 95 -
xsec/xkms/impl/XKMSQueryKeyBindingImpl.cpp | 94 -
xsec/xkms/impl/XKMSQueryKeyBindingImpl.hpp | 76 -
xsec/xkms/impl/XKMSRSAKeyPairImpl.cpp | 185 -
xsec/xkms/impl/XKMSRSAKeyPairImpl.hpp | 107 -
xsec/xkms/impl/XKMSRecoverKeyBindingImpl.cpp | 137 -
xsec/xkms/impl/XKMSRecoverKeyBindingImpl.hpp | 84 -
xsec/xkms/impl/XKMSRecoverRequestImpl.cpp | 261 --
xsec/xkms/impl/XKMSRecoverRequestImpl.hpp | 107 -
xsec/xkms/impl/XKMSRecoverResultImpl.cpp | 380 --
xsec/xkms/impl/XKMSRecoverResultImpl.hpp | 129 -
xsec/xkms/impl/XKMSRegisterRequestImpl.cpp | 350 --
xsec/xkms/impl/XKMSRegisterRequestImpl.hpp | 113 -
xsec/xkms/impl/XKMSRegisterResultImpl.cpp | 382 --
xsec/xkms/impl/XKMSRegisterResultImpl.hpp | 129 -
xsec/xkms/impl/XKMSReissueKeyBindingImpl.cpp | 135 -
xsec/xkms/impl/XKMSReissueKeyBindingImpl.hpp | 84 -
xsec/xkms/impl/XKMSReissueRequestImpl.cpp | 350 --
xsec/xkms/impl/XKMSReissueRequestImpl.hpp | 113 -
xsec/xkms/impl/XKMSReissueResultImpl.cpp | 190 -
xsec/xkms/impl/XKMSReissueResultImpl.hpp | 107 -
xsec/xkms/impl/XKMSRequestAbstractTypeImpl.cpp | 399 --
xsec/xkms/impl/XKMSRequestAbstractTypeImpl.hpp | 190 -
xsec/xkms/impl/XKMSRespondWithImpl.cpp | 165 -
xsec/xkms/impl/XKMSRespondWithImpl.hpp | 90 -
xsec/xkms/impl/XKMSResponseMechanismImpl.cpp | 163 -
xsec/xkms/impl/XKMSResponseMechanismImpl.hpp | 90 -
xsec/xkms/impl/XKMSResultImpl.cpp | 122 -
xsec/xkms/impl/XKMSResultImpl.hpp | 88 -
xsec/xkms/impl/XKMSResultTypeImpl.cpp | 318 --
xsec/xkms/impl/XKMSResultTypeImpl.hpp | 129 -
xsec/xkms/impl/XKMSRevokeKeyBindingImpl.cpp | 137 -
xsec/xkms/impl/XKMSRevokeKeyBindingImpl.hpp | 84 -
xsec/xkms/impl/XKMSRevokeRequestImpl.cpp | 302 --
xsec/xkms/impl/XKMSRevokeRequestImpl.hpp | 112 -
xsec/xkms/impl/XKMSRevokeResultImpl.cpp | 190 -
xsec/xkms/impl/XKMSRevokeResultImpl.hpp | 107 -
xsec/xkms/impl/XKMSStatusImpl.cpp | 362 --
xsec/xkms/impl/XKMSStatusImpl.hpp | 91 -
xsec/xkms/impl/XKMSStatusRequestImpl.cpp | 165 -
xsec/xkms/impl/XKMSStatusRequestImpl.hpp | 96 -
xsec/xkms/impl/XKMSStatusResultImpl.cpp | 227 -
xsec/xkms/impl/XKMSStatusResultImpl.hpp | 108 -
xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.cpp | 92 -
xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.hpp | 76 -
xsec/xkms/impl/XKMSUseKeyWithImpl.cpp | 209 -
xsec/xkms/impl/XKMSUseKeyWithImpl.hpp | 92 -
xsec/xkms/impl/XKMSValidateRequestImpl.cpp | 173 -
xsec/xkms/impl/XKMSValidateRequestImpl.hpp | 101 -
xsec/xkms/impl/XKMSValidateResultImpl.cpp | 190 -
xsec/xkms/impl/XKMSValidateResultImpl.hpp | 106 -
xsec/xkms/impl/XKMSValidityIntervalImpl.cpp | 251 -
xsec/xkms/impl/XKMSValidityIntervalImpl.hpp | 93 -
205 files changed, 146 insertions(+), 44551 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..76bc0648
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,61 @@
+*.o
+*.lo
+*.la
+*.al
+*.libs
+*.so
+*.so.[0-9]*
+*.a
+*.pc
+*.pc.in
+*.pyc
+*.pyo
+*.rej
+*.aps
+*.suo
+*.ncb
+*.opensdf
+*.sdf
+*~
+*.#*
+.*.swp
+*.vcxproj.user
+.DS_store
+Makefile
+Makefile.in
+stamp-h1
+stamp-h2
+.deps
+.dirstamp
+/xmltooling-uninstalled.sh
+/aclocal.m4
+/autom4te.cache
+/config.guess
+/config.h
+/config.h.in
+/config.log
+/config.status
+/config.sub
+/configure
+/depcomp
+/install-sh
+/libtool
+/missing
+/pkginfo
+/.settings
+/doxyfile
+/*.gz
+/*.zip
+/*.bz2
+/ipch
+/build-aux
+/build
+/Build
+/doc/api
+/m4/lt~obsolete.m4
+/m4/ltsugar.m4
+/m4/ltoptions.m4
+/m4/libtool.m4
+/m4/ltversion.m4
+/xsec/framework/XSECConfig.hpp
+/xsec/xsec-*
diff --git a/NOTICE.txt b/NOTICE.txt
index 8187a7a2..0f9538dd 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -1,4 +1,4 @@
-Apache Santuario XML-Security-C Library
+Formerly the Apache Santuario XML-Security-C Library
Copyright 2010-2021 The Apache Software Foundation
This product includes software developed at
diff --git a/configure.ac b/configure.ac
index 9442703d..31022335 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
# Process this file with autoreconf
AC_PREREQ(2.50)
-AC_INIT([[XML-Security-C]],[2.0.4],[dev at shibboleth.net],[xml-security-c])
+AC_INIT([[XML-Security-C]],[3.0.0],[dev at shibboleth.net],[xml-security-c])
AC_CONFIG_SRCDIR(xsec)
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_MACRO_DIR(m4)
@@ -95,77 +95,6 @@ xerces_CXXFLAGS=$xerces_CFLAGS
xerces_CFLAGS=""
AC_SUBST([xerces_CXXFLAGS])
-# Get user options
-
-AC_ARG_WITH(xalan,
- AS_HELP_STRING([--with-xalan],[Enable Xalan integration. Values = 'yes' or installation directory (Default = yes)]),
- use_xalan=$withval, use_xalan=yes)
-
-if test x"$use_xalan" != "xyes" ; then
- if test x"$use_xalan" != "xno" ; then
- XALANCROOT=$use_xalan
- fi
-fi
-
-# Now check for Xalan
-
-if test x"$use_xalan" != x"no" ; then
-
- if test $XALANCROOT; then
-
- AC_MSG_NOTICE([looking for Xalan headers in $XALANCROOT])
-
- # Updated to include nls/include as this is generally needed for
- # compilation against non-installed xalan.
- # Also now include XALANCROOT/include to cater for installed xalan
- xalan_CXXFLAGS="-I${XALANCROOT}/src -I${XALANCROOT}/include -I${XALANCROOT}/nls/include"
- xalan_LIBS="-L${XALANCROOT}/lib -lxalan-c"
- AX_SAVE_FLAGS_WITH_PREFIX([xalan],[[CXXFLAGS]])
- AC_CHECK_HEADER([xalanc/Include/XalanVersion.hpp],
- [xalan_found=yes])
- AX_RESTORE_FLAGS_WITH_PREFIX([xalan],[[CXXFLAGS]])
-
- fi
-
- if test -z "$xalan_found" ; then
-
- AC_MSG_NOTICE([looking for Xalan in system includes])
- unset ac_cv_header_xalanc_Include_XalanVersion_hpp
- AC_CHECK_HEADER([xalanc/Include/XalanVersion.hpp],
- [xalan_found=yes
- xalan_CXXFLAGS=""
- xalan_LIBS="-lxalan-c"],
- [AC_MSG_NOTICE([WARNING - configuring without Xalan])])
-
- fi
-fi
-
-if test "${xalan_found}" = "yes" ; then
-AX_SAVE_FLAGS_WITH_PREFIX([xalan],[[CXXFLAGS],[LIBS]])
-
-AC_MSG_CHECKING([Xalan version])
-AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([#include <xalanc/Include/XalanVersion.hpp>],
-[#if _XALAN_VERSION >= 11100
-int i = 0;
-#else
-#error requires Xalan version 1.11+
-#endif])],
- [AC_MSG_RESULT(OK)],
- [AC_MSG_FAILURE([Xalan-C 1.11+ is required])])
-
- # Do we need xalanMsg.so?
- AC_SEARCH_LIBS([XalanInitialize],[xalanMsg],[xalan_LIBS="$LIBS"])
-
- AC_DEFINE([XSEC_HAVE_XALAN],[1],[Define to 1 if Xalan is available.])
- AC_SUBST([xalan_CXXFLAGS])
- AC_SUBST([xalan_LIBS])
-
-AX_RESTORE_FLAGS_WITH_PREFIX([xalan],[[CXXFLAGS],[LIBS]])
-else
- AC_MSG_NOTICE([Xalan not included in build - XPath and XSLT will not be available])
-fi
-
AC_LANG(C)
# Crypto provider options (OpenSSL / NSS)
@@ -239,30 +168,8 @@ AS_IF([test x"$with_openssl" != xno],
],[AS_IF([test "x$with_openssl" != xcheck],[AC_MSG_ERROR([Unable to find OpenSSL])])])
])
-AC_ARG_WITH([nss],
- [AS_HELP_STRING([--with-nss],[use the NSS crypto provider @<:@default=check@:>@])],,
- [with_nss=check])
-
-AS_IF([test x"$with_nss" != xno],
- [AX_PKG_CHECK_MODULES([nss],,[nss],
- [with_nss=found
- AC_DEFINE([XSEC_HAVE_NSS],[1],[Define if NSS is in use])
- AC_MSG_WARN([NSS is no longer officially supported])
- ],[AS_IF([test "x$with_nss" != "xcheck"],[AC_MSG_ERROR([Unable to find NSS])])])
- ])
-
-AC_ARG_ENABLE(xkms,
- AS_HELP_STRING([--disable-xkms],[disable XKMS support]),
- [have_xkms=${enableval}],
- [have_xkms=yes])
-if test x"$have_xkms" = "xyes" ; then
- AC_DEFINE([XSEC_XKMS_ENABLED],[1],[Define to 1 if XKMS support is included.])
-fi
-
# Populate the Makefile conditionals
AM_CONDITIONAL([XSEC_AM_HAVE_OPENSSL],[test "x$with_openssl" = xfound])
-AM_CONDITIONAL([XSEC_AM_HAVE_NSS],[test "x$with_nss" = xfound])
-AM_CONDITIONAL(XSEC_AM_HAVE_XKMS, test x"$have_xkms" = "xyes")
# output the Makefiles
AC_OUTPUT
diff --git a/xsec/Makefile.am b/xsec/Makefile.am
index 957142e5..cd144568 100644
--- a/xsec/Makefile.am
+++ b/xsec/Makefile.am
@@ -21,8 +21,8 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
noinst_PROGRAMS = ${samples}
bin_PROGRAMS = ${tools}
-AM_CXXFLAGS += $(xerces_CXXFLAGS) $(xalan_CXXFLAGS)
-LDADD = libxml-security-c.la $(xerces_LIBS) $(xalan_LIBS)
+AM_CXXFLAGS += $(xerces_CXXFLAGS)
+LDADD = libxml-security-c.la $(xerces_LIBS)
#
# The following are sample programs. They are NOT installed
@@ -84,10 +84,8 @@ xsec_xtest_SOURCES = \
tools/xtest/xtest.cpp
xsec_xtest_CPPFLAGS = $(AM_CPPFLAGS) -DXSEC_BUILDING_TOOLS
xsec_xtest_CXXFLAGS = $(AM_CXXFLAGS) \
- $(nss_CFLAGS) \
$(openssl_CFLAGS)
xsec_xtest_LDADD = $(LDADD) \
- $(nss_LIBS) \
$(openssl_LIBS)
tools += xsec-c14n
@@ -104,10 +102,8 @@ xsec_checksig_SOURCES = \
tools/checksig/InteropResolver.cpp
xsec_checksig_CPPFLAGS = $(AM_CPPFLAGS) -DXSEC_BUILDING_TOOLS
xsec_checksig_CXXFLAGS = $(AM_CXXFLAGS) \
- $(nss_CFLAGS) \
$(openssl_CFLAGS)
xsec_checksig_LDADD = $(LDADD) \
- $(nss_LIBS) \
$(openssl_LIBS)
tools += xsec-templatesign
@@ -136,38 +132,20 @@ xsec_cipher_SOURCES = \
tools/cipher/XencInteropResolver.cpp
xsec_cipher_CPPFLAGS = $(AM_CPPFLAGS) -DXSEC_BUILDING_TOOLS
xsec_cipher_CXXFLAGS = $(AM_CXXFLAGS) \
- $(nss_CFLAGS) \
$(openssl_CFLAGS)
xsec_cipher_LDADD = $(LDADD) \
- $(nss_LIBS) \
$(openssl_LIBS)
-if XSEC_AM_HAVE_XKMS
-tools += xsec-xklient
-xsec_xklient_SOURCES = \
- tools/xklient/xklient.cpp \
- enc/OpenSSL/OpenSSLSupport.hpp
-xsec_xklient_CPPFLAGS = $(AM_CPPFLAGS) -DXSEC_BUILDING_TOOLS
-xsec_xklient_CXXFLAGS = $(AM_CXXFLAGS) \
- $(openssl_CFLAGS)
-xsec_xklient_LDADD = $(LDADD) \
- $(openssl_LIBS)
-endif
-
libxml_security_c_la_CPPFLAGS = $(AM_CPPFLAGS) -DXSEC_BUILDING_LIBRARY
libxml_security_c_la_CXXFLAGS = \
- $(xalan_CXXFLAGS) \
$(xerces_CXXFLAGS) \
$(openssl_CFLAGS) \
- $(nss_CFLAGS) \
$(PTHREAD_CFLAGS)
libxml_security_c_la_LIBADD = \
- $(xalan_LIBS) \
$(xerces_LIBS) \
$(openssl_LIBS) \
- $(nss_LIBS) \
$(PTHREAD_LIBS)
lib_LTLIBRARIES = libxml-security-c.la
@@ -177,14 +155,12 @@ canonincludedir = $(includedir)/xsec/canon
encincludedir = $(includedir)/xsec/enc
xscryptincludedir = $(includedir)/xsec/enc/XSCrypt
opensslincludedir = $(includedir)/xsec/enc/OpenSSL
-nssincludedir = $(includedir)/xsec/enc/NSS
dsigincludedir = $(includedir)/xsec/dsig
frameworkincludedir = $(includedir)/xsec/framework
transformersincludedir = $(includedir)/xsec/transformers
utilsincludedir = $(includedir)/xsec/utils
unixutilsincludedir = $(includedir)/xsec/utils/unixutils
xencincludedir = $(includedir)/xsec/xenc
-xkmsincludedir = $(includedir)/xsec/xkms
# The required include files
@@ -235,19 +211,8 @@ opensslinclude_HEADERS = \
enc/OpenSSL/OpenSSLCryptoHash.hpp \
enc/OpenSSL/OpenSSLSupport.hpp
-nssinclude_HEADERS = \
- enc/NSS/NSSCryptoX509.hpp \
- enc/NSS/NSSCryptoHashHMAC.hpp \
- enc/NSS/NSSCryptoKeyDSA.hpp \
- enc/NSS/NSSCryptoKeyHMAC.hpp \
- enc/NSS/NSSCryptoHash.hpp \
- enc/NSS/NSSCryptoSymmetricKey.hpp \
- enc/NSS/NSSCryptoProvider.hpp \
- enc/NSS/NSSCryptoKeyRSA.hpp
-
dsiginclude_HEADERS = \
dsig/DSIGKeyInfoSPKIData.hpp \
- dsig/DSIGXPathHere.hpp \
dsig/DSIGAlgorithmHandlerDefault.hpp \
dsig/DSIGXPathFilterExpr.hpp \
dsig/DSIGKeyInfoX509.hpp \
@@ -291,7 +256,6 @@ nodist_frameworkinclude_HEADERS = \
framework/XSECConfig.hpp
transformersinclude_HEADERS = \
- transformers/TXFMXPathFilter.hpp \
transformers/TXFMHash.hpp \
transformers/TXFMParser.hpp \
transformers/TXFMOutputFile.hpp \
@@ -305,16 +269,12 @@ transformersinclude_HEADERS = \
transformers/TXFMConcatChains.hpp \
transformers/TXFMSB.hpp \
transformers/TXFMC14n.hpp \
- transformers/TXFMXSL.hpp \
- transformers/TXFMXPath.hpp \
transformers/TXFMBase64.hpp
utilsinclude_HEADERS = \
utils/XSECSafeBuffer.hpp \
- utils/XSECSOAPRequestor.hpp \
utils/XSECTXFMInputSource.hpp \
utils/XSECNameSpaceExpander.hpp \
- utils/XSECSOAPRequestorSimple.hpp \
utils/XSECXPathNodeList.hpp \
utils/XSECSafeBufferFormatter.hpp \
utils/XSECBinTXFMInputStream.hpp \
@@ -330,47 +290,6 @@ xencinclude_HEADERS = \
xenc/XENCCipherReference.hpp \
xenc/XENCCipher.hpp
-xkmsinclude_HEADERS = \
- xkms/XKMSNotBoundAuthentication.hpp \
- xkms/XKMSValidateResult.hpp \
- xkms/XKMSValidityInterval.hpp \
- xkms/XKMSStatusRequest.hpp \
- xkms/XKMSRegisterRequest.hpp \
- xkms/XKMSPendingRequest.hpp \
- xkms/XKMSCompoundRequest.hpp \
- xkms/XKMSUseKeyWith.hpp \
- xkms/XKMSValidateRequest.hpp \
- xkms/XKMSUnverifiedKeyBinding.hpp \
- xkms/XKMSLocateResult.hpp \
- xkms/XKMSRespondWith.hpp \
- xkms/XKMSQueryKeyBinding.hpp \
- xkms/XKMSPrototypeKeyBinding.hpp \
- xkms/XKMSKeyBindingAbstractType.hpp \
- xkms/XKMSMessageAbstractType.hpp \
- xkms/XKMSMessageFactory.hpp \
- xkms/XKMSConstants.hpp \
- xkms/XKMSRequestAbstractType.hpp \
- xkms/XKMSResult.hpp \
- xkms/XKMSAuthentication.hpp \
- xkms/XKMSLocateRequest.hpp \
- xkms/XKMSResultType.hpp \
- xkms/XKMSStatusResult.hpp \
- xkms/XKMSKeyBinding.hpp \
- xkms/XKMSCompoundResult.hpp \
- xkms/XKMSRegisterResult.hpp \
- xkms/XKMSResponseMechanism.hpp \
- xkms/XKMSStatus.hpp \
- xkms/XKMSRevokeRequest.hpp \
- xkms/XKMSRevokeResult.hpp \
- xkms/XKMSRecoverKeyBinding.hpp \
- xkms/XKMSRevokeKeyBinding.hpp \
- xkms/XKMSRSAKeyPair.hpp \
- xkms/XKMSRecoverResult.hpp \
- xkms/XKMSReissueResult.hpp \
- xkms/XKMSRecoverRequest.hpp \
- xkms/XKMSReissueRequest.hpp \
- xkms/XKMSReissueKeyBinding.hpp
-
libxml_security_c_la_SOURCES = ${lib_sources}
@@ -404,11 +323,6 @@ lib_sources += ${utils_sources}
lib_sources += ${xenc_sources}
-# XML Key Management
-if XSEC_AM_HAVE_XKMS
- lib_sources += ${xkms_sources}
-endif
-
#
# The following blocks are conditionally added on the basis
# of selections made during the "configure" operation
@@ -417,10 +331,6 @@ if XSEC_AM_HAVE_OPENSSL
lib_sources += ${openssl_sources}
endif
-if XSEC_AM_HAVE_NSS
- lib_sources += ${nss_sources}
-endif
-
# Sources are build up using a find command:
#
# find xsec/transformers/ -name '*.cpp' -exec echo {} \\ ";" | sed "s/xsec\// ..\/xsec\//g"
@@ -439,7 +349,6 @@ dsig_sources = \
dsig/DSIGReferenceList.cpp \
dsig/DSIGKeyInfoValue.cpp \
dsig/DSIGKeyInfoDEREncoded.cpp \
- dsig/DSIGXPathHere.cpp \
dsig/DSIGAlgorithmHandlerDefault.cpp \
dsig/DSIGXPathFilterExpr.cpp \
dsig/DSIGKeyInfoMgmtData.cpp \
@@ -490,13 +399,10 @@ txfm_sources = \
transformers/TXFMSB.cpp \
transformers/TXFMEnvelope.cpp \
transformers/TXFMBase64.cpp \
- transformers/TXFMXPathFilter.cpp \
transformers/TXFMHash.cpp \
transformers/TXFMC14n.cpp \
transformers/TXFMURL.cpp \
transformers/TXFMOutputFile.cpp \
- transformers/TXFMXPath.cpp \
- transformers/TXFMXSL.cpp \
transformers/TXFMDocObject.cpp \
transformers/TXFMConcatChains.cpp \
transformers/TXFMChar.cpp
@@ -518,9 +424,7 @@ utils_sources = \
utils/XSECDOMUtils.cpp \
utils/XSECSafeBufferFormatter.cpp \
utils/XSECNameSpaceExpander.cpp \
- utils/XSECPlatformUtils.cpp \
- utils/XSECSOAPRequestorSimple.cpp \
- utils/unixutils/XSECSOAPRequestorSimpleUnix.cpp
+ utils/XSECPlatformUtils.cpp
# XML Encryption
@@ -544,86 +448,6 @@ xenc_sources = \
xenc/impl/XENCEncryptedKeyImpl.cpp \
xenc/impl/XENCCipherReferenceImpl.hpp
-# XML Key Management
-xkms_sources = \
- xkms/XKMSConstants.cpp \
- xkms/impl/XKMSCompoundRequestImpl.cpp \
- xkms/impl/XKMSRevokeKeyBindingImpl.hpp \
- xkms/impl/XKMSRecoverRequestImpl.cpp \
- xkms/impl/XKMSRegisterResultImpl.cpp \
- xkms/impl/XKMSRecoverResultImpl.cpp \
- xkms/impl/XKMSValidateResultImpl.hpp \
- xkms/impl/XKMSRevokeResultImpl.hpp \
- xkms/impl/XKMSCompoundResultImpl.cpp \
- xkms/impl/XKMSRevokeKeyBindingImpl.cpp \
- xkms/impl/XKMSCompoundResultImpl.hpp \
- xkms/impl/XKMSUnverifiedKeyBindingImpl.hpp \
- xkms/impl/XKMSKeyBindingAbstractTypeImpl.cpp \
- xkms/impl/XKMSQueryKeyBindingImpl.hpp \
- xkms/impl/XKMSPrototypeKeyBindingImpl.cpp \
- xkms/impl/XKMSValidateResultImpl.cpp \
- xkms/impl/XKMSRSAKeyPairImpl.hpp \
- xkms/impl/XKMSAuthenticationImpl.cpp \
- xkms/impl/XKMSNotBoundAuthenticationImpl.hpp \
- xkms/impl/XKMSCompoundRequestImpl.hpp \
- xkms/impl/XKMSPendingRequestImpl.hpp \
- xkms/impl/XKMSStatusResultImpl.cpp \
- xkms/impl/XKMSStatusImpl.hpp \
- xkms/impl/XKMSRegisterRequestImpl.hpp \
- xkms/impl/XKMSReissueRequestImpl.cpp \
- xkms/impl/XKMSKeyBindingImpl.cpp \
- xkms/impl/XKMSUseKeyWithImpl.hpp \
- xkms/impl/XKMSRequestAbstractTypeImpl.cpp \
- xkms/impl/XKMSRespondWithImpl.cpp \
- xkms/impl/XKMSResponseMechanismImpl.hpp \
- xkms/impl/XKMSResultImpl.hpp \
- xkms/impl/XKMSReissueResultImpl.cpp \
- xkms/impl/XKMSAuthenticationImpl.hpp \
- xkms/impl/XKMSMessageAbstractTypeImpl.cpp \
- xkms/impl/XKMSRevokeResultImpl.cpp \
- xkms/impl/XKMSStatusResultImpl.hpp \
- xkms/impl/XKMSReissueKeyBindingImpl.hpp \
- xkms/impl/XKMSRespondWithImpl.hpp \
- xkms/impl/XKMSRevokeRequestImpl.cpp \
- xkms/impl/XKMSPendingRequestImpl.cpp \
- xkms/impl/XKMSRecoverResultImpl.hpp \
- xkms/impl/XKMSValidateRequestImpl.cpp \
- xkms/impl/XKMSStatusRequestImpl.hpp \
- xkms/impl/XKMSRecoverRequestImpl.hpp \
- xkms/impl/XKMSRecoverKeyBindingImpl.cpp \
- xkms/impl/XKMSRSAKeyPairImpl.cpp \
- xkms/impl/XKMSMessageAbstractTypeImpl.hpp \
- xkms/impl/XKMSUnverifiedKeyBindingImpl.cpp \
- xkms/impl/XKMSValidityIntervalImpl.hpp \
- xkms/impl/XKMSLocateResultImpl.hpp \
- xkms/impl/XKMSLocateRequestImpl.cpp \
- xkms/impl/XKMSResultTypeImpl.cpp \
- xkms/impl/XKMSRecoverKeyBindingImpl.hpp \
- xkms/impl/XKMSResultImpl.cpp \
- xkms/impl/XKMSValidityIntervalImpl.cpp \
- xkms/impl/XKMSRegisterRequestImpl.cpp \
- xkms/impl/XKMSReissueResultImpl.hpp \
- xkms/impl/XKMSStatusImpl.cpp \
- xkms/impl/XKMSReissueRequestImpl.hpp \
- xkms/impl/XKMSStatusRequestImpl.cpp \
- xkms/impl/XKMSReissueKeyBindingImpl.cpp \
- xkms/impl/XKMSKeyBindingImpl.hpp \
- xkms/impl/XKMSValidateRequestImpl.hpp \
- xkms/impl/XKMSKeyBindingAbstractTypeImpl.hpp \
- xkms/impl/XKMSResultTypeImpl.hpp \
- xkms/impl/XKMSMessageFactoryImpl.cpp \
- xkms/impl/XKMSRevokeRequestImpl.hpp \
- xkms/impl/XKMSResponseMechanismImpl.cpp \
- xkms/impl/XKMSNotBoundAuthentication.cpp \
- xkms/impl/XKMSLocateRequestImpl.hpp \
- xkms/impl/XKMSLocateResultImpl.cpp \
- xkms/impl/XKMSRequestAbstractTypeImpl.hpp \
- xkms/impl/XKMSQueryKeyBindingImpl.cpp \
- xkms/impl/XKMSUseKeyWithImpl.cpp \
- xkms/impl/XKMSMessageFactoryImpl.hpp \
- xkms/impl/XKMSPrototypeKeyBindingImpl.hpp \
- xkms/impl/XKMSRegisterResultImpl.hpp
-
# Conditional crypto routines
openssl_sources = \
@@ -639,36 +463,8 @@ openssl_sources = \
enc/OpenSSL/OpenSSLCryptoKeyHMAC.cpp \
enc/OpenSSL/OpenSSLSupport.cpp
-nss_sources = \
- enc/NSS/NSSCryptoX509.cpp \
- enc/NSS/NSSCryptoHashHMAC.cpp \
- enc/NSS/NSSCryptoHash.cpp \
- enc/NSS/NSSCryptoKeyDSA.cpp \
- enc/NSS/NSSCryptoProvider.cpp \
- enc/NSS/NSSCryptoSymmetricKey.cpp \
- enc/NSS/NSSCryptoKeyRSA.cpp \
- enc/NSS/NSSCryptoKeyHMAC.cpp
-
#
# Now the library specific build items
#
-libxml_security_c_la_LDFLAGS = -version-info 20:4:0
-
-EXTRA_DIST = \
- utils/winutils/XSECSOAPRequestorSimpleWin32.cpp \
- enc/WinCAPI/WinCAPICryptoProvider.cpp \
- enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp \
- enc/WinCAPI/WinCAPICryptoHash.cpp \
- enc/WinCAPI/WinCAPICryptoKeyDSA.cpp \
- enc/WinCAPI/WinCAPICryptoHashHMAC.hpp \
- enc/WinCAPI/WinCAPICryptoKeyDSA.hpp \
- enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp \
- enc/WinCAPI/WinCAPICryptoX509.hpp \
- enc/WinCAPI/WinCAPICryptoKeyRSA.hpp \
- enc/WinCAPI/WinCAPICryptoX509.cpp \
- enc/WinCAPI/WinCAPICryptoHashHMAC.cpp \
- enc/WinCAPI/WinCAPICryptoHash.hpp \
- enc/WinCAPI/WinCAPICryptoKeyRSA.cpp \
- enc/WinCAPI/WinCAPICryptoProvider.hpp \
- enc/WinCAPI/WinCAPICryptoSymmetricKey.cpp \
- enc/WinCAPI/WinCAPICryptoKeyHMAC.cpp
+libxml_security_c_la_LDFLAGS = -version-info 30:0:0
+
diff --git a/xsec/canon/XSECC14n20010315.cpp b/xsec/canon/XSECC14n20010315.cpp
index 259ea85e..610f7152 100644
--- a/xsec/canon/XSECC14n20010315.cpp
+++ b/xsec/canon/XSECC14n20010315.cpp
@@ -45,37 +45,6 @@
XERCES_CPP_NAMESPACE_USE
-#ifdef XSEC_HAVE_XALAN
-
-// Xalan includes
-#include <xalanc/XalanDOM/XalanDocument.hpp>
-#include <xalanc/XercesParserLiaison/XercesDocumentWrapper.hpp>
-#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
-#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XPath/NodeRefList.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-// Namespace definitions
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XercesDOMSupport)
-XALAN_USING_XALAN(XercesParserLiaison)
-XALAN_USING_XALAN(XalanDocument)
-XALAN_USING_XALAN(XalanNode)
-XALAN_USING_XALAN(XalanElement)
-XALAN_USING_XALAN(XalanDOMString)
-XALAN_USING_XALAN(XalanDOMChar)
-XALAN_USING_XALAN(NodeRefList)
-XALAN_USING_XALAN(XercesDocumentWrapper)
-XALAN_USING_XALAN(XercesWrapperNavigator)
-XALAN_USING_XALAN(c_wstr)
-
-#endif
-
// General includes
#include <stdlib.h>
#include <string.h>
@@ -451,88 +420,9 @@ bool XSECC14n20010315::getCommentsProcessing(void) {
int XSECC14n20010315::XPathSelectNodes(const char * XPathExpr) {
-#ifndef XSEC_HAVE_XPATH
-
throw XSECException(XSECException::UnsupportedFunction,
"This library has been compiled without XPath support");
-#else
-
- XPathEvaluator::initialize();
-
- // We use Xalan to process the Xerces DOM tree and get the XPath nodes
-
- XercesParserLiaison theParserLiaison;
- XercesDOMSupport theDOMSupport(theParserLiaison);
-
- if (mp_doc == 0) {
- throw XSECException(XSECException::UnsupportedFunction,
- "XPath selection only supported in C14n for full documents");
- }
-
- DOMElement* theXercesNode = mp_doc->createElement(c_wstr(XalanDOMString("ns")));
- theXercesNode->setAttribute(c_wstr(XalanDOMString("xmlns:ietf")), c_wstr(XalanDOMString("http://www.ietf.org")));
-
- XalanDocument* theDoc = theParserLiaison.createDocument(mp_doc);
-
- // Set up the XPath evaluator
-
- XPathEvaluator theEvaluator;
-
- // OK, let's find the context node...
-
- XalanDOMString cd = XalanDOMString("/"); // For the moment assume the root is the context
-
- const XalanDOMChar * cexpr = cd.c_str();
-
- XalanNode* const theContextNode =
- theEvaluator.selectSingleNode(
- theDOMSupport,
- theDoc,
- cexpr,
- theDoc->getDocumentElement());
-
- if (theContextNode == 0)
- {
-
- // No appropriate nodes.
- return 0;
-
- }
- // OK, let's evaluate the expression...
-
- XalanDOMString ed = XalanDOMString(XPathExpr);
- const XalanDOMChar * expr = ed.c_str();
-
- NodeRefList output;
-
- NodeRefList theResult(
- theEvaluator.selectNodeList(
- output,
- theDOMSupport,
- theContextNode,
- expr,
- theDoc->getElementById(XalanDOMString("ns"))));
-
-
- XercesDocumentWrapper *theWrapper = theParserLiaison.mapDocumentToWrapper(theDoc);
- XercesWrapperNavigator theWrapperNavigator(theWrapper);
-
- int size = (int) theResult.getLength();
- const DOMNode *item;
-
- for (int i = 0; i < size; ++ i) {
-
- item = theWrapperNavigator.mapNode(theResult.item(i));
- m_XPathMap.addNode(item);
- //tmp->element = theBridgeNavigator.mapNode(theResult.item(i));
- }
-
- m_XPathSelection = true;
- return size;
-
-#endif
-
}
void XSECC14n20010315::setXPathMap(const XSECXPathNodeList & map) {
diff --git a/xsec/canon/XSECC14n20010315.hpp b/xsec/canon/XSECC14n20010315.hpp
index ba7b8067..a88fbc86 100644
--- a/xsec/canon/XSECC14n20010315.hpp
+++ b/xsec/canon/XSECC14n20010315.hpp
@@ -83,17 +83,8 @@ struct XSECNodeListElt {
class XSEC_EXPORT XSECC14n20010315 : public XSECCanon {
-#if defined(XALAN_NO_NAMESPACES)
- typedef vector<char *> CharListVectorType;
-#else
typedef std::vector<char *> CharListVectorType;
-#endif
-
-#if defined(XALAN_SIZE_T_IN_NAMESPACE_STD)
- typedef std::size_t size_type;
-#else
typedef size_t size_type;
-#endif
public:
diff --git a/xsec/dsig/DSIGReference.cpp b/xsec/dsig/DSIGReference.cpp
index 395b48a0..998d6dd5 100644
--- a/xsec/dsig/DSIGReference.cpp
+++ b/xsec/dsig/DSIGReference.cpp
@@ -36,9 +36,7 @@
#include <xsec/transformers/TXFMHash.hpp>
#include <xsec/transformers/TXFMBase64.hpp>
#include <xsec/transformers/TXFMSB.hpp>
-#include <xsec/transformers/TXFMXPath.hpp>
#include <xsec/transformers/TXFMC14n.hpp>
-#include <xsec/transformers/TXFMXSL.hpp>
#include <xsec/transformers/TXFMEnvelope.hpp>
#include <xsec/dsig/DSIGConstants.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
diff --git a/xsec/dsig/DSIGTransformBase64.cpp b/xsec/dsig/DSIGTransformBase64.cpp
index 8250a562..44788323 100644
--- a/xsec/dsig/DSIGTransformBase64.cpp
+++ b/xsec/dsig/DSIGTransformBase64.cpp
@@ -36,7 +36,6 @@
#include <xsec/transformers/TXFMBase64.hpp>
#include <xsec/transformers/TXFMC14n.hpp>
#include <xsec/transformers/TXFMChain.hpp>
-#include <xsec/transformers/TXFMXPath.hpp>
#include "../utils/XSECDOMUtils.hpp"
@@ -69,33 +68,10 @@ void DSIGTransformBase64::appendTransformer(TXFMChain * input) {
if (input->getLastTxfm()->getNodeType() != TXFMBase::DOM_NODE_XPATH_NODESET) {
-#ifndef XSEC_HAVE_XPATH
-
throw XSECException(XSECException::UnsupportedFunction,
"Unable to extract Base64 text from Nodes without XPath support");
}
-
-#else
-
- // Use an XPath transform to get "Self::text()" from the nodeset
-
- TXFMXPath *x;
-
- XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(x);
- ((TXFMXPath *) x)->evaluateExpr(mp_txfmNode, "self::text()");
-
- }
-
- TXFMC14n *c;
-
- // Now use c14n to translate to BYTES
-
- XSECnew(c, TXFMC14n(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(c);
-#endif
-
}
// Now the actual Base64
diff --git a/xsec/dsig/DSIGTransformEnvelope.cpp b/xsec/dsig/DSIGTransformEnvelope.cpp
index fe08d703..89d389f8 100644
--- a/xsec/dsig/DSIGTransformEnvelope.cpp
+++ b/xsec/dsig/DSIGTransformEnvelope.cpp
@@ -36,7 +36,6 @@
#include <xsec/transformers/TXFMEnvelope.hpp>
#include <xsec/transformers/TXFMC14n.hpp>
#include <xsec/transformers/TXFMChain.hpp>
-#include <xsec/transformers/TXFMXPath.hpp>
#include "../utils/XSECDOMUtils.hpp"
@@ -63,18 +62,6 @@ DSIGTransformEnvelope::~DSIGTransformEnvelope() {};
void DSIGTransformEnvelope::appendTransformer(TXFMChain * input) {
-#ifdef XSEC_USE_XPATH_ENVELOPE
-
- TXFMXPath *x;
-
- // Special XPath transform
- XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(x);
-
- // Execute the envelope expression
- x->evaluateEnvelope(mp_txfmNode);
-#else
-
TXFMEnvelope *x;
// Use the Envelope transform
@@ -84,9 +71,6 @@ void DSIGTransformEnvelope::appendTransformer(TXFMChain * input) {
// Execute envelope
x->evaluateEnvelope(mp_txfmNode);
-
-#endif
-
}
DOMElement * DSIGTransformEnvelope::createBlankTransform(DOMDocument * parentDoc) {
diff --git a/xsec/dsig/DSIGTransformXPath.cpp b/xsec/dsig/DSIGTransformXPath.cpp
index 12aba211..9acce4bf 100644
--- a/xsec/dsig/DSIGTransformXPath.cpp
+++ b/xsec/dsig/DSIGTransformXPath.cpp
@@ -28,7 +28,6 @@
#include <xsec/dsig/DSIGSignature.hpp>
#include <xsec/dsig/DSIGTransformXPath.hpp>
-#include <xsec/transformers/TXFMXPath.hpp>
#include <xsec/framework/XSECEnv.hpp>
#include <xsec/framework/XSECError.hpp>
#include <xsec/framework/XSECException.hpp>
@@ -72,26 +71,8 @@ DSIGTransformXPath::~DSIGTransformXPath() {};
void DSIGTransformXPath::appendTransformer(TXFMChain * input) {
-#ifndef XSEC_HAVE_XPATH
-
throw XSECException(XSECException::UnsupportedFunction,
"XPath transforms are not supported in this compilation of the XSEC library");
-
-#else
-
- TXFMXPath *x;
- // XPath transform
- XSECnew(x, TXFMXPath(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(x);
-
- // These can throw, but the TXFMXPath is now owned by the chain, so will
- // be cleaned up down the calling stack.
-
- x->setNameSpace(mp_NSMap);
- x->evaluateExpr(mp_txfmNode, m_expr);
-
-#endif /* XSEC_HAVE_XPATH */
-
}
DOMElement * DSIGTransformXPath::createBlankTransform(DOMDocument * parentDoc) {
diff --git a/xsec/dsig/DSIGTransformXPathFilter.cpp b/xsec/dsig/DSIGTransformXPathFilter.cpp
index b26a9807..66d10d5a 100644
--- a/xsec/dsig/DSIGTransformXPathFilter.cpp
+++ b/xsec/dsig/DSIGTransformXPathFilter.cpp
@@ -34,7 +34,6 @@
#include <xsec/dsig/DSIGXPathFilterExpr.hpp>
#include <xsec/framework/XSECEnv.hpp>
#include <xsec/framework/XSECError.hpp>
-#include <xsec/transformers/TXFMXPathFilter.hpp>
#include <xsec/transformers/TXFMChain.hpp>
#include "../utils/XSECDOMUtils.hpp"
@@ -76,22 +75,8 @@ void DSIGTransformXPathFilter::appendTransformer(TXFMChain * input) {
"DSIGTransformXPathFilter::appendTransform - load not yet called");
}
-#ifndef XSEC_HAVE_XPATH
throw XSECException(XSECException::UnsupportedFunction,
"XPath transforms are not supported in this build of the XSEC library");
-#else
- TXFMXPathFilter *xpf;
- // XPath transform
- XSECnew(xpf, TXFMXPathFilter(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(xpf);
-
- // These can throw, but the TXFMXPathFilter is now owned by the chain, so will
- // be cleaned up down the calling stack.
-
- xpf->evaluateExprs(&m_exprs);
-
-#endif /* NO_XPATH */
-
}
// --------------------------------------------------------------------------------
diff --git a/xsec/dsig/DSIGTransformXSL.cpp b/xsec/dsig/DSIGTransformXSL.cpp
index 79e55f20..6500d347 100644
--- a/xsec/dsig/DSIGTransformXSL.cpp
+++ b/xsec/dsig/DSIGTransformXSL.cpp
@@ -33,7 +33,6 @@
#include <xsec/framework/XSECEnv.hpp>
#include <xsec/framework/XSECError.hpp>
#include <xsec/framework/XSECException.hpp>
-#include <xsec/transformers/TXFMXSL.hpp>
#include <xsec/transformers/TXFMC14n.hpp>
#include <xsec/transformers/TXFMChain.hpp>
@@ -112,39 +111,8 @@ DSIGTransformXSL::~DSIGTransformXSL() {};
void DSIGTransformXSL::appendTransformer(TXFMChain * input) {
-#ifndef XSEC_HAVE_XSLT
-
throw XSECException(XSECException::UnsupportedFunction,
"XSLT Transforms not supported in this compilation of the library");
-#else
-
- if (mp_stylesheetNode == 0)
- throw XSECException(XSECException::XSLError, "Style Sheet not found for XSL Transform");
-
-
- TXFMBase * nextInput;
-
- // XSLT Transform - requires a byte stream input
-
- if (input->getLastTxfm()->getOutputType() == TXFMBase::DOM_NODES) {
-
- // Use c14n to translate to BYTES
-
- XSECnew(nextInput, TXFMC14n(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(nextInput);
- }
-
- TXFMXSL * x;
-
- // Create the XSLT transform
- XSECnew(x, TXFMXSL(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(x);
-
- // Patch to avoid c14n of stylesheet
- XSECDomToSafeBuffer sbStyleSheet(mp_stylesheetNode);
- x->evaluateStyleSheet(sbStyleSheet);
-#endif /* XSEC_HAVE_XSLT */
-
}
diff --git a/xsec/dsig/DSIGXPathHere.cpp b/xsec/dsig/DSIGXPathHere.cpp
deleted file mode 100644
index 2c6a415f..00000000
--- a/xsec/dsig/DSIGXPathHere.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * DSIGXPathHere := Implementation of the "here()" XPath function.
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGXPathHere.hpp>
-
-#ifdef XSEC_HAVE_XPATH
-
-XALAN_USING_XALAN(XalanCopyConstruct);
-
-DSIGXPathHere::DSIGXPathHere() {
-
- XalanHereNode = NULL;
-
-}
-
-DSIGXPathHere::DSIGXPathHere(XalanNode * here) {
-
- XalanHereNode = here;
-
-}
-
-DSIGXPathHere::~DSIGXPathHere() {}
-
-// These methods are inherited from Function ...
-
-XObjectPtr DSIGXPathHere::execute(
- XPathExecutionContext& executionContext,
- XalanNode* context,
- // const XObjectPtr arg1,
- const Locator* locator) const {
-
- // Simple function - simply return the Xalan Node we already have
-
- typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList;
-
- // This list will hold the nodes we find.
-
- BorrowReturnMutableNodeRefList nl(executionContext);
-
- nl->addNodeInDocOrder(XalanHereNode, executionContext);
-
- return executionContext.getXObjectFactory().createNodeSet(nl);
-}
-
-
-#if defined(XSEC_NO_COVARIANT_RETURN_TYPE)
- Function*
-#else
- DSIGXPathHere*
-#endif
- DSIGXPathHere::clone(MemoryManagerType& theManager) const {
- return XalanCopyConstruct(theManager, *this);
- }
-
- const XalanDOMString
- &DSIGXPathHere::getError(XalanDOMString& theBuffer) const {
-
- theBuffer = "The here() function takes no arguments!";
- return theBuffer;
- }
-
-#endif /* XSEC_HAVE_XPATH */
diff --git a/xsec/dsig/DSIGXPathHere.hpp b/xsec/dsig/DSIGXPathHere.hpp
deleted file mode 100644
index d19d4b6c..00000000
--- a/xsec/dsig/DSIGXPathHere.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * DSIGXPathHere := Implementation of the "here()" XPath function.
- *
- * $Id$
- *
- */
-
-#ifndef DSIGXPATHHERE_INCLUDE
-#define DSIGXPATHHERE_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#include <xercesc/util/PlatformUtils.hpp>
-
-#ifdef XSEC_HAVE_XALAN
-
-#if defined(_MSC_VER)
-# pragma warning(disable: 4267)
-#endif
-
-#include <xalanc/Include/PlatformDefinitions.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-#include <xalanc/XPath/XObjectFactory.hpp>
-#include <xalanc/XalanDOM/XalanElement.hpp>
-#include <xalanc/XalanDOM/XalanNode.hpp>
-#include <xalanc/XalanDOM/XalanDocument.hpp>
-#include <xalanc/XPath/Function.hpp>
-#include <xalanc/XPath/XObjectTypeCallback.hpp>
-#include <xalanc/XPath/MutableNodeRefList.hpp>
-#include <xalanc/XPath/NodeRefListBase.hpp>
-
-#if defined(_MSC_VER)
-# pragma warning(default: 4267)
-#endif
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-// Namespace usage
-
-XALAN_USING_XALAN(Function);
-XALAN_USING_XALAN(XalanNode);
-XALAN_USING_XALAN(XPathExecutionContext);
-XALAN_USING_XALAN(XalanDOMString);
-XALAN_USING_XALAN(XObjectPtr);
-XALAN_USING_XALAN(MemoryManagerType);
-
-XSEC_USING_XERCES(Locator);
-
-#endif
-
-#ifdef XSEC_HAVE_XPATH
-
-// If there is no XPath then let's not even bother with this class.
-
-class DSIGXPathHere : public Function {
-
-private:
-
- XalanNode * XalanHereNode;
-
-public:
-
- typedef Function ParentType;
-
- DSIGXPathHere();
- DSIGXPathHere(XalanNode *here);
-
- virtual
- ~DSIGXPathHere();
-
- // These methods are inherited from Function ...
-
- virtual XObjectPtr
- execute(
- XPathExecutionContext& executionContext,
- XalanNode* context,
- //const XObjectPtr arg1,
- const LocatorType* locator) const;
-
-#if !defined(XALAN_NO_USING_DECLARATION)
- using ParentType::execute;
-#endif
-
-#if defined(XSEC_NO_COVARIANT_RETURN_TYPE)
- virtual Function*
-#else
- virtual DSIGXPathHere*
-#endif
- clone(MemoryManagerType& theManager) const;
-
-protected:
-
- const XalanDOMString& getError(XalanDOMString& theBuffer) const;
-
-private:
-
- // Not implemented...
- DSIGXPathHere&
- operator=(const DSIGXPathHere&);
-
- bool
- operator==(const DSIGXPathHere&) const;
-};
-
-#endif
-
-#endif
-
diff --git a/xsec/enc/NSS/NSSCryptoHash.cpp b/xsec/enc/NSS/NSSCryptoHash.cpp
deleted file mode 100644
index c742a1b7..00000000
--- a/xsec/enc/NSS/NSSCryptoHash.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoHash := NSS Implementation of Message digests
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/enc/NSS/NSSCryptoHash.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoHash::NSSCryptoHash(HashType alg) {
-
- switch (alg) {
-
- case (XSECCryptoHash::HASH_SHA1) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA1);
- break;
-
- case (XSECCryptoHash::HASH_SHA256) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA256);
- break;
-
- case (XSECCryptoHash::HASH_SHA384) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA384);
- break;
-
- case (XSECCryptoHash::HASH_SHA512) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA512);
- break;
-
- case (XSECCryptoHash::HASH_MD5) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_MD5);
- break;
-
- default :
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Unknown algorithm");
-
- }
-
- m_hashType = alg;
-
- SECStatus s = PK11_DigestBegin(mp_md);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error initializing Message Digest");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoHash::~NSSCryptoHash() {
-
- if (mp_md != 0)
- PK11_DestroyContext(mp_md, PR_TRUE);
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Reset
-// --------------------------------------------------------------------------------
-
-void NSSCryptoHash::reset(void) {
-
- SECStatus s = PK11_DigestBegin(mp_md);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error initializing Message Digest");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Hash
-// --------------------------------------------------------------------------------
-
-void NSSCryptoHash::hash(unsigned char * data,
- unsigned int length) {
-
- SECStatus s = PK11_DigestOp(mp_md, data, length);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error Hashing Data");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Finish
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoHash::finish(unsigned char * hash,
- unsigned int maxLength) {
-
- unsigned int retLen = XSEC_MAX_HASH_SIZE;
-
- SECStatus s = PK11_DigestFinal(mp_md, m_mdValue, &retLen, XSEC_MAX_HASH_SIZE);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error getting hash value");
-
- }
-
- m_mdLen = retLen;
-
- retLen = (maxLength > m_mdLen ? m_mdLen : maxLength);
- memcpy(hash, m_mdValue, retLen);
-
- return (unsigned int) retLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get information
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash::HashType NSSCryptoHash::getHashType(void) const {
-
- return m_hashType; // This could be any kind of hash
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoHash.hpp b/xsec/enc/NSS/NSSCryptoHash.hpp
deleted file mode 100644
index fdb4678a..00000000
--- a/xsec/enc/NSS/NSSCryptoHash.hpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoHash := NSS Implementation of Message digests
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOHASH_INCLUDE
-#define NSSCRYPTOHASH_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoHash.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <nss.h>
-
-#define NSS_MAX_HASH_SIZE 128
-
-/**
- * @ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief NSS Implementation of Hash functions.
- *
- * Uses the NSS functions to perform digest functions.
- *
- */
-
-class XSEC_EXPORT NSSCryptoHash : public XSECCryptoHash {
-
-
-public :
-
- /** @name Constructors/Destructors */
- //@{
- /**
- * \brief Construct a Hash object
- *
- * Creates a NSS based hash object of the required type.
- *
- * @param alg The algorithm to use for digest operations
- */
-
- NSSCryptoHash(XSECCryptoHash::HashType alg);
- virtual ~NSSCryptoHash();
-
- //@}
-
- /** @name HMAC Functions */
- //@{
-
- /**
- *\brief
- *
- * Does nothing. If the required function is an HMAC function,
- * then NSSCryptoHashHMAC should be used.
- *
- * @param key The key the HMAC function should use.
- */
-
- virtual void setKey(const XSECCryptoKey * key) {}
-
- //@}
-
- /** @name Digest/Hash functions */
- //@{
-
- /**
- * \brief Reset the hash function
- *
- * Re-initialises the digest structure.
- */
-
- virtual void reset(void);
-
- /**
- * \brief Hash some data.
- *
- * Take length bytes of data from the data buffer and update the hash
- * that already exists. This function may (and normally will) be called
- * many times for large blocks of data.
- *
- * @param data The buffer containing the data to be hashed.
- * @param length The number of bytes to be read from data
- */
-
- virtual void hash(unsigned char * data,
- unsigned int length);
-
- /**
- * \brief Finish up a Digest operation and read the result.
- *
- * This call tells the CryptoHash object that the input is complete and
- * to finalise the Digest. The output of the digest is read into the
- * hash buffer (at most maxLength bytes)
- *
- * @param hash The buffer the hash should be read into.
- * @param maxLength The maximum number of bytes to be read into hash
- * @returns The number of bytes copied into the hash buffer
- */
-
- virtual unsigned int finish(unsigned char * hash,
- unsigned int maxLength);// Finish and get hash
-
- //@}
-
- /** @name Information functions */
- //@{
-
- /**
- *\brief
- *
- * Determine the hash type of this object
- *
- * @returns The hash type
- */
-
- virtual HashType getHashType(void) const;
-
- //@}
-
-private:
-
- // Not implemented constructors
- NSSCryptoHash();
-
- unsigned char m_mdValue[NSS_MAX_HASH_SIZE]; // Final output
- unsigned int m_mdLen;
-
- HashType m_hashType;
-
- PK11Context * mp_md;
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOHASHSHA1_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoHashHMAC.cpp b/xsec/enc/NSS/NSSCryptoHashHMAC.cpp
deleted file mode 100644
index 02af3b1d..00000000
--- a/xsec/enc/NSS/NSSCryptoHashHMAC.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoHashHMAC := NSS Implementation of HMAC
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/enc/NSS/NSSCryptoHashHMAC.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include <memory.h>
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoHashHMAC::NSSCryptoHashHMAC(HashType alg) {
-
- switch (alg) {
-
- case (XSECCryptoHash::HASH_SHA1) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA1);
- break;
-
- case (XSECCryptoHash::HASH_SHA256) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA256);
- break;
-
- case (XSECCryptoHash::HASH_SHA384) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA384);
- break;
-
- case (XSECCryptoHash::HASH_SHA512) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_SHA512);
- break;
-
- case (XSECCryptoHash::HASH_MD5) :
-
- mp_md = PK11_CreateDigestContext(SEC_OID_MD5);
- break;
-
- default :
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Unknown algorithm");
-
- }
-
- m_hashType = alg;
-
- m_blockSize = XSEC_MAX_HASH_BLOCK_SIZE;
-
- SECStatus s = PK11_DigestBegin(mp_md);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error initializing Message Digest");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoHashHMAC::~NSSCryptoHashHMAC() {
-
- if (mp_md != 0)
- PK11_DestroyContext(mp_md, PR_TRUE);
-
-}
-
-// --------------------------------------------------------------------------------
-// Reset
-// --------------------------------------------------------------------------------
-
-void NSSCryptoHashHMAC::reset() {
-
- SECStatus s = PK11_DigestBegin(mp_md);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error initializing Message Digest");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Key manipulation
-// --------------------------------------------------------------------------------
-
-void NSSCryptoHashHMAC::setKey(const XSECCryptoKey *key) {
-
- if (key->getKeyType() != XSECCryptoKey::KEY_HMAC) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:HashHMAC - Non HMAC Key passed to HashHMAC");
-
- }
-
- m_keyLen = ((XSECCryptoKeyHMAC *) key)->getKey(m_keyBuf);
-
- PK11SlotInfo * slot = PK11_GetInternalKeySlot();
-
- if (slot == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:HashHMAC - Failed to get internal key slot");
-
- }
-
- SECItem keyItem;
- keyItem.data = (unsigned char *) m_keyBuf.rawBuffer();
- keyItem.len = m_keyLen;
-
- CK_MECHANISM_TYPE hmacType;
-
- switch (m_hashType) {
-
- case (XSECCryptoHash::HASH_SHA1) :
-
- hmacType = CKM_SHA_1_HMAC;
-
- break;
-
- case (XSECCryptoHash::HASH_SHA224) :
-
- hmacType = CKM_SHA224_HMAC;
-
- break;
-
- case (XSECCryptoHash::HASH_SHA256) :
-
- hmacType = CKM_SHA256_HMAC;
-
- break;
-
- case (XSECCryptoHash::HASH_SHA384) :
-
- hmacType = CKM_SHA384_HMAC;
-
- break;
-
- case (XSECCryptoHash::HASH_SHA512) :
-
- hmacType = CKM_SHA512_HMAC;
-
- break;
-
- case (XSECCryptoHash::HASH_MD5) :
-
- hmacType = CKM_MD5_HMAC;
-
- break;
-
- default :
-
- hmacType = 0;
-
- }
-
- if(hmacType == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Unknown algorithm");
-
- }
-
- PK11SymKey * symKey = PK11_ImportSymKey(slot,
- hmacType,
- PK11_OriginUnwrap,
- CKA_SIGN,
- &keyItem,
- NULL);
-
- SECItem noParams;
- noParams.data = 0;
- noParams.len = 0;
-
- mp_md = PK11_CreateContextBySymKey(hmacType,
- CKA_SIGN,
- symKey,
- &noParams);
-
- if(mp_md == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Unknown algorithm");
-
- }
-
- if (symKey)
- PK11_FreeSymKey(symKey);
-
- if (slot)
- PK11_FreeSlot(slot);
-
-}
-
-// --------------------------------------------------------------------------------
-// Perform hash operation
-// --------------------------------------------------------------------------------
-
-void NSSCryptoHashHMAC::hash(unsigned char * data,
- unsigned int length) {
-
- if (mp_md == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:HashHMAC - hash called prior to setKey");
-
- }
-
- SECStatus s = PK11_DigestOp(mp_md, data, length);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error Hashing Data");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Finish
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoHashHMAC::finish(unsigned char * hash,
- unsigned int maxLength) {
-
- unsigned int retLen = XSEC_MAX_HASH_SIZE;
-
- SECStatus s = PK11_DigestFinal(mp_md, m_mdValue, &retLen, XSEC_MAX_HASH_SIZE);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "NSS:Hash - Error getting hash value");
-
- }
-
- m_mdLen = retLen;
-
- retLen = (maxLength > m_mdLen ? m_mdLen : maxLength);
- memcpy(hash, m_mdValue, retLen);
-
- return (unsigned int) retLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get information
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash::HashType NSSCryptoHashHMAC::getHashType(void) const {
-
- return m_hashType; // This could be any kind of hash
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoHashHMAC.hpp b/xsec/enc/NSS/NSSCryptoHashHMAC.hpp
deleted file mode 100644
index 9ac65aea..00000000
--- a/xsec/enc/NSS/NSSCryptoHashHMAC.hpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoHashHMAC := NSS Implementation of HMAC
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOHASHHMAC_INCLUDE
-#define NSSCRYPTOHASHHMAC_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <nss.h>
-
-#include <xsec/enc/XSECCryptoHash.hpp>
-#include <xsec/utils/XSECSafeBuffer.hpp>
-
-/**
- * @ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief Implementation of HMAC Hash functions in the NSS provider
- *
- * Uses the NSS functions to implement an HMAC.
- *
- */
-
-class XSEC_EXPORT NSSCryptoHashHMAC : public XSECCryptoHash {
-
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor
- *
- * Create the object, with the indicated algorithm
- * (Currently supports MD5 and SHA1)
- *
- * @param alg Digest algorithm to use
- */
-
- NSSCryptoHashHMAC(XSECCryptoHash::HashType alg);
- virtual ~NSSCryptoHashHMAC();
-
- //@}
-
- /** @name HMAC Functions */
- //@{
-
- /**
- *\brief Set the HMAC key
- *
- * Sets the key - which needs to have a base class of
- * NSSCryptoKeyHMAC.
- *
- * @param key The key the HMAC function should use.
- */
-
- virtual void setKey(const XSECCryptoKey * key);
-
- //@}
-
- /** @name Hash functions */
- //@{
-
- /**
- * \brief Reset the hash function
- *
- * Re-initialises the digest structure.
- */
-
- virtual void reset(void);
-
- /**
- * \brief Hash some data.
- *
- * Take length bytes of data from the data buffer and update the hash
- * that already exists. This function may (and normally will) be called
- * many times for large blocks of data.
- *
- * @param data The buffer containing the data to be hashed.
- * @param length The number of bytes to be read from data
- */
-
- virtual void hash(unsigned char * data,
- unsigned int length);
-
- /**
- * \brief Finish up a Digest operation and read the result.
- *
- * This call tells the CryptoHash object that the input is complete and
- * to finalise the Digest. The output of the digest is read into the
- * hash buffer (at most maxLength bytes). This is effectively the
- * signature for the data that has been run through the HMAC function.
- *
- * @param hash The buffer the hash should be read into.
- * @param maxLength The maximum number of bytes to be read into hash
- * @returns The number of bytes copied into the hash buffer
- */
-
- virtual unsigned int finish(unsigned char * hash,
- unsigned int maxLength);
-
- //@}
-
- /** @name Information functions */
- //@{
-
- /**
- *\brief
- *
- * Determine the hash type of this object
- *
- * @returns The hash type
- */
-
- virtual HashType getHashType(void) const;
-
- //@}
-
-private:
-
- // Not implemented constructors
- NSSCryptoHashHMAC();
-
- unsigned char m_mdValue[XSEC_MAX_HASH_SIZE]; // Final output
- unsigned int m_mdLen;
-
- HashType m_hashType;
-
- PK11Context * mp_md;
-
- unsigned char m_ipadKeyed[XSEC_MAX_HASH_SIZE];
- unsigned char m_opadKeyed[XSEC_MAX_HASH_SIZE];
-
- unsigned int m_blockSize; // Block size (bytes) for used alg.
-
- safeBuffer m_keyBuf; // The loaded key
- unsigned int m_keyLen; // The loaded key length
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOHASHHMAC_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoKeyDSA.cpp b/xsec/enc/NSS/NSSCryptoKeyDSA.cpp
deleted file mode 100644
index e91d0f02..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyDSA.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyDSA := DSA Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/enc/NSS/NSSCryptoKeyDSA.hpp>
-#include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#include <xercesc/util/Janitor.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoKeyDSA::NSSCryptoKeyDSA(SECKEYPublicKey * pubkey, SECKEYPrivateKey * privkey) {
-
- // NOTE - We OWN those handles
- mp_pubkey = pubkey;
- mp_privkey = privkey;
-
- mp_P = NULL;
- mp_Q = NULL;
- mp_G = NULL;
- mp_Y = NULL;
-
-};
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoKeyDSA::~NSSCryptoKeyDSA() {
-
- // Clean up
-
- if (mp_pubkey != 0)
- SECKEY_DestroyPublicKey(mp_pubkey);
-
- if (mp_privkey != 0)
- SECKEY_DestroyPrivateKey(mp_privkey);
-
- if (mp_P != NULL)
- SECITEM_FreeItem(mp_P, PR_TRUE);
-
- if (mp_Q != NULL)
- SECITEM_FreeItem(mp_Q, PR_TRUE);
-
- if (mp_G != NULL)
- SECITEM_FreeItem(mp_G, PR_TRUE);
-
- if (mp_Y != NULL)
- SECITEM_FreeItem(mp_Y, PR_TRUE);
-
-};
-
-const XMLCh * NSSCryptoKeyDSA::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVNSS;
-}
-
-// --------------------------------------------------------------------------------
-// Get key type
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey::KeyType NSSCryptoKeyDSA::getKeyType() const {
-
- // Find out what we have
- if (mp_pubkey == NULL) {
-
- if (mp_privkey != 0)
- return KEY_DSA_PRIVATE;
-
- // Check if we have parameters loaded
- if (mp_P == NULL ||
- mp_Q == NULL ||
- mp_G == NULL ||
- mp_Y == NULL)
- return KEY_NONE;
- else
- return KEY_DSA_PUBLIC;
- }
-
- if (mp_privkey != 0)
- return KEY_DSA_PAIR;
-
- // If we have m_key - it must be public
- return KEY_DSA_PUBLIC;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load P parameter
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadPBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_P != NULL) {
- SECITEM_FreeItem(mp_P, PR_TRUE);
- mp_P = NULL; // In case we get an exception
- }
-
- mp_P = NSSCryptoProvider::b642SI(b64, len);
-
-}
-
-// --------------------------------------------------------------------------------
-// Load Q parameter
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadQBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_Q != NULL) {
- SECITEM_FreeItem(mp_Q, PR_TRUE);
- mp_Q = NULL; // In case we get an exception
- }
-
- mp_Q = NSSCryptoProvider::b642SI(b64, len);
-}
-
-// --------------------------------------------------------------------------------
-// Load G parameter
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadGBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_G != NULL) {
- SECITEM_FreeItem(mp_G, PR_TRUE);
- mp_G = NULL; // In case we get an exception
- }
-
- mp_G = NSSCryptoProvider::b642SI(b64, len);
-}
-
-// --------------------------------------------------------------------------------
-// Load Y parameter
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadYBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_Y != NULL) {
- SECITEM_FreeItem(mp_Y, PR_TRUE);
- mp_Y = NULL; // In case we get an exception
- }
-
- mp_Y = NSSCryptoProvider::b642SI(b64, len);
-}
-
-// --------------------------------------------------------------------------------
-// Load Y parameter
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadJBase64BigNums(const char * b64, unsigned int len) {
- //Do nothing
-}
-
-// --------------------------------------------------------------------------------
-// Import key
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::importKey(void) const {
-
- if (mp_pubkey != 0 ||
- mp_P == NULL ||
- mp_Q == NULL ||
- mp_G == NULL ||
- mp_Y == NULL)
- return;
-
- PRArenaPool * arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
-
- if(arena == NULL) {
-
- throw XSECCryptoException(XSECCryptoException::GeneralError,
- "NSS:DSA Error attempting create new arena");
-
- }
-
- mp_pubkey = (SECKEYPublicKey*)PORT_ArenaZAlloc(arena, sizeof(SECKEYPublicKey));
-
- if(mp_pubkey == NULL ) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting create new arena");
-
- }
-
- mp_pubkey->arena = arena;
- mp_pubkey->u.dsa.params.arena = arena;
- mp_pubkey->keyType = dsaKey;
-
- SECStatus s = SECITEM_CopyItem(arena, &(mp_pubkey->u.dsa.params.prime), mp_P);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to import P key parameter");
-
- }
-
- s = SECITEM_CopyItem(arena, &(mp_pubkey->u.dsa.params.subPrime), mp_Q);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to import Q key parameter");
-
- }
-
- s = SECITEM_CopyItem(arena, &(mp_pubkey->u.dsa.params.base), mp_G);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to import G key parameter");
-
- }
-
- s = SECITEM_CopyItem(arena, &(mp_pubkey->u.dsa.publicValue), mp_Y);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to import Y key parameter");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Verify a signature encoded as a Base64 string
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoKeyDSA::verifyBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64Signature,
- unsigned int sigLen) const {
-
- // Use the currently loaded key to validate the Base64 encoded signature
-
- if (mp_pubkey == 0) {
-
- // Try to import from the parameters
- importKey();
-
- if (mp_pubkey == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Attempt to validate signature with empty key");
-
- }
-
- }
-
- // Decode the signature
- unsigned char * rawSig;
- unsigned int rawSigLen;
- XSECnew(rawSig, unsigned char[sigLen]);
- ArrayJanitor<unsigned char> j_rawSig(rawSig);
-
- // Decode the signature
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- rawSigLen = b64.decode((unsigned char *) base64Signature, sigLen, rawSig, sigLen);
- rawSigLen += b64.decodeFinish(&rawSig[rawSigLen], sigLen - rawSigLen);
-
- SECItem signature;
- signature.type = siBuffer;
- signature.data = rawSig;
- signature.len = rawSigLen;
-
- SECItem data;
- data.type = siBuffer;
- data.data = (unsigned char *)hashBuf;
- data.len = hashLen;
-
- // Verify signature
- SECStatus s = PK11_Verify(mp_pubkey, &signature, &data, NULL);
-
- return s == SECSuccess;
-
-}
-
-// --------------------------------------------------------------------------------
-// Sign and encode result as a Base64 string
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyDSA::signBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen) const {
-
- // Sign a pre-calculated hash using this key
-
- if (mp_privkey == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Attempt to sign data using a public or un-loaded key");
-
- }
-
- unsigned int signatureLen = PK11_SignatureLen(mp_privkey);
-
- unsigned char * rawSig;
- XSECnew(rawSig, unsigned char[signatureLen]);
- ArrayJanitor<unsigned char> j_rawSig(rawSig);
-
- SECItem signature;
- signature.type = siBuffer;
- signature.data = rawSig;
- signature.len = signatureLen;
-
- SECItem data;
- data.type = siBuffer;
- data.data = hashBuf;
- data.len = hashLen;
-
- SECStatus s = PK11_Sign(mp_privkey, &signature, &data);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Error during signing operation");
-
- }
-
- // Now encode
- XSCryptCryptoBase64 b64;
- b64.encodeInit();
- unsigned int ret = b64.encode(signature.data, signature.len,
- (unsigned char *) base64SignatureBuf, base64SignatureBufLen);
- ret += b64.encodeFinish((unsigned char *) &base64SignatureBuf[ret],
- base64SignatureBufLen - ret);
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Clone key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * NSSCryptoKeyDSA::clone() const {
-
- NSSCryptoKeyDSA * ret = NULL;
-
- XSECnew(ret, NSSCryptoKeyDSA(mp_pubkey, mp_privkey));
-
- // Clone public key
- if (mp_pubkey != 0) {
-
- ret->mp_pubkey = SECKEY_CopyPublicKey(mp_pubkey);
-
- if (ret->mp_pubkey == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) public key");
-
- }
-
- }
-
- // Clone private key
- if (mp_privkey != 0) {
-
- ret->mp_privkey = SECKEY_CopyPrivateKey(mp_privkey);
-
- if (ret->mp_privkey == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) private key");
-
- }
-
- }
-
- // Clone parameter P
- if (mp_P != 0) {
- ret->mp_P = SECITEM_DupItem(mp_P);
-
- if (ret->mp_P == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) P key parameter");
-
- }
- }
-
- // Clone parameter Q
- if (mp_Q != 0) {
- ret->mp_Q = SECITEM_DupItem(mp_Q);
-
- if (ret->mp_Q == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) Q key parameter");
-
- }
- }
-
- // Clone parameter G
- if (mp_G != 0) {
- ret->mp_G = SECITEM_DupItem(mp_G);
-
- if (ret->mp_G == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) G key parameter");
-
- }
- }
-
- // Clone parameter Y
- if (mp_Y != 0) {
- ret->mp_Y = SECITEM_DupItem(mp_Y);
-
- if (ret->mp_Y == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:DSA Error attempting to clone (copy) Y key parameter");
-
- }
- }
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Some utility functions
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyDSA::loadParamsFromKey(void) {
-
- if (mp_pubkey == 0)
- return;
-
- mp_P = SECITEM_DupItem(&(mp_pubkey->u.dsa.params.prime));
-
- if (mp_P == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Error during extracting P from public key");
-
- }
-
- mp_Q = SECITEM_DupItem(&(mp_pubkey->u.dsa.params.subPrime));
-
- if (mp_Q == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Error during extracting Q from public key");
-
- }
-
- mp_G = SECITEM_DupItem(&(mp_pubkey->u.dsa.params.base));
-
- if (mp_G == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Error during extracting G from public key");
-
- }
-
- mp_Y = SECITEM_DupItem(&(mp_pubkey->u.dsa.publicValue));
-
- if (mp_Y == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:DSA - Error during extracting Y from public key");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Get P parameter
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyDSA::getPBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_P == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_P == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_P, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Q parameter
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyDSA::getQBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_Q == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_Q == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_Q, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get G parameter
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyDSA::getGBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_G == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_G == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_G, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Y parameter
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyDSA::getYBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_Y == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_Y == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_Y, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoKeyDSA.hpp b/xsec/enc/NSS/NSSCryptoKeyDSA.hpp
deleted file mode 100644
index a04fd3d8..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyDSA.hpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyDSA := DSA Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOKEYDSA_INCLUDE
-#define NSSCRYPTOKEYDSA_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyDSA.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <keyhi.h>
-#include <nss.h>
-
-class NSSCryptoProvider;
-
-/**
- * \ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief NSS implementation class for DSA keys.
- *
- * The library uses classes derived from this to process DSA keys.
- */
-
-
-class XSEC_EXPORT NSSCryptoKeyDSA : public XSECCryptoKeyDSA {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Ctor for DSA keys
- *
- * You can set either public, private or both keys
- *
- * @param pubkey A handle to the public key (optional)
- * @param privkey A handle to the private key (optional)
- */
-
- NSSCryptoKeyDSA(SECKEYPublicKey * pubkey = NULL, SECKEYPrivateKey * privkey = NULL);
-
- virtual ~NSSCryptoKeyDSA();
-
- //@}
-
- /** @name Required Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * Allows the caller (and library) to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const;
-
- /**
- *\brief Return the NSS string identifier
- */
-
- virtual const XMLCh * getProviderName() const;
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey * clone() const;
-
- //@}
-
- /** @name Required DSA methods */
- //@{
-
- /**
- * \brief Create a signature
- *
- * Sign the buffer using the internal private key. Will throw a DSAError
- * if the key is not set, or is not a private key.
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Number of bytes of hash in the hashBuf
- * @param base64SignatureBuf Buffer to place the base64 encoded result
- * in.
- * @param base64SignatureBufLen Implementations need to ensure they do
- * not write more bytes than this into the buffer
- */
-
- virtual unsigned int signBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen) const;
-
- /**
- * \brief Verify a signature
- *
- * The library will call this function to validate a signature
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Length of the data in the digest buffer
- * @param base64Signature Buffer containing the Base64 encoded signature
- * @param sigLen Length of the data in the signature buffer
- * @returns true if the signature was valid, false otherwise
- */
-
- virtual bool verifyBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64Signature,
- unsigned int sigLen) const;
-
- //@}
-
- /** @name Optional Interface methods
- *
- * Have been fully implemented in the NSS interface to allow interop
- * testing to occur.
- *
- */
- //@{
-
- /**
- * \brief Load P
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadPBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load Q
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadQBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load G
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadGBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load Y
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadYBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load J
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadJBase64BigNums(const char * b64, unsigned int len);
-
- //@}
-
- /** @name NSS Specific functions */
- //@{
-
- /**
- * \brief Retrieve P
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded P parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getPBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve Q
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded Q parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getQBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve G
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded G parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getGBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve Y
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded Y parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getYBase64BigNums(char * b64, unsigned int len);
-
- //@}
-
-private:
-
- mutable SECKEYPublicKey * mp_pubkey;
- SECKEYPrivateKey * mp_privkey;
-
- SECItem * mp_P;
- SECItem * mp_Q;
- SECItem * mp_G;
- SECItem * mp_Y;
-
- // Instruct to import from parameters
-
- void importKey(void) const;
- void loadParamsFromKey(void);
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOKEYDSA_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoKeyHMAC.cpp b/xsec/enc/NSS/NSSCryptoKeyHMAC.cpp
deleted file mode 100644
index ea472f15..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyHMAC.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyHMAC := HMAC Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/dsig/DSIGConstants.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoKeyHMAC::NSSCryptoKeyHMAC() :m_keyBuf("") {
-
- m_keyBuf.isSensitive();
- m_keyLen = 0;
-
-}
-
-const XMLCh * NSSCryptoKeyHMAC::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVNSS;
-}
-
-
-// --------------------------------------------------------------------------------
-// Set key
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyHMAC::setKey(unsigned char * inBuf, unsigned int inLength) {
-
- m_keyBuf.sbMemcpyIn(inBuf, inLength);
- m_keyLen = inLength;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get key
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyHMAC::getKey(safeBuffer &outBuf) const {
-
- outBuf = m_keyBuf;
- return m_keyLen;
-
-}
-
-// --------------------------------------------------------------------------------
-// Replicate key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * NSSCryptoKeyHMAC::clone() const {
-
- NSSCryptoKeyHMAC * ret;
-
- XSECnew(ret, NSSCryptoKeyHMAC());
-
- ret->m_keyBuf = m_keyBuf;
- ret->m_keyLen = m_keyLen;
-
- return ret;
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoKeyHMAC.hpp b/xsec/enc/NSS/NSSCryptoKeyHMAC.hpp
deleted file mode 100644
index fc5d3908..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyHMAC.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyHMAC := HMAC Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOKEYHMAC_INCLUDE
-#define NSSCRYPTOKEYHMAC_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyHMAC.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <nss.h>
-
-/**
- * \ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief NSS implementation for HMAC keys.
- *
- */
-
-class XSEC_EXPORT NSSCryptoKeyHMAC : public XSECCryptoKeyHMAC {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
- /**
- * \brief Constructor
- *
- */
-
- NSSCryptoKeyHMAC();
-
- virtual ~NSSCryptoKeyHMAC() {};
-
- //@}
-
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * For DSA keys, this allows people to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const {return KEY_HMAC;}
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey * clone() const;
-
- /**
- * \brief Return the NSS string identifier
- */
-
- virtual const XMLCh * getProviderName() const;
-
- //@}
-
- /** @name Optional Interface methods */
- //@{
-
- /**
- * \brief Set the key
- *
- * Set the key from the buffer
- *
- * @param inBuf Buffer containing the direct bitwise representation of the key
- * @param inLength Number of bytes of key in the buffer
- *
- * @note isSensitive() should have been called on the inbound buffer
- * to ensure the contents is overwritten when the safeBuffer is deleted
- */
-
- virtual void setKey(unsigned char * inBuf, unsigned int inLength);
-
- /**
- * \brief Get the key value
- *
- * Copy the key into the safeBuffer and return the number of bytes
- * copied.
- *
- * @param outBuf Buffer to copy key into
- * @returns number of bytes copied in
- */
-
- virtual unsigned int getKey(safeBuffer &outBuf) const;
-
- //@}
-
-private:
-
- safeBuffer m_keyBuf;
- unsigned int m_keyLen;
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOKEYHMAC_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoKeyRSA.cpp b/xsec/enc/NSS/NSSCryptoKeyRSA.cpp
deleted file mode 100644
index b07d7443..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyRSA.cpp
+++ /dev/null
@@ -1,708 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyRSA := RSA Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/enc/NSS/NSSCryptoKeyRSA.hpp>
-#include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#include <xercesc/util/Janitor.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <secder.h>
-#include <secdig.h>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoKeyRSA::NSSCryptoKeyRSA(SECKEYPublicKey * pubkey, SECKEYPrivateKey * privkey) {
-
- // NOTE - We OWN those handles
- mp_pubkey = pubkey;
- mp_privkey = privkey;
-
- mp_modulus = NULL;
- mp_exponent = NULL;
-};
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoKeyRSA::~NSSCryptoKeyRSA() {
-
- // Clean up
-
- if (mp_pubkey != 0)
- SECKEY_DestroyPublicKey(mp_pubkey);
-
- if (mp_privkey != 0)
- SECKEY_DestroyPrivateKey(mp_privkey);
-
- if (mp_modulus != NULL)
- SECITEM_FreeItem(mp_modulus, PR_TRUE);
-
- if (mp_exponent != NULL)
- SECITEM_FreeItem(mp_exponent, PR_TRUE);
-};
-
-const XMLCh * NSSCryptoKeyRSA::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVNSS;
-}
-
-// --------------------------------------------------------------------------------
-// Get key type
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey::KeyType NSSCryptoKeyRSA::getKeyType() const {
-
- // Find out what we have
- if (mp_pubkey == 0) {
-
- if (mp_privkey != 0)
- return KEY_RSA_PRIVATE;
-
- if (mp_exponent == NULL || mp_modulus == NULL)
- return KEY_NONE;
- else
- return KEY_RSA_PUBLIC;
-
- }
-
- if (mp_privkey != 0)
- return KEY_RSA_PAIR;
-
- return KEY_RSA_PUBLIC;
-}
-
-
-// --------------------------------------------------------------------------------
-// Load modulus
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyRSA::loadPublicModulusBase64BigNums(const char* b64, unsigned int len) {
-
- if (mp_modulus != NULL) {
-
- SECITEM_FreeItem(mp_modulus, PR_TRUE);
- mp_modulus = NULL; // In case we get an exception
-
- }
-
- mp_modulus = NSSCryptoProvider::b642SI(b64, len);
-
-}
-
-// --------------------------------------------------------------------------------
-// Load exponent
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyRSA::loadPublicExponentBase64BigNums(const char* b64, unsigned int len) {
-
- if (mp_exponent != NULL) {
-
- SECITEM_FreeItem(mp_exponent, PR_TRUE);
- mp_exponent = NULL; // In case we get an exception
-
- }
-
- mp_exponent = NSSCryptoProvider::b642SI(b64, len);
-
-}
-
-// --------------------------------------------------------------------------------
-// Import key
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyRSA::importKey() const {
-
- if (mp_pubkey != 0 || mp_exponent == NULL || mp_modulus == NULL)
- return;
-
-
- PRArenaPool * arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
-
- if(arena == NULL) {
-
- throw XSECCryptoException(XSECCryptoException::GeneralError,
- "NSS:RSA Error attempting create new arena");
-
- }
-
- mp_pubkey = (SECKEYPublicKey*)PORT_ArenaZAlloc(arena, sizeof(SECKEYPublicKey));
-
- if(mp_pubkey == NULL ) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::GeneralError,
- "NSS:RSA Error attempting create new arena");
-
- }
-
- mp_pubkey->arena = arena;
- mp_pubkey->keyType = rsaKey;
-
- SECStatus s = SECITEM_CopyItem(arena, &(mp_pubkey->u.rsa.modulus), mp_modulus);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:RSA Error attempting to import modulus");
-
- }
-
- s = SECITEM_CopyItem(arena, &(mp_pubkey->u.rsa.publicExponent), mp_exponent);
-
- if (s != SECSuccess) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "NSS:RSA Error attempting to import exponent");
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Verify a signature encoded as a Base64 string
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoKeyRSA::verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf,
- unsigned int hashLen,
- const char * base64Signature,
- unsigned int sigLen,
- XSECCryptoHash::HashType type) const {
-
- // Use the currently loaded key to validate the Base64 encoded signature
-
- if (mp_pubkey == 0) {
-
- // Try to import from the parameters
- importKey();
-
- if (mp_pubkey == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Attempt to validate signature with empty key");
- }
- }
-
- // Decode the signature
- unsigned char * rawSig;
- unsigned int rawSigLen;
- XSECnew(rawSig, unsigned char[sigLen]);
- ArrayJanitor<unsigned char> j_rawSig(rawSig);
-
- // Decode the signature
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- rawSigLen = b64.decode((unsigned char *) base64Signature, sigLen, rawSig, sigLen);
- rawSigLen += b64.decodeFinish(&rawSig[rawSigLen], sigLen - rawSigLen);
-
- SECItem signature;
- signature.type = siBuffer;
- signature.data = rawSig;
- signature.len = rawSigLen;
-
- SECItem data;
- data.data = 0;
- data.len = 0;
- SECOidTag hashalg;
- PRArenaPool * arena = 0;
- SGNDigestInfo *di = 0;
- SECItem * res;
-
- switch (type) {
-
- case (XSECCryptoHash::HASH_MD5):
- hashalg = SEC_OID_MD5;
- break;
- case (XSECCryptoHash::HASH_SHA1):
- hashalg = SEC_OID_SHA1;
- break;
- case (XSECCryptoHash::HASH_SHA256):
- hashalg = SEC_OID_SHA256;
- break;
- case (XSECCryptoHash::HASH_SHA384):
- hashalg = SEC_OID_SHA384;
- break;
- case (XSECCryptoHash::HASH_SHA512):
- hashalg = SEC_OID_SHA512;
- break;
- default:
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Unsupported hash algorithm in RSA sign");
- }
-
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!arena) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error creating arena");
- }
-
- di = SGN_CreateDigestInfo(hashalg, (unsigned char * )hashBuf, hashLen);
- if (di == NULL) {
-
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error creating digest info");
- }
-
- res = SEC_ASN1EncodeItem(arena, &data, di, NSS_Get_sgn_DigestInfoTemplate(NULL, 0));
-
- if (!res) {
- SGN_DestroyDigestInfo(di);
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error encoding digest info for RSA sign");
- }
-
- // Verify signature
- SECStatus s = PK11_Verify(mp_pubkey, &signature, &data, NULL);
-
- return s == SECSuccess;
-}
-
-// --------------------------------------------------------------------------------
-// Sign and encode result as a Base64 string
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen,
- XSECCryptoHash::HashType type) const {
-
- // Sign a pre-calculated hash using this key
- if (mp_privkey == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Attempt to sign data using a public or un-loaded key");
- }
-
- unsigned char * rawSig;
- XSECnew(rawSig, unsigned char[base64SignatureBufLen]);
- ArrayJanitor<unsigned char> j_rawSig(rawSig);
-
- SECItem signature;
- signature.type = siBuffer;
- signature.data = rawSig;
- signature.len = base64SignatureBufLen;
-
- SECItem data;
- data.data = 0;
- SECOidTag hashalg;
- PRArenaPool * arena = 0;
- SGNDigestInfo *di = 0;
- SECItem * res;
-
- switch (type) {
-
- case (XSECCryptoHash::HASH_MD5):
- hashalg = SEC_OID_MD5;
- break;
- case (XSECCryptoHash::HASH_SHA1):
- hashalg = SEC_OID_SHA1;
- break;
- case (XSECCryptoHash::HASH_SHA256):
- hashalg = SEC_OID_SHA256;
- break;
- case (XSECCryptoHash::HASH_SHA384):
- hashalg = SEC_OID_SHA384;
- break;
- case (XSECCryptoHash::HASH_SHA512):
- hashalg = SEC_OID_SHA512;
- break;
- default:
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Unsupported hash algorithm in RSA sign");
- }
-
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!arena) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error creating arena");
- }
-
- di = SGN_CreateDigestInfo(hashalg, hashBuf, hashLen);
- if (di == NULL) {
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error creating digest info");
- }
-
- res = SEC_ASN1EncodeItem(arena, &data, di, NSS_Get_sgn_DigestInfoTemplate(NULL, 0));
-
- if (!res) {
- SGN_DestroyDigestInfo(di);
- PORT_FreeArena(arena, PR_FALSE);
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error encoding digest info for RSA sign");
- }
-
-/* data.type = siBuffer;
- data.data = hashBuf;
- data.len = hashLen;*/
-
- /* As of V1.3.1 - create a DigestInfo block */
-
-
- SECStatus s = PK11_Sign(mp_privkey, &signature, &data);
-
- SGN_DestroyDigestInfo(di);
- PORT_FreeArena(arena, PR_FALSE);
-
- if (s != SECSuccess) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error during signing operation");
- }
-
- // Now encode
- XSCryptCryptoBase64 b64;
- b64.encodeInit();
- unsigned int ret = b64.encode(signature.data, signature.len, (unsigned char *) base64SignatureBuf, base64SignatureBufLen);
- ret += b64.encodeFinish((unsigned char *) &base64SignatureBuf[ret], base64SignatureBufLen - ret);
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Clone key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * NSSCryptoKeyRSA::clone() const {
-
- NSSCryptoKeyRSA * ret;
-
- XSECnew(ret, NSSCryptoKeyRSA(mp_pubkey, mp_privkey));
-
- if (mp_pubkey != 0) {
- ret->mp_pubkey = SECKEY_CopyPublicKey(mp_pubkey);
- if (ret->mp_pubkey == 0) {
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:RSA Error attempting to clone (copy) public key");
- }
- }
-
- if (mp_privkey != 0) {
- ret->mp_privkey = SECKEY_CopyPrivateKey(mp_privkey);
- if (ret->mp_privkey == 0) {
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:RSA Error attempting to clone (copy) private key");
- }
- }
-
- // Clone modulus
- if (mp_modulus != 0) {
- ret->mp_modulus = SECITEM_DupItem(mp_modulus);
- if (ret->mp_modulus == 0) {
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:RSA Error attempting to clone (copy) modulus");
- }
- }
-
- // Clone exponent
- if (mp_exponent != 0) {
- ret->mp_exponent = SECITEM_DupItem(mp_exponent);
- if (ret->mp_exponent == 0) {
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSS:RSA Error attempting to clone (copy) exponent");
- }
- }
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// decrypt a buffer
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::privateDecrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI,
- const XMLCh* mgfURI,
- unsigned char* params,
- unsigned int paramslen) const {
-
- // Perform a decrypt
- if (mp_privkey == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Attempt to decrypt data with empty key");
- }
-
- unsigned int decryptSize = inLength;
-
- SECStatus s;
- unsigned char *ptr = NULL;
-
- switch (padding) {
-
- case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
-
- s = PK11_PubDecryptRaw(mp_privkey,
- plainBuf,
- (unsigned int*)&decryptSize,
- maxOutLength,
- (unsigned char*)inBuf,
- inLength);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA privateKeyDecrypt - Error Decrypting PKCS1_5 padded RSA encrypt");
-
- }
-
- //do the padding (http://www.w3.org/TR/xmlenc-core/#rsa-1_5)
- ptr = (unsigned char*) memchr(plainBuf, 0x02, decryptSize);
- if( ptr )
- {
- unsigned int bytesToRemove = ((ptr-plainBuf)+1);
- memmove(plainBuf, ptr+1, decryptSize-bytesToRemove);
- decryptSize -= bytesToRemove;
- }
-
- ptr = (unsigned char*) memchr(plainBuf, 0x00, decryptSize);
- if( ptr )
- {
- unsigned int bytesToRemove = ((ptr-plainBuf)+1);
- memmove(plainBuf, ptr+1, decryptSize-bytesToRemove);
- decryptSize -= bytesToRemove;
- }
-
- break;
-
- case XSECCryptoKeyRSA::PAD_OAEP :
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - OAEP padding method not supported in NSS yet");
- break;
-
-
- default :
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Unknown padding method");
- }
-
- return decryptSize;
-}
-
-// --------------------------------------------------------------------------------
-// Encrypt a buffer
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::publicEncrypt(const unsigned char * inBuf,
- unsigned char * cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI,
- const XMLCh* mgfURI,
- unsigned char* params,
- unsigned int paramslen) const {
-
- // Perform an encrypt
- if (mp_pubkey == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Attempt to encrypt data with empty key");
- }
-
- unsigned int encryptSize = SECKEY_PublicKeyStrength(mp_pubkey);
-
- if (maxOutLength < encryptSize) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Too small buffer for encrypted buffer output");
- }
-
- SECStatus s;
-
- unsigned char * buf;
- XSECnew(buf, unsigned char[encryptSize]);
- ArrayJanitor<unsigned char> j_buf(buf);
-
- switch (padding) {
- case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
-
- // do the padding (http://www.w3.org/TR/xmlenc-core/#rsa-1_5)
- {
-
- // generate random data for padding
- SECStatus s = PK11_GenerateRandom(buf, encryptSize);
-
- if (s != SECSuccess) {
- throw XSECException(XSECException::InternalError,
- "NSSCryptoKeyRSA() - Error generating Random data");
- }
-
- // first byte have to be 0x02
- buf[0] = 0x00;
- buf[1] = 0x02;
-
- // check that there are no 0x00 bytes among random data
- for (unsigned int i = 2; i < encryptSize - inLength - 1; i++) {
-
- while (buf[i] == 0x00) {
- // replace all 0x00 occurences in random data with random value
- PK11_GenerateRandom(&buf[i], 1);
- }
- }
-
- // before key add 0x00 byte
- buf[encryptSize - inLength - 1] = 0x00;
-
- // at the end of input buffer (to be encrypted) add key
- memcpy(&buf[encryptSize - inLength], inBuf, inLength);
- }
-
- // encrypt
- s = PK11_PubEncryptRaw(mp_pubkey, cipherBuf, (unsigned char*)buf, encryptSize, NULL);
-
- if (s != SECSuccess) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA publicKeyEncrypt - Error performing encrypt");
- }
-
- break;
-
- case XSECCryptoKeyRSA::PAD_OAEP :
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - OAEP padding method not supported in NSS yet");
- break;
-
- default :
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Unknown padding method");
- }
-
- return encryptSize;
-}
-
-// --------------------------------------------------------------------------------
-// Get key size in bytes
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::getLength(void) const {
-
- unsigned int ret = 0;
-
- if (mp_pubkey != 0) {
- ret = SECKEY_PublicKeyStrength(mp_pubkey);
- } else if (mp_privkey != 0) {
- ret = PK11_GetPrivateModulusLen(mp_privkey);
- }
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Load parameters from key (utility function)
-// --------------------------------------------------------------------------------
-
-void NSSCryptoKeyRSA::loadParamsFromKey(void) {
-
- if (mp_pubkey == 0)
- return;
-
- mp_modulus = SECITEM_DupItem(&(mp_pubkey->u.rsa.modulus));
-
- if (mp_modulus == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error during extracting modulus from public key");
- }
-
- mp_exponent = SECITEM_DupItem(&(mp_pubkey->u.rsa.publicExponent));
-
- if (mp_exponent == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "NSS:RSA - Error during extracting exponent from public key");
- }
-}
-
-// --------------------------------------------------------------------------------
-// Get exponent
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::getExponentBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_exponent == 0) {
- return 0; // Nothing we can do
- }
-
- if (mp_exponent == NULL) {
- loadParamsFromKey();
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_exponent, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-}
-
-// --------------------------------------------------------------------------------
-// Get modulus
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoKeyRSA::getModulusBase64BigNums(char * b64, unsigned int len) {
-
- if (mp_pubkey == 0 && mp_modulus == 0) {
- return 0; // Nothing we can do
- }
-
- if (mp_modulus == NULL) {
- loadParamsFromKey();
- }
-
- unsigned int bLen = 0;
- unsigned char * b = NSSCryptoProvider::SI2b64(mp_modulus, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoKeyRSA.hpp b/xsec/enc/NSS/NSSCryptoKeyRSA.hpp
deleted file mode 100644
index 231a1659..00000000
--- a/xsec/enc/NSS/NSSCryptoKeyRSA.hpp
+++ /dev/null
@@ -1,291 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoKeyRSA := NSS implementation of RSA Keys
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOKEYRSA_INCLUDE
-#define NSSCRYPTOKEYRSA_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyRSA.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <keyhi.h>
-#include <nss.h>
-
-class NSSCryptoProvider;
-
-/**
- * \ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief NSS implementation of the interface class for RSA keys.
- *
- * The library uses classes derived from this to process RSA keys.
- */
-
-class XSEC_EXPORT NSSCryptoKeyRSA : public XSECCryptoKeyRSA {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Create an RSA key
- *
- * @param pubkey A handle to the public key (optional)
- * @param privkey A handle to the private key (optional)
- */
-
- NSSCryptoKeyRSA(SECKEYPublicKey* pubkey = NULL, SECKEYPrivateKey* privkey = NULL);
-
- virtual ~NSSCryptoKeyRSA();
-
- //@}
-
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * For RSA keys, this allows people to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const;
-
- /**
- * \brief Return the NSS identifier string
- */
-
- virtual const XMLCh* getProviderName() const;
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey* clone() const;
-
- //@}
-
- /** @name Mandatory RSA interface methods
- *
- * These classes are required by the library.
- */
- //@{
-
-
- /**
- * \brief Verify a SHA1 PKCS1 encoded signature
- *
- * The library will call this function to validate an RSA signature
- * The standard by default uses SHA1 in a PKCS1 encoding.
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Length of the data in the digest buffer
- * @param base64Signature Buffer containing the Base64 encoded signature
- * @param sigLen Length of the data in the signature buffer
- * @param type The hash method that was used to create the hash that is being
- * passed in
- * @returns true if the signature was valid, false otherwise
- */
-
- virtual bool verifySHA1PKCS1Base64Signature(const unsigned char* hashBuf,
- unsigned int hashLen,
- const char* base64Signature,
- unsigned int sigLen,
- XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Create a signature
- *
- * The library will call this function to create a signature from
- * a pre-calculated digest. The output signature will
- * be Base64 encoded such that it can be placed directly into the
- * XML document
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Number of bytes of hash in the hashBuf
- * @param base64SignatureBuf Buffer to place the base64 encoded result
- * in.
- * @param base64SignatureBufLen Implementations need to ensure they do
- * not write more bytes than this into the buffer
- * @param type Hash Method used in order to embed correct OID for sig
- */
-
- virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char* hashBuf,
- unsigned int hashLen,
- char* base64SignatureBuf,
- unsigned int base64SignatureBufLen,
- XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Decrypt using private key
- *
- * The library will call this function to decrypt a piece of cipher
- * text using the private component of this key.
- *
- * @param inBuf cipher text to decrypt
- * @param plainBuf output buffer for decrypted bytes
- * @param inLength bytes of cipher text to decrypt
- * @param maxOutLength size of outputBuffer
- * @param padding Type of padding (PKCS 1.5 or OAEP)
- * @param hashURI Hash Method for OAEP encryption
- * @param mgfURI algorithm identifier for OAEP mask generation function
- * @param params raw OAEP parameter data, if any
- * @param paramslen OEP parameter length
- */
-
- virtual unsigned int privateDecrypt(const unsigned char* inBuf,
- unsigned char* plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI=NULL,
- const XMLCh* mgfURI=NULL,
- unsigned char* params=NULL,
- unsigned int paramsLen=0) const;
-
- /**
- * \brief Encrypt using a public key
- *
- * The library will call this function to encrypt a plain text buffer
- * using the public component of this key.
- *
- * @param inBuf plain text to decrypt
- * @param cipherBuf output buffer for decrypted bytes
- * @param inLength bytes of plain text to encrypt
- * @param maxOutLength size of outputBuffer
- * @param padding Type of padding (PKCS 1.5 or OAEP)
- * @param hashURI Hash Method for OAEP encryption
- * @param mgfURI algorithm identifier for OAEP mask generation function
- * @param params raw OAEP parameter data, if any
- * @param paramslen OEP parameter length
- */
-
- virtual unsigned int publicEncrypt(const unsigned char* inBuf,
- unsigned char* cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI=NULL,
- const XMLCh* mgfURI=NULL,
- unsigned char* params=NULL,
- unsigned int paramsLen=0) const;
-
- /**
- * \brief Obtain the length of an RSA key
- *
- * @returns The length of the rsa key (in bytes)
- */
-
- virtual unsigned int getLength() const;
-
- //@}
-
- /** @name Optional Interface methods
- *
- * Have been implemented to allow interoperability testing
- */
-
- //@{
-
- /**
- * \brief Load the modulus
- *
- * Load the modulus from a Base64 encoded string
- *
- * param b64 A buffer containing the encoded string
- * param len The length of the data in the buffer
- */
-
- virtual void loadPublicModulusBase64BigNums(const char* b64, unsigned int len);
-
- /**
- * \brief Load the exponent
- *
- * Load the exponent from a Base64 encoded string
- *
- * param b64 A buffer containing the encoded string
- * param len The length of the data in the buffer
- */
-
- virtual void loadPublicExponentBase64BigNums(const char* b64, unsigned int len);
-
- //@}
-
- /** @name NSS Specific Functions */
- //@{
-
-
- /**
- * \brief Retrieve the exponent
- *
- * Retrieves the exponent in ds:CryptoBinary encoded format
- *
- * @param b64 Buffer to place encoded exponent into
- * @param len Maximum number of bytes to place in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getExponentBase64BigNums(char* b64, unsigned int len);
-
- /**
- * \brief Retrieve the modulus
- *
- * Retrieves the modulus in ds:CryptoBinary encoded format
- *
- * @param b64 Buffer to place the encoded modulus into
- * @param len Maximum number of bytes to place in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getModulusBase64BigNums(char* b64, unsigned int len);
-
- //@}
-
-private:
-
- mutable SECKEYPublicKey* mp_pubkey;
- SECKEYPrivateKey* mp_privkey;
-
- SECItem* mp_modulus;
- SECItem* mp_exponent;
-
- // Instruct to import from parameters
-
- void importKey(void) const;
- void loadParamsFromKey(void);
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOKEYRSA_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoProvider.cpp b/xsec/enc/NSS/NSSCryptoProvider.cpp
deleted file mode 100644
index ec927a3f..00000000
--- a/xsec/enc/NSS/NSSCryptoProvider.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoProvider := Provider to support NSS
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#include <xsec/enc/NSS/NSSCryptoX509.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyDSA.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyRSA.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-#include <xsec/enc/NSS/NSSCryptoHash.hpp>
-#include <xsec/enc/NSS/NSSCryptoHashHMAC.hpp>
-#include <xsec/enc/NSS/NSSCryptoSymmetricKey.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-int NSSCryptoProvider::m_initialised = 0;
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-void NSSCryptoProvider::Init(const char * dbDir) {
- ++m_initialised;
-
- if (m_initialised > 1)
- return;
-
- SECStatus s;
-
- if (dbDir != NULL)
- s = NSS_Init(dbDir);
- else
- s = NSS_NoDB_Init(NULL);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::MemoryError,
- "NSSCryptoProvider:NSSCryptoProvider - Error initializing NSS");
-
- }
-}
-
-NSSCryptoProvider::NSSCryptoProvider(const char * dbDir) {
- Init(dbDir);
-}
-
-
-// --------------------------------------------------------------------------------
-// Empty constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoProvider::NSSCryptoProvider()
-{
- Init(NULL);
-}
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoProvider::~NSSCryptoProvider()
-{
- if (m_initialised == 1) {
-
- PK11_LogoutAll();
-
- SECStatus s = NSS_Shutdown();
-
- // Note that NSS will fail to shut down if any memory leaks are detected (NSS
- // objects were not released). This is security measure to prevent abuse of your
- // private keys.
- if (s != SECSuccess) {
-
- //throw XSECCryptoException(XSECCryptoException::GeneralError,
- // "NSSCryptoProvider:NSSCryptoProvider - Error shuting down NSS");
-
- }
-
- }
- m_initialised--;
-}
-
-// --------------------------------------------------------------------------------
-// Get NSS string
-// --------------------------------------------------------------------------------
-
-const XMLCh * NSSCryptoProvider::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVNSS;
-}
-
-unsigned int NSSCryptoProvider::getMaxHashSize() const {
- return 128;
-}
-
-
-// --------------------------------------------------------------------------------
-// Hash
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash* NSSCryptoProvider::hash(XSECCryptoHash::HashType type) const {
- NSSCryptoHash* ret;
-
- XSECnew(ret, NSSCryptoHash(type));
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Hash HMAC
-// --------------------------------------------------------------------------------
-
-XSECCryptoHash* NSSCryptoProvider::HMAC(XSECCryptoHash::HashType type)const {
- NSSCryptoHashHMAC* ret;
-
- XSECnew(ret, NSSCryptoHashHMAC(type));
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Get HMAC key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKeyHMAC* NSSCryptoProvider::keyHMAC(void) const {
-
- NSSCryptoKeyHMAC* ret;
-
- XSECnew(ret, NSSCryptoKeyHMAC());
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Get DSA key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKeyDSA* NSSCryptoProvider::keyDSA() const {
-
- NSSCryptoKeyDSA * ret;
-
- XSECnew(ret, NSSCryptoKeyDSA());
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Get RSA key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKeyRSA* NSSCryptoProvider::keyRSA() const {
-
- NSSCryptoKeyRSA * ret;
-
- XSECnew(ret, NSSCryptoKeyRSA());
-
- return ret;
-}
-
-XSECCryptoKeyEC* NSSCryptoProvider::keyEC() const {
-
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "NSSCryptoProvider::keyEC - EC support not available");
-}
-
-XSECCryptoKey* NSSCryptoProvider::keyDER(const char* buf, unsigned long len, bool base64) const {
-
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "NSSCryptoProvider::keyDER - DER decoding support not available");
-}
-
-// --------------------------------------------------------------------------------
-// Get symmetric key
-// --------------------------------------------------------------------------------
-
-XSECCryptoSymmetricKey* NSSCryptoProvider::keySymmetric(XSECCryptoSymmetricKey::SymmetricKeyType alg) const {
-
- // Only temporary
-
- NSSCryptoSymmetricKey * ret;
-
- XSECnew(ret, NSSCryptoSymmetricKey(alg));
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Get X509 class
-// --------------------------------------------------------------------------------
-
-XSECCryptoX509* NSSCryptoProvider::X509() const {
-
- NSSCryptoX509 * ret;
-
- XSECnew(ret, NSSCryptoX509());
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Get Base64
-// --------------------------------------------------------------------------------
-
-XSECCryptoBase64* NSSCryptoProvider::base64() const {
-
- // NSS does provide a Base64 decoder/encoder,
- // but rather use the internal implementation.
-
- XSCryptCryptoBase64 * ret;
-
- XSECnew(ret, XSCryptCryptoBase64());
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Translate a Base64 number to a SECItem
-// --------------------------------------------------------------------------------
-
-SECItem* NSSCryptoProvider::b642SI(const char* b64, unsigned int b64Len) {
-
- SECItem * rv;
-
- unsigned char * os;
- XSECnew(os, unsigned char[b64Len]);
- ArrayJanitor<unsigned char> j_os(os);
-
- // Decode
- XSCryptCryptoBase64 b;
-
- b.decodeInit();
- unsigned int retLen = b.decode((unsigned char *) b64, b64Len, os, b64Len);
- retLen += b.decodeFinish(&os[retLen], b64Len - retLen);
-
- rv = SECITEM_AllocItem(NULL, NULL, retLen);
- rv->len = retLen;
- memcpy(rv->data, os, retLen);
-
- return rv;
-}
-
-// --------------------------------------------------------------------------------
-// Translate a SECItem to a Base64 I2OSP number
-// --------------------------------------------------------------------------------
-
-unsigned char* NSSCryptoProvider::SI2b64(SECItem* n, unsigned int& retLen) {
-
- unsigned char * b64;
- // Naieve length calculation
- unsigned int bufLen = n->len * 2 + 4;
-
- XSECnew(b64, unsigned char[bufLen]);
- ArrayJanitor<unsigned char> j_b64(b64);
-
- // Encode
- XSCryptCryptoBase64 b;
-
- b.encodeInit();
- retLen = b.encode(n->data, (unsigned int) n->len, b64, bufLen);
- retLen += b.encodeFinish(&b64[retLen], bufLen - retLen);
-
- j_b64.release();
- return b64;
-}
-
-// --------------------------------------------------------------------------------
-// Check if hash algorithm is supported
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoProvider::algorithmSupported(XSECCryptoHash::HashType alg) const {
-
- switch (alg) {
-
- case (XSECCryptoHash::HASH_SHA1) :
- case (XSECCryptoHash::HASH_MD5) :
- case (XSECCryptoHash::HASH_SHA256) :
- case (XSECCryptoHash::HASH_SHA384) :
- case (XSECCryptoHash::HASH_SHA512) :
- return true;
-
- default:
- return false;
-
- }
-
- return false;
-}
-
-// --------------------------------------------------------------------------------
-// Check if cypher algorithm is supported
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoProvider::algorithmSupported(XSECCryptoSymmetricKey::SymmetricKeyType alg) const {
-
- switch (alg) {
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- //return m_haveAES;
- return true;
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- return true;
-
- default:
-
- return false;
-
- }
-
- return false;
-}
-
-
-// --------------------------------------------------------------------------------
-// Generate random data
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoProvider::getRandom(unsigned char* buffer, unsigned int numOctets) const {
-
- SECStatus s = PK11_GenerateRandom(buffer, numOctets);
-
- if (s != SECSuccess) {
- throw XSECException(XSECException::InternalError,
- "NSSCryptoProvider() - Error generating Random data");
- }
-
- return numOctets;
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoProvider.hpp b/xsec/enc/NSS/NSSCryptoProvider.hpp
deleted file mode 100644
index 7cd9a633..00000000
--- a/xsec/enc/NSS/NSSCryptoProvider.hpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoProvider := Base class to handle NSS
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOPROVIDER_INCLUDE
-#define NSSCRYPTOPROVIDER_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoProvider.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <nss.h>
-
-/**
- * @defgroup nsscrypto NSS Interface
- * @ingroup nsscrypto
- * The NSS crypto provides an experimental inerface to the NSS API.
- */
-
- /*\@{*/
-
-class XSEC_EXPORT NSSCryptoProvider : public XSECCryptoProvider {
-
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
- /**
- * \brief Create a NSS interface layer
- *
- * @param dbDir Directory where NSS key database is stored.
- * Will initialise NSS without DB support if nothing passed in.
- * If you are writing Mozilla/Firefox plugin, you shouldn't
- * use this ctor, because Mozilla/Firefox init NSS. Use empty
- * ctor instead.
- */
-
- NSSCryptoProvider(const char * dbDir);
-
- /**
- * \brief Create a NSS interface layer
- *
- * Will not initialise NSS library, user should do that
- */
-
- NSSCryptoProvider();
-
- virtual ~NSSCryptoProvider();
-
- //@}
-
- /** @name Hashing (Digest) Functions */
- //@{
-
- /**
- * \brief Get the provider's maximum digest length.
- *
- * Call used by the library to max out the buffer sizes it uses.
- *
- * @returns maximum size to allow for
- */
- virtual unsigned int getMaxHashSize() const;
-
- /**
- * \brief Return a hashing implementation.
- *
- * Call used by the library to obtain a hashing implementation from the
- * provider.
- *
- * @returns a pointer to a hashing object.
- */
- virtual XSECCryptoHash* hash(XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Return an HMAC implementation.
- *
- * Call used by the library to obtain an HMAC implementation from the
- * provider. The caller will need to set the key in the hash
- * object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey().
- *
- * @returns a pointer to the hashing object.
- */
- virtual XSECCryptoHash* HMAC(XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Return a HMAC key
- *
- * Sometimes the library needs to create an HMAC key (notably within
- * the XKMS utilities).
- *
- * This function allows the library to obtain a key that can then have
- * a value set within it.
- */
-
- virtual XSECCryptoKeyHMAC* keyHMAC(void) const;
-
- /**
- * \brief Determine whether a given algorithm is supported
- *
- * A call that can be used to determine whether a given
- * digest algorithm is supported
- */
-
- virtual bool algorithmSupported(XSECCryptoHash::HashType alg) const;
-
- //@}
-
- /** @name Encoding functions */
- //@{
-
- /**
- * \brief Return a Base64 encoder/decoder implementation.
- *
- * Call used by the library to obtain a Base64
- * encoder/decoder.
- *
- * @note NSS do implement Base64, but internal
- * implementation (XSCrypt) is used instead.
- *
- * @returns Pointer to the new Base64 encoder.
- * @see XSCryptCryptoBase64
- */
-
- virtual XSECCryptoBase64* base64() const;
-
- //@}
-
- /** @name Keys and Certificates */
- //@{
-
- /**
- * \brief Return a DSA key implementation object.
- *
- * Call used by the library to obtain a DSA key object.
- *
- * @returns Pointer to the new DSA key
- * @see NSSCryptoKeyDSA
- */
-
- virtual XSECCryptoKeyDSA* keyDSA() const;
-
- /**
- * \brief Return an RSA key implementation object.
- *
- * Call used by the library to obtain an NSS RSA key object.
- *
- * @returns Pointer to the new RSA key
- * @see NSSCryptoKeyRSA
- */
-
- virtual XSECCryptoKeyRSA* keyRSA() const;
-
- /**
- * \brief Return an EC key implementation object.
- *
- * Call used by the library to obtain an NSS EC key object.
- *
- * @returns Pointer to the new EC key
- */
-
- virtual XSECCryptoKeyEC* keyEC() const;
-
- /**
- * \brief Return a key implementation object based on DER-encoded input.
- *
- * Call used by the library to obtain a key object from a DER-encoded key.
- *
- * @param buf DER-encoded data
- * @param buflen length of data
- * @param base64 true iff data is base64-encoded
- * @returns Pointer to the new key
- */
-
- virtual XSECCryptoKey* keyDER(const char* buf, unsigned long buflen, bool base64) const;
-
- /**
- * \brief Return an X509 implementation object.
- *
- * Call used by the library to obtain an object that can work
- * with X509 certificates.
- *
- * @returns Pointer to the new X509 object
- * @see NSSCryptoX509
- */
-
- virtual XSECCryptoX509* X509() const;
-
- /**
- * \brief Determine whether a given algorithm is supported
- *
- * A call that can be used to determine whether a given
- * symmetric algorithm is supported
- */
-
- virtual bool algorithmSupported(XSECCryptoSymmetricKey::SymmetricKeyType alg) const;
-
- /**
- * \brief Return a Symmetric Key implementation object.
- *
- * Call used by the library to obtain a bulk encryption
- * object.
- *
- * @returns Pointer to the new SymmetricKey object
- * @see XSECCryptoSymmetricKey
- */
-
- virtual XSECCryptoSymmetricKey* keySymmetric(XSECCryptoSymmetricKey::SymmetricKeyType alg) const;
-
- /**
- * \brief Obtain some random octets
- *
- * For generation of IVs and the like, the library needs to be able
- * to obtain "random" octets. The library uses this call to the
- * crypto provider to obtain what it needs.
- *
- * @param buffer The buffer to place the random data in
- * @param numOctets Number of bytes required
- * @returns Number of bytes obtained.
- */
-
- virtual unsigned int getRandom(unsigned char* buffer, unsigned int numOctets) const;
-
- /**
- * \brief Translate B64 I2OS integer to a NSS SECItem.
- *
- * Decodes a Base64 (ds:CryptoBinary) integer into SECItem.
- *
- * @param b64 Base 64 string
- * @param b64Len Length of base64 string
- * @param retLen Parameter to hold length of return integer
- */
-
- static SECItem* b642SI(const char* b64, unsigned int b64Len);
-
- /**
- * \brief Translate a SECItem to a B64 I2OS integer .
- *
- * Encodes a SECItem in I2OSP base64 encoded format.
- *
- * @param n Buffer holding the SECItem
- * @param nLen Length of data in buffer
- * @param retLen Parameter to hold length of return integer
- * @returns A pointer to a buffer holding the encoded data
- * (transfers ownership)
- */
-
- static unsigned char* SI2b64(SECItem* n, unsigned int &retLen);
-
- //@}
-
- /** @name Information Functions */
- //@{
-
- /**
- * \brief Returns a string that identifies the Crypto Provider
- */
-
- virtual const XMLCh* getProviderName() const;
-
- //@}
-
-
-private:
-
- void Init(const char * dbDir);
- static int m_initialised;
-
-};
-
-/*\@}*/
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOPROVIDER_INCLUDE */
-
diff --git a/xsec/enc/NSS/NSSCryptoSymmetricKey.cpp b/xsec/enc/NSS/NSSCryptoSymmetricKey.cpp
deleted file mode 100644
index 6f725091..00000000
--- a/xsec/enc/NSS/NSSCryptoSymmetricKey.cpp
+++ /dev/null
@@ -1,616 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECCryptoSymmetricKey := Bulk encryption algorithms should all be
- * implemented via this interface
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/utils/XSECPlatformUtils.hpp>
-#include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#include <xsec/enc/NSS/NSSCryptoSymmetricKey.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-
-#include <xercesc/util/Janitor.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include "prerror.h"
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoSymmetricKey::NSSCryptoSymmetricKey(XSECCryptoSymmetricKey::SymmetricKeyType type) :
-m_keyType(type),
-m_keyMode(MODE_NONE),
-m_initialised(false),
-mp_k(NULL)
-{
-
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoSymmetricKey::~NSSCryptoSymmetricKey() {
-
- if (mp_k != 0)
- PK11_FreeSymKey(mp_k);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get key type
-// --------------------------------------------------------------------------------
-
-XSECCryptoSymmetricKey::SymmetricKeyType NSSCryptoSymmetricKey::getSymmetricKeyType() const {
-
- return m_keyType;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get provider name
-// --------------------------------------------------------------------------------
-
-const XMLCh * NSSCryptoSymmetricKey::getProviderName() const {
-
- return DSIGConstants::s_unicodeStrPROVNSS;
-
-}
-
-// --------------------------------------------------------------------------------
-// Replicate key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * NSSCryptoSymmetricKey::clone() const {
-
- NSSCryptoSymmetricKey * ret;
-
- XSECnew(ret, NSSCryptoSymmetricKey(m_keyType));
-
- if (mp_k != 0) {
-
- ret->mp_k = PK11_ReferenceSymKey(mp_k);
-
- }
-
- ret->m_keyType = m_keyType;
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Store the key value
-// --------------------------------------------------------------------------------
-
-void NSSCryptoSymmetricKey::setKey(const unsigned char * key, unsigned int keyLen) {
-
- if (mp_k != 0) {
- PK11_FreeSymKey(mp_k);
- mp_k = 0;
- }
-
- CK_MECHANISM_TYPE cipherMech;
-
- switch (m_keyType) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- cipherMech = CKM_DES3_CBC_PAD;
- break;
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- cipherMech = CKM_AES_CBC_PAD;
- break;
-
- default:
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unknown key type");
-
- }
-
- // Turn the raw key into a SECItem
- SECItem keyItem;
- keyItem.data = (unsigned char*)key;
- keyItem.len = keyLen;
-
- PK11SlotInfo * slot = PK11_GetBestSlot(cipherMech, NULL);
-
- // Turn the SECItem into a key object
- mp_k = PK11_ImportSymKey(slot,
- cipherMech,
- PK11_OriginUnwrap,
- CKA_ENCRYPT,
- &keyItem,
- NULL);
-
- if (slot)
- PK11_FreeSlot(slot);
-
-}
-
-// --------------------------------------------------------------------------------
-// Decrypt context initialisation
-// --------------------------------------------------------------------------------
-
-int NSSCryptoSymmetricKey::decryptCtxInit(const unsigned char * iv) {
-
- // Returns amount of IV data used (in bytes)
- // Sets m_initialised if the key is OK and the IV is OK.
-
- if (m_initialised)
- return 0;
-
- if (mp_k == 0) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Cannot initialise without key");
- }
- else if (m_keyMode == MODE_NONE) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Cannot initialise without mode");
- }
-
- // Set up the context according to the required cipher type
-
- switch (m_keyType) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- // A 3DES key
-
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- return 0; // Cannot initialise without an IV
-
- }
-
- SECItem ivItem;
- ivItem.data = (unsigned char*)iv;
- ivItem.len = 8;
- int encryptAlg = (m_doPad == true ? CKM_DES3_CBC_PAD : CKM_DES3_CBC);
-
- SECItem * secParam = PK11_ParamFromIV(encryptAlg, &ivItem);
- mp_ctx = PK11_CreateContextBySymKey(encryptAlg, CKA_DECRYPT, mp_k, secParam);
-
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 8;
- }
- else if (m_keyMode == MODE_ECB) {
- SECItem * secParam = PK11_ParamFromIV(CKM_DES3_ECB, NULL);
- mp_ctx = PK11_CreateContextBySymKey(CKM_DES3_ECB, CKA_DECRYPT, mp_k, secParam);
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
- m_ivSize = 0;
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unrecognized cipher mode");
- }
-
- break;
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- // An AES key
-
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- return 0; // Cannot initialise without an IV
-
- }
-
- SECItem ivItem;
- ivItem.data = (unsigned char*)iv;
- ivItem.len = 16;
-
- SECItem * secParam = PK11_ParamFromIV(CKM_AES_CBC_PAD, &ivItem);
- mp_ctx = PK11_CreateContextBySymKey(CKM_AES_CBC_PAD, CKA_DECRYPT, mp_k, secParam);
-
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 16;
-
- }
- else if (m_keyMode == MODE_ECB) {
-
- SECItem * secParam = PK11_ParamFromIV(CKM_AES_ECB, NULL);
- mp_ctx = PK11_CreateContextBySymKey(CKM_AES_ECB, CKA_DECRYPT, mp_k, secParam);
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 0;
-
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unrecognized cipher mode");
- }
-
- break;
-
- default :
-
- // Cannot do this without an IV
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unknown key type");
-
- }
-
- // Reset some parameters
- m_initialised = true;
-
- // Return number of bytes chewed up by IV
- return m_ivSize;
-}
-
-// --------------------------------------------------------------------------------
-// Decrypt initialisation
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoSymmetricKey::decryptInit(bool doPad,
- SymmetricKeyMode mode,
- const unsigned char * iv,
- const unsigned char* tag,
- unsigned int taglen) {
-
- m_initialised = false;
- m_ivSent = iv == NULL;
- m_doPad = doPad;
- m_keyMode = mode;
- decryptCtxInit(iv);
- return true;
-
-}
-
-// --------------------------------------------------------------------------------
-// Decrypt
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoSymmetricKey::decrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength) {
-
- // NOTE: This won't actually stop NSS blowing the buffer, so the onus is
- // on the caller.
-
- unsigned int offset = 0;
- if (!m_initialised) {
- offset = decryptCtxInit(inBuf);
- if (offset > inLength) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Not enough data passed in to get IV");
- }
- }
-
- int outl = inLength - offset;
-
- SECStatus s = PK11_CipherOp(mp_ctx, plainBuf, &outl, maxOutLength, (unsigned char*)inBuf, inLength);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error during NSS decrypt");
-
- }
-
- // remove IV
- if (m_ivSent) {
- memmove(plainBuf, &plainBuf[m_ivSize], outl);
- outl -= m_ivSize;
- m_ivSent = false;
- }
-
- return outl;
-
-}
-
-// --------------------------------------------------------------------------------
-// Decrypt finalisation
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoSymmetricKey::decryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength) {
-
- unsigned int outl = 0;
-
- SECStatus s = PK11_DigestFinal(mp_ctx, plainBuf, &outl, maxOutLength);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error during NSS decrypt finalisation");
-
- }
-
- PK11_DestroyContext(mp_ctx, PR_TRUE);
- mp_ctx = NULL;
- m_initialised = false;
-
- return outl;
-}
-
-// --------------------------------------------------------------------------------
-// Encrypt initialisation
-// --------------------------------------------------------------------------------
-
-bool NSSCryptoSymmetricKey::encryptInit(bool doPad,
- SymmetricKeyMode mode,
- const unsigned char * iv) {
-
- if (m_initialised == true)
- return true;
-
- m_doPad = doPad;
- m_keyMode = mode;
-
- if (mp_k == 0) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Cannot initialise without key");
- }
- else if (m_keyMode == MODE_NONE) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Cannot initialise without mode");
- }
-
- // Do some parameter initialisation
- m_initialised = true;
-
- // Set up the context according to the required cipher type
-
- const unsigned char * usedIV = NULL;
- unsigned char genIV[256];
-
- // Tell the library that the IV still has to be sent
-
- m_ivSent = false;
-
- switch (m_keyType) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- // A 3DES key
-
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- SECStatus s = PK11_GenerateRandom(genIV, 8);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error generating random IV");
-
- }
-
- usedIV = genIV;
-
- }
- else
- usedIV = iv;
-
- SECItem ivItem;
- ivItem.data = (unsigned char*)usedIV;
- ivItem.len = 8;
- int encryptAlg = (m_doPad == true ? CKM_DES3_CBC_PAD : CKM_DES3_CBC);
-
- SECItem * secParam = PK11_ParamFromIV(encryptAlg, &ivItem);
- mp_ctx = PK11_CreateContextBySymKey(encryptAlg, CKA_ENCRYPT, mp_k, secParam);
-
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 8;
- }
- else if (m_keyMode == MODE_ECB) {
- mp_ctx = PK11_CreateContextBySymKey(CKM_DES3_ECB, CKA_ENCRYPT, mp_k, NULL);
-
- m_ivSize = 0;
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unsupported DES3 cipher mode");
- }
-
- break;
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- // An AES key
-
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- SECStatus s = PK11_GenerateRandom(genIV, 16);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error generating random IV");
-
- }
-
- usedIV = genIV;
-
- }
- else
- usedIV = iv;
-
- SECItem ivItem;
- ivItem.data = (unsigned char*)usedIV;
- ivItem.len = 16;
-
- SECItem * secParam = PK11_ParamFromIV(CKM_AES_CBC_PAD, &ivItem);
- mp_ctx = PK11_CreateContextBySymKey(CKM_AES_CBC_PAD, CKA_ENCRYPT, mp_k, secParam);
-
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 16;
- }
- else if (m_keyMode == MODE_ECB) {
- SECItem * secParam = PK11_ParamFromIV(CKM_AES_ECB, NULL);
- mp_ctx = PK11_CreateContextBySymKey(CKM_AES_ECB, CKA_ENCRYPT, mp_k, secParam);
- if (secParam)
- SECITEM_FreeItem(secParam, PR_TRUE);
-
- m_ivSize = 0;
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unsupported AES cipher mode");
- }
-
- break;
-
- default :
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Unknown key type");
-
- }
-
- // Add IV
- if (m_keyMode == MODE_CBC || m_keyMode == MODE_GCM) {
-
- memcpy(m_lastBlock, usedIV, m_ivSize);
-
- }
-
- return true;
-
-}
-
-// --------------------------------------------------------------------------------
-// Encrypt
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoSymmetricKey::encrypt(const unsigned char * inBuf,
- unsigned char * cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength) {
-
- if (m_initialised == false) {
-
- encryptInit();
-
- }
-
- // NOTE: This won't actually stop NSS blowing the buffer, so the onus is
- // on the caller.
-
- unsigned int offset = 0;
- if (m_ivSent == false && m_ivSize > 0) {
-
- memcpy(cipherBuf, m_lastBlock, m_ivSize);
- m_ivSent = true;
-
- offset = m_ivSize;
-
- }
-
- int outl = 0;
-
- if (inLength + offset > maxOutLength) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Not enough space in output buffer for encrypt");
-
- }
-
- SECStatus s = PK11_CipherOp(mp_ctx,
- &cipherBuf[offset],
- &outl,
- maxOutLength - offset,
- (unsigned char*)inBuf,
- inLength);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error during NSS encrypt");
-
- }
-
- return outl + offset;
-
-}
-
-// --------------------------------------------------------------------------------
-// Encrypt finalisation
-// --------------------------------------------------------------------------------
-
-unsigned int NSSCryptoSymmetricKey::encryptFinish(unsigned char * cipherBuf,
- unsigned int maxOutLength,
- unsigned int taglen) {
-
- unsigned int outl = 0;
-
- SECStatus s = PK11_DigestFinal(mp_ctx, cipherBuf, &outl, maxOutLength);
-
- if (s != SECSuccess) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "NSS:SymmetricKey - Error during NSS encrypt");
-
- }
-
- PK11_DestroyContext(mp_ctx, PR_TRUE);
- mp_ctx = NULL;
-
- // Setup so can be re-used
- m_initialised = false;
-
- return outl;
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoSymmetricKey.hpp b/xsec/enc/NSS/NSSCryptoSymmetricKey.hpp
deleted file mode 100644
index f845a372..00000000
--- a/xsec/enc/NSS/NSSCryptoSymmetricKey.hpp
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECCryptoSymmetricKey := Bulk encryption algorithms should all be
- * implemented via this interface
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOSYMMETRICKEY_INCLUDE
-#define NSSCRYPTOSYMMETRICKEY_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoSymmetricKey.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <pk11func.h>
-#include <nss.h>
-
-#define NSS_MAX_BLOCK_SIZE 32
-
-/**
- * \ingroup nsscrypto
- * @{
- */
-
-/**
- * \brief Base interface definition for symmetric key material.
- *
- * This is the implementation for a wrapper of NSS symmetric
- * crypto functions.
- */
-
-class XSEC_EXPORT NSSCryptoSymmetricKey : public XSECCryptoSymmetricKey {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor
- *
- * Can only construct a Symmetric key if we know what type it is
- *
- * @param type The type of key (i.e. algorithm) to create
- **/
-
- NSSCryptoSymmetricKey(XSECCryptoSymmetricKey::SymmetricKeyType type);
-
- /**
- * \brief Destructor
- *
- * Implementations must ensure that the held key is properly destroyed
- * (overwritten) when key objects are deleted.
- */
-
- virtual ~NSSCryptoSymmetricKey();
-
- //@}
-
- /** @name Basic CryptoKey Interface methods */
- //@{
-
- /**
- * \brief Returns a string that identifies the crypto owner of this library.
- */
-
- virtual const XMLCh * getProviderName() const;
-
- /**
- * \brief Clone the key
- *
- * All keys need to be able to copy themselves and return
- * a pointer to the copy. This allows the library to
- * duplicate keys.
- */
-
- virtual XSECCryptoKey * clone() const;
-
- //@}
-
- /** @name Symmetric key interface methods */
- //@{
-
- /**
- * \brief What type of symmetric key is this?
- *
- * There are a number of different types of symmetric key.
- * This method allows callers to determine the type of this
- * particular key
- */
-
- SymmetricKeyType getSymmetricKeyType(void) const;
-
- /**
- * \brief Set the key from the provided bytes
- *
- * Symmetric keys can all be loaded from a buffer containing a series
- * of bytes.
- *
- * @param key The buffer containing the key bytes
- * @param keyLen The number of key bytes in the buffer
- *
- */
-
- void setKey(const unsigned char * key, unsigned int keyLen);
-
- /**
- * \brief Initialise an decryption process
- *
- * Setup the key to get ready for a decryption session.
- * Callers can pass in an IV. If one is not provided,
- * but the algorithm requires one (e.g. 3DES_CBC), then
- * implementations should assume that the start of the
- * cipher text stream will in fact be the IV.
- *
- * @param doPad By default, we perform padding for last block
- * @param mode mode selection (Currently ECB or CBC mode only)
- * @param iv Initialisation Vector to be used. NULL if one is
- * not required, or if IV will be set from data stream
- * @param tag Authentication tag to be used for AEAD ciphers
- * @param taglen length of Authentication Tag
- * @returns true if the initialisation succeeded.
- */
-
- virtual bool decryptInit(bool doPad = true,
- SymmetricKeyMode mode = MODE_CBC,
- const unsigned char * iv = NULL,
- const unsigned char* tag = NULL,
- unsigned int taglen = 0);
-
- /**
- * \brief Continue an decrypt operation using this key.
- *
- * Decryption must have been set up using an encryptInit
- * call. Takes the inBuf and continues a decryption operation,
- * writing the output to outBuf.
- *
- * This function does not have to guarantee that all input
- * will be decrypted. In cases where the input is not a length
- * of the block size, the implementation will need to hold back
- * cipher-text to be handles during the next operation.
- *
- * @note While maxOutLength is defined, the NSS libraries will
- * not read the value, so the onus is on the caller to ensure the
- * buffer is long enough to hold the output!
- *
- * @param inBuf Octets to be decrypted
- * @param plainBuf Buffer to place output in
- * @param inLength Number of bytes to decrypt
- * @param maxOutLength Maximum number of bytes to place in output
- * buffer
- * @returns Bytes placed in output Buffer
- */
-
- virtual unsigned int decrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength);
-
- /**
- * \brief Finish a decryption operation
- *
- * Complete a decryption process. No cipher text is passed in,
- * as this should simply be removing any remaining text from
- * the plain storage buffer.
- *
- * May throw an exception if there is some stored cipher text
- * that is not the length of the block size for block algorithms.
- *
- * @note While maxOutLength is defined, the NSS libraries will
- * not read the value, so the onus is on the caller to ensure the
- * buffer is long enough to hold the output!
- *
- * @param plainBuf Buffer to place any remaining plain text in
- * @param maxOutLength Maximum number of bytes to pace in output
- * @returns Bytes placed in output buffer
- */
-
- virtual unsigned int decryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength);
-
- /**
- * \brief Initialise an encryption process
- *
- * Setup the key to get ready for a decryption session.
- * Callers can pass in an IV. If one is not provided,
- * but the algorithm requires one (e.g. 3DES_CBC), then
- * implementations are required to generate one.
- *
- * @param doPad By default, we perform padding for last block
- * @param mode What mode to handle blocks (Currently CBC or ECB)
- * @param iv Initialisation Vector to be used. NULL if one is
- * not required, or if IV is to be generated
- * @returns true if the initialisation succeeded.
- */
-
- virtual bool encryptInit(bool doPad = true,
- SymmetricKeyMode mode = MODE_CBC,
- const unsigned char * iv = NULL);
-
- /**
- * \brief Continue an encryption operation using this key.
- *
- * Encryption must have been set up using an encryptInit
- * call. Takes the inBuf and continues a encryption operation,
- * writing the output to outBuf.
- *
- * This function does not have to guarantee that all input
- * will be encrypted. In cases where the input is not a length
- * of the block size, the implementation will need to hold back
- * plain-text to be handled during the next operation.
- *
- * @param inBuf Octets to be encrypted
- * @param cipherBuf Buffer to place output in
- * @param inLength Number of bytes to encrypt
- * @param maxOutLength Maximum number of bytes to place in output
- * buffer
- * @returns Bytes placed in output Buffer
- */
-
- virtual unsigned int encrypt(const unsigned char * inBuf,
- unsigned char * cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength);
-
- /**
- * \brief Finish a encryption operation
- *
- * Complete a encryption process. No plain text is passed in,
- * as this should simply be removing any remaining text from
- * the plain storage buffer and creating a final padded block.
- *
- * Padding is performed by taking the remaining block, and
- * setting the last byte to equal the number of bytes of
- * padding. If the plain was an exact multiple of the block size,
- * then an extra block of padding will be used. For example, if
- * the block size is 8 bytes, and there were three remaining plain
- * text bytes (0x01, 0x02 and 0x03), the final block will be :
- *
- * 0x010203????????05
- *
- * @param cipherBuf Buffer to place final block of cipher text in
- * @param maxOutLength Maximum number of bytes to pace in output
- * @param taglen length of Authentication Tag
- * @returns Bytes placed in output buffer
- */
-
- virtual unsigned int encryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength,
- unsigned int taglen = 0);
-
- //@}
-
-private:
-
- // Unimplemented constructors
-
- NSSCryptoSymmetricKey();
- NSSCryptoSymmetricKey(const NSSCryptoSymmetricKey &);
- NSSCryptoSymmetricKey & operator= (const NSSCryptoSymmetricKey &);
-
- int decryptCtxInit(const unsigned char * iv);
-
- SymmetricKeyType m_keyType;
- SymmetricKeyMode m_keyMode; // ECB or CBC
- bool m_initialised;
- bool m_doPad; //Does we need it? Yes we do - key wraps are unpadded for 3DES
-
- unsigned char m_lastBlock[NSS_MAX_BLOCK_SIZE];
- unsigned int m_blockSize;
- bool m_ivSent; // Has the IV been put in the stream
- unsigned int m_ivSize;
-
- PK11Context * mp_ctx;
- PK11SymKey * mp_k;
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOSYMMETRICKEY_INCLUDE */
diff --git a/xsec/enc/NSS/NSSCryptoX509.cpp b/xsec/enc/NSS/NSSCryptoX509.cpp
deleted file mode 100644
index 3521c272..00000000
--- a/xsec/enc/NSS/NSSCryptoX509.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoX509:= NSS based class for handling X509 (V3) certificates
- *
- * Author(s): Milan Tomic
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#include <xsec/enc/NSS/NSSCryptoX509.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyDSA.hpp>
-#include <xsec/enc/NSS/NSSCryptoKeyRSA.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-extern "C" {
-
-extern CERTCertificate *
-__CERT_DecodeDERCertificate (SECItem *derSignedCert, PRBool copyDER, char *nickname);
-
-}
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoX509::NSSCryptoX509() : m_DERX509(""), mp_cert(NULL) {
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Constructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoX509::NSSCryptoX509(CERTCertificate * pCert) {
-
- // Build this from an existing CERTCertificate structure
-
- mp_cert = pCert;
-
- unsigned char * encCert;
- unsigned long len = mp_cert->derCert.len * 2;
- XSECnew(encCert, unsigned char [len]);
- ArrayJanitor<unsigned char> j_encCert(encCert);
-
- // Base64 Encode
- XSCryptCryptoBase64 b64;
-
- b64.encodeInit();
- unsigned long encCertLen = b64.encode(mp_cert->derCert.data, mp_cert->derCert.len, encCert, len);
- encCertLen += b64.encodeFinish(&encCert[encCertLen], len - encCertLen);
-
- // Check the result
- if (encCert == NULL) {
-
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSSX509:NSSX509 - Error encoding certificate");
-
- }
-
- m_DERX509.sbMemcpyIn(encCert, encCertLen);
- m_DERX509[encCertLen] = '\0';
-
-}
-
-// --------------------------------------------------------------------------------
-// Destructor
-// --------------------------------------------------------------------------------
-
-NSSCryptoX509::~NSSCryptoX509() {
-
- if (mp_cert != 0)
- CERT_DestroyCertificate(mp_cert);
-
-}
-
-// --------------------------------------------------------------------------------
-// Load X509
-// --------------------------------------------------------------------------------
-
-void NSSCryptoX509::loadX509Base64Bin(const char * buf, unsigned int len) {
-
- unsigned char * rawCert;
- XSECnew(rawCert, unsigned char [len]);
- ArrayJanitor<unsigned char> j_rawCert(rawCert);
-
- // Base64 Decode
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- unsigned int rawCertLen = b64.decode((unsigned char *) buf, len, rawCert, len);
- rawCertLen += b64.decodeFinish(&rawCert[rawCertLen], len - rawCertLen);
-
- // Now load certificate
-
- SECItem i;
- i.type = siBuffer;
- i.data = rawCert;
- i.len = rawCertLen;
-
- SECItem *certs[1];
- certs[0] = &i;
-
- // For returning
- CERTCertificate **certArray = NULL;
-
- /* mp_cert = __CERT_DecodeDERCertificate(&i, PR_TRUE, NULL); */
- CERT_ImportCerts(CERT_GetDefaultCertDB(), certUsageUserCertImport, 1, certs,
- &certArray, PR_FALSE, PR_FALSE, NULL);
- // 1. If you got an compiler error here add into "nss/cert.h" delacarion for
- // CERT_DecodeDERCertificate() (the same parameters as for __CERT_DecodeDERCertificate())
- // 2. Since __CERT_DecodeDERCertificate is a private function we might consider using
- // __CERT_NewTempCertificate() or CERT_ImportCerts() instead.
-
- // Now map to our cert
- if (certArray == NULL) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSSX509:loadX509Base64Bin - Error decoding certificate");
- }
-
- mp_cert = certArray[0];
-
- if (mp_cert == 0) {
-
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSSX509:loadX509Base64Bin - Error decoding certificate");
-
- }
-
- m_DERX509.sbMemcpyIn(buf, len);
- m_DERX509[len] = '\0';
-
-}
-
-// --------------------------------------------------------------------------------
-// Get NSS provider name
-// --------------------------------------------------------------------------------
-
-const XMLCh * NSSCryptoX509::getProviderName() const {
-
- return DSIGConstants::s_unicodeStrPROVNSS;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get publickey type: RSA or DSA
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey::KeyType NSSCryptoX509::getPublicKeyType() const {
-
- if (mp_cert == NULL) {
-
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSS:X509 - getPublicKeyType called before X509 loaded");
-
- }
-
- XSECCryptoKey::KeyType kt = XSECCryptoKey::KEY_NONE;
-
- SECKEYPublicKey * pubkey = CERT_ExtractPublicKey(mp_cert);
-
- if (pubkey == 0) {
-
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSS:X509 - Error extracting public key from X509 certificate");
-
- }
-
- if (pubkey->keyType == dsaKey)
- kt = XSECCryptoKey::KEY_DSA_PUBLIC;
-
- if (pubkey->keyType == rsaKey)
- kt = XSECCryptoKey::KEY_RSA_PUBLIC;
-
- SECKEY_DestroyPublicKey(pubkey);
-
- return kt;
-
-}
-
-// --------------------------------------------------------------------------------
-// Replicate public key
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * NSSCryptoX509::clonePublicKey() const {
-
- if (mp_cert == NULL) {
-
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "NSS:X509 - clonePublicKey called before X509 loaded");
-
- }
-
- // Import the key into the provider to get a pointer to the key
-
- if (getPublicKeyType() == XSECCryptoKey::KEY_DSA_PUBLIC) {
-
- SECKEYPublicKey * pubkey = CERT_ExtractPublicKey(mp_cert);
-
- // Now that we have a handle for the DSA key, create a DSA Key object to
- // wrap it in
-
- NSSCryptoKeyDSA * ret;
- XSECnew(ret, NSSCryptoKeyDSA(pubkey));
-
- return ret;
-
- }
-
- if (getPublicKeyType() == XSECCryptoKey::KEY_RSA_PUBLIC) {
-
- SECKEYPublicKey * pubkey = CERT_ExtractPublicKey(mp_cert);
-
- // Now that we have a handle for the DSA key, create a DSA Key object to
- // wrap it in
-
- NSSCryptoKeyRSA * ret;
- XSECnew(ret, NSSCryptoKeyRSA(pubkey));
-
- return ret;
-
- }
-
- return NULL; // Unknown key type, but not necessarily an error
-
-}
-
-#endif /* XSEC_HAVE_NSS */
diff --git a/xsec/enc/NSS/NSSCryptoX509.hpp b/xsec/enc/NSS/NSSCryptoX509.hpp
deleted file mode 100644
index 33387e04..00000000
--- a/xsec/enc/NSS/NSSCryptoX509.hpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * NSSCryptoX509:= NSS based class for handling X509 (V3) certificates
- *
- * Author(s): Milan Tomic
- *
- */
-
-#ifndef NSSCRYPTOX509_INCLUDE
-#define NSSCRYPTOX509_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoX509.hpp>
-
-#if defined (XSEC_HAVE_NSS)
-
-#include <cert.h>
-
-class NSSCryptoProvider;
-
-/**
- * \brief NSS implementation class for interface for X509 certificates.
- * @ingroup nsscrypto
- *
- * The library uses classes derived from this to process X509 Certificates.
- *
- */
-
-class XSEC_EXPORT NSSCryptoX509 : public XSECCryptoX509 {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor for X509 objects
- *
- * Empty ctor, used when loading X509 from KeyInfo
- *
- */
-
- NSSCryptoX509();
-
- /**
- * \brief Constructor for X509 objects
- *
- * This ctor is used when we wish to get cert as Base64
- *
- * @param pCert pointer to NSS certificate structure
- *
- */
-
- NSSCryptoX509(CERTCertificate * pCert);
-
- virtual ~NSSCryptoX509();
-
- //@}
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of the key stored in the certificate.
- *
- * Will extract the key from the certificate to return the appropriate
- * type
- *
- */
-
- virtual XSECCryptoKey::KeyType getPublicKeyType() const;
-
- /**
- * \brief Get a copy of the public key.
- *
- * Extracts the public key from the certificate and returns the appropriate
- * NSSCryrptoKey (DSA or RSA) object
- *
- */
-
- virtual XSECCryptoKey * clonePublicKey() const;
-
- /**
- * \brief Returns a string that identifies the crypto owner of this library.
- */
-
- virtual const XMLCh * getProviderName() const;
-
- //@}
-
- /** @name Load and Get the certificate */
- //@{
-
- /**
- * \brief Load a certificate into the object.
- *
- * Take a base64 DER encoded certificate and load.
- *
- * @param buf A buffer containing the Base64 encoded certificate
- * @param len The number of bytes of data in the certificate.
- */
-
- virtual void loadX509Base64Bin(const char * buf, unsigned int len);
-
- /**
- * \brief Get a Base64 DER encoded copy of the certificate
- *
- * @returns A safeBuffer containing the DER encoded certificate
- */
-
- virtual safeBuffer &getDEREncodingSB(void) {return m_DERX509;}
-
- /**
- * \brief Get a Base64 DER encoded copy of the certificate
- *
- * @returns A safeBuffer containing the DER encoded certificate
- */
-
- virtual const safeBuffer &getDEREncodingSB(void) const {return m_DERX509;}
-
- //@}
-
-private:
-
- safeBuffer m_DERX509;
- CERTCertificate * mp_cert;
-
-};
-
-#endif /* XSEC_HAVE_NSS */
-#endif /* NSSCRYPTOX509_INCLUDE */
-
diff --git a/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp b/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp
index a2c5de71..3b635f34 100644
--- a/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp
+++ b/xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp
@@ -107,8 +107,7 @@ public :
/**
* \brief Return a HMAC key
*
- * Sometimes the library needs to create an HMAC key (notably within
- * the XKMS utilities.
+ * Sometimes the library needs to create an HMAC key.
*
* This function allows the library to obtain a key that can then have
* a value set within it.
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoHash.cpp b/xsec/enc/WinCAPI/WinCAPICryptoHash.cpp
deleted file mode 100644
index fd9219ac..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoHash.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoHash := Windows CAPI Implementation of Message digests
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/WinCAPI/WinCAPICryptoHash.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include <memory.h>
-
-// Constructors/Destructors
-
-WinCAPICryptoHash::WinCAPICryptoHash(HCRYPTPROV prov, HashType alg) {
-
- m_p = prov;
- m_hashType = alg;
- m_h = 0;
-
- reset();
-}
-
-
-WinCAPICryptoHash::~WinCAPICryptoHash() {
-
- if (m_h != 0)
- CryptDestroyHash(m_h);
-
-}
-
-
-
-// Hashing Activities
-void WinCAPICryptoHash::reset(void) {
-
- if (m_h != 0)
- CryptDestroyHash(m_h);
-
- m_h = 0;
-
- BOOL fResult;
- ALG_ID alg_id;
-
- switch (m_hashType) {
-
- case (XSECCryptoHash::HASH_SHA1) :
-
- alg_id = CALG_SHA;
- break;
-
- case (XSECCryptoHash::HASH_MD5) :
-
- alg_id = CALG_MD5;
- break;
-
- default :
-
- alg_id = 0;
-
- }
-
- if(alg_id == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Unknown algorithm (NOTE SHA512 and SHA256 not supported");
- }
-
- fResult = CryptCreateHash(
- m_p,
- alg_id,
- 0,
- 0,
- &m_h);
-
- if (fResult == 0 || m_h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Error creating hash object");
- }
-
-}
-
-void WinCAPICryptoHash::hash(unsigned char * data,
- unsigned int length) {
-
- BOOL fResult = CryptHashData(
- m_h,
- data,
- length,
- 0);
-
- if (fResult == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Error Hashing Data");
- }
-
-}
-
-unsigned int WinCAPICryptoHash::finish(unsigned char * hash,
- unsigned int maxLength) {
-
- DWORD retLen;
- BOOL fResult;
-
- retLen = WINCAPI_MAX_HASH_SIZE;
-
- fResult = CryptGetHashParam(
- m_h,
- HP_HASHVAL,
- m_mdValue,
- &retLen,
- 0);
-
- if (fResult == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Error getting hash value");
- }
-
- m_mdLen = retLen;
- retLen = (maxLength > m_mdLen ? m_mdLen : maxLength);
- memcpy(hash, m_mdValue, retLen);
-
- return (unsigned int) retLen;
-
-}
-
-// Get information
-
-XSECCryptoHash::HashType WinCAPICryptoHash::getHashType(void) const {
-
- return m_hashType; // This could be any kind of hash
-
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoHash.hpp b/xsec/enc/WinCAPI/WinCAPICryptoHash.hpp
deleted file mode 100644
index c01cdd07..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoHash.hpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoHash := Windows CAPI Implementation of Message digests
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOHASH_INCLUDE
-#define WINCAPICRYPTOHASH_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoHash.hpp>
-
-# if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-#define WINCAPI_MAX_HASH_SIZE 256
-
-class WinCAPICryptoProvider;
-
-/**
- * @ingroup wincapicrypto
- */
-
-/**
- * \brief Windows Crypto API Implementation of Hash functions.
- *
- * Uses the Windows Crypt functions to perform digest functions.
- *
- */
-
-class XSEC_EXPORT WinCAPICryptoHash : public XSECCryptoHash {
-
-
-public :
-
- /** @name Constructors/Destructors */
- //@{
- /**
- * \brief Construct a Hash object
- *
- * Creates a Windows Crypto API based hash object of the required
- * type.
- *
- * @param prov handle to a provider that supports the required algorithm.
- * Both PROV_RSA_FULL and PROV_DSS support MD5 and SHA1
- * @param alg The algorithm to use for digest operations
- */
-
- WinCAPICryptoHash(HCRYPTPROV prov, XSECCryptoHash::HashType alg);
- virtual ~WinCAPICryptoHash();
-
- //@}
-
- /** @name HMAC Functions */
- //@{
-
- /**
- *\brief
- *
- * Does nothing. If the required function is an HMAC function,
- * then WinCAPICryptoHashHMAC should be used.
- *
- * @param key The key the HMAC function should use.
- */
-
- virtual void setKey(const XSECCryptoKey * key) {}
-
- //@}
-
- /** @name Digest/Hash functions */
- //@{
-
- /**
- * \brief Rest the hash function
- *
- * Re-initialises the digest structure.
- */
-
- virtual void reset(void);
-
- /**
- * \brief Hash some data.
- *
- * Take length bytes of data from the data buffer and update the hash
- * that already exists. This function may (and normally will) be called
- * many times for large blocks of data.
- *
- * @param data The buffer containing the data to be hashed.
- * @param length The number of bytes to be read from data
- */
-
- virtual void hash(unsigned char * data,
- unsigned int length);
-
- /**
- * \brief Finish up a Digest operation and read the result.
- *
- * This call tells the CryptoHash object that the input is complete and
- * to finalise the Digest. The output of the digest is read into the
- * hash buffer (at most maxLength bytes)
- *
- * @param hash The buffer the hash should be read into.
- * @param maxLength The maximum number of bytes to be read into hash
- * @returns The number of bytes copied into the hash buffer
- */
-
- virtual unsigned int finish(unsigned char * hash,
- unsigned int maxLength);// Finish and get hash
-
- //@}
-
- /** @name Information functions */
- //@{
-
- /**
- *\brief
- *
- * Determine the hash type of this object
- *
- * @returns The hash type
- */
-
- virtual HashType getHashType(void) const;
-
- //@}
-
-private:
-
- // Not implemented constructors
- WinCAPICryptoHash();
-
- unsigned char m_mdValue[WINCAPI_MAX_HASH_SIZE]; // Final output
- unsigned int m_mdLen;
-
- XSECCryptoHash::HashType m_hashType;
-
- HCRYPTPROV m_p;
- HCRYPTHASH m_h;
-
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOHASHSHA1_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.cpp b/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.cpp
deleted file mode 100644
index d7706a81..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.cpp
+++ /dev/null
@@ -1,420 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoHashHMAC := Windows CAPI Implementation of Message digests
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include <memory.h>
-
-// --------------------------------------------------------------------------------
-// IPAD/OPAD definitions
-// --------------------------------------------------------------------------------
-
-static unsigned char ipad[] = {
-
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
- 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
-};
-
-static unsigned char opad[] = {
-
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
- 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
-};
-
-// --------------------------------------------------------------------------------
-// Constructors/Destructors
-// --------------------------------------------------------------------------------
-
-WinCAPICryptoHashHMAC::WinCAPICryptoHashHMAC(HCRYPTPROV prov, HashType alg) {
-
- m_p = prov;
- m_h = 0;
- m_blockSize = 64; // We only know SHA-1 and MD5 at this time - both are 64 bytes
-
- switch (alg) {
-
- case (XSECCryptoHash::HASH_SHA1) :
-
- m_algId = CALG_SHA;
- break;
-
- case (XSECCryptoHash::HASH_MD5) :
-
- m_algId = CALG_MD5;
- break;
-
- default :
-
- m_algId = 0;
-
- }
-
- if(m_algId == 0) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Unknown algorithm");
- }
-
- m_hashType = alg;
-
-
-}
-
-void WinCAPICryptoHashHMAC::reset() {
-
- if (m_h != 0)
- CryptDestroyHash(m_h);
-
-}
-
-WinCAPICryptoHashHMAC::~WinCAPICryptoHashHMAC() {
-
- if (m_h != 0)
- CryptDestroyHash(m_h);
-
-}
-
-// --------------------------------------------------------------------------------
-// Key manipulation
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoHashHMAC::eraseKeys(void) {
-
- // Overwrite the ipad/opad calculated key values
- unsigned char * i = m_ipadKeyed;
- unsigned char * j = m_opadKeyed;
-
- for (unsigned int k = 0; k < XSEC_MAX_HASH_BLOCK_SIZE; ++k) {
- *i++ = 0;
- *j++ = 0;
- }
-
-}
-
-void WinCAPICryptoHashHMAC::setKey(const XSECCryptoKey *key) {
-
-
- BOOL fResult;
-
- // Use this to initialise the ipadKeyed/opadKeyed values
-
- if (key->getKeyType() != XSECCryptoKey::KEY_HMAC) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:HashHMAC - Non HMAC Key passed to HashHMAC");
-
- }
-
- if (m_blockSize > XSEC_MAX_HASH_BLOCK_SIZE) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:HashHMAC - Internal error - have got a blocksize bigger than I can handle");
-
- }
-
- // Check to see if this is an internal Windows Key
- if (strEquals(key->getProviderName(), DSIGConstants::s_unicodeStrPROVWinCAPI) &&
- ((WinCAPICryptoKeyHMAC *) key)->getWinKey() != 0) {
-
- // Over-ride the local provider for this
-
- HCRYPTPROV p = ((WinCAPICryptoKeyHMAC *) key)->getWinKeyProv();
- HCRYPTKEY k = ((WinCAPICryptoKeyHMAC *) key)->getWinKey();
-
- fResult = CryptCreateHash(
- p,
- CALG_HMAC,
- k,
- 0,
- &m_h);
-
- if (fResult == 0 || m_h == 0) {
- DWORD error = GetLastError();
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::setKey - Error creating internally keyed hash object");
- }
-
- // Set the HMAC algorithm
- HMAC_INFO hi;
-
- hi.HashAlgid = m_algId;
- hi.pbInnerString = NULL; // Use default inner and outer strings
- hi.cbInnerString = 0;
- hi.pbOuterString = NULL;
- hi.cbOuterString = 0;
-
- fResult = CryptSetHashParam(
- m_h,
- HP_HMAC_INFO,
- (BYTE *) &hi,
- 0);
-
- if (fResult == 0 || m_h == 0) {
- DWORD error = GetLastError();
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::setKey - Error setting HASH_INFO object");
- }
-
-
-
- return;
-
- }
-
- // Need to load from raw bit string
-
- safeBuffer keyBuf;
- unsigned int keyLen = ((XSECCryptoKeyHMAC *) key)->getKey(keyBuf);
-
- if (keyLen > m_blockSize) {
-
- HCRYPTHASH h;
-
- fResult = CryptCreateHash(
- m_p,
- m_algId,
- 0,
- 0,
- &h);
-
- if (fResult == 0 || h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::setKey - Error creating hash object");
- }
-
- fResult = CryptHashData(
- h,
- keyBuf.rawBuffer(),
- keyLen,
- 0);
-
- if (fResult == 0 || h == 0) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::setKey - Error hashing key data");
- }
-
- BYTE outData[XSEC_MAX_HASH_SIZE];
- DWORD outDataLen = XSEC_MAX_HASH_SIZE;
-
- CryptGetHashParam(
- h,
- HP_HASHVAL,
- outData,
- &outDataLen,
- 0);
-
- if (fResult == 0 || h == 0) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::setKey - Error getting hash result");
- }
-
- keyBuf.sbMemcpyIn(outData, outDataLen);
- keyLen = outDataLen;
-
- if (h)
- CryptDestroyHash(h);
-
-
- }
-
- // Now create the ipad and opad keyed values
- memcpy(m_ipadKeyed, ipad, m_blockSize);
- memcpy(m_opadKeyed, opad, m_blockSize);
-
- // XOR with the key
- for (unsigned int i = 0; i < keyLen; ++i) {
- m_ipadKeyed[i] = keyBuf[i] ^ m_ipadKeyed[i];
- m_opadKeyed[i] = keyBuf[i] ^ m_opadKeyed[i];
- }
-
-
- // Now create the hash object, and start with the ipad operation
- fResult = CryptCreateHash(
- m_p,
- m_algId,
- 0,
- 0,
- &m_h);
-
- if (fResult == 0 || m_h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:HashHMAC - Error creating hash object");
- }
-
- fResult = CryptHashData(
- m_h,
- m_ipadKeyed,
- m_blockSize,
- 0);
-
- if (fResult == 0 || m_h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:HashHMAC - Error performing initial ipad digest");
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Hash operations
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoHashHMAC::hash(unsigned char * data,
- unsigned int length) {
-
- if (m_h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:HashHMAC::hash() - Called prior to setting key");
- }
-
- BOOL fResult = CryptHashData(
- m_h,
- data,
- length,
- 0);
-
- if (fResult == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Error Hashing Data");
- }
-
-}
-
-unsigned int WinCAPICryptoHashHMAC::finish(unsigned char * hash,
- unsigned int maxLength) {
-
- DWORD retLen;
- BOOL fResult;
-
- retLen = XSEC_MAX_HASH_SIZE;
-
- fResult = CryptGetHashParam(
- m_h,
- HP_HASHVAL,
- m_mdValue,
- &retLen,
- 0);
-
- if (fResult == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash - Error getting hash value");
- }
-
- // Perform the opad operation
- HCRYPTHASH h;
- fResult = CryptCreateHash(
- m_p,
- m_algId,
- 0,
- 0,
- &h);
-
- if (fResult == 0 || h == 0) {
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::finish - Error creating hash object for opad operation");
- }
-
- fResult = CryptHashData(
- h,
- m_opadKeyed,
- m_blockSize,
- 0);
-
- if (fResult == 0 || h == 0) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::finish - Error hashing opad data");
- }
-
- fResult = CryptHashData(
- h,
- m_mdValue,
- retLen,
- 0);
-
- if (fResult == 0 || h == 0) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:Hash::finish - Error hashing ipad hash to opad");
- }
-
- // Read out the final hash
- retLen = XSEC_MAX_HASH_SIZE;
-
- fResult = CryptGetHashParam(
- h,
- HP_HASHVAL,
- m_mdValue,
- &retLen,
- 0);
-
- CryptDestroyHash(h);
-
- m_mdLen = retLen;
- retLen = (maxLength > m_mdLen ? m_mdLen : maxLength);
- memcpy(hash, m_mdValue, retLen);
-
- return (unsigned int) retLen;
-
-}
-
-// Get information
-
-XSECCryptoHash::HashType WinCAPICryptoHashHMAC::getHashType(void) const {
-
- return m_hashType; // This could be any kind of hash
-
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp b/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp
deleted file mode 100644
index ffb5cf4e..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoHashHMAC := Windows CAPI Implementation of HMAC
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOHASHHMAC_INCLUDE
-#define WINCAPICRYPTOHASHHMAC_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoHash.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-class WinCAPICryptoProvider;
-
-/**
- * @ingroup wincapicrypto
- */
-
-/**
- * \brief Implementation of HMAC Hash functions in the Windows providers
- *
- * Uses the Windows Crypt* API functions to implement an HMAC.
- *
- * Unfortunately the Windows Crypto API does not allow callers to enter an
- * HMAC key directly. It relies on a seed being entered into a digest
- * function that is then used to derive a key that can be used in an
- * HMAC function.
- *
- * Two types of key can therefore be used - a direct Windows key, or
- * a "standard" string as the HMAC key. In the latter case, the HMAC
- * function is implemented internally around a standard Windows
- * hash function. In the former case, the Windows HMAC functions are
- * used. (The latter case is mainly for interoperability testing, where
- * the key is provided and needs to be entered "as is".
- *
- */
-
-class XSEC_EXPORT WinCAPICryptoHashHMAC : public XSECCryptoHash {
-
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor
- *
- * Create the object, with the indicated algorithm
- * (Currently supports MD5 and SHA1)
- *
- *
- * @param prov handle to a provider that supports the required algorithm.
- * Both PROV_RSA_FULL and PROV_DSS support MD5 and SHA1
- * @param alg Digest algorithm to use
- */
-
- WinCAPICryptoHashHMAC(HCRYPTPROV prov, XSECCryptoHash::HashType alg);
- virtual ~WinCAPICryptoHashHMAC();
-
- //@}
-
- /** @name HMAC Functions */
- //@{
-
- /**
- *\brief Set the HMAC key
- *
- * Sets the key - which needs to have a base class of
- * WinCAPICryptoKeyHMAC.
- *
- * @param key The key the HMAC function should use.
- */
-
- virtual void setKey(const XSECCryptoKey * key);
-
- //@}
-
- /** @name Hash functions */
- //@{
-
- /**
- * \brief Reset the hash function
- *
- * Re-initialises the digest structure.
- */
-
- virtual void reset(void);
-
- /**
- * \brief Hash some data.
- *
- * Take length bytes of data from the data buffer and update the hash
- * that already exists. This function may (and normally will) be called
- * many times for large blocks of data.
- *
- * @param data The buffer containing the data to be hashed.
- * @param length The number of bytes to be read from data
- */
-
- virtual void hash(unsigned char * data,
- unsigned int length);
-
- /**
- * \brief Finish up a Digest operation and read the result.
- *
- * This call tells the CryptoHash object that the input is complete and
- * to finalise the Digest. The output of the digest is read into the
- * hash buffer (at most maxLength bytes). This is effectively the
- * signature for the data that has been run through the HMAC function.
- *
- * @param hash The buffer the hash should be read into.
- * @param maxLength The maximum number of bytes to be read into hash
- * @returns The number of bytes copied into the hash buffer
- */
-
- virtual unsigned int finish(unsigned char * hash,
- unsigned int maxLength);
-
- //@}
-
- /** @name Information functions */
- //@{
-
- /**
- *\brief
- *
- * Determine the hash type of this object
- *
- * @returns The hash type
- */
-
- virtual HashType getHashType(void) const;
-
- //@}
-
-private:
-
- // Not implemented constructors
- WinCAPICryptoHashHMAC();
-
- unsigned char m_mdValue[XSEC_MAX_HASH_SIZE]; // Final output
- unsigned int m_mdLen;
-
- ALG_ID m_algId;
- XSECCryptoHash::HashType m_hashType;
-
- HCRYPTPROV m_p;
- HCRYPTHASH m_h;
-
- unsigned char m_ipadKeyed[XSEC_MAX_HASH_SIZE];
- unsigned char m_opadKeyed[XSEC_MAX_HASH_SIZE];
-
- unsigned int m_blockSize; // Block size (bytes) for used alg.
-
- // Internal functions
- void eraseKeys();
-
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOHASHHMAC_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.cpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.cpp
deleted file mode 100644
index e5c5fb0c..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.cpp
+++ /dev/null
@@ -1,777 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyDSA := DSA Keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/XSECCryptoUtils.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA(HCRYPTPROV prov) {
-
- // Create a new key to be loaded as we go
-
- m_key = 0;
- m_p = prov;
- m_keySpec = 0;
-
- mp_P = NULL;
- mp_Q = NULL;
- mp_G = NULL;
- mp_Y = NULL;
-
-};
-
-// "Hidden" WinCAPI constructor
-
-WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA(HCRYPTPROV prov,
- HCRYPTKEY k) :
-m_p(prov) {
-
- m_key = k; // NOTE - We OWN this handle
- m_keySpec = 0;
-
- mp_P = mp_Q = mp_G = mp_Y = NULL;
- m_PLen = m_QLen = m_GLen = m_YLen = 0;
-
-}
-
-WinCAPICryptoKeyDSA::WinCAPICryptoKeyDSA(HCRYPTPROV prov,
- DWORD keySpec,
- bool isPrivate) :
-m_p(prov) {
-
- if (isPrivate == false) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "Public keys defined via keySpec ctor not yet supported");
-
-
- }
-
- m_key = 0;
- m_keySpec = keySpec;
-
- mp_P = mp_Q = mp_G = mp_Y = NULL;
- m_PLen = m_QLen = m_GLen = m_YLen = 0;
-
-}
-
-WinCAPICryptoKeyDSA::~WinCAPICryptoKeyDSA() {
-
-
- // If we have a DSA, delete it
-
- if (m_key != 0)
- CryptDestroyKey(m_key);
-
- if (mp_P != NULL)
- delete[] mp_P;
- if (mp_Q != NULL)
- delete[] mp_Q;
- if (mp_G != NULL)
- delete[] mp_G;
- if (mp_Y != NULL)
- delete[] mp_Y;
-
-};
-
-const XMLCh * WinCAPICryptoKeyDSA::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVWinCAPI;
-}
-
-// Generic key functions
-
-XSECCryptoKey::KeyType WinCAPICryptoKeyDSA::getKeyType() const {
-
- // Find out what we have
- if (m_key == NULL) {
-
- // For now we don't really understand Private Windows keys
- if (m_keySpec != 0)
- return KEY_DSA_PRIVATE;
-
- // Check if we have parameters loaded
- if (mp_P == NULL ||
- mp_Q == NULL ||
- mp_G == NULL ||
- mp_Y == NULL)
- return KEY_NONE;
- else
- return KEY_DSA_PUBLIC;
- }
-
- if (m_keySpec != 0)
- return KEY_DSA_PAIR;
-
- // If we have m_key - it must be public
-
- return KEY_DSA_PUBLIC;
-
-}
-
-void WinCAPICryptoKeyDSA::loadPBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_P != NULL) {
- delete[] mp_P;
- mp_P = NULL; // In case we get an exception
- }
-
- mp_P = WinCAPICryptoProvider::b642WinBN(b64, len, m_PLen);
-
-}
-
-void WinCAPICryptoKeyDSA::loadQBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_Q != NULL) {
- delete[] mp_Q;
- mp_Q = NULL; // In case we get an exception
- }
-
- mp_Q = WinCAPICryptoProvider::b642WinBN(b64, len, m_QLen);
-}
-
-void WinCAPICryptoKeyDSA::loadGBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_G != NULL) {
- delete[] mp_G;
- mp_G = NULL; // In case we get an exception
- }
-
- mp_G = WinCAPICryptoProvider::b642WinBN(b64, len, m_GLen);
-}
-
-void WinCAPICryptoKeyDSA::loadYBase64BigNums(const char * b64, unsigned int len) {
-
- if (mp_Y != NULL) {
- delete[] mp_Y;
- mp_Y = NULL; // In case we get an exception
- }
-
- mp_Y = WinCAPICryptoProvider::b642WinBN(b64, len, m_YLen);
-}
-
-void WinCAPICryptoKeyDSA::loadJBase64BigNums(const char * b64, unsigned int len) {
-/*
- Do nothing
-*/
-}
-
-
-// --------------------------------------------------------------------------------
-// Verify a signature encoded as a Base64 string
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoKeyDSA::importKey(void) const {
-
- if (m_key != 0 ||
- mp_P == NULL ||
- mp_Q == NULL ||
- mp_G == NULL ||
- mp_Y == NULL)
- return;
-
- // Do some basic checks
- if ((m_QLen > 20) |
- (m_GLen > m_PLen) |
- (m_YLen > m_PLen)) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Parameter lengths inconsistent");
- }
-
- // Create a DSS Public-Key blob
-
- // First build a buffer to hold everything
- BYTE * blobBuffer;
- unsigned int blobBufferLen = WINCAPI_BLOBHEADERLEN + WINCAPI_DSSPUBKEYLEN + (3 * m_PLen) + 0x14 + WINCAPI_DSSSEEDLEN;
- XSECnew(blobBuffer, BYTE[blobBufferLen]);
- ArrayJanitor<BYTE> j_blobBuffer(blobBuffer);
-
- // Blob header
- BLOBHEADER * header = (BLOBHEADER *) blobBuffer;
-
- header->bType = PUBLICKEYBLOB;
- header->bVersion = 0x02; // We are using a version 2 blob
- header->reserved = 0;
- header->aiKeyAlg = CALG_DSS_SIGN;
-
- // Now the public key header
- DSSPUBKEY * pubkey = (DSSPUBKEY *) (blobBuffer + WINCAPI_BLOBHEADERLEN);
-
- pubkey->magic = 0x31535344; // ASCII encoding of DSS1
- pubkey->bitlen = m_PLen * 8; // Number of bits in prime modulus
-
- // Now copy in each of the keys
- BYTE * i = (BYTE *) (pubkey);
- i += WINCAPI_DSSPUBKEYLEN;
-
- memcpy(i, mp_P, m_PLen);
- i+= m_PLen;
-
- // Q
- memcpy(i, mp_Q, m_QLen);
- i += m_QLen;
-
- // Pad with 0s
- unsigned int j;
- for (j = m_QLen; j < 20 ; ++j)
- *i++ = 0;
-
- // Generator
- memcpy(i, mp_G, m_GLen);
- i += m_GLen;
- // Pad
- for (j = m_GLen; j < m_PLen ; ++j)
- *i++ = 0;
-
- // Public key
- memcpy(i, mp_Y, m_YLen);
- i += m_YLen;
- // Pad
- for (j = m_YLen; j < m_PLen ; ++j)
- *i++ = 0;
-
- // Set seed to 0
- for (j = 0; j < WINCAPI_DSSSEEDLEN; ++j)
- *i++ = 0xFF; // SEED Counter set to 0xFFFFFFFF will cause seed to be ignored
-
- // Now that we have the blob, import
- BOOL fResult = CryptImportKey(
- m_p,
- blobBuffer,
- blobBufferLen,
- 0, // Not signed
- 0, // No flags
- &m_key);
-
- if (fResult == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA Error attempting to import key parameters");
-
- }
-
-}
-
-bool WinCAPICryptoKeyDSA::verifyBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64Signature,
- unsigned int sigLen) const {
-
- // Use the currently loaded key to validate the Base64 encoded signature
-
- if (m_key == 0) {
-
- // Try to import from the parameters
- importKey();
-
- if (m_key == 0) {
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Attempt to validate signature with empty key");
- }
- }
-
- // Decode the signature
- unsigned char * rawSig;
- DWORD rawSigLen;
- XSECnew(rawSig, BYTE [sigLen]);
- ArrayJanitor<BYTE> j_rawSig(rawSig);
-
- // Decode the signature
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- rawSigLen = b64.decode((unsigned char *) base64Signature, sigLen, rawSig, sigLen);
- rawSigLen += b64.decodeFinish(&rawSig[rawSigLen], sigLen - rawSigLen);
-
- // Reverse the sig - Windows stores integers as octet streams in little endian
- // order. The I2OSP algorithm used by XMLDSig to store integers is big endian
-
- BYTE rawSigFinal[40];
- BYTE * j, *k, *l, *m;
-
- unsigned char rb[20];
- unsigned char sb[20];
-
- if (rawSigLen == 40) {
-
- j = rawSig;
- k = rawSig + 20;
-
- } else if (rawSigLen == 46 && ASN2DSASig(rawSig, rb, sb) == true) {
-
- j = rb;
- k = sb;
-
- } else {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA::VerifyBase64Signature - Expect 40 bytes in a DSA signature");
- }
-
- l = rawSigFinal + 19;
- m = rawSigFinal + 39;
-
- while (l >= rawSigFinal) {
- *l-- = *j++;
- *m-- = *k++;
- }
-
- // Have to create a Windows hash object and feed in the hash
- BOOL fResult;
- HCRYPTHASH h;
- fResult = CryptCreateHash(m_p,
- CALG_SHA1,
- 0,
- 0,
- &h);
-
- if (!fResult) {
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error creating Windows Hash Object");
- }
-
- // Feed the hash value into the newly created hash object
- fResult = CryptSetHashParam(
- h,
- HP_HASHVAL,
- hashBuf,
- 0);
-
- if (!fResult) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error Setting Hash Value in Windows Hash object");
- }
-
- // Now validate
- fResult = CryptVerifySignature(
- h,
- rawSigFinal,
- 40,
- m_key,
- NULL,
- 0);
-
- if (!fResult) {
-
- DWORD error = GetLastError();
-
- /* For some reason, the default Microsoft DSS provider generally returns
- * NTE_FAIL (which denotes an internal failure in the provider) for a
- * failed signature rather than NTE_BAD_SIGNATURE
- */
-
- if (error != NTE_BAD_SIGNATURE && error != NTE_FAIL) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error occurred in DSA validation");
- }
-
- if (h)
- CryptDestroyHash(h);
- return false;
- }
-
- if (h)
- CryptDestroyHash(h);
-
- return true;
-
-}
-
-// --------------------------------------------------------------------------------
-// Sign and encode result as a Base64 string
-// --------------------------------------------------------------------------------
-
-
-unsigned int WinCAPICryptoKeyDSA::signBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen) const {
-
- // Sign a pre-calculated hash using this key
-
- if (m_keySpec == 0) {
-
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Attempt to sign data a public or non-existent key");
- }
-
- // Have to create a Windows hash object and feed in the hash
- BOOL fResult;
- HCRYPTHASH h;
- fResult = CryptCreateHash(m_p,
- CALG_SHA1,
- 0,
- 0,
- &h);
-
- if (!fResult) {
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error creating Windows Hash Object");
- }
-
- // Feed the hash value into the newly created hash object
- fResult = CryptSetHashParam(
- h,
- HP_HASHVAL,
- hashBuf,
- 0);
-
- if (!fResult) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error Setting Hash Value in Windows Hash object");
- }
-
- // Now sign
- BYTE rawSig[50];
- DWORD rawSigLen = 50;
- fResult = CryptSignHash(
- h,
- m_keySpec,
- NULL,
- 0,
- rawSig,
- &rawSigLen);
-
- if (!fResult || rawSigLen != 40) {
-
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error occurred in DSA signing");
- }
-
- if (h)
- CryptDestroyHash(h);
- // Now encode into a signature block
- BYTE rawSigFinal[40];
-
- BYTE * i, * j, * m, * n;
-
- i = rawSig;
- j = rawSig + 20;
- m = rawSigFinal + 19;
- n = rawSigFinal + 39;
-
- while (m >= rawSigFinal) {
- *m-- = *i++;
- *n-- = *j++;
- }
-
- // Now encode
- XSCryptCryptoBase64 b64;
- b64.encodeInit();
- unsigned int ret = b64.encode(rawSigFinal, 40, (unsigned char *) base64SignatureBuf, base64SignatureBufLen);
- ret += b64.encodeFinish((unsigned char *) &base64SignatureBuf[ret], base64SignatureBufLen - ret);
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Clone key
-// --------------------------------------------------------------------------------
-
-
-XSECCryptoKey * WinCAPICryptoKeyDSA::clone() const {
-
- WinCAPICryptoKeyDSA * ret;
-
- XSECnew(ret, WinCAPICryptoKeyDSA(m_p));
-
- if (m_key != 0) {
-
- // CryptDuplicateKey is not supported in Windows NT, so we need to export and then
- // reimport the key to get a copy
-
- BYTE keyBuf[2048];
- DWORD keyBufLen = 2048;
- CryptExportKey(m_key, 0, PUBLICKEYBLOB, 0, keyBuf, &keyBufLen);
-
- // Now re-import
- CryptImportKey(m_p, keyBuf, keyBufLen, NULL, 0, &ret->m_key);
- }
-
- ret->m_PLen = m_PLen;
- if (mp_P != NULL) {
- XSECnew(ret->mp_P, BYTE[m_PLen]);
- memcpy(ret->mp_P, mp_P, m_PLen);
- }
- else
- ret->mp_P = NULL;
-
- ret->m_QLen = m_QLen;
- if (mp_Q != NULL) {
- XSECnew(ret->mp_Q, BYTE[m_QLen]);
- memcpy(ret->mp_Q, mp_Q, m_QLen);
- }
- else
- ret->mp_Q = NULL;
-
- ret->m_GLen = m_GLen;
- if (mp_G != NULL) {
- XSECnew(ret->mp_G, BYTE[m_GLen]);
- memcpy(ret->mp_G, mp_G, m_GLen);
- }
- else
- ret->mp_G = NULL;
-
- ret->m_YLen = m_YLen;
- if (mp_Y != NULL) {
- XSECnew(ret->mp_Y, BYTE[m_YLen]);
- memcpy(ret->mp_Y, mp_Y, m_YLen);
- }
- else
- ret->mp_Y = NULL;
-
-
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Some utility functions
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoKeyDSA::loadParamsFromKey(void) {
-
- if (m_key == 0) {
-
- if (m_keySpec == 0)
- return;
-
- // See of we can get the user key
- if (!CryptGetUserKey(m_p, m_keySpec, &m_key))
- return;
-
- }
-
- // Export key into a keyblob
- BOOL fResult;
- DWORD blobLen;
-
- fResult = CryptExportKey(
- m_key,
- 0,
- PUBLICKEYBLOB,
- 0,
- NULL,
- &blobLen);
-
- if (fResult == 0 || blobLen < 1) {
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error exporting public key");
- }
-
- BYTE * blob;
- XSECnew(blob, BYTE[blobLen]);
- ArrayJanitor<BYTE> j_blob(blob);
-
- fResult = CryptExportKey(
- m_key,
- 0,
- PUBLICKEYBLOB,
- 0,
- blob,
- &blobLen);
-
- if (fResult == 0 || blobLen < 1) {
- throw XSECCryptoException(XSECCryptoException::DSAError,
- "WinCAPI:DSA - Error exporting public key");
- }
-
- DSSPUBKEY * pk = (DSSPUBKEY *) ( blob + WINCAPI_BLOBHEADERLEN );
- DWORD keyLen = pk->bitlen / 8;
-
- // Copy the keys
-
- BYTE * i = (BYTE *) ( pk );
- i += WINCAPI_DSSPUBKEYLEN;
- if (mp_P != NULL)
- delete[] mp_P;
-
- XSECnew(mp_P, BYTE[keyLen]);
- memcpy(mp_P, i, keyLen);
- m_PLen = keyLen;
-
- i+=keyLen;
-
- if (mp_Q != NULL)
- delete[] mp_Q;
-
- m_QLen = 20;
- while (i[m_QLen - 1] == 0 && m_QLen > 0)
- m_QLen--;
- XSECnew(mp_Q, BYTE[m_QLen]);
- memcpy(mp_Q, i, m_QLen);
-
- i+=20;
-
- if (mp_G != NULL)
- delete[] mp_G;
-
- m_GLen = keyLen;
- while(i[m_GLen - 1] == 0 && m_GLen > 0)
- m_GLen--;
-
- XSECnew(mp_G, BYTE[m_GLen]);
- memcpy(mp_G, i, m_GLen);
-
- i+=keyLen;
-
- if (mp_Y != NULL)
- delete[] mp_Y;
-
- m_YLen = keyLen;
- while (i[m_YLen] == 0 && m_YLen > 0)
- m_YLen--;
-
- XSECnew(mp_Y, BYTE[m_YLen]);
- memcpy(mp_Y, i, m_YLen);
-
-}
-
-unsigned int WinCAPICryptoKeyDSA::getPBase64BigNums(char * b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_P == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_P == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_P, m_PLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-unsigned int WinCAPICryptoKeyDSA::getQBase64BigNums(char * b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_Q == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_Q == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_Q, m_QLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-unsigned int WinCAPICryptoKeyDSA::getGBase64BigNums(char * b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_G == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_G == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_G, m_GLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-unsigned int WinCAPICryptoKeyDSA::getYBase64BigNums(char * b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_Y == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_Y == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_Y, m_YLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
-
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp
deleted file mode 100644
index 34944398..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp
+++ /dev/null
@@ -1,303 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyDSA := DSA Keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOKEYDSA_INCLUDE
-#define WINCAPICRYPTOKEYDSA_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyDSA.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-class WinCAPICryptoProvider;
-
-/**
- * \ingroup wincapicrypto
- */
-
-/**
- * \brief WinCAPI implementation class for DSA keys.
- *
- * The library uses classes derived from this to process DSA keys.
- */
-
-
-class XSEC_EXPORT WinCAPICryptoKeyDSA : public XSECCryptoKeyDSA {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Ctor for DSA keys
- *
- * This constructor should be used for public keys that are going to be
- * loaded later via P, Q etc.
- *
- * @param prov A handle to the provider (and key store) that will be
- * used to hold the key being built (Obviously a provider type that supports
- * DSS, such as DSS_PROV)
- */
-
- WinCAPICryptoKeyDSA(HCRYPTPROV prov);
-
- virtual ~WinCAPICryptoKeyDSA();
-
- /**
- * \brief WinCAPI Specific constructor for public keys
- *
- * Create a DSA key for use in XSEC from an existing public HCRYPTKEY
- *
- * @param prov A handle to the CSP to be used for operations under this key.
- * @param k The key to use
- * @note k is owned by the library. When the wrapper
- * WinCAPICryptoKeyDSA is deleted, k will be destroyed using
- * CryptDestroyKey(). Note also that prov will not be released.
- */
-
- WinCAPICryptoKeyDSA(HCRYPTPROV prov, HCRYPTKEY k);
-
- /**
- * \brief WinCAPI Specific constructor for private keys
- *
- * Create a DSA key for use in XSEC from a passed in handle to a provider
- * and associated key store
- *
- * @param prov A handle to the CSP to be used and read for the key.
- * @param keySpec The Key to use (AT_SIGNATURE or AT_KEYEXCHANGE)
- * @param isPrivate Should be true. In future, may be able to define public
- * keys this way as well.
- * @note The prov will not be released on close.
- */
-
- WinCAPICryptoKeyDSA(HCRYPTPROV prov, DWORD keySpec, bool isPrivate);
-
- //@}
-
- /** @name Required Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * Allows the caller (and library) to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const;
-
- /**
- *\brief Return the WiNCAPI string identifier
- */
-
- virtual const XMLCh * getProviderName() const;
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey * clone() const;
-
- //@}
-
- /** @name Required DSA methods */
- //@{
-
- /**
- * \brief Create a signature
- *
- * Sign the buffer using the internal private key. Will throw a DSAError
- * if the key is not set, or is not a private key.
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Number of bytes of hash in the hashBuf
- * @param base64SignatureBuf Buffer to place the base64 encoded result
- * in.
- * @param base64SignatureBufLen Implementations need to ensure they do
- * not write more bytes than this into the buffer
- */
-
- virtual unsigned int signBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen) const;
-
- /**
- * \brief Verify a signature
- *
- * The library will call this function to validate a signature
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Length of the data in the digest buffer
- * @param base64Signature Buffer containing the Base64 encoded signature
- * @param sigLen Length of the data in the signature buffer
- * @returns true if the signature was valid, false otherwise
- */
-
- virtual bool verifyBase64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64Signature,
- unsigned int sigLen) const;
-
- //@}
-
- /** @name Optional Interface methods
- *
- * Have been fully implemented in the WinCAPI interface to allow interop
- * testing to occur.
- *
- */
- //@{
-
- /**
- * \brief Load P
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadPBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load Q
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadQBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load G
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadGBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load Y
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadYBase64BigNums(const char * b64, unsigned int len);
-
- /**
- * \brief Load J
- *
- * @param b64 Base64 encoded parameter - read from XML document
- * @param len Length of the encoded string
- */
-
- virtual void loadJBase64BigNums(const char * b64, unsigned int len);
-
- //@}
-
- /** @name WinCAPI Specific functions */
- //@{
-
- /**
- * \brief Retrieve P
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded P parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getPBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve Q
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded Q parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getQBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve G
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded G parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getGBase64BigNums(char * b64, unsigned int len);
-
- /**
- * \brief Retrieve Y
- *
- * @param b64 Buffer to place ds:CryptoBinary encoded Y parameter in
- * @param len Max amount of data to be placed in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getYBase64BigNums(char * b64, unsigned int len);
-
- //@}
-
-private:
-
- HCRYPTPROV m_p;
- mutable HCRYPTKEY m_key; // For a public key
- DWORD m_keySpec; // For a private key
-
- BYTE * mp_P;
- BYTE * mp_Q;
- BYTE * mp_G;
- BYTE * mp_Y;
-
- unsigned int m_PLen;
- unsigned int m_QLen;
- unsigned int m_GLen;
- unsigned int m_YLen;
-
- // Instruct to import from parameters
-
- void importKey(void) const;
- void loadParamsFromKey(void);
-
- // No default constructor
- WinCAPICryptoKeyDSA();
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOKEYDSA_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.cpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.cpp
deleted file mode 100644
index 16940d1d..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyHMAC := Windows HMAC keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGConstants.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-WinCAPICryptoKeyHMAC::WinCAPICryptoKeyHMAC(HCRYPTPROV prov) :m_keyBuf("") {
-
- m_keyBuf.isSensitive();
- m_keyLen = 0;
- m_k = 0;
- m_p = prov;
-
-};
-
-const XMLCh * WinCAPICryptoKeyHMAC::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVWinCAPI;
-}
-
-void WinCAPICryptoKeyHMAC::setKey(unsigned char * inBuf, unsigned int inLength) {
-
- m_keyBuf.sbMemcpyIn(inBuf, inLength);
- m_keyLen = inLength;
-
-}
-
-unsigned int WinCAPICryptoKeyHMAC::getKey(safeBuffer &outBuf) const {
-
- outBuf = m_keyBuf;
- return m_keyLen;
-
-}
-
-XSECCryptoKey * WinCAPICryptoKeyHMAC::clone() const {
-
- WinCAPICryptoKeyHMAC * ret;
-
- XSECnew(ret, WinCAPICryptoKeyHMAC(m_p));
-
- ret->m_keyBuf = m_keyBuf;
- ret->m_keyLen = m_keyLen;
-
- if (m_k != 0) {
-#if (_WIN32_WINNT > 0x0400)
- if (CryptDuplicateKey(m_k,
- 0,
- 0,
- &(ret->m_k)) == 0 ) {
-
- throw XSECCryptoException(XSECCryptoException::MDError,
- "WinCAPI:KeyHMAC Error attempting to clone key parameters");
-
- }
-#else
- throw XSECCryptoException(XSECCryptoException::MDError,
- "Unable to clone keys in Windows NT 4.0 and below");
-#endif
- }
- else
- ret->m_k = 0;
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Windows Specific Keys
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoKeyHMAC::setWinKey(HCRYPTKEY k) {
-
- if (m_k != 0) {
-
- CryptDestroyKey(m_k);
-
- }
-
- m_k = k;
-
-}
-
-HCRYPTKEY WinCAPICryptoKeyHMAC::getWinKey(void) const {
-
- return m_k;
-
-}
-
-HCRYPTPROV WinCAPICryptoKeyHMAC::getWinKeyProv(void) const {
-
- return m_p;
-
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp
deleted file mode 100644
index bd30f7b7..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp
+++ /dev/null
@@ -1,191 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyHMAC := HMAC Keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOKEYHMAC_INCLUDE
-#define WINCAPICRYPTOKEYHMAC_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyHMAC.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-/**
- * \ingroup wincapicrypto
- */
-
-/**
- * \brief Windows Crypto API implementation for HMAC keys.
- *
- * Used to provide HMAC keys to WinCAPI CryptoHashHMAC
- *
- * Provides two types of key.
- *
- * A <b>Windows Key</b> (via setWinKey) is a direct key that can be used
- * by the Windows HMAC implementation.
- *
- * A <b>byte</b> key (via setKey) is a string of bytes that will be used
- * as a key. This requires an internal implementation of an HMAC using the
- * Windows Digest functions, as the Windows API does not allow direct
- * loading of these keys.
- */
-
-class XSEC_EXPORT WinCAPICryptoKeyHMAC : public XSECCryptoKeyHMAC {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
- /**
- * \brief Constructor
- *
- * @param prov The handle to the provider context that was used to
- * create any Windows keys (later set via setKey). If this is not
- * to be used for a windows key (i.e. will be used for a "normal"
- * buffer of bytes as a key, then this value can be set to 0
- */
-
- WinCAPICryptoKeyHMAC(HCRYPTPROV prov);
-
- virtual ~WinCAPICryptoKeyHMAC() {};
-
- //@}
-
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * For DSA keys, this allows people to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const {return KEY_HMAC;}
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey * clone() const ;
-
- /**
- * \brief Return the WinCAPI string identifier
- */
-
- virtual const XMLCh * getProviderName() const;
-
- //@}
-
- /** @name Optional Interface methods */
- //@{
-
- /**
- * \brief Set the key
- *
- * Set the key from the buffer
- *
- * @param inBuf Buffer containing the direct bitwise representation of the key
- * @param inLength Number of bytes of key in the buffer
- *
- * @note isSensitive() should have been called on the inbound buffer
- * to ensure the contents is overwritten when the safeBuffer is deleted
- */
-
- virtual void setKey(unsigned char * inBuf, unsigned int inLength);
-
- /**
- * \brief Get the key value
- *
- * Copy the key into the safeBuffer and return the number of bytes
- * copied.
- *
- * @param outBuf Buffer to copy key into
- * @returns number of bytes copied in
- */
-
- virtual unsigned int getKey(safeBuffer &outBuf) const;
-
- //@}
-
- /** @name Windows specific keys */
- //@{
-
- /**
- * \brief Set a Windows key
- *
- * Set a Windows Crypto key that has been either derived via the
- * various Crypt functions or has been loaded from an encrypted BLOB
- *
- * @param k Windows CAPI key to load
- * Note that the library now owns this key (and will destroy it).
- */
-
- void setWinKey(HCRYPTKEY k);
-
- /**
- * \brief Get a windows key
- *
- * Used by WinCAPICryptoHashHMAC to retrieve the key in order to
- * load it into the HMAC function.
- *
- * @returns The key to use or 0 if this object does not hold one
- */
-
- HCRYPTKEY getWinKey(void) const;
-
- /**
- * \brief Get a windows key provider
- *
- * Used by WinCAPICryptoHashHMAC to retrieve the provider handle associated
- * with an HMAC key in order to load it into the HMAC function.
- *
- * @returns The key to use or 0 if this object does not hold one
- */
-
- HCRYPTPROV getWinKeyProv(void) const;
-
- //@}
-
-private:
-
- safeBuffer m_keyBuf;
- unsigned int m_keyLen;
-
- HCRYPTKEY m_k;
- HCRYPTPROV m_p;
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOKEYHMAC_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp
deleted file mode 100644
index 63a622cf..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp
+++ /dev/null
@@ -1,843 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyRSA := RSA Keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#include "../../utils/XSECAlgorithmSupport.hpp"
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-#if !defined (CRYPT_OAEP)
-# define CRYPT_OAEP 0x00000040
-# define KP_OAEP_PARAMS 36
-#endif
-
-#if !defined (CRYPT_DECRYPT_RSA_NO_PADDING_CHECK)
-# define CRYPT_DECRYPT_RSA_NO_PADDING_CHECK 0x00000020
-#endif
-
-WinCAPICryptoKeyRSA::WinCAPICryptoKeyRSA(HCRYPTPROV prov) {
-
- // Create a new key to be loaded as we go
-
- m_key = 0;
- m_p = prov;
- m_keySpec = 0;
-
- mp_exponent = NULL;
- m_exponentLen = 0;
- mp_modulus = NULL;
- m_modulusLen = 0;
-};
-
-WinCAPICryptoKeyRSA::~WinCAPICryptoKeyRSA() {
-
- // If we have a RSA, delete it
-
- if (m_key != 0)
- CryptDestroyKey(m_key);
-
- if (mp_exponent)
- delete[] mp_exponent;
- if (mp_modulus)
- delete[] mp_modulus;
-};
-
-WinCAPICryptoKeyRSA::WinCAPICryptoKeyRSA(HCRYPTPROV prov,
- HCRYPTKEY k) : m_p(prov) {
-
- m_key = k; // NOTE - We OWN this handle
- m_keySpec = 0;
-
- mp_exponent = mp_modulus = NULL;
- m_exponentLen = m_modulusLen = 0;
-}
-
-WinCAPICryptoKeyRSA::WinCAPICryptoKeyRSA(HCRYPTPROV prov,
- DWORD keySpec,
- bool isPrivate) : m_p(prov) {
-
- if (isPrivate == false) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPICryptoKeyRSA - Public keys defined via keySpec ctor not yet supported");
-
-
- }
-
- if (!CryptGetUserKey(prov, keySpec, &m_key)) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA Unable to retrieve user key");
- }
-
- //m_key = 0;
- m_keySpec = keySpec;
-
- mp_exponent = mp_modulus = NULL;
- m_exponentLen = m_modulusLen = 0;
-}
-
-const XMLCh * WinCAPICryptoKeyRSA::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVWinCAPI;
-}
-
-// Generic key functions
-
-XSECCryptoKey::KeyType WinCAPICryptoKeyRSA::getKeyType() const {
-
- // Find out what we have
- if (m_key == 0) {
-
- if (m_keySpec != 0)
- return KEY_RSA_PRIVATE;
-
- if (mp_exponent == NULL ||
- mp_modulus == NULL)
- return KEY_NONE;
- else
- return KEY_RSA_PUBLIC;
-
- }
-
- if (m_keySpec != 0)
- return KEY_RSA_PAIR;
-
- return KEY_RSA_PUBLIC;
-}
-
-
-// --------------------------------------------------------------------------------
-// Load key from parameters
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoKeyRSA::loadPublicModulusBase64BigNums(const char* b64, unsigned int len) {
-
- if (mp_modulus != NULL) {
- delete[] mp_modulus;
- mp_modulus = NULL; // In case we get an exception
- }
-
- mp_modulus = WinCAPICryptoProvider::b642WinBN(b64, len, m_modulusLen);
-
-}
-
-void WinCAPICryptoKeyRSA::loadPublicExponentBase64BigNums(const char* b64, unsigned int len) {
-
- if (mp_exponent != NULL) {
- delete[] mp_exponent;
- mp_exponent = NULL; // In case we get an exception
- }
-
- mp_exponent = WinCAPICryptoProvider::b642WinBN(b64, len, m_exponentLen);
-}
-
-HCRYPTKEY WinCAPICryptoKeyRSA::importKey() const {
-
- if (m_key != 0 ||
- mp_exponent == NULL ||
- mp_modulus == NULL)
-
- return m_key;
-
-
- // Create a RSA Public-Key blob
-
- // First build a buffer to hold everything
-
- BYTE * blobBuffer;
- unsigned int blobBufferLen = WINCAPI_BLOBHEADERLEN + WINCAPI_RSAPUBKEYLEN + m_modulusLen;
- XSECnew(blobBuffer, BYTE[blobBufferLen]);
- ArrayJanitor<BYTE> j_blobBuffer(blobBuffer);
-
- // Blob header
- BLOBHEADER * header = (BLOBHEADER *) blobBuffer;
-
- header->bType = PUBLICKEYBLOB;
- header->bVersion = 0x02; // We are using a version 2 blob
- header->reserved = 0;
- header->aiKeyAlg = CALG_RSA_SIGN;
-
- // Now the public key header
- RSAPUBKEY * pubkey = (RSAPUBKEY *) (blobBuffer + WINCAPI_BLOBHEADERLEN);
-
- pubkey->magic = 0x31415352; // ASCII encoding of RSA1
- pubkey->bitlen = m_modulusLen * 8; // Number of bits in prime modulus
- pubkey->pubexp = 0;
- BYTE * i = ((BYTE *) &(pubkey->pubexp));
- for (unsigned int j = 0; j < m_exponentLen; ++j)
- *i++ = mp_exponent[j];
-
- // Now copy in the modulus
- i = (BYTE *) (pubkey);
- i += WINCAPI_RSAPUBKEYLEN;
-
- memcpy(i, mp_modulus, m_modulusLen);
-
- // Now that we have the blob, import
- BOOL fResult = CryptImportKey(
- m_p,
- blobBuffer,
- blobBufferLen,
- 0, // Not signed
- 0, // No flags
- &m_key);
-
- if (fResult == 0) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA Error attempting to import key parameters");
-
- }
-
- return m_key;
-}
-
-
-// --------------------------------------------------------------------------------
-// Verify a signature encoded as a Base64 string
-// --------------------------------------------------------------------------------
-
-bool WinCAPICryptoKeyRSA::verifySHA1PKCS1Base64Signature(const unsigned char * hashBuf,
- unsigned int hashLen,
- const char * base64Signature,
- unsigned int sigLen,
- XSECCryptoHash::HashType type) const {
-
- // Use the currently loaded key to validate the Base64 encoded signature
-
- if (m_key == 0) {
-
- // Try to import from the parameters
- importKey();
-
- if (m_key == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Attempt to validate signature with empty key");
- }
- }
-
- /* Is this a hash we support? */
- ALG_ID alg;
- switch (type) {
- case (XSECCryptoHash::HASH_MD5):
- alg = CALG_MD5;
- break;
- case (XSECCryptoHash::HASH_SHA1):
- alg=CALG_SHA1;
- break;
- default:
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA Unsupported hash algorithm for RSA sign - only MD5 or SHA1 supported");
- }
-
- // Decode the signature
- unsigned char * rawSig;
- DWORD rawSigLen;
- XSECnew(rawSig, BYTE [sigLen]);
- ArrayJanitor<BYTE> j_rawSig(rawSig);
-
- // Decode the signature
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- rawSigLen = b64.decode((unsigned char *) base64Signature, sigLen, rawSig, sigLen);
- rawSigLen += b64.decodeFinish(&rawSig[rawSigLen], sigLen - rawSigLen);
-
- BYTE * rawSigFinal;
- XSECnew(rawSigFinal, BYTE[rawSigLen]);
- ArrayJanitor<BYTE> j_rawSigFinal(rawSigFinal);
-
- BYTE * j, *l;
- j = rawSig;
- l = rawSigFinal + rawSigLen - 1;
-
- while (l >= rawSigFinal) {
- *l-- = *j++;
- }
-
- // Have to create a Windows hash object and feed in the hash
- BOOL fResult;
- HCRYPTHASH h;
- fResult = CryptCreateHash(m_p,
- alg,
- 0,
- 0,
- &h);
-
- if (!fResult) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error creating Windows Hash Object");
- }
-
- // Feed the hash value into the newly created hash object
- fResult = CryptSetHashParam(
- h,
- HP_HASHVAL,
- (unsigned char *) hashBuf,
- 0);
-
- if (!fResult) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error Setting Hash Value in Windows Hash object");
- }
-
- // Now validate
- fResult = CryptVerifySignature(
- h,
- rawSigFinal,
- rawSigLen,
- m_key,
- NULL,
- 0);
-
- if (!fResult) {
-
- DWORD error = GetLastError();
-
- if (error != NTE_BAD_SIGNATURE) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error occurred in RSA validation");
- }
-
- if (h)
- CryptDestroyHash(h);
- return false;
- }
-
- if (h)
- CryptDestroyHash(h);
- return true;
-}
-
-// --------------------------------------------------------------------------------
-// Sign and encode result as a Base64 string
-// --------------------------------------------------------------------------------
-
-
-unsigned int WinCAPICryptoKeyRSA::signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen,
- XSECCryptoHash::HashType type) const {
-
- // Sign a pre-calculated hash using this key
-
- if (m_keySpec == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Attempt to sign data using a public or un-loaded key");
- }
-
- /* Is this a hash we support? */
- ALG_ID alg;
- switch (type) {
- case (XSECCryptoHash::HASH_MD5):
- alg = CALG_MD5;
- break;
- case (XSECCryptoHash::HASH_SHA1):
- alg = CALG_SHA1;
- break;
- default:
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA Unsupported hash algorithm for RSA sign - only MD5 or SHA1 supported");
- }
-
- // Have to create a Windows hash object and feed in the hash
- BOOL fResult;
- HCRYPTHASH h;
- fResult = CryptCreateHash(m_p,
- alg,
- 0,
- 0,
- &h);
-
- if (!fResult) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error creating Windows Hash Object");
- }
-
- // Feed the hash value into the newly created hash object
- fResult = CryptSetHashParam(
- h,
- HP_HASHVAL,
- hashBuf,
- 0);
-
- if (!fResult) {
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error Setting Hash Value in Windows Hash object");
- }
-
- // Now sign
- DWORD rawSigLen;
- fResult = CryptSignHash(
- h,
- m_keySpec,
- NULL,
- 0,
- NULL,
- &rawSigLen);
-
- if (!fResult || rawSigLen < 1) {
-
- if (h)
- CryptDestroyHash(h);
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error occurred obtaining RSA sig length");
- }
-
- BYTE * rawSig;
- XSECnew(rawSig, BYTE[rawSigLen]);
- ArrayJanitor<BYTE> j_rawSig(rawSig);
-
- fResult = CryptSignHash(
- h,
- m_keySpec,
- NULL,
- 0,
- rawSig,
- &rawSigLen);
-
- if (!fResult || rawSigLen < 1) {
-
- // Free the hash
- if (h)
- CryptDestroyHash(h);
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error occurred signing hash");
- }
-
- // Free the hash
- if (h)
- CryptDestroyHash(h);
-
- // Now encode into a signature block
- BYTE *rawSigFinal;
- XSECnew(rawSigFinal, BYTE[rawSigLen]);
- ArrayJanitor<BYTE> j_rawSigFinal(rawSigFinal);
-
- BYTE * i, * j;
-
- i = rawSig;
- j = rawSigFinal + rawSigLen - 1;
-
- while (j >= rawSigFinal) {
- *j-- = *i++;
- }
-
- // Now encode
- XSCryptCryptoBase64 b64;
- b64.encodeInit();
- unsigned int ret = b64.encode(rawSigFinal, rawSigLen, (unsigned char *) base64SignatureBuf, base64SignatureBufLen);
- ret += b64.encodeFinish((unsigned char *) &base64SignatureBuf[ret], base64SignatureBufLen - ret);
-
- return ret;
-}
-
-XSECCryptoKey * WinCAPICryptoKeyRSA::clone() const {
-
- WinCAPICryptoKeyRSA * ret;
-
- XSECnew(ret, WinCAPICryptoKeyRSA(m_p));
-
- if (m_key != 0) {
-
- // CryptDuplicateKey is not supported in Windows NT, so we need to export and then
- // reimport the key to get a copy
-
- BYTE keyBuf[2048];
- DWORD keyBufLen = 2048;
- CryptExportKey(m_key, 0, PUBLICKEYBLOB, 0, keyBuf, &keyBufLen);
-
- // Now re-import
- CryptImportKey(m_p, keyBuf, keyBufLen, NULL, 0, &ret->m_key);
- }
-
- ret->m_keySpec = m_keySpec;
-
- ret->m_exponentLen = m_exponentLen;
- if (mp_exponent != NULL) {
- XSECnew(ret->mp_exponent, BYTE[m_exponentLen]);
- memcpy(ret->mp_exponent, mp_exponent, m_exponentLen);
- }
- else
- ret->mp_exponent = NULL;
-
- ret->m_modulusLen = m_modulusLen;
- if (mp_modulus != NULL) {
- XSECnew(ret->mp_modulus, BYTE[m_modulusLen]);
- memcpy(ret->mp_modulus, mp_modulus, m_modulusLen);
- }
- else
- ret->mp_modulus = NULL;
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// decrypt a buffer
-// --------------------------------------------------------------------------------
-
-unsigned int WinCAPICryptoKeyRSA::privateDecrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI,
- const XMLCh* mgfURI,
- unsigned char* params,
- unsigned int paramsLen) const {
-
- // Perform a decrypt
- if (m_key == NULL) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Attempt to decrypt data with empty key");
- }
-
- // Have to reverse ordering of input :
- DWORD decryptSize = inLength;
- // memcpy(plainBuf, inBuf, inLength);
- for (unsigned int i = 0; i < inLength; ++i) {
- plainBuf[i] = inBuf[inLength - 1 - i];
- }
-
- switch (padding) {
-
- case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
-
- if (!CryptDecrypt(m_key,
- 0,
- TRUE,
- 0,
- plainBuf,
- &decryptSize)) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA privateKeyDecrypt - Error Decrypting PKCS1_5 padded RSA encrypt");
- }
-
- break;
-
- case XSECCryptoKeyRSA::PAD_OAEP :
-
- if (XSECAlgorithmSupport::getMGF1HashType(mgfURI) != XSECCryptoHash::HASH_SHA1) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedAlgorithm,
- "WinCAPI:RSA - Unsupported OAEP MGF algorithm");
- }
-
- if (XSECAlgorithmSupport::getHashType(hashURI) != XSECCryptoHash::HASH_SHA1) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedAlgorithm,
- "WinCAPI:RSA - Unsupported OAEP digest algorithm");
- }
- else if (paramsLen > 0) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "WinCAPI::setOAEPParams - OAEP parameters are not supported by Windows Crypto API");
- }
-
- if (!CryptDecrypt(m_key,
- 0,
- TRUE,
- CRYPT_OAEP,
- plainBuf,
- &decryptSize)) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA privateKeyDecrypt - Error Decrypting PKCS1v2 OAEP padded RSA encrypt");
- }
-
- break;
-
-
- default :
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WiNCAPI:RSA - Unknown padding method");
- }
-
-
- return decryptSize;
-}
-
-// --------------------------------------------------------------------------------
-// encrypt a buffer
-// --------------------------------------------------------------------------------
-
-unsigned int WinCAPICryptoKeyRSA::publicEncrypt(const unsigned char* inBuf,
- unsigned char* cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI,
- const XMLCh* mgfURI,
- unsigned char* params,
- unsigned int paramsLen) const {
-
- // Perform an encrypt
- if (m_key == 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Attempt to encrypt data with empty key");
- }
-
- DWORD encryptSize = inLength;
- memcpy(cipherBuf, inBuf, inLength);
-
- switch (padding) {
-
- case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
-
- if (!CryptEncrypt(m_key,
- 0, /* No Hash */
- TRUE, /* Is Final */
- 0, /* No flags */
- cipherBuf,
- &encryptSize,
- maxOutLength)) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA publicKeyEncrypt - Error performing encrypt");
- }
-
- if (encryptSize <= 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA publicKeyEncrypt - Error performing PKCS1_5 padded RSA encrypt");
- }
-
- break;
-
- case XSECCryptoKeyRSA::PAD_OAEP :
-
- if (XSECAlgorithmSupport::getHashType(hashURI) != XSECCryptoHash::HASH_SHA1) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedAlgorithm,
- "WinCAPI:RSA - OAEP padding method requires SHA-1 digest method");
- }
- else if (XSECAlgorithmSupport::getMGF1HashType(mgfURI) != XSECCryptoHash::HASH_SHA1) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedAlgorithm,
- "WinCAPI:RSA - Unsupported OAEP MGF algorithm");
- }
- else if (paramsLen > 0) {
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "WinCAPI::setOAEPParams - OAEP parameters are not supported by Windows Crypto API");
- }
-
- if (!CryptEncrypt(m_key,
- 0, /* No Hash */
- TRUE, /* Is Final */
- CRYPT_OAEP,
- cipherBuf,
- &encryptSize,
- maxOutLength)) {
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA publicKeyEncrypt - Error performing encrypt");
- }
-
- if (encryptSize <= 0) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA publicKeyEncrypt - Error performing OAEP RSA encrypt");
- }
-
- break;
-
- default :
-
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Unknown padding method");
- }
-
- // Reverse the output
- unsigned char *tbuf;
- XSECnew(tbuf, unsigned char[encryptSize]);
- ArrayJanitor<unsigned char> j_tbuf(tbuf);
- memcpy(tbuf, cipherBuf, encryptSize);
-
- for (unsigned int i = 0; i < encryptSize; ++i)
- cipherBuf[i] = tbuf[encryptSize - 1 - i];
-
- return encryptSize;
-}
-
-// --------------------------------------------------------------------------------
-// Size in bytes
-// --------------------------------------------------------------------------------
-
-unsigned int WinCAPICryptoKeyRSA::getLength() const {
-
- DWORD len;
- DWORD pLen = 4;
-
- if (!CryptGetKeyParam(m_key,
- KP_BLOCKLEN,
- (BYTE *) &len,
- &pLen,
- 0)) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error determining key size");
- }
-
- return len / 8;
-}
-
-// --------------------------------------------------------------------------------
-// Some utility functions
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoKeyRSA::loadParamsFromKey() {
-
- if (m_key == 0) {
-
- if (m_keySpec == 0)
- return;
-
- // See of we can get the user key
- if (!CryptGetUserKey(m_p, m_keySpec, &m_key))
- return;
- }
-
- // Export key into a keyblob
- BOOL fResult;
- DWORD blobLen;
-
- fResult = CryptExportKey(
- m_key,
- 0,
- PUBLICKEYBLOB,
- 0,
- NULL,
- &blobLen);
-
- if (fResult == 0 || blobLen < 1) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error exporting public key");
- }
-
- BYTE * blob;
- XSECnew(blob, BYTE[blobLen]);
- ArrayJanitor<BYTE> j_blob(blob);
-
- fResult = CryptExportKey(
- m_key,
- 0,
- PUBLICKEYBLOB,
- 0,
- blob,
- &blobLen);
-
- if (fResult == 0 || blobLen < 1) {
- throw XSECCryptoException(XSECCryptoException::RSAError,
- "WinCAPI:RSA - Error exporting public key");
- }
-
- RSAPUBKEY * pk = (RSAPUBKEY *) ( blob + WINCAPI_BLOBHEADERLEN );
- DWORD keyLen = pk->bitlen / 8;
-
- // Copy the keys
-
- BYTE * i = (BYTE *) ( pk );
- i += WINCAPI_RSAPUBKEYLEN;
- if (mp_modulus != NULL)
- delete[] mp_modulus;
-
- m_modulusLen = keyLen;
- XSECnew(mp_modulus, BYTE[m_modulusLen]);
- memcpy(mp_modulus, i, m_modulusLen);
-
- // Take the simple way out
- XSECnew(mp_exponent, BYTE[4]);
- *((DWORD *) mp_exponent) = pk->pubexp;
-
- // Now cut any leading 0s (Windows is LE, so start least significant end)
-
- m_exponentLen = 3;
- while (m_exponentLen > 0 && mp_exponent[m_exponentLen] == 0)
- m_exponentLen--;
-
- m_exponentLen++; // Make it a length as apposed to an offset
-}
-
-unsigned int WinCAPICryptoKeyRSA::getExponentBase64BigNums(char* b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_exponent == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_exponent == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_exponent, m_exponentLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-}
-
-unsigned int WinCAPICryptoKeyRSA::getModulusBase64BigNums(char* b64, unsigned int len) {
-
- if (m_key == 0 && m_keySpec == 0 && mp_modulus == NULL) {
-
- return 0; // Nothing we can do
-
- }
-
- if (mp_modulus == NULL) {
-
- loadParamsFromKey();
-
- }
-
- unsigned int bLen;
- unsigned char * b = WinCAPICryptoProvider::WinBN2b64(mp_modulus, m_modulusLen, bLen);
- if (bLen > len)
- bLen = len;
- memcpy(b64, b, bLen);
- delete[] b;
-
- return bLen;
-}
-
-#endif /* WINCAPI */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp b/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp
deleted file mode 100644
index 6a644a6c..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp
+++ /dev/null
@@ -1,336 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoKeyRSA := Windows implementation of RSA Keys
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOKEYRSA_INCLUDE
-#define WINCAPICRYPTOKEYRSA_INCLUDE
-
-#include <xsec/enc/XSECCryptoKeyRSA.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-class WinCAPICryptoProvider;
-
-/**
- * \ingroup wincapicrypto
- */
-
-/**
- * \brief WinCAPI implementation of the interface class for RSA keys.
- *
- * The library uses classes derived from this to process RSA keys.
- */
-
-class XSEC_EXPORT WinCAPICryptoKeyRSA : public XSECCryptoKeyRSA {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Create an RSA key
- *
- * Constructor used to create an "empty" RSA key, that the
- * library will later set parameters for the public key within.
- *
- * @param prov A handle to a PROV_RSA_FULL provider that the
- * library will eventually import the key into
- */
-
- WinCAPICryptoKeyRSA(HCRYPTPROV prov);
-
- /**
- * \brief Dedicated WinCAPI constructor for a public RSA key
- *
- * Create a public RSA key for use in XSEC from an existing HCRYPTKEY
- *
- * @param prov The handle to the provider that was used to create the key
- * @param k The key to use
- * @note k is owned by the library. When the wrapper
- * WinCAPICryptoKeyRSA is deleted, k will be destroyed using
- * CryptDestroyKey()
- */
-
- WinCAPICryptoKeyRSA(HCRYPTPROV prov, HCRYPTKEY k);
-
- /**
- * \brief Dedicated WinCAPI constructor for a private RSA key
- *
- * Create a public RSA key for use in XSEC from an keySpec
- *
- * @param prov The handle to the provider that was used to create the key
- * @param keySpec The key to use (AT_SIGNATURE or AT_KEYEXCHANGE
- * @param isPrivate Should be true. May be used later for public
- * keys created this way
- */
-
- WinCAPICryptoKeyRSA(HCRYPTPROV prov, DWORD keySpec, bool isPrivate);
-
- virtual ~WinCAPICryptoKeyRSA();
-
- //@}
-
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of this key.
- *
- * For RSA keys, this allows people to determine whether this is a
- * public key, private key or a key pair
- */
-
- virtual XSECCryptoKey::KeyType getKeyType() const;
-
- /**
- * \brief Return the WinCAPI identifier string
- */
-
- virtual const XMLCh* getProviderName() const;
-
- /**
- * \brief Replicate key
- */
-
- virtual XSECCryptoKey* clone() const;
-
- //@}
-
- /** @name Mandatory RSA interface methods
- *
- * These classes are required by the library.
- */
- //@{
-
-
- /**
- * \brief Verify a SHA1 PKCS1 encoded signature
- *
- * The library will call this function to validate an RSA signature
- * The standard by default uses SHA1 in a PKCS1 encoding.
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Length of the data in the digest buffer
- * @param base64Signature Buffer containing the Base64 encoded signature
- * @param sigLen Length of the data in the signature buffer
- * @param type The hash method that was used to create the hash that is being
- * passed in
- * @returns true if the signature was valid, false otherwise
- */
-
- virtual bool verifySHA1PKCS1Base64Signature(const unsigned char* hashBuf,
- unsigned int hashLen,
- const char* base64Signature,
- unsigned int sigLen,
- XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Create a signature
- *
- * The library will call this function to create a signature from
- * a pre-calculated digest. The output signature will
- * be Base64 encoded such that it can be placed directly into the
- * XML document
- *
- * @param hashBuf Buffer containing the pre-calculated (binary) digest
- * @param hashLen Number of bytes of hash in the hashBuf
- * @param base64SignatureBuf Buffer to place the base64 encoded result
- * in.
- * @param base64SignatureBufLen Implementations need to ensure they do
- * not write more bytes than this into the buffer
- * @param type The hash method that was used to create the hash that is being
- * passed in
- */
-
- virtual unsigned int signSHA1PKCS1Base64Signature(unsigned char * hashBuf,
- unsigned int hashLen,
- char * base64SignatureBuf,
- unsigned int base64SignatureBufLen,
- XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Decrypt using private key
- *
- * The library will call this function to decrypt a piece of cipher
- * text using the private component of this key.
- *
- * @param inBuf cipher text to decrypt
- * @param plainBuf output buffer for decrypted bytes
- * @param inLength bytes of cipher text to decrypt
- * @param maxOutLength size of outputBuffer
- * @param padding Type of padding (PKCS 1.5 or OAEP)
- * @param hashURI Hash Method for OAEP encryption
- * @param mgfURI algorithm identifier for OAEP mask generation function
- * @param params raw OAEP parameter data, if any
- * @param paramslen OEP parameter length
- */
-
- virtual unsigned int privateDecrypt(const unsigned char* inBuf,
- unsigned char* plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI=NULL,
- const XMLCh* mgfURI=NULL,
- unsigned char* params=NULL,
- unsigned int paramsLen=0) const;
-
- /**
- * \brief Encrypt using a public key
- *
- * The library will call this function to encrypt a plain text buffer
- * using the public component of this key.
- *
- * @param inBuf plain text to decrypt
- * @param cipherBuf output buffer for decrypted bytes
- * @param inLength bytes of plain text to encrypt
- * @param maxOutLength size of outputBuffer
- * @param padding Type of padding (PKCS 1.5 or OAEP)
- * @param hashURI Hash Method for OAEP encryption
- * @param mgfURI algorithm identifier for OAEP mask generation function
- * @param params raw OAEP parameter data, if any
- * @param paramslen OEP parameter length
- */
-
- virtual unsigned int publicEncrypt(const unsigned char* inBuf,
- unsigned char* cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength,
- PaddingType padding,
- const XMLCh* hashURI=NULL,
- const XMLCh* mgfURI=NULL,
- unsigned char* params=NULL,
- unsigned int paramsLen=0) const;
-
- /**
- * \brief Obtain the length of an RSA key
- *
- * @returns The length of the rsa key (in bytes)
- */
-
- virtual unsigned int getLength() const;
-
- //@}
-
- /** @name Optional Interface methods
- *
- * Have been implemented to allow interoperability testing
- */
-
- //@{
-
- /**
- * \brief Load the modulus
- *
- * Load the modulus from a Base64 encoded string
- *
- * param b64 A buffer containing the encoded string
- * param len The length of the data in the buffer
- */
-
- virtual void loadPublicModulusBase64BigNums(const char* b64, unsigned int len);
-
- /**
- * \brief Load the exponent
- *
- * Load the exponent from a Base64 encoded string
- *
- * param b64 A buffer containing the encoded string
- * param len The length of the data in the buffer
- */
-
- virtual void loadPublicExponentBase64BigNums(const char* b64, unsigned int len);
-
- //@}
-
- /** @name WinCAPI Specific Functions */
- //@{
-
-
- /**
- * \brief Retrieve the exponent
- *
- * Retrieves the exponent in ds:CryptoBinary encoded format
- *
- * @param b64 Buffer to place encoded exponent into
- * @param len Maximum number of bytes to place in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getExponentBase64BigNums(char* b64, unsigned int len);
-
- /**
- * \brief Retrieve the modulus
- *
- * Retrieves the modulus in ds:CryptoBinary encoded format
- *
- * @param b64 Buffer to place the encoded modulus into
- * @param len Maximum number of bytes to place in buffer
- * @returns The number of bytes placed in the buffer
- */
-
- unsigned int getModulusBase64BigNums(char* b64, unsigned int len);
-
- /**
- * \brief Import key and return it
- *
- * Retrieves the RSA key as HCRYPTKEY
- *
- * @returns The key
- */
-
- HCRYPTKEY importKey() const;
-
- //@}
-
-private:
- HCRYPTPROV m_p;
- mutable HCRYPTKEY m_key; // For a public key
- DWORD m_keySpec; // For a private key
-
- BYTE* mp_modulus;
- BYTE* mp_exponent;
-
- unsigned int m_modulusLen;
- unsigned int m_exponentLen;
-
- // Instruct to import from parameters
- void loadParamsFromKey();
-
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOKEYRSA_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp b/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp
deleted file mode 100644
index b94904c5..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoProvider.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoProvider := Provider to support Windows Crypto API
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECError.hpp>
-
-
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoX509.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoHash.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoHashHMAC.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-static char s_xsecKeyStoreName[] = "ApacheXML-SecurityKeyStore";
-
-WinCAPICryptoProvider::WinCAPICryptoProvider(
- LPCSTR provDSSName,
- LPCSTR provRSAName,
- DWORD dwFlags) {
-
- if (!CryptAcquireContext(&m_provDSS,
- NULL,
- provDSSName,
- PROV_DSS,
- CRYPT_VERIFYCONTEXT))
- {
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error obtaining default PROV_DSS");
- }
-
- if (!CryptAcquireContext(&m_provRSA,
- NULL,
- provRSAName,
- PROV_RSA_AES,
- CRYPT_VERIFYCONTEXT))
- {
- // Check if we maybe don't understand AES
-
- DWORD error = GetLastError();
- if (error == NTE_PROV_TYPE_NOT_DEF || error == 0) {
-
- // This system does not have AES!
- m_haveAES = false;
- m_provRSAType = PROV_RSA_FULL;
-
- if (!CryptAcquireContext(&m_provRSA,
- NULL,
- provRSAName,
- PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT))
- {
-
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error obtaining default PROV_RSA_FULL");
- }
-
- }
-
- else {
-
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error obtaining default PROV_RSA_AES");
- }
- }
-
- else {
- m_haveAES = true;
- m_provRSAType = PROV_RSA_AES;
- }
-
- // Now obtain our internal (library) key store
-
- if (!CryptAcquireContext(&m_provApacheKeyStore,
- s_xsecKeyStoreName,
- provRSAName,
- m_provRSAType,
- dwFlags))
- {
- CryptAcquireContext(&m_provApacheKeyStore,
- s_xsecKeyStoreName,
- provRSAName,
- m_provRSAType,
- CRYPT_DELETEKEYSET);
-
- // Try to create
- if (!CryptAcquireContext(&m_provApacheKeyStore,
- s_xsecKeyStoreName,
- provRSAName,
- m_provRSAType,
- dwFlags | CRYPT_NEWKEYSET)) {
-
- // Prevents failure on mandatory profiles, see SANTUARIO-378.
- if (GetLastError() != NTE_TEMPORARY_PROFILE) {
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error obtaining generating internal key store for PROV_RSA_FULL");
- } else {
- m_provApacheKeyStore = NULL;
- }
- }
- else {
- HCRYPTKEY k;
- if (!CryptGenKey(m_provApacheKeyStore, AT_KEYEXCHANGE, CRYPT_EXPORTABLE, &k)) {
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error generating internal key set for PROV_RSA_FULL");
- }
- CryptDestroyKey(k);
- }
- }
-
- // Copy parameters for later use
-
- if (provDSSName != NULL)
- m_provDSSName = strdup(provDSSName);
- else
- m_provDSSName = NULL;
-
- if (provRSAName != NULL)
- m_provRSAName = strdup(provRSAName);
- else
- m_provRSAName = NULL;
-}
-
-WinCAPICryptoProvider::~WinCAPICryptoProvider() {
- CryptReleaseContext(m_provRSA, 0);
- CryptReleaseContext(m_provDSS, 0);
- if (m_provApacheKeyStore) {
- CryptReleaseContext(m_provApacheKeyStore, 0);
- }
-}
-
-const XMLCh* WinCAPICryptoProvider::getProviderName() const {
-
- return DSIGConstants::s_unicodeStrPROVWinCAPI;
-
-}
-
-
-// Hashing classes
-
-unsigned int WinCAPICryptoProvider::getMaxHashSize() const {
- return WINCAPI_MAX_HASH_SIZE;
-}
-
-
-XSECCryptoHash* WinCAPICryptoProvider::hash(XSECCryptoHash::HashType type) const {
-
- WinCAPICryptoHash* ret = NULL;
-
- switch(type) {
- case XSECCryptoHash::HASH_SHA1:
- case XSECCryptoHash::HASH_MD5:
- XSECnew(ret, WinCAPICryptoHash(m_provDSS, type));
- break;
- }
-
- return ret;
-}
-
-XSECCryptoHash* WinCAPICryptoProvider::HMAC(XSECCryptoHash::HashType type) const {
-
- WinCAPICryptoHashHMAC* ret = NULL;
-
- switch(type) {
- case XSECCryptoHash::HASH_SHA1:
- case XSECCryptoHash::HASH_MD5:
- XSECnew(ret, WinCAPICryptoHashHMAC(m_provDSS, type));
- break;
- }
-
- return ret;
-}
-
-XSECCryptoKeyHMAC* WinCAPICryptoProvider::keyHMAC(void) const {
- WinCAPICryptoKeyHMAC * ret;
-
- XSECnew(ret, WinCAPICryptoKeyHMAC(m_provDSS));
-
- return ret;
-}
-
-XSECCryptoKeyDSA* WinCAPICryptoProvider::keyDSA() const {
- WinCAPICryptoKeyDSA * ret;
-
- XSECnew(ret, WinCAPICryptoKeyDSA(m_provDSS));
-
- return ret;
-}
-
-XSECCryptoKeyRSA* WinCAPICryptoProvider::keyRSA() const {
- WinCAPICryptoKeyRSA * ret;
-
- XSECnew(ret, WinCAPICryptoKeyRSA(m_provRSA));
-
- return ret;
-}
-
-XSECCryptoKeyEC* WinCAPICryptoProvider::keyEC() const {
-
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "WinCAPICryptoProvider::keyEC - EC support not available");
-}
-
-XSECCryptoKey* WinCAPICryptoProvider::keyDER(const char* buf, unsigned long len, bool base64) const {
-
- throw XSECCryptoException(XSECCryptoException::UnsupportedError,
- "WinCAPICryptoProvider::keyDER - DER decoding support not available");
-}
-
-XSECCryptoX509* WinCAPICryptoProvider::X509() const {
- WinCAPICryptoX509 * ret;
-
- XSECnew(ret, WinCAPICryptoX509(m_provRSA, m_provDSS));
-
- return ret;
-}
-
-XSECCryptoBase64* WinCAPICryptoProvider::base64() const {
-
- // The Windows CAPI does not provide a Base64 decoder/encoder.
- // Use the internal implementation.
-
- XSCryptCryptoBase64 * ret;
-
- XSECnew(ret, XSCryptCryptoBase64());
-
- return ret;
-}
-
-bool WinCAPICryptoProvider::algorithmSupported(XSECCryptoSymmetricKey::SymmetricKeyType alg) const {
-
- switch (alg) {
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- return m_haveAES;
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- return true;
-
- default:
-
- return false;
-
- }
-
- return false;
-}
-
-bool WinCAPICryptoProvider::algorithmSupported(XSECCryptoHash::HashType alg) const {
- switch (alg) {
-
- case (XSECCryptoHash::HASH_SHA1) :
- case (XSECCryptoHash::HASH_MD5) :
-
- return true;
-
- case (XSECCryptoHash::HASH_SHA224) :
- case (XSECCryptoHash::HASH_SHA256) :
- case (XSECCryptoHash::HASH_SHA384) :
- case (XSECCryptoHash::HASH_SHA512) :
-
- return false;
-
- default:
- return false;
- }
-
- return false;
-}
-
-XSECCryptoSymmetricKey* WinCAPICryptoProvider::keySymmetric(XSECCryptoSymmetricKey::SymmetricKeyType alg) const {
- // Only temporary
-
- WinCAPICryptoSymmetricKey * ret;
-
- XSECnew(ret, WinCAPICryptoSymmetricKey(m_provApacheKeyStore, alg));
-
- return ret;
-}
-
-unsigned int WinCAPICryptoProvider::getRandom(unsigned char* buffer, unsigned int numOctets) const {
-
- if (!CryptGenRandom(m_provApacheKeyStore, numOctets, buffer)) {
- throw XSECException(XSECException::InternalError,
- "WinCAPICryptoProvider() - Error generating Random data");
- }
-
- return numOctets;
-}
-
-
-
-// --------------------------------------------------------------------------------
-// Translate a Base64 number to a Windows (little endian) integer
-// --------------------------------------------------------------------------------
-
-BYTE* WinCAPICryptoProvider::b642WinBN(const char* b64, unsigned int b64Len, unsigned int& retLen) {
-
- BYTE * os;
- XSECnew(os, BYTE[b64Len]);
- ArrayJanitor<BYTE> j_os(os);
-
- // Decode
- XSCryptCryptoBase64 b;
-
- b.decodeInit();
- retLen = b.decode((unsigned char *) b64, b64Len, os, b64Len);
- retLen += b.decodeFinish(&os[retLen], b64Len - retLen);
-
- BYTE * ret;
- XSECnew(ret, BYTE[retLen]);
-
- BYTE * j = os;
- BYTE * k = ret + retLen - 1;
-
- for (unsigned int i = 0; i < retLen ; ++i)
- *k-- = *j++;
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Translate a Windows integer to a Base64 I2OSP number
-// --------------------------------------------------------------------------------
-
-unsigned char * WinCAPICryptoProvider::WinBN2b64(BYTE * n, DWORD nLen, unsigned int &retLen) {
-
-
- // First reverse
- BYTE * rev;;
- XSECnew(rev, BYTE[nLen]);
- ArrayJanitor<BYTE> j_rev(rev);
-
- BYTE * j = n;
- BYTE * k = rev + nLen - 1;
-
- for (unsigned int i = 0; i < nLen ; ++i)
- *k-- = *j++;
-
-
- unsigned char * b64;
- // Naieve length calculation
- unsigned int bufLen = nLen * 2 + 4;
-
- XSECnew(b64, unsigned char[bufLen]);
- ArrayJanitor<unsigned char> j_b64(b64);
-
- XSCryptCryptoBase64 b;
-
- b.encodeInit();
- retLen = b.encode(rev, (unsigned int) nLen, b64, bufLen);
- retLen += b.encodeFinish(&b64[retLen], bufLen - retLen);
-
- j_b64.release();
- return b64;
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
-
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp b/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp
deleted file mode 100644
index fec93732..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoProvider := Base class to handle Windows Crypto API
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOPROVIDER_INCLUDE
-#define WINCAPICRYPTOPROVIDER_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoProvider.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if defined (_WIN32_WINNT)
-# undef _WIN32_WINNT
-#endif
-#define _WIN32_WINNT 0x0400
-#include <wincrypt.h>
-
-
-// For older versions of wincrypt.h
-
-#if !defined (PROV_RSA_AES)
-# define PROV_RSA_AES 24
-# define ALG_SID_AES_128 14
-# define ALG_SID_AES_192 15
-# define ALG_SID_AES_256 16
-# define ALG_SID_AES 17
-# define CALG_AES_128 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_128)
-# define CALG_AES_192 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_192)
-# define CALG_AES_256 (ALG_CLASS_DATA_ENCRYPT|ALG_TYPE_BLOCK|ALG_SID_AES_256)
-#endif
-
-#define WINCAPI_BLOBHEADERLEN 0x08
-#define WINCAPI_DSSPUBKEYLEN 0x08
-#define WINCAPI_DSSSEEDLEN 0x18
-#define WINCAPI_RSAPUBKEYLEN 0x0C
-
-/**
- * @defgroup wincapicrypto Windows Crypto API Interface
- * @ingroup crypto
- * The WinCAPI crypto provides an experimental inerface to
- * the Windows Cryptographic API.
- *
- * All initialisation of the Windows providers needs to be done
- * by the calling application. The interface will call the provided
- * DSS (PROV_DSS) provider and RSA (PROV_RSA_FULL) provider to perform
- * cryptographic functions.
- *
- * The tools use the default providers, but the calling application
- * can use any providers that implement PROV_DSS and PROV_FULL_RSA.
- *
- * Note that, unlike the OpenSSL classes, the various implementation
- * classes all require their owner provider class to be passed into
- * the constructor. This allows them to access the RSA and DSS CAPI
- * providers being used for the implementation.
- *
- * @todo Need to allow the various classes to over-ride the PROV
- * objects to allow specific private key instances rather than one
- * instance across the library instance.
- */
- /*\@{*/
-
-class XSEC_EXPORT WinCAPICryptoProvider : public XSECCryptoProvider {
-
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
- /**
- * \brief Create a Windows CAPI interface layer
- *
- * Windows CSPs work under a provider model. The user should specify
- * which CSP to use.
- *
- * @param provDSSName Name of DSS provider - must be of type PROV_DSS.
- * Will use the default Windows DSS provider if nothing passed in.
- * @param provRSAName RSA provider - must be of type PROV_RSA_FULL.
- * Will use the default RSA_FULL provider if nothing passed in
- * @param dwFlags If you are running XSEC as service you should specify
- * CRYPT_MACHINE_KEYSET here
- */
-
- WinCAPICryptoProvider(LPCSTR provDSSName = NULL, LPCSTR provRSAName = NULL, DWORD dwFlags = 0);
-
- virtual ~WinCAPICryptoProvider();
-
- //@}
-
- /** @name Hashing (Digest) Functions */
- //@{
-
- /**
- * \brief Get the provider's maximum digest length.
- *
- * Call used by the library to max out the buffer sizes it uses.
- *
- * @returns maximum size to allow for
- */
- virtual unsigned int getMaxHashSize() const;
-
- /**
- * \brief Return a hashing implementation.
- *
- * Call used by the library to obtain a hashing implementation from the
- * provider.
- *
- * @returns a pointer to a hashing object.
- */
- virtual XSECCryptoHash* hash(XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Return an HMAC implementation.
- *
- * Call used by the library to obtain an HMAC implementation from the
- * provider. The caller will need to set the key in the hash
- * object with an XSECCryptoKeyHMAC using XSECCryptoHash::setKey().
- *
- * @returns a pointer to the hashing object.
- */
- virtual XSECCryptoHash* HMAC(XSECCryptoHash::HashType type) const;
-
- /**
- * \brief Return a HMAC key
- *
- * Sometimes the library needs to create an HMAC key (notably within
- * the XKMS utilities.
- *
- * This function allows the library to obtain a key that can then have
- * a value set within it.
- */
-
- virtual XSECCryptoKeyHMAC* keyHMAC(void) const;
-
- //@}
-
- /** @name Encoding functions */
- //@{
-
- /**
- * \brief Return a Base64 encoder/decoder implementation.
- *
- * Call used by the library to obtain a Base64
- * encoder/decoder.
- *
- * @note Windows providers do not implement Base64, so the internal
- * implementation (XSCrypt) is used instead.
- *
- *
- * @returns Pointer to the new Base64 encoder.
- * @see XSCryptCryptoBase64
- */
-
- virtual XSECCryptoBase64* base64() const;
-
- //@}
-
- /** @name Keys and Certificates */
- //@{
-
- /**
- * \brief Return a DSA key implementation object.
- *
- * Call used by the library to obtain a DSA key object.
- *
- * @returns Pointer to the new DSA key
- * @see WinCAPICryptoKeyDSA
- */
-
- virtual XSECCryptoKeyDSA* keyDSA() const;
-
- /**
- * \brief Return an RSA key implementation object.
- *
- * Call used by the library to obtain an WinCAPI RSA key object.
- *
- * @returns Pointer to the new RSA key
- * @see WinCAPICryptoKeyRSA
- */
-
- virtual XSECCryptoKeyRSA* keyRSA() const;
-
- /**
- * \brief Return an EC key implementation object.
- *
- * Call used by the library to obtain an WinCAPI EC key object.
- *
- * @returns Pointer to the new EC key
- */
-
- virtual XSECCryptoKeyEC* keyEC() const;
-
- /**
- * \brief Return a key implementation object based on DER-encoded input.
- *
- * Call used by the library to obtain a key object from a DER-encoded key.
- *
- * @param buf DER-encoded data
- * @param buflen length of data
- * @param base64 true iff data is base64-encoded
- * @returns Pointer to the new key
- */
-
- virtual XSECCryptoKey* keyDER(const char* buf, unsigned long buflen, bool base64) const;
-
- /**
- * \brief Return an X509 implementation object.
- *
- * Call used by the library to obtain an object that can work
- * with X509 certificates.
- *
- * @returns Pointer to the new X509 object
- * @see WinCAPICryptoX509
- */
-
- virtual XSECCryptoX509* X509() const;
-
- //@}
-
- /** @name Windows CAPI Specific methods */
- //@{
-
- /**
- * \brief Returns the Crypto Provider being used for DSS
- */
-
- HCRYPTPROV getProviderDSS(void) {return m_provDSS;}
-
- /**
- * \brief Returns the Provider being used for RSA functions
- */
-
- HCRYPTPROV getProviderRSA(void) {return m_provRSA;}
-
- /**
- * \brief Return the internal key store provider
- */
-
- HCRYPTPROV getApacheKeyStore(void) {return m_provApacheKeyStore;}
-
- /**
- * \brief Translate B64 I2OS integer to a WinCAPI int.
- *
- * Decodes a Base64 (ds:CryptoBinary) integer and reverses the order to
- * allow loading into a Windows CAPI function. (CAPI uses Little Endian
- * storage of integers).
- *
- * @param b64 Base 64 string
- * @param b64Len Length of base64 string
- * @param retLen Parameter to hold length of return integer
- */
-
- static BYTE* b642WinBN(const char* b64, unsigned int b64Len, unsigned int& retLen);
-
- /**
- * \brief Translate a WinCAPI int to a B64 I2OS integer .
- *
- * Encodes a Windows integer in I2OSP base64 encoded format.
- *
- * @param n Buffer holding the Windows Integer
- * @param nLen Length of data in buffer
- * @param retLen Parameter to hold length of return integer
- * @returns A pointer to a buffer holding the encoded data
- * (transfers ownership)
- */
-
- static unsigned char* WinBN2b64(BYTE* n, DWORD nLen, unsigned int &retLen);
-
- /**
- * \brief Determine whether a given algorithm is supported
- *
- * A call that can be used to determine whether a given
- * symmetric algorithm is supported
- */
-
- virtual bool algorithmSupported(XSECCryptoSymmetricKey::SymmetricKeyType alg) const;
-
- /**
- * \brief Determine whether a given algorithm is supported
- *
- * A call that can be used to determine whether a given
- * digest algorithm is supported
- */
-
- virtual bool algorithmSupported(XSECCryptoHash::HashType alg) const;
-
- /**
- * \brief Return a Symmetric Key implementation object.
- *
- * Call used by the library to obtain a bulk encryption
- * object.
- *
- * @returns Pointer to the new SymmetricKey object
- * @see XSECCryptoSymmetricKey
- */
-
- virtual XSECCryptoSymmetricKey* keySymmetric(XSECCryptoSymmetricKey::SymmetricKeyType alg) const;
-
- /**
- * \brief Obtain some random octets
- *
- * For generation of IVs and the like, the library needs to be able
- * to obtain "random" octets. The library uses this call to the
- * crypto provider to obtain what it needs.
- *
- * @param buffer The buffer to place the random data in
- * @param numOctets Number of bytes required
- * @returns Number of bytes obtained.
- */
-
- virtual unsigned int getRandom(unsigned char * buffer, unsigned int numOctets) const;
-
-
- //@}
-
- /** @name Information Functions */
- //@{
-
- /**
- * \brief Returns a string that identifies the Crypto Provider
- */
-
- virtual const XMLCh* getProviderName() const;
-
- //@}
-
-
-private:
- HCRYPTPROV m_provDSS;
- HCRYPTPROV m_provRSA;
- HCRYPTPROV m_provApacheKeyStore;
- LPCSTR m_provDSSName;
- LPCSTR m_provRSAName;
- bool m_haveAES;
- DWORD m_provRSAType;
-
-};
-
-/*\@}*/
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOPROVIDER_INCLUDE */
-
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.cpp b/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.cpp
deleted file mode 100644
index 14e1b5b2..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.cpp
+++ /dev/null
@@ -1,756 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECCryptoSymmetricKey := Bulk encryption algorithms should all be
- * implemented via this interface
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/utils/XSECPlatformUtils.hpp>
-
-
-XERCES_CPP_NAMESPACE_USE
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include <xercesc/util/Janitor.hpp>
-
-// --------------------------------------------------------------------------------
-// Constructors and Destructors
-// --------------------------------------------------------------------------------
-
-WinCAPICryptoSymmetricKey::WinCAPICryptoSymmetricKey(
- HCRYPTPROV prov,
- XSECCryptoSymmetricKey::SymmetricKeyType type) :
-m_keyType(type),
-m_keyMode(MODE_NONE),
-m_initialised(false),
-m_doPad(true),
-m_p(prov),
-m_k(0) {
-
-
-}
-
-WinCAPICryptoSymmetricKey::~WinCAPICryptoSymmetricKey() {
-
- if (m_k != 0)
- CryptDestroyKey(m_k);
-
-}
-
-// --------------------------------------------------------------------------------
-// Basic Key interface methods
-// --------------------------------------------------------------------------------
-
-XSECCryptoKey * WinCAPICryptoSymmetricKey::clone() const {
-
- WinCAPICryptoSymmetricKey * ret;
-
- XSECnew(ret, WinCAPICryptoSymmetricKey(m_p, m_keyType));
- ret->m_keyLen = m_keyLen;
- ret->m_keyBuf = m_keyBuf;
-
- if (m_k != 0) {
-
-#if (_WIN32_WINNT > 0x0400)
-
- // Only supported in Win2K and above
-
- if (CryptDuplicateKey(m_k,
- 0,
- 0,
- &(ret->m_k)) == 0 ) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey Error attempting to clone key parameters");
-
- }
-#else
-
- ret->setKey(m_keyBuf.rawBuffer(), m_keyLen);
-
-#endif
- }
- else
- ret->m_k = 0;
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Store the key value
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoSymmetricKey::setKey(const unsigned char * key, unsigned int keyLen) {
-
- m_keyBuf.sbMemcpyIn(key, keyLen);
- m_keyLen = keyLen;
-
- if (m_k != 0)
- CryptDestroyKey(m_k);
-
- m_p = 0;
- m_k = createWindowsKey(key, keyLen, m_keyType, &m_p);
-}
-
-// --------------------------------------------------------------------------------
-// Decrypt
-// --------------------------------------------------------------------------------
-
-int WinCAPICryptoSymmetricKey::decryptCtxInit(const unsigned char * iv) {
-
- // Returns amount of IV data used (in bytes)
- // Sets m_initialised iff the key is OK and the IV is OK.
-
- if (m_initialised)
- return 0;
-
- if (m_k == 0) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Cannot initialise without key");
- }
- else if (m_keyMode == MODE_NONE) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Cannot initialise without mode");
- }
-
- DWORD cryptMode;
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- return 0; // Cannot initialise without an IV
-
- }
-
- cryptMode = CRYPT_MODE_CBC;
-
- if (!CryptSetKeyParam(m_k, KP_MODE, (BYTE *) (&cryptMode), 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting cipher mode");
-
- }
-
- if (!CryptSetKeyParam(m_k, KP_IV, (unsigned char *) iv, 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting IV");
-
- }
-
- }
- else if (m_keyMode == MODE_ECB) {
- cryptMode = CRYPT_MODE_ECB;
-
- if (!CryptSetKeyParam(m_k, KP_MODE, (BYTE *) (&cryptMode), 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting cipher mode");
-
- }
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unknown cipher mode");
- }
-
- // Set up the context according to the required cipher type
- switch (m_keyType) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- // A 3DES CBC key
-
- m_blockSize = 8;
- m_bytesInLastBlock = 0;
- m_initialised = true;
-
- break;
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- // An AES key
-
- m_blockSize = 16;
- m_bytesInLastBlock = 0;
- m_initialised = true;
-
- break;
-
- default :
-
- // Cannot do this without an IV
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unknown key type");
-
- }
-
- // Setup ivSize
- switch (m_keyMode) {
- case MODE_CBC:
- m_ivSize = m_blockSize;
- break;
-
- case MODE_GCM:
- m_ivSize = 12;
- break;
-
- default:
- m_ivSize = 0;
- }
-
- return m_ivSize;
-}
-
-
-bool WinCAPICryptoSymmetricKey::decryptInit(bool doPad,
- SymmetricKeyMode mode,
- const unsigned char* iv,
- const unsigned char* tag,
- unsigned int taglen) {
-
- m_initialised = false;
- m_doPad = doPad;
- m_keyMode = mode;
- decryptCtxInit(iv);
- return true;
-
-}
-
-unsigned int WinCAPICryptoSymmetricKey::decrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength) {
-
-
-
- // NOTE: This won't actually stop WinCAPI blowing the buffer, so the onus is
- // on the caller.
-
- unsigned int offset = 0;
- if (!m_initialised) {
- offset = decryptCtxInit(inBuf);
- if (offset > inLength) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Not enough data passed in to get IV");
- }
- }
-
- /* As per bug #38365 - we need to ensure there are enough characters to decrypt.
- Otherwise we get some nasty errors due to rounding calculations when inputs
- are too small */
-
- else if (m_bytesInLastBlock + inLength < m_blockSize) {
- // Not enough input data
- memcpy(&m_lastBlock[m_bytesInLastBlock], inBuf, inLength);
- m_bytesInLastBlock += inLength;
- return 0;
- }
-
- DWORD outl = inLength - offset;
-
- // Copy in last block
- if (m_bytesInLastBlock > 0)
- memcpy(plainBuf, m_lastBlock, m_bytesInLastBlock);
-
- // Copy out the tail, as we _MUST_ know when we come to the end for decryptFinal
- unsigned int rounding = (outl % m_blockSize) + m_blockSize;
- memcpy(&plainBuf[m_bytesInLastBlock], &inBuf[offset], outl - rounding);
-
- // Copy the tail to m_lastBlock
- memcpy(m_lastBlock, &inBuf[offset + outl - rounding], rounding);
- outl = outl - rounding + m_bytesInLastBlock;
- m_bytesInLastBlock = rounding;
-
- if (!CryptDecrypt(m_k,
- 0,
- FALSE,
- 0,
- plainBuf,
- &outl)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error during WinCAPI decrypt");
-
- }
-
- return outl;
-
-}
-
-unsigned int WinCAPICryptoSymmetricKey::decryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength) {
-
- DWORD outl = m_bytesInLastBlock;
-
- memcpy(plainBuf, m_lastBlock, outl);
-
- if (!CryptDecrypt(m_k,
- 0,
- FALSE,
- 0,
- plainBuf,
- &outl)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error during WinCAPI decrypt finalisation");
-
- }
-
- if (m_doPad) {
-
- // Need to do this ourselves, as WinCAPI appears broken
- if (plainBuf[outl - 1] > m_blockSize) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Bad padding");
- }
-
- outl -= plainBuf[outl - 1];
-
- }
-
- // This is just to reset the key, and does nothing else useful.
- DWORD tmpout = maxOutLength - outl;
- CryptDecrypt(m_k, 0, TRUE, 0, &plainBuf[outl], &tmpout);
-
- return outl;
-}
-
-// --------------------------------------------------------------------------------
-// Encrypt
-// --------------------------------------------------------------------------------
-
-void WinCAPICryptoSymmetricKey::encryptCtxInit(const unsigned char * iv) {
-
-
-
- if (m_initialised == true)
- return;
-
- if (m_keyLen == 0) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Cannot initialise without key");
- }
- else if (m_keyMode == MODE_NONE) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Cannot initialise without mode");
- }
-
- m_initialised = true;
-
- // Set up the context according to the required cipher type
-
- const unsigned char * usedIV = NULL;
- unsigned char genIV[256];
- DWORD cryptMode;
-
- // Tell the library that the IV still has to be sent
-
- if (m_keyMode == MODE_CBC) {
-
- if (iv == NULL) {
-
- BOOL res = CryptGenRandom(m_p, 256, genIV);
- if (res == FALSE) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error generating random IV");
- }
-
- usedIV = genIV;
- //return 0; // Cannot initialise without an IV
-
- }
- else
- usedIV = iv;
-
- cryptMode = CRYPT_MODE_CBC;
-
- if (!CryptSetKeyParam(m_k, KP_MODE, (BYTE *) (&cryptMode), 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting cipher mode");
-
- }
-
- // Set the IV parameter
- if (!CryptSetKeyParam(m_k, KP_IV, (unsigned char *) usedIV, 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting IV");
-
- }
-
- }
- else if (m_keyMode == MODE_ECB) {
-
- cryptMode = CRYPT_MODE_ECB;
-
- if (!CryptSetKeyParam(m_k, KP_MODE, (BYTE *) (&cryptMode), 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting cipher mode");
-
- }
- }
- else {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "OpenSSL:SymmetricKey - Unsupported cipher mode");
- }
-
- switch (m_keyType) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
-
- // A 3DES key
-
- m_blockSize = 8;
- if (m_keyMode == MODE_CBC)
- m_ivSize = 8;
- else
- m_ivSize = 0;
- m_bytesInLastBlock = 0;
-
- break;
-
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
-
- // An AES key
-
- m_blockSize = 16;
- if (m_keyMode == MODE_CBC)
- m_ivSize = 16;
- else if (m_keyMode == MODE_GCM)
- m_ivSize = 12;
- else
- m_ivSize = 0;
- m_bytesInLastBlock = 0;
-
- break;
-
- default :
-
- // Cannot do this without an IV
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unknown key type");
-
- }
-
- if (usedIV != NULL && m_ivSize > 0)
- memcpy(m_lastBlock, usedIV, m_ivSize);
-
-
-}
-bool WinCAPICryptoSymmetricKey::encryptInit(bool doPad,
- SymmetricKeyMode mode,
- const unsigned char * iv) {
-
- m_doPad = doPad;
- m_keyMode = mode;
- m_initialised = false;
- encryptCtxInit(iv);
- return true;
-
-}
-
-unsigned int WinCAPICryptoSymmetricKey::encrypt(const unsigned char * inBuf,
- unsigned char * cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength) {
-
- if (m_initialised == false) {
-
- encryptInit();
-
- }
-
- // NOTE: This won't actually stop WinCAPI blowing the buffer, so the onus is
- // on the caller.
-
- unsigned int offset = 0;
- unsigned char * bufPtr;
- unsigned char * encPtr; // Ptr to start of block to encrypt
-
- DWORD outl = 0;
-
- if (m_ivSize > 0) {
-
- DWORD len = m_ivSize;
- if (!CryptGetKeyParam(m_k, KP_IV, (unsigned char *) m_lastBlock, &len, 0)) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error setting IV");
-
- }
- memcpy(cipherBuf, m_lastBlock, m_ivSize);
- offset = m_ivSize;
- outl += m_ivSize;
- m_ivSize = 0;
-
- }
-
- /* As per bug #38365 - we need to ensure there are enough characters to encrypt.
- Otherwise we get some nasty errors due to rounding calculations when inputs
- are too small */
-
- if (inLength < m_blockSize) {
- // Not enough input data
- memcpy(&m_lastBlock[m_bytesInLastBlock], inBuf, inLength);
- m_bytesInLastBlock += inLength;
-
- // Just in case we have returned an IV
- return outl;
- }
-
- bufPtr = &cipherBuf[offset];
- encPtr = bufPtr;
-
- if (m_bytesInLastBlock > 0) {
- memcpy(bufPtr, m_lastBlock, m_bytesInLastBlock);
- bufPtr = &bufPtr[m_bytesInLastBlock];
- outl += m_bytesInLastBlock;
- }
-
- unsigned int rounding = (m_bytesInLastBlock + inLength) % m_blockSize;
- rounding += m_blockSize;
-
- outl += inLength - rounding;
- if (outl > maxOutLength) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Not enough space in output buffer for encrypt");
- }
-
- outl -= offset;
-
- // Now copy back one block + rounding
- memcpy(m_lastBlock, &inBuf[inLength - rounding], rounding);
- m_bytesInLastBlock = rounding;
-
- // Finally, copy in last of buffer to encrypt
- memcpy(bufPtr, inBuf, inLength - rounding);
-
- // Do the enrypt
- if (!CryptEncrypt(m_k, 0, FALSE, 0, encPtr, &outl, maxOutLength)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error during WinCAPI encrypt");
- }
-
- return outl + offset;
-
-}
-
-unsigned int WinCAPICryptoSymmetricKey::encryptFinish(unsigned char * cipherBuf,
- unsigned int maxOutLength,
- unsigned int taglen) {
-
- DWORD outl = m_bytesInLastBlock + m_blockSize;
-
- if (outl > maxOutLength) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Not enough space in output buffer for encrypt - NOTE WinCAPI requires an extra block to complete encryption");
- }
-
- outl = 0;
-
- if (m_bytesInLastBlock != 0) {
-
- memcpy(cipherBuf, m_lastBlock, m_bytesInLastBlock);
- outl = m_bytesInLastBlock;
-
- }
-
- if (!CryptEncrypt(m_k, 0, TRUE, 0, cipherBuf, &outl, maxOutLength)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Error during WinCAPI encrypt");
- }
-
- if (!m_doPad) {
-
- // It is the responsibility of the caller to ensure they have
- // passed in block size num bytes
-
- if (outl >= m_blockSize)
- outl -= m_blockSize;
-
- }
-
- return outl;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Create a windows key
-// --------------------------------------------------------------------------------
-
-HCRYPTKEY WinCAPICryptoSymmetricKey::createWindowsKey(
- const unsigned char * key,
- unsigned int keyLen,
- XSECCryptoSymmetricKey::SymmetricKeyType type,
- HCRYPTPROV * prov) {
-
- // First get the correct Provider handle to load the key into
-
- HCRYPTPROV p;
-
- if (prov == NULL || *prov == 0) {
- if (!strEquals(XSECPlatformUtils::g_cryptoProvider->getProviderName(), DSIGConstants::s_unicodeStrPROVWinCAPI)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Main provider is not Windows provider");
- }
-
- WinCAPICryptoProvider * cp =
- (WinCAPICryptoProvider*) XSECPlatformUtils::g_cryptoProvider;
-
- p = cp->getApacheKeyStore();
-
- if (p == 0) {
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unable to retrieve internal key store");
-
- }
-
- if (prov != NULL)
- *prov = p;
- }
-
- else if (prov != NULL)
- p = *prov;
-
- // Get the key wrapping key
- HCRYPTKEY k;
- if (!CryptGetUserKey(p, AT_KEYEXCHANGE, &k)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unable to retrieve internal key pair");
- }
-
- // Find out how long the output will be
- DWORD outl = 0;
- if (!CryptEncrypt(k, 0, TRUE, 0, 0, &outl, keyLen)) {
- DWORD error = GetLastError();
- if (error == NTE_BAD_KEY) {
- // We throw either way, but this is *likely* to be an unsupported OS issue
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey::createWindowsKey - Error encrypting a key - is this >= Windows 2000?");
- }
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unable to determine space required to encrypt key");
- }
-
- // Create the necessary buffer
- unsigned char * encryptBuf;
- unsigned int encryptBufSize = outl;
- XSECnew(encryptBuf, unsigned char[outl]);
- ArrayJanitor<unsigned char> j_encryptBuf(encryptBuf);
-
- memcpy(encryptBuf, key, keyLen);
- outl = keyLen;
-
- // Do the encrypt
-
- if (!CryptEncrypt(k, 0, TRUE, 0, encryptBuf, &outl, encryptBufSize)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unable to encrypt key");
- }
-
- // Now we have the encrypted buffer, create a SIMPLEBLOB structure
-
- unsigned char * simpleBlob;
- XSECnew(simpleBlob, unsigned char [sizeof (BLOBHEADER) + sizeof (DWORD) + outl]);
- ArrayJanitor<unsigned char> j_simpleBlob(simpleBlob);
-
- BLOBHEADER * blobHeader = (BLOBHEADER *) simpleBlob;
- blobHeader->bType = SIMPLEBLOB;
- blobHeader->bVersion = CUR_BLOB_VERSION;
- blobHeader->reserved = 0;
-
- unsigned int expectedLength;
-
- switch (type) {
-
- case (XSECCryptoSymmetricKey::KEY_3DES_192) :
- blobHeader->aiKeyAlg = CALG_3DES;
- expectedLength = 24;
- break;
- case (XSECCryptoSymmetricKey::KEY_AES_128) :
- blobHeader->aiKeyAlg = CALG_AES_128;
- expectedLength = 16;
- break;
- case (XSECCryptoSymmetricKey::KEY_AES_192) :
- blobHeader->aiKeyAlg = CALG_AES_192;
- expectedLength = 24;
- break;
- case (XSECCryptoSymmetricKey::KEY_AES_256) :
- blobHeader->aiKeyAlg = CALG_AES_256;
- expectedLength = 32;
- break;
- default :
-
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey::createWindowsKey - Unknown Symmetric key type");
-
- }
-
- // Check key length - otherwise the user could get some very cryptic error messages
- if (keyLen != expectedLength) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey::createWindowsKey - Key length incorrect for algorithm");
- }
-
- DWORD * algId = (DWORD *) (simpleBlob + sizeof(BLOBHEADER));
- *algId = CALG_RSA_KEYX;
-
- // Copy in the encrypted data
- memcpy(&simpleBlob[sizeof(BLOBHEADER) + sizeof(DWORD)], encryptBuf, outl);
-
- // Now do the import
-
- HCRYPTKEY k2;
-
- if (!CryptImportKey(p, simpleBlob, sizeof(BLOBHEADER) + sizeof(DWORD) + outl, k, CRYPT_EXPORTABLE, &k2)) {
- throw XSECCryptoException(XSECCryptoException::SymmetricError,
- "WinCAPI:SymmetricKey - Unable to import key");
- }
-
- return k2;
-
-}
-
-
-#endif /* XSEC_HAVE_WINCAPI */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp b/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp
deleted file mode 100644
index 4a6fc6f9..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp
+++ /dev/null
@@ -1,344 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECCryptoSymmetricKey := Bulk encryption algorithms should all be
- * implemented via this interface
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-
-
-#ifndef WINCAPICRYPTOSYMMETRICKEY_INCLUDE
-#define WINCAPICRYPTOSYMMETRICKEY_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoSymmetricKey.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#if !defined(_WIN32_WINNT)
-# define _WIN32_WINNT 0x0400
-#endif
-
-#include <wincrypt.h>
-
-#define WINCAPI_MAX_BLOCK_SIZE 32
-
-/**
- * \ingroup wincapicrypto
- */
-
-/**
- * \brief Base interface definition for symmetric key material.
- *
- * This is the implementation for a wrapper of Windows CryptoAPI symmetric
- * crypto functions.
- */
-
-class XSEC_EXPORT WinCAPICryptoSymmetricKey : public XSECCryptoSymmetricKey {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor
- *
- * Can only construct a Symmetric key if we know what type it is
- *
- * @param prov The appropriate provider that supports the required algorithm.
- * Can be 0 if the app is going to pass in an octet via setKey, as the library
- * will use its own internal key store and handle to CSP.
- * @param type The type of key (i.e. algorithm) to create
- **/
-
- WinCAPICryptoSymmetricKey(HCRYPTPROV prov, XSECCryptoSymmetricKey::SymmetricKeyType type);
-
- /**
- * \brief Destructor
- *
- * Implementations must ensure that the held key is properly destroyed
- * (overwritten) when key objects are deleted.
- */
-
- virtual ~WinCAPICryptoSymmetricKey();
-
- //@}
-
- /** @name Basic CryptoKey Interface methods */
- //@{
-
- /**
- * \brief Returns a string that identifies the crypto owner of this library.
- */
-
- virtual const XMLCh * getProviderName() const {return DSIGConstants::s_unicodeStrPROVWinCAPI;}
-
- /**
- * \brief Clone the key
- *
- * All keys need to be able to copy themselves and return
- * a pointer to the copy. This allows the library to
- * duplicate keys.
- */
-
- virtual XSECCryptoKey * clone() const;
-
- //@}
-
- /** @name Symmetric key interface methods */
- //@{
-
- /**
- * \brief What type of symmetric key is this?
- *
- * There are a number of different types of symmetric key.
- * This method allows callers to determine the type of this
- * particular key
- */
-
- SymmetricKeyType getSymmetricKeyType(void) const {return m_keyType;}
-
- /**
- * \brief Set the key from the provided bytes
- *
- * Symmetric keys can all be loaded from a buffer containing a series
- * of bytes.
- *
- * @param key The buffer containing the key bytes
- * @param keyLen The number of key bytes in the buffer
- *
- */
-
- void setKey(const unsigned char * key, unsigned int keyLen);
-
- /**
- * \brief Initialise an decryption process
- *
- * Setup the key to get ready for a decryption session.
- * Callers can pass in an IV. If one is not provided,
- * but the algorithm requires one (e.g. 3DES_CBC), then
- * implementations should assume that the start of the
- * cipher text stream will in fact be the IV.
- *
- * @param doPad By default, we perform padding for last block
- * @param mode mode selection (Currently ECB or CBC mode only)
- * @param iv Initialisation Vector to be used. NULL if one is
- * not required, or if IV will be set from data stream
- * @param tag Authentication tag to be used for AEAD ciphers
- * @param taglen length of Authentication Tag
- * @returns true if the initialisation succeeded.
- */
-
- virtual bool decryptInit(bool doPad = true,
- SymmetricKeyMode mode = MODE_CBC,
- const unsigned char * iv = NULL,
- const unsigned char* tag = NULL,
- unsigned int taglen = 0);
-
- /**
- * \brief Continue an decrypt operation using this key.
- *
- * Decryption must have been set up using an encryptInit
- * call. Takes the inBuf and continues a decryption operation,
- * writing the output to outBuf.
- *
- * This function does not have to guarantee that all input
- * will be decrypted. In cases where the input is not a length
- * of the block size, the implementation will need to hold back
- * cipher-text to be handles during the next operation.
- *
- * @note While maxOutLength is defined, the WinCAPI library will
- * not read the value, so the onus is on the caller to ensure the
- * buffer is long enough to hold the output!
- *
- * @param inBuf Octets to be decrypted
- * @param plainBuf Buffer to place output in
- * @param inLength Number of bytes to decrypt
- * @param maxOutLength Maximum number of bytes to place in output
- * buffer
- * @returns Bytes placed in output Buffer
- */
-
- virtual unsigned int decrypt(const unsigned char * inBuf,
- unsigned char * plainBuf,
- unsigned int inLength,
- unsigned int maxOutLength);
-
- /**
- * \brief Finish a decryption operation
- *
- * Complete a decryption process. No cipher text is passed in,
- * as this should simply be removing any remaining text from
- * the plain storage buffer.
- *
- * May throw an exception if there is some stored cipher text
- * that is not the length of the block size for block algorithms.
- *
- * @note While maxOutLength is defined, the WinCAPI library will
- * not read the value, so the onus is on the caller to ensure the
- * buffer is long enough to hold the output!
- *
- * @param plainBuf Buffer to place any remaining plain text in
- * @param maxOutLength Maximum number of bytes to pace in output
- * @returns Bytes placed in output buffer
- */
-
- virtual unsigned int decryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength);
-
- /**
- * \brief Initialise an encryption process
- *
- * Setup the key to get ready for a decryption session.
- * Callers can pass in an IV. If one is not provided,
- * but the algorithm requires one (e.g. 3DES_CBC), then
- * implementations are required to generate one.
- *
- * @param doPad By default, we perform padding for last block
- * @param mode What mode to handle blocks (Currently CBC or ECB)
- * @param iv Initialisation Vector to be used. NULL if one is
- * not required, or if IV is to be generated
- * @returns true if the initialisation succeeded.
- */
-
- virtual bool encryptInit(bool doPad = true,
- SymmetricKeyMode mode = MODE_CBC,
- const unsigned char * iv = NULL);
-
- /**
- * \brief Continue an encryption operation using this key.
- *
- * Encryption must have been set up using an encryptInit
- * call. Takes the inBuf and continues a encryption operation,
- * writing the output to outBuf.
- *
- * This function does not have to guarantee that all input
- * will be encrypted. In cases where the input is not a length
- * of the block size, the implementation will need to hold back
- * plain-text to be handled during the next operation.
- *
- * @param inBuf Octets to be encrypted
- * @param cipherBuf Buffer to place output in
- * @param inLength Number of bytes to encrypt
- * @param maxOutLength Maximum number of bytes to place in output
- * buffer
- * @returns Bytes placed in output Buffer
- */
-
- virtual unsigned int encrypt(const unsigned char * inBuf,
- unsigned char * cipherBuf,
- unsigned int inLength,
- unsigned int maxOutLength);
-
- /**
- * \brief Finish a encryption operation
- *
- * Complete a encryption process. No plain text is passed in,
- * as this should simply be removing any remaining text from
- * the plain storage buffer and creating a final padded block.
- *
- * Padding is performed by taking the remaining block, and
- * setting the last byte to equal the number of bytes of
- * padding. If the plain was an exact multiple of the block size,
- * then an extra block of padding will be used. For example, if
- * the block size is 8 bytes, and there were three remaining plain
- * text bytes (0x01, 0x02 and 0x03), the final block will be :
- *
- * 0x010203????????05
- *
- * @param plainBuf Buffer to place final block of cipher text in
- * @param maxOutLength Maximum number of bytes to pace in output
- * @param taglen length of Authentication Tag
- * @returns Bytes placed in output buffer
- */
-
- virtual unsigned int encryptFinish(unsigned char * plainBuf,
- unsigned int maxOutLength,
- unsigned int taglen = 0);
-
- //@}
-
- /** @name Windows utility functions */
- //@{
-
- /**
- * \brief Create a symmetric key from a octet string
- *
- * Uses the ApacheKeyStore to wrap an octet string in a public key
- * and then load it into the Apache Key Container within the defined
- * CSP
- *
- * @param key The buffer of bytes to load from
- * @param keyLen The number of bytes to load
- * @param type The key type to create from the bytes
- * @param prov If NULL, ignored. If non-null, but *prov == 0, the
- * function will use an internal handle to a CSP and return the value
- * in *prov. If *prov != 0, use contents of *prov as the provider to
- * load the key into. NOTE - The provider <em>must</em> have a
- * AT_KEYEXCHANGE key pair available.
- * @returns a pointer to the key or 0 on failure
- */
-
- static HCRYPTKEY createWindowsKey(const unsigned char * key,
- unsigned int keyLen,
- XSECCryptoSymmetricKey::SymmetricKeyType type,
- HCRYPTPROV * prov);
-
-
-
-private:
-
- // Unimplemented constructors
-
- WinCAPICryptoSymmetricKey();
- WinCAPICryptoSymmetricKey(const WinCAPICryptoSymmetricKey &);
- WinCAPICryptoSymmetricKey & operator= (const WinCAPICryptoSymmetricKey &);
-
- int decryptCtxInit(const unsigned char * iv);
- void encryptCtxInit(const unsigned char * iv);
-
- // Private variables
- SymmetricKeyType m_keyType;
- SymmetricKeyMode m_keyMode; // ECB or CBC
- safeBuffer m_keyBuf; // Holder of the key
- unsigned int m_keyLen;
- bool m_initialised;
- bool m_doPad;
-
- unsigned char m_lastBlock[WINCAPI_MAX_BLOCK_SIZE];
- unsigned int m_bytesInLastBlock;
- unsigned int m_blockSize;
- unsigned int m_ivSize;
-
- HCRYPTPROV m_p;
- HCRYPTKEY m_k;
-
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOSYMMETRICKEY_INCLUDE */
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoX509.cpp b/xsec/enc/WinCAPI/WinCAPICryptoX509.cpp
deleted file mode 100644
index e92694dd..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoX509.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoX509:= Windows CAPI based class for handling X509 (V3) certificates
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoX509.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp>
-#include <xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#include <xercesc/util/Janitor.hpp>
-
-XSEC_USING_XERCES(ArrayJanitor);
-
-WinCAPICryptoX509::WinCAPICryptoX509(HCRYPTPROV provRSA, HCRYPTPROV provDSS) :
-m_DERX509(""), mp_certContext(NULL), m_pRSA(provRSA), m_pDSS(provDSS) {
-
-
-}
-
-WinCAPICryptoX509::WinCAPICryptoX509(PCCERT_CONTEXT pCertContext,
- HCRYPTPROV provRSA, HCRYPTPROV provDSS) :
-m_pRSA(provRSA), m_pDSS(provDSS) {
-
- // Build this from an existing PCCERT_CONTEXT structure
-
- mp_certContext = pCertContext;
-
- unsigned char * encCert;
- unsigned long len = mp_certContext->cbCertEncoded * 2;
- XSECnew(encCert, unsigned char [len]);
- ArrayJanitor<unsigned char> j_encCert(encCert);
-
- // Base64 Encode
- XSCryptCryptoBase64 b64;
-
- b64.encodeInit();
- unsigned long encCertLen = b64.encode(mp_certContext->pbCertEncoded, mp_certContext->cbCertEncoded, encCert, len);
- encCertLen += b64.encodeFinish(&encCert[encCertLen], len - encCertLen);
-
- // Check the result
- if (encCert == NULL) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPIX509:WinCAPIX509 - Error encoding certificate");
- }
-
- m_DERX509.sbMemcpyIn(encCert, encCertLen);
- m_DERX509[encCertLen] = '\0';
-
-}
-
-WinCAPICryptoX509::~WinCAPICryptoX509() {
-
- if (mp_certContext != NULL)
- CertFreeCertificateContext(mp_certContext);
-
-}
-
-const XMLCh * WinCAPICryptoX509::getProviderName() const {
- return DSIGConstants::s_unicodeStrPROVWinCAPI;
-}
-
-// load functions
-
-void WinCAPICryptoX509::loadX509Base64Bin(const char * buf, unsigned int len) {
-
- unsigned char * rawCert;
- XSECnew(rawCert, unsigned char [len]);
- ArrayJanitor<unsigned char> j_rawCert(rawCert);
-
- // Base64 Decode
- XSCryptCryptoBase64 b64;
-
- b64.decodeInit();
- unsigned int rawCertLen = b64.decode((unsigned char *) buf, len, rawCert, len);
- rawCertLen += b64.decodeFinish(&rawCert[rawCertLen], len - rawCertLen);
-
- // Now load certificate into Win32 CSP
-
- mp_certContext = CertCreateCertificateContext(
- X509_ASN_ENCODING,
- rawCert,
- rawCertLen);
-
- if (mp_certContext == 0) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPIX509:loadX509Base64Bin - Error decoding certificate");
- }
-
-
- m_DERX509.sbMemcpyIn(buf, len);
- m_DERX509[len] = '\0';
-
-}
-
-// Info functions
-
-XSECCryptoKey::KeyType WinCAPICryptoX509::getPublicKeyType() const {
-
- if (mp_certContext == NULL) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPI:X509 - getPublicKeyType called before X509 loaded");
- }
-
- if (lstrcmp(mp_certContext->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, CRYPTO_OID_DSA) == 0)
- return XSECCryptoKey::KEY_DSA_PUBLIC;
-
- if (lstrcmp(mp_certContext->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, szOID_RSA_RSA) == 0)
- return XSECCryptoKey::KEY_RSA_PUBLIC;
-
- return XSECCryptoKey::KEY_NONE;
-
-}
-
-
-// Get functions
-XSECCryptoKey * WinCAPICryptoX509::clonePublicKey() const {
-
-
- if (mp_certContext == NULL) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPI:X509 - clonePublicKey called before X509 loaded");
- }
-
- // Import the key into the provider to get a pointer to the key
-
- HCRYPTKEY key;
- BOOL fResult;
-
- if (getPublicKeyType() == XSECCryptoKey::KEY_DSA_PUBLIC) {
-
- fResult= CryptImportPublicKeyInfo(
- m_pDSS,
- X509_ASN_ENCODING,
- &(mp_certContext->pCertInfo->SubjectPublicKeyInfo),
- &key);
-
-
- if (fResult == FALSE) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPI:X509 - Error loading public key info from certificate");
- }
-
- // Now that we have a handle for the DSA key, create a DSA Key object to
- // wrap it in
-
- WinCAPICryptoKeyDSA * ret;
- XSECnew(ret, WinCAPICryptoKeyDSA(m_pDSS, key));
-
- return ret;
-
- }
-
- if (getPublicKeyType() == XSECCryptoKey::KEY_RSA_PUBLIC) {
-
- fResult= CryptImportPublicKeyInfo(
- m_pRSA,
- X509_ASN_ENCODING,
- &(mp_certContext->pCertInfo->SubjectPublicKeyInfo),
- &key);
-
-
- if (fResult == FALSE) {
- throw XSECCryptoException(XSECCryptoException::X509Error,
- "WinCAPI:X509 - Error loading public key info from certificate");
- }
-
- // Now that we have a handle for the DSA key, create a DSA Key object to
- // wrap it in
-
- WinCAPICryptoKeyRSA * ret;
- XSECnew(ret, WinCAPICryptoKeyRSA(m_pRSA, key));
-
- return ret;
-
- }
-
- return NULL; // Unknown key type, but not necessarily an error
-
-}
-
-#endif /* XSEC_HAVE_WINCAPI */
-
-
diff --git a/xsec/enc/WinCAPI/WinCAPICryptoX509.hpp b/xsec/enc/WinCAPI/WinCAPICryptoX509.hpp
deleted file mode 100644
index 0e9f072f..00000000
--- a/xsec/enc/WinCAPI/WinCAPICryptoX509.hpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * WinCAPICryptoX509:= Windows CAPI based class for handling X509 (V3) certificates
- *
- * Author(s): Berin Lautenbach
- *
- * $Id$
- *
- */
-
-#ifndef WINCAPICRYPTOX509_INCLUDE
-#define WINCAPICRYPTOX509_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/enc/XSECCryptoX509.hpp>
-
-#if defined (XSEC_HAVE_WINCAPI)
-
-#define _WIN32_WINNT 0x0400
-#include <wincrypt.h>
-
-class WinCAPICryptoProvider;
-
-/**
- * \brief WinCAPI implementation class for interface for X509 certificates.
- * @ingroup wincapicrypto
- *
- * The library uses classes derived from this to process X509 Certificates.
- *
- */
-
-class XSEC_EXPORT WinCAPICryptoX509 : public XSECCryptoX509 {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor for X509 objects
- *
- * The windows constructor requires RSA or DSS crypto providers,
- * depending on the key type within the cert.
- *
- * @param provRSA A handle to the PROV_RSA_FULL type provider that the
- * interface should use when importing keys and manipulating certs
- * @param provDSS A handle to the PROV_DSS type provider that the
- * interface should use when importing keys and manipulating certs
- */
-
- WinCAPICryptoX509(HCRYPTPROV provRSA, HCRYPTPROV provDSS);
-
- /**
- * \brief Constructor for X509 objects
- *
- * @param pCertContext A certificate handle
- * @param provRSA A handle to the PROV_RSA_FULL type provider that the
- * interface should use when importing keys and manipulating certs
- * @param provDSS A handle to the PROV_DSS type provider that the
- * interface should use when importing keys and manipulating certs
- */
-
- WinCAPICryptoX509(PCCERT_CONTEXT pCertContext,
- HCRYPTPROV provRSA, HCRYPTPROV provDSS);
-
- virtual ~WinCAPICryptoX509();
-
- //@}
- /** @name Key Interface methods */
- //@{
-
- /**
- * \brief Return the type of the key stored in the certificate.
- *
- * Will extract the key from the certificate to return the appropriate
- * type
- *
- */
-
- virtual XSECCryptoKey::KeyType getPublicKeyType() const;
-
- /**
- * \brief Get a copy of the public key.
- *
- * Extracts the public key from the certificate and returns the appropriate
- * WinCAPICryrptoKey (DSA or RSA) object
- *
- */
-
- virtual XSECCryptoKey * clonePublicKey() const;
-
- /**
- * \brief Returns a string that identifies the crypto owner of this library.
- */
-
- virtual const XMLCh * getProviderName() const;
-
- //@}
-
- /** @name Load and Get the certificate */
- //@{
-
- /**
- * \brief Load a certificate into the object.
- *
- * Take a base64 DER encoded certificate and load.
- *
- * @param buf A buffer containing the Base64 encoded certificate
- * @param len The number of bytes of data in the certificate.
- */
-
- virtual void loadX509Base64Bin(const char * buf, unsigned int len);
-
- /**
- * \brief Get a Base64 DER encoded copy of the certificate
- *
- * @returns A safeBuffer containing the DER encoded certificate
- */
-
- virtual safeBuffer &getDEREncodingSB(void) {return m_DERX509;}
-
- /**
- * \brief Get a Base64 DER encoded copy of the certificate
- *
- * @returns A safeBuffer containing the DER encoded certificate
- */
-
- virtual const safeBuffer &getDEREncodingSB(void) const {return m_DERX509;}
-
- //@}
-
-private:
-
- safeBuffer m_DERX509;
- PCCERT_CONTEXT mp_certContext;
-
- HCRYPTPROV m_pRSA;
- HCRYPTPROV m_pDSS;
-
-};
-
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* WINCAPICRYPTOX509_INCLUDE */
-
diff --git a/xsec/enc/XSECCryptoProvider.hpp b/xsec/enc/XSECCryptoProvider.hpp
index 54c04b24..2b2fa0eb 100644
--- a/xsec/enc/XSECCryptoProvider.hpp
+++ b/xsec/enc/XSECCryptoProvider.hpp
@@ -196,8 +196,7 @@ public :
/**
* \brief Return a HMAC key
*
- * Sometimes the library needs to create an HMAC key (notably within
- * the XKMS utilities.
+ * Sometimes the library needs to create an HMAC key.
*
* This function allows the library to obtain a key that can then have
* a value set within it.
diff --git a/xsec/enc/XSECCryptoUtils.cpp b/xsec/enc/XSECCryptoUtils.cpp
index 224dd2c9..db53f00e 100644
--- a/xsec/enc/XSECCryptoUtils.cpp
+++ b/xsec/enc/XSECCryptoUtils.cpp
@@ -44,329 +44,6 @@
XERCES_CPP_NAMESPACE_USE
-#ifdef XSEC_XKMS_ENABLED
-
-// --------------------------------------------------------------------------------
-// XKMS Limited-Use Shared Secret handling
-// --------------------------------------------------------------------------------
-
-int CleanXKMSPassPhrase(unsigned char * input, int inputLen, safeBuffer &output) {
-
- // Now obsolete - use SASLCleanXKMSPassPhrase instead
- int j = 0;
- unsigned char c;
- for (int i = 0; i < inputLen; ++i) {
-
- c = input[i];
-
- if (c >= 'A' && c <= 'Z') {
- output[j++] = c - 'A' + 'a';
- }
- else if (c != '\n' && c != '\r' && c != '\t' && c != ' ') {
- output[j++] = c;
- }
-
- }
-
- return j;
-
-}
-
-int SASLCleanXKMSPassPhrase(unsigned char * input, int inputLen, safeBuffer &output) {
-
- // For now - this does *not* implement the full SASLPrep algorithm.
- // THe NFKC form is not trivial to implement - so this is kept very simple.
- // TODO - Fix this - it can be an interoperability issue as pass phrases from
- // different implementations could be treated differently.
- // Currently we only check for prohibited unput for chars < 0xFFFF and drop any
- // chars over 0xFFFF
-
- unsigned char * inp = new unsigned char[inputLen + 1];
- ArrayJanitor<unsigned char> j_inp(inp);
- memcpy(inp, input, inputLen);
- inp[inputLen] = '\0';
-
- XSECAutoPtrXMLCh uinput((char *) inp);
- XMLSize_t l = XMLString::stringLen(uinput.get());
- XMLCh* uoutput = new XMLCh[l + 1];
- ArrayJanitor<XMLCh> j_uoutput(uoutput);
-
- XMLSize_t i, j;
- j = 0;
-
- XMLCh ch1;
-
- for (i = 0; i < l; ++i) {
-
- ch1 = uinput.get()[i];
- // Case one - char is < 0x10000
- if (ch1 < 0xD800 || ch1 > 0xDFFF) {
-
- // OK - ch1 is "real" value - let's see if it is legal
- // The following switch tables are derived from
- // RFC 3454 - see http://www.ietf.org/rfc/rfc3454.txt
-
- // Non-ASCII Spaces - C.1.2
- switch (ch1) {
-
- case 0x00A0: // NO-BREAK SPACE
- case 0x1680: // OGHAM SPACE MARK
- case 0x2000: // EN QUAD
- case 0x2001: // EM QUAD
- case 0x2002: // EN SPACE
- case 0x2003: // EM SPACE
- case 0x2004: // THREE-PER-EM SPACE
- case 0x2005: // FOUR-PER-EM SPACE
- case 0x2006: // SIX-PER-EM SPACE
- case 0x2007: // FIGURE SPACE
- case 0x2008: // PUNCTUATION SPACE
- case 0x2009: // THIN SPACE
- case 0x200A: // HAIR SPACE
- case 0x200B: // ZERO WIDTH SPACE
- case 0x202F: // NARROW NO-BREAK SPACE
- case 0x205F: // MEDIUM MATHEMATICAL SPACE
- case 0x3000: // IDEOGRAPHIC SPACE
-
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - Non ASCII space character in XKMS pass phrase");
- default:
-
- break;
-
- }
-
- // ASCII Control characters
- // Note - us unsigned, so always >= 0)
- if ((ch1 <= 0x1F) || (ch1 == 0x7F)) {
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - ASCII control character in XKMS pass phrase");
- }
-
- // Non-ASCII Control Characters
- if ((ch1 >= 0x80 && ch1 <= 0x9F) ||
- (ch1 >= 0x206A && ch1 <= 0x206F) ||
- (ch1 >= 0xFFF9 && ch1 <= 0xFFFC)) {
-
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - NON ASCII control character in XKMS pass phrase");
- }
-
- switch (ch1) {
-
-
- case 0x06DD: // ARABIC END OF AYAH
- case 0x070F: // SYRIAC ABBREVIATION MARK
- case 0x180E: // MONGOLIAN VOWEL SEPARATOR
- case 0x200C: // ZERO WIDTH NON-JOINER
- case 0x200D: // ZERO WIDTH JOINER
- case 0x2028: // LINE SEPARATOR
- case 0x2029: // PARAGRAPH SEPARATOR
- case 0x2060: // WORD JOINER
- case 0x2061: // FUNCTION APPLICATION
- case 0x2062: // INVISIBLE TIMES
- case 0x2063: // INVISIBLE SEPARATOR
- case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - NON ASCII control character in XKMS pass phrase");
- default:
- break; }
- // 1D173-1D17A; [MUSICAL CONTROL CHARACTERS] is not relevant as we are looking at
- // ch1 at the moment
-
- // Private Use characters
- if ((ch1 >= 0xE000 && ch1 <= 0xF8FF)) {
-
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - Private Use character in XKMS pass phrase");
- }
-
- // Non-character code points
- if ((ch1 >= 0xFDD0 && ch1 <= 0xFDEF) ||
- (ch1 >= 0xFFFE)) {
-
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - Non-character code points in XKMS pass phrase");
- }
-
- // Inappropriate for plain text characters
-
- switch (ch1) {
- case 0xFFF9: // INTERLINEAR ANNOTATION ANCHOR
- case 0xFFFA: // INTERLINEAR ANNOTATION SEPARATOR
- case 0xFFFB: // INTERLINEAR ANNOTATION TERMINATOR
- case 0xFFFC: // OBJECT REPLACEMENT CHARACTER
- case 0xFFFD: // REPLACEMENT CHARACTER
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - Innappropriate for plain text chararcters in XKMS pass phrase");
- default:
- break;
- }
-
- // Inappripriate for canonical representation characters
- if (ch1 >= 0x2FF0 && ch1 <= 0x2FFB) {
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - Innappropriate for canonicalisation chararcters in XKMS pass phrase");
- }
-
- // Change display properties or are deprecated
- switch (ch1) {
- case 0x0340: // COMBINING GRAVE TONE MARK
- case 0x0341: // COMBINING ACUTE TONE MARK
- case 0x200E: // LEFT-TO-RIGHT MARK
- case 0x200F: // RIGHT-TO-LEFT MARK
- case 0x202A: // LEFT-TO-RIGHT EMBEDDING
- case 0x202B: // RIGHT-TO-LEFT EMBEDDING
- case 0x202C: // POP DIRECTIONAL FORMATTING
- case 0x202D: // LEFT-TO-RIGHT OVERRIDE
- case 0x202E: // RIGHT-TO-LEFT OVERRIDE
- case 0x206A: // INHIBIT SYMMETRIC SWAPPING
- case 0x206B: // ACTIVATE SYMMETRIC SWAPPING
- case 0x206C: // INHIBIT ARABIC FORM SHAPING
- case 0x206D: // ACTIVATE ARABIC FORM SHAPING
- case 0x206E: // NATIONAL DIGIT SHAPES
- case 0x206F: // NOMINAL DIGIT SHAPES
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - change display or deprecated chararcters in XKMS pass phrase");
- default:
- break;
- }
-
- // We got this far = just run with it for now
- uoutput[j++] = ch1;
- }
- else {
- throw XSECException(XSECException::XKMSError,
- "SASLCleanXKMSPassPhrase - don't support XKMS pass phrase chars > 0xFFFF");
- }
- } /* for */
- uoutput[j++] = chNull;
-
- // Now transcode
- char * utf8output= transcodeToUTF8(uoutput);
- output.sbStrcpyIn(utf8output);
-
- int ret = (int)strlen(utf8output);
- XSEC_RELEASE_XMLCH(utf8output);
- return ret;
-}
-
-int XSEC_EXPORT CalculateXKMSAuthenticationKey(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen) {
-
- unsigned char keyVal[] = {XKMSAuthenticationValue};
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- Janitor<XSECCryptoKeyHMAC> j_k(k);
- k->setKey(keyVal, 1);
-
- XSECCryptoHash *h = XSECPlatformUtils::g_cryptoProvider->HMAC(XSECCryptoHash::HASH_SHA1);
- Janitor<XSECCryptoHash> j_h(h);
- h->setKey(k);
-
- // Clean the input
- safeBuffer sb;
- int l = SASLCleanXKMSPassPhrase(input, inputLen, sb);
-
- h->hash((unsigned char *) sb.rawBuffer(), l);
- return h->finish(output, maxOutputLen);
-
-}
-
-
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen) {
-
- unsigned char keyVal[] = {XKMSRevocationCodeIdenfitierEncoding1};
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- Janitor<XSECCryptoKeyHMAC> j_k(k);
- k->setKey(keyVal, 1);
-
- XSECCryptoHash *h = XSECPlatformUtils::g_cryptoProvider->HMAC(XSECCryptoHash::HASH_SHA1);
- Janitor<XSECCryptoHash> j_h(h);
-
- h->setKey(k);
-
- // Clean the input
- safeBuffer sb;
- int l = CleanXKMSPassPhrase(input, inputLen, sb);
-
- h->hash((unsigned char *) sb.rawBuffer(), l);
- return h->finish(output, maxOutputLen);
-
-}
-
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen) {
-
-
- unsigned char tmpBuf[XSEC_MAX_HASH_SIZE];
- int tmpLen = CalculateXKMSRevocationCodeIdentifierEncoding1(input, inputLen, tmpBuf, XSEC_MAX_HASH_SIZE);
- return CalculateXKMSRevocationCodeIdentifierEncoding2From1(tmpBuf, tmpLen, output, maxOutputLen);
-
-}
-
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2From1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen) {
-
- unsigned char keyVal[] = {XKMSRevocationCodeIdenfitierEncoding2};
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- Janitor<XSECCryptoKeyHMAC> j_k(k);
- k->setKey(keyVal, 1);
-
- XSECCryptoHash *h = XSECPlatformUtils::g_cryptoProvider->HMAC(XSECCryptoHash::HASH_SHA1);
- Janitor<XSECCryptoHash> j_h(h);
-
- h->setKey(k);
-
- h->hash(input, inputLen);
- return h->finish(output, maxOutputLen);
-
-}
-
-int XSEC_EXPORT CalculateXKMSKEK(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen) {
-
- unsigned char keyVal[] = {XKMSKeyEncryption};
- unsigned char shaOutput[22]; // SHA1 has 20 bytes of output
-
- // Clean the input
- safeBuffer sb;
- int l = SASLCleanXKMSPassPhrase(input, inputLen, sb);
-
- // Need to iterate through until we have enough data
- int bytesDone = 0, bytesToDo;;
- shaOutput[0] = keyVal[0];
- int keyLen = 1;
- while (bytesDone < maxOutputLen) {
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(shaOutput, keyLen);
-
- XSECCryptoHash *h = XSECPlatformUtils::g_cryptoProvider->HMAC(XSECCryptoHash::HASH_SHA1);
- Janitor<XSECCryptoHash> j_h(h);
-
- h->setKey(k);
- delete(k);
-
- // Now hash next round of data
- h->hash((unsigned char *) sb.rawBuffer(), l);
- keyLen = h->finish(shaOutput, 22);
-
- // Copy into the output buffer
- bytesToDo = maxOutputLen - bytesDone;
- bytesToDo = bytesToDo > 20 ? 20 : bytesToDo;
- memcpy(&output[bytesDone], shaOutput, bytesToDo);
- bytesDone += bytesToDo;
-
- // Set up for next key
- shaOutput[0] ^= keyVal[0];
- keyLen = 20;
-
- j_h.release();
- delete h;
- }
-
- return bytesDone;
-
-}
-
-#endif
// --------------------------------------------------------------------------------
// Some Base64 helpers
diff --git a/xsec/enc/XSECCryptoUtils.hpp b/xsec/enc/XSECCryptoUtils.hpp
index 5c31a619..62943ecd 100644
--- a/xsec/enc/XSECCryptoUtils.hpp
+++ b/xsec/enc/XSECCryptoUtils.hpp
@@ -40,24 +40,6 @@
* @ingroup crypto
*/
-#ifdef XSEC_XKMS_ENABLED
-// --------------------------------------------------------------------------------
-// XKMS Limited-Use Shared Secret handling
-// --------------------------------------------------------------------------------
-
-#define XKMSAuthenticationValue 0x01
-#define XKMSRevocationCodeIdenfitierEncoding1 0x02
-#define XKMSRevocationCodeIdenfitierEncoding2 0x03
-#define XKMSKeyEncryption 0x04
-
-int XSEC_EXPORT CalculateXKMSAuthenticationKey(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
-/* Calculate encoding 2 - Input is original pass phrase */
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
-/* Calculate encoding 2 - Input is encoding 1 */
-int XSEC_EXPORT CalculateXKMSRevocationCodeIdentifierEncoding2From1(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
-int XSEC_EXPORT CalculateXKMSKEK(unsigned char * input, int inputLen, unsigned char * output, int maxOutputLen);
-#endif
// --------------------------------------------------------------------------------
// Some Base64 helpers
diff --git a/xsec/framework/XSECConfig.hpp.in b/xsec/framework/XSECConfig.hpp.in
index ea209b18..f86c63c4 100644
--- a/xsec/framework/XSECConfig.hpp.in
+++ b/xsec/framework/XSECConfig.hpp.in
@@ -1,17 +1,11 @@
/* xsec/framework/XSECConfig.hpp.in. Generated from configure.ac by autoheader. */
-/* Define if NSS is in use. */
-#undef XSEC_HAVE_NSS
-
/* Define if OpenSSL is in use. */
#undef XSEC_HAVE_OPENSSL
/* Define to 1 if getcwd(NULL, 0) works. */
#undef XSEC_HAVE_GETCWD_DYN
-/* Define to 1 if Xalan is available. */
-#undef XSEC_HAVE_XALAN
-
/* Define to 1 if OpenSSL has EVP_CIPHER_CTX_set_padding. */
#undef XSEC_OPENSSL_CANSET_PADDING
@@ -36,7 +30,4 @@
/* Define to 1 if OpenSSL has SHA2 support. */
#undef XSEC_OPENSSL_HAVE_SHA2
-/* Define to 1 if XKMS support is included. */
-#undef XSEC_XKMS_ENABLED
-
#include <xsec/framework/XSECVersion.hpp>
diff --git a/xsec/framework/XSECDefs.hpp b/xsec/framework/XSECDefs.hpp
index bfa0d69c..9cf27021 100644
--- a/xsec/framework/XSECDefs.hpp
+++ b/xsec/framework/XSECDefs.hpp
@@ -123,28 +123,6 @@
// Configuration includes
-// We want to use XPath calculated transforms
-
-//#define XSEC_USE_XPATH_ENVELOPE
-
-
-// Given the configuration - what should we set?
-
-#ifdef XSEC_HAVE_XALAN
-
-# define XSEC_HAVE_XPATH
-# define XSEC_HAVE_XSLT
-
-#endif
-
-#ifndef XSEC_HAVE_XPATH
-
-# ifdef XSEC_USE_XPATH_ENVELOPE
-# undef XSEC_USE_XPATH_ENVELOPE
-# endif
-
-#endif
-
#if defined(XSEC_BUILDING_LIBRARY) || defined(XSEC_BUILDING_TOOLS)
# ifdef HAVE_STRCASECMP
# define _stricmp(x,y) strcasecmp(x,y)
diff --git a/xsec/framework/XSECEnv.cpp b/xsec/framework/XSECEnv.cpp
index 95d55e10..5d81425e 100644
--- a/xsec/framework/XSECEnv.cpp
+++ b/xsec/framework/XSECEnv.cpp
@@ -99,18 +99,6 @@ const XMLCh s_defaultXENC11Prefix[] = {
};
-#ifdef XSEC_XKMS_ENABLED
-const XMLCh s_defaultXKMSPrefix[] = {
-
- chLatin_x,
- chLatin_k,
- chLatin_m,
- chLatin_s,
- chNull
-
-};
-#endif
-
// --------------------------------------------------------------------------------
// Default Id names
// --------------------------------------------------------------------------------
@@ -148,9 +136,7 @@ XSECEnv::XSECEnv(DOMDocument *doc) {
mp_xpfPrefixNS = XMLString::replicate(s_defaultXPFPrefix);
mp_xencPrefixNS = XMLString::replicate(s_defaultXENCPrefix);
mp_xenc11PrefixNS = XMLString::replicate(s_defaultXENC11Prefix);
-#ifdef XSEC_XKMS_ENABLED
- mp_xkmsPrefixNS = XMLString::replicate(s_defaultXKMSPrefix);
-#endif
+
m_prettyPrintFlag = true;
mp_URIResolver = NULL;
@@ -177,9 +163,7 @@ XSECEnv::XSECEnv(const XSECEnv & theOther) {
mp_xpfPrefixNS = XMLString::replicate(theOther.mp_xpfPrefixNS);
mp_xencPrefixNS = XMLString::replicate(theOther.mp_xencPrefixNS);
mp_xenc11PrefixNS = XMLString::replicate(s_defaultXENC11Prefix);
-#ifdef XSEC_XKMS_ENABLED
- mp_xkmsPrefixNS = XMLString::replicate(theOther.mp_xkmsPrefixNS);
-#endif
+
m_prettyPrintFlag = theOther.m_prettyPrintFlag;
if (theOther.mp_URIResolver != NULL)
@@ -230,12 +214,6 @@ XSECEnv::~XSECEnv() {
XSEC_RELEASE_XMLCH(mp_xenc11PrefixNS);
}
-#ifdef XSEC_XKMS_ENABLED
- if (mp_xkmsPrefixNS != NULL) {
- XSEC_RELEASE_XMLCH(mp_xkmsPrefixNS);
- }
-#endif
-
if (mp_URIResolver != NULL) {
delete mp_URIResolver;
}
@@ -336,17 +314,6 @@ void XSECEnv::setXENC11NSPrefix(const XMLCh * prefix) {
}
-#ifdef XSEC_XKMS_ENABLED
-void XSECEnv::setXKMSNSPrefix(const XMLCh * prefix) {
-
- if (mp_xkmsPrefixNS != NULL)
- XSEC_RELEASE_XMLCH(mp_xkmsPrefixNS);
-
- mp_xkmsPrefixNS = XMLString::replicate(prefix);
-
-}
-#endif
-
// --------------------------------------------------------------------------------
// Id Attribute Names Handling
// --------------------------------------------------------------------------------
@@ -506,4 +473,3 @@ void XSECEnv::doPrettyPrint(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node) const
node->appendChild(mp_doc->createTextNode(DSIGConstants::s_unicodeStrNL));
}
-
diff --git a/xsec/framework/XSECEnv.hpp b/xsec/framework/XSECEnv.hpp
index 418d282b..7cf20b31 100644
--- a/xsec/framework/XSECEnv.hpp
+++ b/xsec/framework/XSECEnv.hpp
@@ -167,17 +167,6 @@ public:
void setXENC11NSPrefix(const XMLCh * prefix);
-#ifdef XSEC_XKMS_ENABLED
- /**
- * \brief Set prefix for XKMS nodes
- *
- * Set the namespace prefix the library will use when creating
- * nodes in the XKMS namespace
- */
-
- void setXKMSNSPrefix(const XMLCh * prefix);
-#endif
-
/**
* \brief Get the NS Prefix being used for DSIG elements.
*
@@ -236,20 +225,6 @@ public:
*/
const XMLCh * getXENC11NSPrefix() const {return mp_xenc11PrefixNS;}
-
-#ifdef XSEC_XKMS_ENABLED
- /**
- * \brief Get namespace prefix for XKMS nodes
- *
- * Find the string being used by the library to prefix nodes in the
- * xkms: namespace.
- *
- * @returns XKMS namespace prefix
- */
-
- const XMLCh * getXKMSNSPrefix(void) const {return mp_xkmsPrefixNS;}
-#endif
-
//@}
/** @name Pretty Printing Functions */
@@ -552,9 +527,7 @@ private:
XMLCh * mp_xpfPrefixNS;
XMLCh * mp_xencPrefixNS;
XMLCh * mp_xenc11PrefixNS;
-#ifdef XSEC_XKMS_ENABLED
- XMLCh * mp_xkmsPrefixNS;
-#endif
+
// Resolvers
XSECURIResolver * mp_URIResolver;
diff --git a/xsec/framework/XSECError.cpp b/xsec/framework/XSECError.cpp
index 4c1470be..f68d20fa 100644
--- a/xsec/framework/XSECError.cpp
+++ b/xsec/framework/XSECError.cpp
@@ -85,12 +85,6 @@ const char * XSECExceptionStrings [] = {
"An error occurred processing an EncryptionMethod node",
"An error occurred processing a CipherReference node",
"An error occurred processing an Object node",
- "An error occurred in XKMS processing",
- "An expected XKMS DOM node or attribute was not found",
- "An error occurred processing a MessageAbstractType object",
- "An error occurred processing a RequestAbstractType object",
- "An error occurred processing a ResultType object",
- "An error occurred processing a Status object",
"Unknown Error type",
};
diff --git a/xsec/framework/XSECException.hpp b/xsec/framework/XSECException.hpp
index e8380895..1050d030 100644
--- a/xsec/framework/XSECException.hpp
+++ b/xsec/framework/XSECException.hpp
@@ -114,15 +114,7 @@ public:
EncryptionMethodError = 48,
CipherReferenceError = 49,
ObjectError = 50,
-
- // XKMS Error
- XKMSError = 51,
- ExpectedXKMSChildNotFound = 52,
- MessageAbstractTypeError = 53,
- RequestAbstractTypeError = 54,
- ResultTypeError = 55,
- StatusError = 56,
- UnknownError = 58 // Must be last!
+ UnknownError = 51 // Must be last!
};
diff --git a/xsec/framework/XSECProvider.cpp b/xsec/framework/XSECProvider.cpp
index ab04f8cf..edee4f7d 100644
--- a/xsec/framework/XSECProvider.cpp
+++ b/xsec/framework/XSECProvider.cpp
@@ -34,10 +34,6 @@
#include "../utils/XSECDOMUtils.hpp"
#include "../xenc/impl/XENCCipherImpl.hpp"
-#ifdef XSEC_XKMS_ENABLED
-# include "../xkms/impl/XKMSMessageFactoryImpl.hpp"
-#endif
-
XERCES_CPP_NAMESPACE_USE
// --------------------------------------------------------------------------------
@@ -47,21 +43,12 @@ XERCES_CPP_NAMESPACE_USE
XSECProvider::XSECProvider() {
- mp_URIResolver = new XSECURIResolverXerces();
-#ifdef XSEC_XKMS_ENABLED
- XSECnew(mp_xkmsMessageFactory, XKMSMessageFactoryImpl());
-#endif
+ mp_URIResolver = NULL;
}
XSECProvider::~XSECProvider() {
- if (mp_URIResolver != NULL)
- delete mp_URIResolver;
-
-#ifdef XSEC_XKMS_ENABLED
- // Clean up XKMS stuff
- delete mp_xkmsMessageFactory;
-#endif
+ delete mp_URIResolver;
}
// --------------------------------------------------------------------------------
@@ -134,15 +121,6 @@ void XSECProvider::releaseCipher(XENCCipher* toRelease) {
delete toRelease;
}
-#ifdef XSEC_XKMS_ENABLED
-// --------------------------------------------------------------------------------
-// XKMS Methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageFactory* XSECProvider::getXKMSMessageFactory() {
- return mp_xkmsMessageFactory;
-}
-#endif
// --------------------------------------------------------------------------------
// Environmental methods
diff --git a/xsec/framework/XSECProvider.hpp b/xsec/framework/XSECProvider.hpp
index 2b343327..7c36aa08 100644
--- a/xsec/framework/XSECProvider.hpp
+++ b/xsec/framework/XSECProvider.hpp
@@ -32,7 +32,6 @@
#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
#include <xsec/xenc/XENCCipher.hpp>
-#include <xsec/xkms/XKMSMessageFactory.hpp>
#include <vector>
@@ -183,24 +182,6 @@ public:
//@}
-#ifdef XSEC_XKMS_ENABLED
- /** @name XKMS Functions */
- //@{
-
- /**
- * \brief Obtain a pointer to the XKMSMessageFactory.
- *
- * The XKMSMessageFactory is used to create and manipulate XKMS messages.
- *
- * @note Unlike other objects created by the provider, only one
- * XKMSMessageFactory is ever instantiated for a particular provider.
- * Applications should <b>never</b> delete the Factory, as it is taken
- * care of by the provider.
- */
-
- XKMSMessageFactory* getXKMSMessageFactory(void);
-#endif
-
/** @name Environmental Options */
//@{
@@ -231,10 +212,6 @@ private:
void setup(DSIGSignature* sig);
void setup(XENCCipher* cipher);
-#ifdef XSEC_XKMS_ENABLED
- XKMSMessageFactory* mp_xkmsMessageFactory;
-#endif
-
XSECURIResolver* mp_URIResolver;
};
diff --git a/xsec/framework/XSECVersion.hpp b/xsec/framework/XSECVersion.hpp
index 3c54ee76..11e88481 100644
--- a/xsec/framework/XSECVersion.hpp
+++ b/xsec/framework/XSECVersion.hpp
@@ -28,9 +28,9 @@
* version number. They are used to create version strings.
*/
-#define XSEC_VERSION_MAJOR 2
+#define XSEC_VERSION_MAJOR 3
#define XSEC_VERSION_MEDIUM 0
-#define XSEC_VERSION_MINOR 4
+#define XSEC_VERSION_MINOR 0
// --------------------------------------------------------------------------------
// Version Handling
diff --git a/xsec/framework/XSECW32Config.hpp b/xsec/framework/XSECW32Config.hpp
index 1f4e1675..09c7b30b 100644
--- a/xsec/framework/XSECW32Config.hpp
+++ b/xsec/framework/XSECW32Config.hpp
@@ -31,32 +31,11 @@
*/
-/*
- * The following defines whether Xalan integration is required.
- *
- * Xalan is used for XSLT and complex XPath processing.
- * Activate this #define if Xalan is not required (or desired)
- */
-
-// #define XSEC_HAVE_XALAN 1
-
-
/*
* Define presence of cryptographic providers.
- *
- * WARNING: Neither WinCAPI nor NSS are officially supported by the sole remanining
- * maintainer of this library. Use at your own risk, or contact the project if you're
- * interested in assisting with maintenance and support of that code.
*/
// #define XSEC_HAVE_OPENSSL 1
-// #define XSEC_HAVE_WINCAPI 1
-// #define XSEC_HAVE_NSS 1
-
-/*
- * Define if XKMS support is enabled.
- */
-// #define XSEC_XKMS_ENABLED 1
/*
* Some settings for OpenSSL if we have it
diff --git a/xsec/framework/version.rc b/xsec/framework/version.rc
index b883ceba..45b0a7d3 100644
--- a/xsec/framework/version.rc
+++ b/xsec/framework/version.rc
@@ -54,8 +54,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 2,0,4,0
- PRODUCTVERSION 2,0,4,0
+ FILEVERSION 3,0,0,0
+ PRODUCTVERSION 3,0,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -71,24 +71,24 @@ BEGIN
BLOCK "0c0904b0"
BEGIN
VALUE "Comments", "\0"
- VALUE "CompanyName", "The Apache Software Foundation\0"
- VALUE "FileDescription", "Santuario C++ XML Security Library\0"
- VALUE "FileVersion", "2, 0, 4, 0\0"
+ VALUE "CompanyName", "Shibboleth Consortium\0"
+ VALUE "FileDescription", "C++ XML Security Library\0"
+ VALUE "FileVersion", "3, 0, 0, 0\0"
#ifdef _DEBUG
- VALUE "InternalName", "xsec_2_0D\0"
+ VALUE "InternalName", "xsec_3_0D\0"
#else
- VALUE "InternalName", "xsec_2_0\0"
+ VALUE "InternalName", "xsec_3_0\0"
#endif
- VALUE "LegalCopyright", "Copyright � 2002-2021 The Apache Software Foundation\0"
+ VALUE "LegalCopyright", "Copyright � 2002-2024 Various\0"
VALUE "LegalTrademarks", "\0"
#ifdef _DEBUG
- VALUE "OriginalFilename", "xsec_2_0D.dll\0"
+ VALUE "OriginalFilename", "xsec_3_0D.dll\0"
#else
- VALUE "OriginalFilename", "xsec_2_0.dll\0"
+ VALUE "OriginalFilename", "xsec_3_0.dll\0"
#endif
VALUE "PrivateBuild", "\0"
- VALUE "ProductName", "Santuario C++ XML Security Library\0"
- VALUE "ProductVersion", "2, 0, 4, 0\0"
+ VALUE "ProductName", "C++ XML Security Library\0"
+ VALUE "ProductVersion", "3, 0, 0, 0\0"
VALUE "SpecialBuild", "\0"
END
END
diff --git a/xsec/samples/simpleDecrypt.cpp b/xsec/samples/simpleDecrypt.cpp
index bd5faf30..c32c26c7 100644
--- a/xsec/samples/simpleDecrypt.cpp
+++ b/xsec/samples/simpleDecrypt.cpp
@@ -50,19 +50,6 @@
#include "../utils/XSECDOMUtils.hpp"
-// Xalan
-
-#ifdef XSEC_HAVE_XALAN
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XalanTransformer)
-#endif
-
// OpenSSL
XERCES_CPP_NAMESPACE_USE
@@ -117,9 +104,6 @@ int main (int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
catch (const XMLException &e) {
diff --git a/xsec/samples/simpleEncrypt.cpp b/xsec/samples/simpleEncrypt.cpp
index 3fdcd964..18b99dff 100644
--- a/xsec/samples/simpleEncrypt.cpp
+++ b/xsec/samples/simpleEncrypt.cpp
@@ -46,15 +46,6 @@
// Xalan
-#ifdef XSEC_HAVE_XALAN
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-XALAN_USING_XALAN(XalanTransformer)
-#endif
-
XERCES_CPP_NAMESPACE_USE
DOMElement * g_toEncrypt;
@@ -119,9 +110,6 @@ int main (int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
catch (const XMLException &e) {
diff --git a/xsec/samples/simpleHMAC.cpp b/xsec/samples/simpleHMAC.cpp
index 745d00eb..89449407 100644
--- a/xsec/samples/simpleHMAC.cpp
+++ b/xsec/samples/simpleHMAC.cpp
@@ -45,17 +45,6 @@
#include "../utils/XSECDOMUtils.hpp"
-// Xalan
-
-#ifdef XSEC_HAVE_XALAN
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-XALAN_USING_XALAN(XalanTransformer)
-#endif
-
XERCES_CPP_NAMESPACE_USE
DOMDocument *createLetter(DOMImplementation *impl) {
@@ -97,9 +86,6 @@ int main (int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
catch (const XMLException &e) {
diff --git a/xsec/samples/simpleValidate.cpp b/xsec/samples/simpleValidate.cpp
index 8d8b51c0..d9636c1a 100644
--- a/xsec/samples/simpleValidate.cpp
+++ b/xsec/samples/simpleValidate.cpp
@@ -50,15 +50,6 @@
XERCES_CPP_NAMESPACE_USE
-#ifdef XSEC_HAVE_XALAN
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-XALAN_USING_XALAN(XalanTransformer)
-#endif
-
char docToValidate [4096] = "\
<PurchaseOrder>\n\
<Company>Widgets.Org</Company>\n\
@@ -115,9 +106,6 @@ int main (int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
catch (const XMLException &e) {
diff --git a/xsec/tools/checksig/checksig.cpp b/xsec/tools/checksig/checksig.cpp
index e068f68a..dcf0c828 100644
--- a/xsec/tools/checksig/checksig.cpp
+++ b/xsec/tools/checksig/checksig.cpp
@@ -76,23 +76,6 @@ using std::cerr;
using std::cout;
using std::endl;
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
-
#if defined (XSEC_HAVE_OPENSSL)
// OpenSSL
@@ -101,24 +84,8 @@ XALAN_USING_XALAN(XalanTransformer)
#endif
-#if defined (XSEC_HAVE_WINCAPI)
-
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-
-#endif
-
-#if defined (XSEC_HAVE_NSS)
-
-# include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-# include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-
-#endif
-
#include <time.h>
-#ifndef XSEC_HAVE_XALAN
-
std::ostream& operator<< (std::ostream& target, const XMLCh * s)
{
char *p = XMLString::transcode(s);
@@ -127,8 +94,6 @@ std::ostream& operator<< (std::ostream& target, const XMLCh * s)
return target;
}
-#endif
-
// ----------------------------------------------------------------------------
// Checksig
// ----------------------------------------------------------------------------
@@ -151,15 +116,6 @@ void printUsage(void) {
#if defined (XSEC_HAVE_OPENSSL)
cerr << " --interop/-i\n";
cerr << " Use the interop resolver for Baltimore interop examples\n\n";
-#endif
-#if defined(XSEC_HAVE_WINCAPI)
-# if defined (XSEC_HAVE_OPENSSL)
- cerr << " --wincapi/-w\n";
- cerr << " Use the Windows CAPI crypto Provider\n\n";
-# endif
- cerr << " --winhmackey/-wh <string>\n";
- cerr << " Use the Windows CAPI crypto provider and hash the <string>\n";
- cerr << " into a Windows key using SHA-1\n\n";
#endif
cerr << " Exits with codes :\n";
cerr << " 0 = Signature OK\n";
@@ -178,9 +134,6 @@ int evaluate(int argc, char ** argv) {
bool useXSECURIResolver = false;
bool useAnonymousResolver = false;
bool useInteropResolver = false;
-#if defined (XSEC_HAVE_WINCAPI)
- HCRYPTPROV win32CSP = 0;
-#endif
bool skipRefs = false;
@@ -235,81 +188,6 @@ int evaluate(int argc, char ** argv) {
useAnonymousResolver = true;
paramCount++;
}
-#if defined (XSEC_HAVE_WINCAPI)
- else if (_stricmp(argv[paramCount], "--wincapi") == 0 || _stricmp(argv[paramCount], "-w") == 0 ||
- _stricmp(argv[paramCount], "--winhmackey") == 0 || _stricmp(argv[paramCount], "-wh") == 0) {
-
- WinCAPICryptoProvider * cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
- if (_stricmp(argv[paramCount], "--winhmackey") == 0 || _stricmp(argv[paramCount], "-wh") == 0) {
-
- // Create a SHA-1 based key based on the <string> parameter
-
- paramCount++;
-
- if (!CryptAcquireContext(&win32CSP,
- NULL,
- NULL,
- PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT))
- {
- cerr << "Error obtaining default RSA_PROV" << endl;
- return 2;
- }
-
- HCRYPTKEY k;
- HCRYPTHASH h;
- BOOL fResult = CryptCreateHash(
- win32CSP,
- CALG_SHA,
- 0,
- 0,
- &h);
-
- if (fResult == 0) {
- cerr << "Error creating hash to create windows hmac key from password" << endl;
- return 2;
- }
- fResult = CryptHashData(
- h,
- (unsigned char *) argv[paramCount],
- (DWORD) strlen(argv[paramCount]),
- 0);
-
- if (fResult == 0) {
- cerr << "Error hashing password to create windows hmac key" << endl;
- return 2;
- }
-
- // Now create a key
- fResult = CryptDeriveKey(
- win32CSP,
- CALG_RC2,
- h,
- CRYPT_EXPORTABLE,
- &k);
-
- if (fResult == 0) {
- cerr << "Error deriving key from hash value" << endl;
- return 2;
- }
-
- // Wrap in a WinCAPI object
- WinCAPICryptoKeyHMAC * hk;
- hk = new WinCAPICryptoKeyHMAC(win32CSP);
- hk->setWinKey(k);
-
- key = hk;
-
- CryptDestroyHash(h);
-
- }
-
- paramCount++;
-
- }
-#endif
else {
cerr << "Unknown option: " << argv[paramCount] << endl << endl;
printUsage();
@@ -317,14 +195,6 @@ int evaluate(int argc, char ** argv) {
}
}
-#if defined (XSEC_HAVE_WINCAPI) && !defined(XSEC_HAVE_OPENSSL)
-
- // Use default DSS provider
- WinCAPICryptoProvider * cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
-#endif
-
if (paramCount >= argc) {
printUsage();
return 2;
@@ -557,12 +427,6 @@ int evaluate(int argc, char ** argv) {
retResult = 1;
}
-#if defined (XSEC_HAVE_WINCAPI)
- // Clean up the handle to the CSP
- if (win32CSP != 0)
- CryptReleaseContext(win32CSP, 0);
-#endif
-
// Janitor will clean up the parser
return retResult;
@@ -591,10 +455,6 @@ int main(int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
@@ -609,10 +469,6 @@ int main(int argc, char **argv) {
retResult = evaluate(argc, argv);
XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
XMLPlatformUtils::Terminate();
#if defined (_DEBUG) && defined (_MSC_VER)
diff --git a/xsec/tools/cipher/XencInteropResolver.cpp b/xsec/tools/cipher/XencInteropResolver.cpp
index 733a2417..5ddf8547 100644
--- a/xsec/tools/cipher/XencInteropResolver.cpp
+++ b/xsec/tools/cipher/XencInteropResolver.cpp
@@ -56,16 +56,6 @@ XERCES_CPP_NAMESPACE_USE
# include <xsec/enc/OpenSSL/OpenSSLCryptoSymmetricKey.hpp>
#endif
-#if defined (XSEC_HAVE_WINCAPI)
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp>
-#endif
-
-#if defined (XSEC_HAVE_NSS)
-# include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-# include <xsec/enc/NSS/NSSCryptoSymmetricKey.hpp>
-#endif
-
// --------------------------------------------------------------------------------
// Merlin Xenc-Five keys and Strings
// --------------------------------------------------------------------------------
@@ -511,8 +501,6 @@ XSECCryptoKey * XencInteropResolver::resolveKey(const DSIGKeyInfoList * lst) con
if (XCX509 != 0) {
#if defined (XSEC_HAVE_OPENSSL)
-
-
if (strEquals(XCX509->getProviderName(),DSIGConstants::s_unicodeStrPROVOpenSSL)) {
OpenSSLCryptoX509 * OSSLX509 = (OpenSSLCryptoX509 *) XCX509;
@@ -537,16 +525,6 @@ XSECCryptoKey * XencInteropResolver::resolveKey(const DSIGKeyInfoList * lst) con
return k;
}
-#if defined (XSEC_HAVE_WINCAPI)
- else {
-#endif /* XSEC_HAVE_WINCAPI */
-#endif /* XSEC_HAVE_OPENSSL */
-
-#if defined (XSEC_HAVE_WINCAPI)
- std::cerr << "WARNING - Unable to load PKCS8 private key file into Windows CAPI" << std::endl;
-#if defined (XSEC_HAVE_OPENSSL)
- }
-#endif /* XSEC_HAVE_WINCAPI */
#endif /* XSEC_HAVE_OPENSSL */
}
}
diff --git a/xsec/tools/cipher/cipher.cpp b/xsec/tools/cipher/cipher.cpp
index 07b51b0b..0b8de003 100644
--- a/xsec/tools/cipher/cipher.cpp
+++ b/xsec/tools/cipher/cipher.cpp
@@ -86,22 +86,6 @@ using std::cout;
using std::endl;
using std::ostream;
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
#if defined (XSEC_HAVE_OPENSSL)
// OpenSSL
@@ -115,26 +99,8 @@ XALAN_USING_XALAN(XalanTransformer)
#endif
-#if defined (XSEC_HAVE_WINCAPI)
-
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoSymmetricKey.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-
-#endif
-
-#if defined (XSEC_HAVE_NSS)
-
-# include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-# include <xsec/enc/NSS/NSSCryptoSymmetricKey.hpp>
-# include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-
-#endif
-
#include <time.h>
-#ifndef XSEC_HAVE_XALAN
-
std::ostream& operator<< (std::ostream& target, const XMLCh * s)
{
char *p = XMLString::transcode(s);
@@ -143,8 +109,6 @@ std::ostream& operator<< (std::ostream& target, const XMLCh * s)
return target;
}
-#endif
-
// ----------------------------------------------------------------------------
// Checksig
// ----------------------------------------------------------------------------
@@ -178,23 +142,10 @@ void printUsage(void) {
cerr << " <filename> - for X509 PEM files (must be an RSA KEK certificate\n";
cerr << " <filename> <password> - for RSA private key files (MUST be a KEK)\n";
cerr << " <key-string> - For a string to use as the key for AES or DES keys\n";
-#ifdef XSEC_XKMS_ENABLED
- cerr << " --xkms/-x\n";
- cerr << " The key that follows on the command line is to be interpreted as\n";
- cerr << " an XKMS RSAKeyPair encryption key\n";
-#endif
cerr << " --interop/-i\n";
cerr << " Use the interop resolver for Baltimore interop examples\n";
cerr << " --out-file/-o\n";
cerr << " Output the result to the indicated file (rather than stdout)\n";
-#ifdef XSEC_HAVE_WINCAPI
- cerr << " --wincapi/-w\n";
- cerr << " Force use of Windows Crypto API\n";
-#endif
-#ifdef XSEC_HAVE_NSS
- cerr << " --nss/-n\n";
- cerr << " Force use of NSS Crypto API\n";
-#endif
cerr << "\n Exits with codes :\n";
cerr << " 0 = Decrypt/Encrypt OK\n";
@@ -215,9 +166,6 @@ int evaluate(int argc, char ** argv) {
bool encryptFileAsData = false;
bool parseXMLInput = true;
bool doXMLOutput = false;
-#ifdef XSEC_XKMS_ENABLED
- bool isXKMSKey = false;
-#endif
XSECCryptoKey * kek = NULL;
XSECCryptoKey * key = NULL;
int keyLen = 0;
@@ -227,15 +175,6 @@ int evaluate(int argc, char ** argv) {
unsigned char keyBuf[24];
XMLFormatTarget *formatTarget ;
-#if defined(_WIN32) && defined (XSEC_HAVE_WINCAPI)
- HCRYPTPROV win32DSSCSP = 0; // Crypto Providers
- HCRYPTPROV win32RSACSP = 0;
-
- CryptAcquireContext(&win32DSSCSP, NULL, NULL, PROV_DSS, CRYPT_VERIFYCONTEXT);
- CryptAcquireContext(&win32RSACSP, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
-
-#endif
-
if (argc < 2) {
printUsage();
@@ -284,28 +223,6 @@ int evaluate(int argc, char ** argv) {
outfile = argv[paramCount];
paramCount++;
}
-#ifdef XSEC_XKMS_ENABLED
- else if (_stricmp(argv[paramCount], "--xkms") == 0 || _stricmp(argv[paramCount], "-x") == 0) {
- paramCount++;
- isXKMSKey = true;
- }
-#endif
-#ifdef XSEC_HAVE_WINCAPI
- else if (_stricmp(argv[paramCount], "--wincapi") == 0 || _stricmp(argv[paramCount], "-w") == 0) {
- // Use the interop key resolver
- WinCAPICryptoProvider * cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
- paramCount++;
- }
-#endif
-#ifdef XSEC_HAVE_NSS
- else if (_stricmp(argv[paramCount], "--nss") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- // NSS Crypto Provider
- NSSCryptoProvider * cp = new NSSCryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
- paramCount++;
- }
-#endif
else if (_stricmp(argv[paramCount], "--key") == 0 || _stricmp(argv[paramCount], "-k") == 0) {
// Have a key!
@@ -392,20 +309,10 @@ int evaluate(int argc, char ** argv) {
XSECCryptoSymmetricKey * sk =
XSECPlatformUtils::g_cryptoProvider->keySymmetric(loadKeyAs);
-#ifdef XSEC_XKMS_ENABLED
- if (isXKMSKey) {
- unsigned char kbuf[XSEC_MAX_HASH_SIZE];
- CalculateXKMSKEK((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), kbuf, XSEC_MAX_HASH_SIZE);
- sk->setKey(kbuf, keyLen);
- }
- else {
-#endif
- memset(keyStr, 0, 64);
- strcpy((char *) keyStr, argv[paramCount]);
- sk->setKey(keyStr, keyLen);
-#ifdef XSEC_XKMS_ENABLED
- }
-#endif
+ memset(keyStr, 0, 64);
+ strcpy((char *) keyStr, argv[paramCount]);
+ sk->setKey(keyStr, keyLen);
+
paramCount++;
if (isKEK)
kek = sk;
@@ -851,10 +758,6 @@ int main(int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
@@ -869,10 +772,6 @@ int main(int argc, char **argv) {
retResult = evaluate(argc, argv);
XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
XMLPlatformUtils::Terminate();
#if defined (_DEBUG) && defined (_MSC_VER)
diff --git a/xsec/tools/siginf/siginf.cpp b/xsec/tools/siginf/siginf.cpp
index 03b990d5..4b155783 100644
--- a/xsec/tools/siginf/siginf.cpp
+++ b/xsec/tools/siginf/siginf.cpp
@@ -79,23 +79,6 @@ using std::cout;
using std::endl;
using std::ostream;
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#else
-
ostream& operator<< (ostream& target, const XMLCh * s)
{
char *p = XMLString::transcode(s);
@@ -104,8 +87,6 @@ ostream& operator<< (ostream& target, const XMLCh * s)
return target;
}
-#endif
-
class X2C {
public:
@@ -513,10 +494,6 @@ int main(int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
@@ -531,10 +508,6 @@ int main(int argc, char **argv) {
retResult = evaluate(argc, argv);
XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
XMLPlatformUtils::Terminate();
#if defined (_DEBUG) && defined (_MSC_VER)
diff --git a/xsec/tools/templatesign/templatesign.cpp b/xsec/tools/templatesign/templatesign.cpp
index 4c47989b..40c3a598 100644
--- a/xsec/tools/templatesign/templatesign.cpp
+++ b/xsec/tools/templatesign/templatesign.cpp
@@ -56,13 +56,6 @@
#endif
-#if defined(XSEC_HAVE_WINCAPI)
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyDSA.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-#endif
-
#include "../../utils/XSECDOMUtils.hpp"
#include <memory.h>
@@ -88,22 +81,6 @@
#include <xercesc/util/XMLNetAccessor.hpp>
#include <xercesc/util/XMLUri.hpp>
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
using std::ostream;
using std::cout;
@@ -506,16 +483,10 @@ void printUsage(void) {
cerr << " --dsakey/-d <dsa private key file> <password>\n";
cerr << " <dsa private key file> contains a PEM encoded private key\n";
cerr << " <password> is the password used to decrypt the key file\n";
-# if defined (XSEC_HAVE_WINCAPI)
- cerr << " NOTE: Not usable if --wincapi previously set\n";
-# endif
# if defined(XSEC_OPENSSL_HAVE_EC)
cerr << " --eckey/-e <ec private key file> <password>\n";
cerr << " <ec private key file> contains a PEM encoded private key\n";
cerr << " <password> is the password used to decrypt the key file\n";
-# endif
-# if defined (XSEC_HAVE_WINCAPI)
- cerr << " NOTE: Not usable if --wincapi previously set\n";
# endif
cerr << " --rsakey/-r <rsa private key file> <password>\n";
cerr << " <rsa privatekey file> contains a PEM encoded private key\n";
@@ -527,27 +498,6 @@ void printUsage(void) {
cerr << " <string> is the hmac key to set\n";
cerr << " --clearkeys/-c\n";
cerr << " Clears out any current KeyInfo elements in the file\n";
-#if defined(XSEC_HAVE_WINCAPI)
- cerr << " --windss/-wd\n";
- cerr << " Use the default user AT_SIGNATURE key from default\n";
- cerr << " Windows DSS CSP\n";
- cerr << " --winrsa/-wr\n";
- cerr << " Use the default user AT_SIGNATURE key from default\n";
- cerr << " Windows RSA CSP\n";
- cerr << " --winhmac/-wh <string>\n";
- cerr << " Create a windows HMAC key using <string> as the password.\n";
- cerr << " Uses a SHA-1 hash of the password to derive a key\n";
-#if defined (CRYPT_ACQUIRE_CACHE_FLAG)
- cerr << " --wincer/-wc <Subject Name>\n";
- cerr << " Use the private key associated with the named certificate in the Windows certificate store\n";
-#endif /* CRYPT_ACQUIRE_CACHE_FLAG */
- cerr << " --windsskeyinfo/-wdi\n";
- cerr << " Clear KeyInfo elements and insert DSS parameters from windows key\n";
- cerr << " --winrsakeyinfo/-wri\n";
- cerr << " Clear KeyInfo elements and insert RSA parameters from windows key\n";
-#endif
-
-
}
int main(int argc, char **argv) {
@@ -561,34 +511,17 @@ int main(int argc, char **argv) {
int certCount = 0;
int paramCount;
bool clearKeyInfo = false;
-#if defined(XSEC_HAVE_WINCAPI)
- HCRYPTPROV win32DSSCSP = 0; // Crypto Provider
- HCRYPTPROV win32RSACSP = 0; // Crypto Provider
- bool winDssKeyInfo = false;
- bool winRsaKeyInfo = false;
- WinCAPICryptoKeyDSA * winKeyDSA = NULL;
- WinCAPICryptoKeyRSA * winKeyRSA = NULL;
-#endif
// Initialise the XML system
try {
-
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
-
}
-
catch (const XMLException &e) {
-
cerr << "Error during initialisation of Xerces" << endl;
cerr << "Error Message = : "
<< e.getMessage() << endl;
-
}
#if defined (XSEC_HAVE_OPENSSL)
@@ -793,249 +726,6 @@ int main(int argc, char **argv) {
paramCount += 1;
}
-
-#if defined (XSEC_HAVE_WINCAPI)
- else if (_stricmp(argv[paramCount], "--windss") == 0 || _stricmp(argv[paramCount], "-wd") == 0) {
-
- WinCAPICryptoProvider * cp;
- // First set windows as the crypto provider
- cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
- // Now set the key
- if (!CryptAcquireContext(&win32DSSCSP,
- NULL,
- NULL,
- PROV_DSS,
- 0)) {
-
- cerr << "Error acquiring Crypto context - Attempting to generate new key pair" << endl;
-
- // Attempt to gen a new keyset
- if (!CryptAcquireContext(&win32DSSCSP,
- NULL,
- NULL,
- PROV_DSS,
- CRYPT_NEWKEYSET)) {
- cerr << "Error acquiring DSS Crypto Service Provider with new keyset" << endl;
- return 2;
- }
- else {
- HCRYPTKEY k;
- if (!CryptGenKey(win32DSSCSP, AT_SIGNATURE, CRYPT_EXPORTABLE, &k)) {
- cerr << "Error generating DSS keyset" << endl;
- return 2;
- }
- CryptDestroyKey(k);
- }
- }
-
- winKeyDSA = new WinCAPICryptoKeyDSA(win32DSSCSP, AT_SIGNATURE, true);
- key = winKeyDSA;
- paramCount++;
- }
-
- else if (_stricmp(argv[paramCount], "--winrsa") == 0 || _stricmp(argv[paramCount], "-wr") == 0) {
- WinCAPICryptoProvider * cp;
- cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
- if (!CryptAcquireContext(&win32RSACSP,
- NULL,
- NULL,
- PROV_RSA_FULL,
- 0)) {
-
- cerr << "Error acquiring Crypto context - Attempting to generate new RSA key pair" << endl;
-
- // Attempt to gen a new keyset
- if (!CryptAcquireContext(&win32RSACSP,
- NULL,
- NULL,
- PROV_RSA_FULL,
- CRYPT_NEWKEYSET)) {
- cerr << "Error acquiring RSA Crypto Service Provider with new keyset" << endl;
- return 2;
- }
- else {
- HCRYPTKEY k;
- if (!CryptGenKey(win32RSACSP, AT_SIGNATURE, CRYPT_EXPORTABLE, &k)) {
- cerr << "Error generating RSA keyset" << endl;
- return 2;
- }
- CryptDestroyKey(k);
- }
- }
-
- winKeyRSA = new WinCAPICryptoKeyRSA(win32RSACSP, AT_SIGNATURE, true);
- key = winKeyRSA;
- paramCount++;
- }
-
- else if (_stricmp(argv[paramCount], "--winhmac") == 0 || _stricmp(argv[paramCount], "-wh") == 0) {
-
- WinCAPICryptoProvider * cp;
- // Obtain default PROV_RSA, with default user key container
- // Note we open in VERIFYCONTEXT as we do not require a assymetric key pair
- if (!CryptAcquireContext(&win32RSACSP,
- NULL,
- NULL,
- PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT)) {
- cerr << "Error acquiring RSA Crypto Service Provider" << endl;
- return 2;
- }
- cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
- paramCount++;
- HCRYPTKEY k;
- HCRYPTHASH h;
- BOOL fResult = CryptCreateHash(
- win32RSACSP,
- CALG_SHA,
- 0,
- 0,
- &h);
-
- if (fResult == 0) {
- cerr << "Error creating hash to create windows hmac key from password" << endl;
- return 2;
- }
- fResult = CryptHashData(
- h,
- (unsigned char *) argv[paramCount],
- (DWORD) strlen(argv[paramCount]),
- 0);
-
- if (fResult == 0) {
- cerr << "Error hashing password to create windows hmac key" << endl;
- return 2;
- }
-
- // Now create a key
- fResult = CryptDeriveKey(
- win32RSACSP,
- CALG_RC2,
- h,
- CRYPT_EXPORTABLE,
- &k);
-
- if (fResult == 0) {
- cerr << "Error deriving key from hash value" << endl;
- return 2;
- }
-
- // Wrap in a WinCAPI object
- WinCAPICryptoKeyHMAC * hk;
- hk = new WinCAPICryptoKeyHMAC(win32RSACSP);
- hk->setWinKey(k);
-
- key = hk;
-
- CryptDestroyHash(h);
- paramCount++;
-
- }
-
- else if (_stricmp(argv[paramCount], "--windsskeyinfo") == 0 || _stricmp(argv[paramCount], "-wdi") == 0) {
- winDssKeyInfo = true;
- paramCount++;
- }
-
- else if (_stricmp(argv[paramCount], "--winrsakeyinfo") == 0 || _stricmp(argv[paramCount], "-wri") == 0) {
- winRsaKeyInfo = true;
- paramCount++;
- }
-
- // Need to find a better way to check this
- // If CryptAcquireCertificatePrivateKey is not defined in the included
- // version of wincapi.h, CRYPT_ACQUIRE_CACHE_FLAG will not be set
-
-#if defined (CRYPT_ACQUIRE_CACHE_FLAG)
-
- // Code provided by Milan Tomic
-
- //Please note that this example below use CryptAcquireCertificatePrivateKey() function
- //which is not declared in wincrypt.h that ships with VC++ 6. If you would like to run
- //this example you'll need to replace your old wincrypt.h and crypt32.lib with new versions.
- //This example below is compatible with Windows 98/IE 5 and above OS/IE versions.
-
- else if (_stricmp(argv[paramCount], "--wincer") == 0 || _stricmp(argv[paramCount], "-wc") == 0) {
- WinCAPICryptoProvider * cp;
- PCCERT_CONTEXT pSignerCert = NULL;
- DWORD dwKeySpec;
- HCERTSTORE hStoreHandle;
- #define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
-
- // Obtain default PROV_DSS with default user key container
- if (!CryptAcquireContext(&win32DSSCSP,
- NULL,
- NULL,
- PROV_DSS,
- 0)) {
- cerr << "Error acquiring DSS Crypto Service Provider" << endl;
- return 2;
- }//*/
-
- // Open 'Personal' certificate store
- if (!(hStoreHandle = CertOpenStore(CERT_STORE_PROV_SYSTEM,
- 0,
- NULL,
- CERT_SYSTEM_STORE_CURRENT_USER,
- L"MY"))) {
- cerr << "Error opening 'Personal' store." << endl;
- return 2;
- }
-
- // Find desired cerificate
- if (!(pSignerCert = CertFindCertificateInStore(hStoreHandle,
- MY_ENCODING_TYPE,
- 0,
- CERT_FIND_SUBJECT_STR_A,
- argv[paramCount+1],
- NULL))) {
- cerr << "Can't find '" << argv[paramCount+1] << "' certificate in 'Personal' store." << endl;
- return 2;
- }
-
- // Now get certificate's private key
- if (!CryptAcquireCertificatePrivateKey(pSignerCert,
- 0,
- NULL,
- &win32RSACSP,
- &dwKeySpec,
- NULL)) {
- cerr << "Can't acquire private key of '" << argv[paramCount+1] << "' certificate." << endl;
- exit(1);
- }
-
- cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
-
- HCRYPTKEY k;
- BOOL fResult = CryptGetUserKey(
- win32RSACSP,
- dwKeySpec,
- &k);
-
- if (!fResult || k == 0) {
- cerr << "Error obtaining default user (AT_SIGNATURE or AT_KEYEXCHANGE) key from windows RSA provider.\n";
- exit(1);
- };
-
- winKeyRSA = new WinCAPICryptoKeyRSA(win32RSACSP, k);
- key = winKeyRSA;
- paramCount += 2;
-
- CertFreeCertificateContext(pSignerCert);
- CertCloseStore(hStoreHandle, 0);
- }
-
-#endif /* CRYPT_ACQUIRE_CACHE_FLAG */
-
-#endif /* XSEC_HAVE_WINCAPI */
-
else {
printUsage();
@@ -1165,50 +855,6 @@ int main(int argc, char **argv) {
sig->sign();
// Add any KeyInfo elements
-
-#if defined(XSEC_HAVE_WINCAPI)
-
- if (winDssKeyInfo == true && winKeyDSA != NULL) {
- char pBuf[1024];
- char qBuf[1024];
- char gBuf[1024];
- char yBuf[1024];
-
- unsigned int i;
- i = winKeyDSA->getPBase64BigNums((char *) pBuf, 1024);
- pBuf[i] = '\0';
- i = winKeyDSA->getQBase64BigNums((char *) qBuf, 1024);
- qBuf[i] = '\0';
- i = winKeyDSA->getGBase64BigNums((char *) gBuf, 1024);
- gBuf[i] = '\0';
- i = winKeyDSA->getYBase64BigNums((char *) yBuf, 1024);
- yBuf[i] = '\0';
-
- sig->clearKeyInfo();
- sig->appendDSAKeyValue(
- MAKE_UNICODE_STRING(pBuf),
- MAKE_UNICODE_STRING(qBuf),
- MAKE_UNICODE_STRING(gBuf),
- MAKE_UNICODE_STRING(yBuf));
- }
-
- if (winRsaKeyInfo == true && winKeyRSA != NULL) {
- char eBuf[1024];
- char mBuf[1024];
-
- unsigned int i;
- i = winKeyRSA->getExponentBase64BigNums((char *) eBuf, 1024);
- eBuf[i] = '\0';
- i = winKeyRSA->getModulusBase64BigNums((char *) mBuf, 1024);
- mBuf[i] = '\0';
-
- sig->clearKeyInfo();
- sig->appendRSAKeyValue(
- MAKE_UNICODE_STRING(mBuf),
- MAKE_UNICODE_STRING(eBuf));
- }
-
-#endif
#if defined (XSEC_HAVE_OPENSSL)
if (certCount > 0) {
@@ -1319,22 +965,11 @@ int main(int argc, char **argv) {
delete gFormatter;
delete formatTarget;
-#if defined (_WIN32) && defined (XSEC_HAVE_WINCAPI)
- if (win32DSSCSP != 0)
- CryptReleaseContext(win32DSSCSP,0);
- if (win32RSACSP != 0)
- CryptReleaseContext(win32RSACSP,0);
-#endif
-
prov->releaseSignature(sig);
delete parser;
delete prov;
XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
XMLPlatformUtils::Terminate();
diff --git a/xsec/tools/threadTest/threadtest.cpp b/xsec/tools/threadTest/threadtest.cpp
index 696702bd..7f15bb0d 100644
--- a/xsec/tools/threadTest/threadtest.cpp
+++ b/xsec/tools/threadTest/threadtest.cpp
@@ -37,11 +37,7 @@
#if defined (XSEC_HAVE_OPENSSL)
# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyHMAC.hpp>
#else
-# if defined (XSEC_HAVE_WINCAPI)
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-# else
-# error No crypto provider available
-# endif
+# error No crypto provider available
#endif
#include "../../utils/XSECDOMUtils.hpp"
@@ -263,12 +259,10 @@ DWORD WINAPI doSignThread (LPVOID Param) {
#if defined (XSEC_HAVE_OPENSSL)
OpenSSLCryptoKeyHMAC * hmacKey = new OpenSSLCryptoKeyHMAC();
-#else
- WinCAPICryptoKeyHMAC * hmacKey = new WinCAPICryptoKeyHMAC(0);
-#endif
hmacKey->setKey((unsigned char *) "secret", (unsigned int) strlen("secret"));
sig->setSigningKey(hmacKey);
sig->sign();
+#endif
g_provider->releaseSignature(sig);
@@ -377,10 +371,6 @@ DWORD WINAPI doVerifyThread (LPVOID Param) {
#if defined (XSEC_HAVE_OPENSSL)
OpenSSLCryptoKeyHMAC *hmacKey = new OpenSSLCryptoKeyHMAC();
-#else
- WinCAPICryptoKeyHMAC *hmacKey = new WinCAPICryptoKeyHMAC(0);
-#endif
-
hmacKey->setKey((unsigned char *) secretKey, (unsigned int) strlen(secretKey));
sig->setSigningKey(hmacKey);
sig->load();
@@ -390,6 +380,7 @@ DWORD WINAPI doVerifyThread (LPVOID Param) {
g_errors++;
g_initMutex.unlock();
}
+#endif
g_provider->releaseSignature(sig);
diff --git a/xsec/tools/txfmout/txfmout.cpp b/xsec/tools/txfmout/txfmout.cpp
index f10b4d3b..0af21947 100644
--- a/xsec/tools/txfmout/txfmout.cpp
+++ b/xsec/tools/txfmout/txfmout.cpp
@@ -77,23 +77,6 @@ using std::cerr;
using std::endl;
using std::ofstream;
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#else
-
std::ostream& operator<< (std::ostream& target, const XMLCh * s)
{
char *p = XMLString::transcode(s);
@@ -102,8 +85,6 @@ std::ostream& operator<< (std::ostream& target, const XMLCh * s)
return target;
}
-#endif
-
// ---------------------------------------------------------------------------
// Outputter
// ---------------------------------------------------------------------------
@@ -408,10 +389,6 @@ int main(int argc, char **argv) {
try {
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
}
diff --git a/xsec/tools/xklient/xklient.cpp b/xsec/tools/xklient/xklient.cpp
deleted file mode 100644
index bc7f67eb..00000000
--- a/xsec/tools/xklient/xklient.cpp
+++ /dev/null
@@ -1,4779 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * xklient := Act as a client for an XKMS service
- *
- * $Id$
- *
- */
-
-// XSEC
-
-#include <xsec/utils/XSECPlatformUtils.hpp>
-#include <xsec/framework/XSECProvider.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/canon/XSECC14n20010315.hpp>
-#include <xsec/dsig/DSIGSignature.hpp>
-#include <xsec/dsig/DSIGKeyInfoX509.hpp>
-#include <xsec/dsig/DSIGKeyInfoValue.hpp>
-#include <xsec/dsig/DSIGKeyInfoName.hpp>
-#include <xsec/framework/XSECException.hpp>
-#include <xsec/enc/XSECCryptoException.hpp>
-#include <xsec/enc/XSCrypt/XSCryptCryptoBase64.hpp>
-#include <xsec/enc/XSECCryptoUtils.hpp>
-#include <xsec/enc/XSECKeyInfoResolverDefault.hpp>
-
-#include <xsec/xkms/XKMSCompoundRequest.hpp>
-#include <xsec/xkms/XKMSCompoundResult.hpp>
-#include <xsec/xkms/XKMSPendingRequest.hpp>
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-#include <xsec/xkms/XKMSLocateRequest.hpp>
-#include <xsec/xkms/XKMSLocateResult.hpp>
-#include <xsec/xkms/XKMSStatusRequest.hpp>
-#include <xsec/xkms/XKMSStatusResult.hpp>
-#include <xsec/xkms/XKMSResult.hpp>
-#include <xsec/xkms/XKMSQueryKeyBinding.hpp>
-#include <xsec/xkms/XKMSKeyBinding.hpp>
-#include <xsec/xkms/XKMSUseKeyWith.hpp>
-#include <xsec/xkms/XKMSConstants.hpp>
-#include <xsec/xkms/XKMSValidateRequest.hpp>
-#include <xsec/xkms/XKMSValidateResult.hpp>
-#include <xsec/xkms/XKMSRegisterRequest.hpp>
-#include <xsec/xkms/XKMSRegisterResult.hpp>
-#include <xsec/xkms/XKMSAuthentication.hpp>
-#include <xsec/xkms/XKMSPrototypeKeyBinding.hpp>
-#include <xsec/xkms/XKMSRevokeRequest.hpp>
-#include <xsec/xkms/XKMSRevokeResult.hpp>
-#include <xsec/xkms/XKMSRecoverRequest.hpp>
-#include <xsec/xkms/XKMSRecoverResult.hpp>
-#include <xsec/xkms/XKMSReissueRequest.hpp>
-#include <xsec/xkms/XKMSReissueResult.hpp>
-#include <xsec/xkms/XKMSRevokeKeyBinding.hpp>
-#include <xsec/xkms/XKMSRecoverKeyBinding.hpp>
-#include <xsec/xkms/XKMSReissueKeyBinding.hpp>
-#include <xsec/xkms/XKMSRSAKeyPair.hpp>
-
-#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-// General
-
-#include <memory.h>
-#include <string.h>
-#include <iostream>
-#include <stdlib.h>
-
-#if !defined(_WIN32)
-# include <sys/time.h>
-# include <time.h>
-#endif
-
-#if defined (_DEBUG) && defined (_MSC_VER)
-#include <crtdbg.h>
-#endif
-
-
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLString.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/parsers/XercesDOMParser.hpp>
-#include <xercesc/framework/StdOutFormatTarget.hpp>
-#include <xercesc/util/XMLException.hpp>
-#include <xercesc/framework/LocalFileInputSource.hpp>
-#include <xercesc/util/XMLUri.hpp>
-#include <xercesc/util/Janitor.hpp>
-#include <xercesc/sax/ErrorHandler.hpp>
-#include <xercesc/sax/SAXParseException.hpp>
-#include <xercesc/sax/EntityResolver.hpp>
-#include <xercesc/sax/InputSource.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-using std::cerr;
-using std::cout;
-using std::endl;
-using std::ostream;
-
-#ifdef XSEC_HAVE_XALAN
-
-// XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
-
-#if defined (XSEC_HAVE_OPENSSL)
-// OpenSSL
-
-# include <openssl/err.h>
-# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyDSA.hpp>
-# include <xsec/enc/OpenSSL/OpenSSLCryptoBase64.hpp>
-# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp>
-# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyHMAC.hpp>
-# include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>
-# include <xsec/enc/OpenSSL/OpenSSLSupport.hpp>
-
-# include <openssl/bio.h>
-# include <openssl/dsa.h>
-# include <openssl/err.h>
-# include <openssl/evp.h>
-# include <openssl/pem.h>
-
-#endif
-
-// --------------------------------------------------------------------------------
-// Global definitions
-// --------------------------------------------------------------------------------
-
-bool g_txtOut = false;
-char * g_authPassPhrase = NULL;
-char * g_privateKeyFile = NULL;
-char * g_privateKeyPassPhrase = NULL;
-
-int doParsedMsgDump(DOMDocument * doc);
-
-// --------------------------------------------------------------------------------
-// General functions
-// --------------------------------------------------------------------------------
-
-
-#ifndef XSEC_HAVE_XALAN
-
-ostream& operator<< (ostream& target, const XMLCh * s)
-{
- char *p = XMLString::transcode(s);
- target << p;
- XSEC_RELEASE_XMLCH(p);
- return target;
-}
-
-#endif
-
-class X2C {
-
-public:
-
- X2C(const XMLCh * in) {
- mp_cStr = XMLString::transcode(in);
- }
- ~X2C() {
- XSEC_RELEASE_XMLCH(mp_cStr);
- }
-
- char * str(void) {
- return mp_cStr;
- }
-
-private :
-
- char * mp_cStr;
-
-};
-
-ostream & operator<<(ostream& target, X2C &x) {
- target << x.str();
- return target;
-}
-
-inline
-void levelSet(unsigned int level) {
-
- for (unsigned int i = 0; i < level; ++i)
- cout << " ";
-
-}
-
-void outputDoc(DOMDocument * doc) {
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
- XMLFormatTarget *formatTarget = new StdOutFormatTarget();
-
- cerr << endl;
-
- DOMLSSerializer *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
-
- // Get the config so we can set up pretty printing
- DOMConfiguration *dc = theSerializer->getDomConfig();
- dc->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, false);
-
- // Now create an output object to format to UTF-8
- DOMLSOutput *theOutput = ((DOMImplementationLS*)impl)->createLSOutput();
- Janitor<DOMLSOutput> j_theOutput(theOutput);
-
- theOutput->setEncoding(MAKE_UNICODE_STRING("UTF-8"));
- theOutput->setByteStream(formatTarget);
-
- theSerializer->write(doc, theOutput);
-
- cout << endl;
-
- cerr << endl;
-
- delete theSerializer;
- delete formatTarget;
-
-}
-
-XSECCryptoX509 * loadX509(const char * infile) {
-
- FILE * f = fopen(infile, "r");
- if (f == NULL)
- return NULL;
-
- safeBuffer sb;
- char buf[1024];
-
- int i = (int) fread(buf, 1, 1024, f);
- int j = 0;
- while (i != 0) {
- sb.sbMemcpyIn(j, buf, i);
- j += i;
- i = (int) fread(buf, 1, 1024, f);
- }
-
- fclose(f);
-
- sb[j] = '\0';
-
- XSECCryptoX509 * ret =
- XSECPlatformUtils::g_cryptoProvider->X509();
-
- ret->loadX509PEM(sb.rawCharBuffer());
-
- return ret;
-
-}
-
-#if defined (XSEC_HAVE_OPENSSL)
-
-XMLCh * BN2b64(const BIGNUM * bn) {
-
- int bytes = BN_num_bytes(bn);
- unsigned char * binbuf = new unsigned char[bytes + 1];
- ArrayJanitor<unsigned char> j_binbuf(binbuf);
-
- bytes = BN_bn2bin(bn, binbuf);
-
-
- int bufLen = bytes * 4;
- int len = bufLen;
- unsigned char * buf;
- XSECnew(buf, unsigned char[bufLen]);
- ArrayJanitor<unsigned char> j_buf(buf);
-
- XSCryptCryptoBase64 *b64;
- XSECnew(b64, XSCryptCryptoBase64);
- Janitor<XSCryptCryptoBase64> j_b64(b64);
-
- b64->encodeInit();
- bufLen = b64->encode(binbuf, bytes, buf, bufLen);
- bufLen += b64->encodeFinish(&buf[bufLen], len-bufLen);
- buf[bufLen] = '\0';
-
- // Now translate to a bignum
- return XMLString::transcode((char *) buf);
-
-}
-
-#endif
-
-DSIGKeyInfoX509 * findX509Data(DSIGKeyInfoList * lst) {
-
- if (lst == NULL)
- return NULL;
-
- int sz = (int) lst->getSize();
- for (int i = 0; i < sz; ++i) {
-
- DSIGKeyInfo *ki = lst->item(i);
- if (ki->getKeyInfoType() == DSIGKeyInfo::KEYINFO_X509)
- return (DSIGKeyInfoX509*) ki;
-
- }
-
- return NULL;
-
-}
-
-// --------------------------------------------------------------------------------
-// ErrorHandler
-// --------------------------------------------------------------------------------
-
-class xkmsErrorHandler : public ErrorHandler {
-
-public:
-
- xkmsErrorHandler() {}
- ~xkmsErrorHandler() {}
-
- // Interface
- virtual void warning (const SAXParseException &exc);
- virtual void error (const SAXParseException &exc);
- virtual void fatalError (const SAXParseException &exc);
- virtual void resetErrors ();
-
-private:
-
- void outputError(const SAXParseException &exc);
-
-};
-
-void xkmsErrorHandler::outputError(const SAXParseException &exc) {
-
- char * systemId = XMLString::transcode(exc.getSystemId());
- char * msg = XMLString::transcode(exc.getMessage());
- if (exc.getLineNumber() > 0 || exc.getColumnNumber() > 0) {
- cerr << "File: " << systemId << " Line : " << exc.getLineNumber() << " Column : "
- << exc.getColumnNumber() << ". " << msg << endl;
- }
- else {
- cerr << msg << endl;
- }
- XSEC_RELEASE_XMLCH(msg);
- XSEC_RELEASE_XMLCH(systemId);
-
-}
-
-void xkmsErrorHandler::warning(const SAXParseException &exc) {
-
- cerr << "Parser warning - ";
- outputError(exc);
-
-}
-
-void xkmsErrorHandler::error (const SAXParseException &exc) {
-
- cerr << "Parser error - ";
- outputError(exc);
-
-}
-
-void xkmsErrorHandler::fatalError (const SAXParseException &exc) {
-
- cerr << "Parser fatal error - ";
- outputError(exc);
-
-}
-
-void xkmsErrorHandler::resetErrors () {
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Create a LocateRequest
-// --------------------------------------------------------------------------------
-
-void printLocateRequestUsage(void) {
-
- cerr << "\nUsage LocateRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-cert/-a <filename> : add cert in filename as a KeyInfo\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Excange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-responselimit/-l <limit>\n";
- cerr << " : Set <limit> for ResponseLimit\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-rsa/-sr <filename> <passphrase>\n";
- cerr << " : Sign using the RSA key in file protected by passphrase\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n\n";
-
-}
-
-XKMSMessageAbstractType * createLocateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printLocateRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSLocateRequest * lr;
- if (cr == NULL)
- lr = factory->createLocateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- lr = cr->createLocateRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-cert") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- XSECCryptoX509 * x = loadX509(argv[paramCount]);
- if (x == NULL) {
- delete lr;
- (*doc)->release();
- cerr << "Error opening Certificate file : " <<
- argv[paramCount] << endl;
- return NULL;
- }
-
- Janitor<XSECCryptoX509> j_x(x);
-
- XKMSQueryKeyBinding * qkb = lr->getQueryKeyBinding();
- if (qkb == NULL) {
- qkb = lr->addQueryKeyBinding();
- }
- // See if there is already an X.509 element
- DSIGKeyInfoX509 * kix;
- if ((kix = findX509Data(qkb->getKeyInfoList())) == NULL)
- kix = qkb->appendX509Data();
- safeBuffer sb = x->getDEREncodingSB();
- kix->appendX509Certificate(sb.sbStrToXMLCh());
- paramCount++;
- }
-
- else if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- XKMSQueryKeyBinding * qkb = lr->addQueryKeyBinding();
- qkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- lr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSQueryKeyBinding * qkb = lr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = lr->addQueryKeyBinding();
- qkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSQueryKeyBinding * qkb = lr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = lr->addQueryKeyBinding();
- qkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSQueryKeyBinding * qkb = lr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = lr->addQueryKeyBinding();
- qkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responselimit") == 0 || _stricmp(argv[paramCount], "-l") == 0) {
- if (paramCount >= argc+1) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- paramCount++;
- lr->setResponseLimit(atoi(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- XKMSQueryKeyBinding *qkb = lr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = lr->addQueryKeyBinding();
-
- qkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- lr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
- lr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printLocateRequestUsage();
- delete lr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = lr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64((BIGNUM*)otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = lr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "dsa/rsa" */
-
-#endif
- else {
- printLocateRequestUsage();
- delete lr;
- (*doc)->release();
- return NULL;
- }
- }
-
- return lr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a ValidateRequest
-// --------------------------------------------------------------------------------
-
-void printValidateRequestUsage(void) {
-
- cerr << "\nUsage ValidateRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-cert/-a <filename> : add cert in filename as a KeyInfo\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Excange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-responselimit/-l <limit>\n";
- cerr << " : Set <limit> for ResponseLimit\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-rsa/-sr <filename> <passphrase>\n";
- cerr << " : Sign using the RSA key in file protected by passphrase\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n";
- cerr << " --sign-cert/-sc <filename>\n";
- cerr << " : Add the indicated certificate to the signature KeyInfo\n\n";
-
-}
-
-XKMSMessageAbstractType * createValidateRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printValidateRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSValidateRequest * vr;
-
- if (cr == NULL)
- vr = factory->createValidateRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- vr = cr->createValidateRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-cert") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- XSECCryptoX509 * x = loadX509(argv[paramCount]);
- if (x == NULL) {
- delete vr;
- (*doc)->release();
- cerr << "Error opening Certificate file : " <<
- argv[paramCount] << endl;
- return NULL;
- }
-
- Janitor<XSECCryptoX509> j_x(x);
-
- XKMSQueryKeyBinding * qkb = vr->getQueryKeyBinding();
- if (qkb == NULL) {
- qkb = vr->addQueryKeyBinding();
- }
- // See if there is already an X.509 element
- DSIGKeyInfoX509 * kix;
- if ((kix = findX509Data(qkb->getKeyInfoList())) == NULL)
- kix = qkb->appendX509Data();
- safeBuffer sb = x->getDEREncodingSB();
- kix->appendX509Certificate(sb.sbStrToXMLCh());
- paramCount++;
-
- }
-
- else if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- XKMSQueryKeyBinding * qkb = vr->addQueryKeyBinding();
- qkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- vr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- vr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printLocateRequestUsage();
- delete vr;
- return NULL;
- }
- vr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responselimit") == 0 || _stricmp(argv[paramCount], "-l") == 0) {
- if (paramCount >= argc+1) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- paramCount++;
- vr->setResponseLimit(atoi(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSQueryKeyBinding * qkb = vr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = vr->addQueryKeyBinding();
- qkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSQueryKeyBinding * qkb = vr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = vr->addQueryKeyBinding();
- qkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSQueryKeyBinding * qkb = vr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = vr->addQueryKeyBinding();
- qkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- XKMSQueryKeyBinding *qkb = vr->getQueryKeyBinding();
- if (qkb == NULL)
- qkb = vr->addQueryKeyBinding();
-
- qkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = vr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = vr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "dsa/rsa" */
- else if (_stricmp(argv[paramCount], "--sign-cert") == 0 || _stricmp(argv[paramCount], "-sc") == 0) {
- if (++paramCount >= argc) {
- printValidateRequestUsage();
- delete vr;
- return NULL;
- }
- XSECCryptoX509 * x = loadX509(argv[paramCount]);
- if (x == NULL) {
- delete vr;
- (*doc)->release();
- cerr << "Error opening Certificate file : " <<
- argv[paramCount] << endl;
- return NULL;
- }
-
- Janitor<XSECCryptoX509> j_x(x);
-
- DSIGSignature * sig = vr->getSignature();
- if (sig == NULL) {
- cerr << "Can only add Certificates to signature after signing\n";
- return NULL;
- }
-
- // See if there is already an X.509 element
- DSIGKeyInfoX509 * kix;
- if ((kix = findX509Data(sig->getKeyInfoList())) == NULL)
- kix = sig->appendX509Data();
- safeBuffer sb = x->getDEREncodingSB();
- kix->appendX509Certificate(sb.sbStrToXMLCh());
- paramCount++;
- }
-
-#endif
- else {
- printValidateRequestUsage();
- delete vr;
- (*doc)->release();
- return NULL;
- }
- }
-
- return vr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a RegisterRequest
-// --------------------------------------------------------------------------------
-
-void printRegisterRequestUsage(void) {
-
- cerr << "\nUsage RegisterRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Exchange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n";
- cerr << " --add-value-dsa/-vd <filename> <passphrase> (and do proof-of-possession sig)\n";
- cerr << " : Add the DSA key as a keyvalue\n";
- cerr << " --add-value-rsa/-vr <filename> <passphrase> (and do proof-of-possession sig)\n";
- cerr << " : Add the RSA key as a keyvalue\n";
- cerr << " --revocation/-v <phrase> : Set <phrase> as revocation code\n";
- cerr << " --kek/-k <phrase> : Key phrase to use for PrivateKey decryption\n";
-#if defined (XSEC_HAVE_OPENSSL)
- cerr << " --output-private-key/-p <file> <pass phrase>\n";
- cerr << " : Write PEM encoded private key to file\n";
-#endif
- cerr << " --authenticate/-a <phrase>\n";
- cerr << " : Use <phrase> as the authentication key for the request\n";
- cerr << " NOTE - This must come *after* adding of KeyInfo elements\n\n";
-
-}
-
-XKMSMessageAbstractType * createRegisterRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- XSECCryptoKey *proofOfPossessionKey = NULL;
- const XMLCh* proofOfPossessionSm = NULL;
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printRegisterRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSRegisterRequest * rr;
-
- if (cr == NULL)
- rr = factory->createRegisterRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- rr = cr->createRegisterRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- XKMSPrototypeKeyBinding * pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
- pkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--kek") == 0 || _stricmp(argv[paramCount], "-k") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- g_authPassPhrase = argv[paramCount++];
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSPrototypeKeyBinding * pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
- pkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSPrototypeKeyBinding * pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
- pkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSPrototypeKeyBinding * pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
- pkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- XKMSPrototypeKeyBinding *pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
-
- pkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--output-private-key") == 0 || _stricmp(argv[paramCount], "-p") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- ++paramCount;
- g_privateKeyFile = argv[paramCount++];
- g_privateKeyPassPhrase = argv[paramCount++];
- }
-#endif
- else if (_stricmp(argv[paramCount], "--revocation") == 0 || _stricmp(argv[paramCount], "-v") == 0) {
- if (++paramCount >= argc) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
- XKMSPrototypeKeyBinding *pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
-
- // Create the RevocationCodeIdentifier
- unsigned char rciBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSRevocationCodeIdentifierEncoding2((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), rciBuf, XSEC_MAX_HASH_SIZE);
-
- if (len <= 0) {
- cerr << "Error creating revocation code!\n";
- delete rr;
- return NULL;
- }
-
- // Convert to base64
- XMLCh * str = EncodeToBase64XMLCh(rciBuf, len);
- pkb->setRevocationCodeIdentifier(str);
- XSEC_RELEASE_XMLCH(str);
-
- paramCount++;;
- }
- else if (_stricmp(argv[paramCount], "--authenticate") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc + 1) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // Create the signature
-
- unsigned char keyBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSAuthenticationKey((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), keyBuf, XSEC_MAX_HASH_SIZE);
- if (len <= 0) {
- cout << "Error creating key from pass phrase" << endl;
- delete rr;
- return NULL;
- }
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(keyBuf, len);
-
- // Set key and validate
- XKMSAuthentication * a = rr->addAuthentication();
- DSIGSignature * sig = a->addKeyBindingAuthenticationSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIHMAC_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
-
- sig->setSigningKey(k);
- sig->sign();
-
- paramCount++;
-
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "sign dsa/rsa" */
- else if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0 ||
- _stricmp(argv[paramCount], "--add-value-rsa") == 0 || _stricmp(argv[paramCount], "-vr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
-
- XKMSPrototypeKeyBinding * pkb = rr->getPrototypeKeyBinding();
- if (pkb == NULL)
- pkb = rr->addPrototypeKeyBinding();
-
-
- if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- proofOfPossessionKey = new OpenSSLCryptoKeyDSA(pkey);
- proofOfPossessionSm = DSIGConstants::s_unicodeStrURIDSA_SHA1;
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- pkb->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
-
- proofOfPossessionKey = new OpenSSLCryptoKeyRSA(pkey);
- proofOfPossessionSm = DSIGConstants::s_unicodeStrURIRSA_SHA1;
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- pkb->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "value dsa/rsa" */
-
-#endif
- else {
- printRegisterRequestUsage();
- delete rr;
- (*doc)->release();
- return NULL;
- }
- }
-
- if (proofOfPossessionKey != NULL) {
-
- // Set up the proof of possession
- DSIGSignature * s =
- rr->addProofOfPossessionSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- proofOfPossessionSm,
- DSIGConstants::s_unicodeStrURISHA1);
-
- s->setSigningKey(proofOfPossessionKey);
- s->sign();
-
- }
-
- return rr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a RevokeRequest
-// --------------------------------------------------------------------------------
-
-void printRevokeRequestUsage(void) {
-
- cerr << "\nUsage RevokeRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Exchange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n";
- cerr << " --add-value-dsa/-vd <filename> <passphrase>\n";
- cerr << " : Add the DSA key as a keyvalue\n";
- cerr << " --add-value-rsa/-vr <filename> <passphrase>\n";
- cerr << " : Add the RSA key as a keyvalue\n";
- cerr << " --revocation/-v <phrase> : Set <phrase> as revocation code\n";
- cerr << " --authenticate/-a <phrase>\n";
- cerr << " : Use <phrase> as the authentication key for the request\n";
- cerr << " NOTE - This must come *after* adding of KeyInfo elements\n\n";
-
-}
-
-XKMSMessageAbstractType * createRevokeRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printRegisterRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSRevokeRequest * rr;
-
- if (cr == NULL)
- rr = factory->createRevokeRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- rr = cr->createRevokeRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
-
- XKMSRevokeKeyBinding * rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
- rkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSRevokeKeyBinding * rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
- rkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSRevokeKeyBinding * rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
- rkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSRevokeKeyBinding * rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
- rkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
- XKMSRevokeKeyBinding *rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
-
- rkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
- else if (_stricmp(argv[paramCount], "--revocation") == 0 || _stricmp(argv[paramCount], "-v") == 0) {
- if (++paramCount >= argc) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
-
- // Create the RevocationCode value
- unsigned char rciBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSRevocationCodeIdentifierEncoding1((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), rciBuf, XSEC_MAX_HASH_SIZE);
-
- if (len <= 0) {
- cerr << "Error creating revocation code!\n";
- delete rr;
- return NULL;
- }
-
- // Convert to base64
- XMLCh * str = EncodeToBase64XMLCh(rciBuf, len);
- rr->addRevocationCode(str);
- XSEC_RELEASE_XMLCH(str);
-
- paramCount++;;
- } else if (_stricmp(argv[paramCount], "--authenticate") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc + 1) {
- printRevokeRequestUsage();
- delete rr;
- return NULL;
- }
-
- // Create the signature
-
- unsigned char keyBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSAuthenticationKey((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), keyBuf, XSEC_MAX_HASH_SIZE);
- if (len <= 0) {
- cout << "Error creating key from pass phrase" << endl;
- delete rr;
- return NULL;
- }
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(keyBuf, len);
-
- // Set key and validate
- XKMSAuthentication * a = rr->addAuthentication();
- DSIGSignature * sig = a->addKeyBindingAuthenticationSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIHMAC_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
-
- sig->setSigningKey(k);
- sig->sign();
-
- paramCount++;
-
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "sign dsa/rsa" */
- else if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0 ||
- _stricmp(argv[paramCount], "--add-value-rsa") == 0 || _stricmp(argv[paramCount], "-vr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
-
- XKMSRevokeKeyBinding * rkb = rr->getRevokeKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRevokeKeyBinding(XKMSStatus::Indeterminate);
-
-
- if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- rkb->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- rkb->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "value dsa/rsa" */
-
-#endif
- else {
- printRevokeRequestUsage();
- delete rr;
- (*doc)->release();
- return NULL;
- }
- }
-
- return rr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a ReissueRequest
-// --------------------------------------------------------------------------------
-
-void printReissueRequestUsage(void) {
-
- cerr << "\nUsage ReissueRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Exchange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n";
- cerr << " --add-value-dsa/-vd <filename> <passphrase>\n";
- cerr << " : Add the DSA key as a keyvalue (and do proof-of-possession sig)\n";
- cerr << " --add-value-rsa/-vr <filename> <passphrase>\n";
- cerr << " : Add the RSA key as a keyvalue (and do proof-of-possession sig)\n";
- cerr << " --authenticate/-a <phrase>\n";
- cerr << " : Use <phrase> as the authentication key for the request\n";
- cerr << " NOTE - This must come *after* adding of KeyInfo elements\n\n";
-
-}
-
-XKMSMessageAbstractType * createReissueRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- XSECCryptoKey *proofOfPossessionKey = NULL;
- const XMLCh* proofOfPossessionSm = NULL;
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printReissueRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSReissueRequest * rr;
-
- if (cr == NULL)
- rr = factory->createReissueRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- rr = cr->createReissueRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
-
- XKMSReissueKeyBinding * pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
- pkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSReissueKeyBinding * pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
- pkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSReissueKeyBinding * pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
- pkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSReissueKeyBinding * pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
- pkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
- XKMSReissueKeyBinding *pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
-
- pkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
- else if (_stricmp(argv[paramCount], "--authenticate") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc + 1) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
-
- // Create the signature
-
- unsigned char keyBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSAuthenticationKey((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), keyBuf, XSEC_MAX_HASH_SIZE);
- if (len <= 0) {
- cout << "Error creating key from pass phrase" << endl;
- delete rr;
- return NULL;
- }
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(keyBuf, len);
-
- // Set key and validate
- XKMSAuthentication * a = rr->addAuthentication();
- DSIGSignature * sig = a->addKeyBindingAuthenticationSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIHMAC_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
-
- sig->setSigningKey(k);
- sig->sign();
-
- paramCount++;
-
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "sign dsa/rsa" */
- else if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0 ||
- _stricmp(argv[paramCount], "--add-value-rsa") == 0 || _stricmp(argv[paramCount], "-vr") == 0) {
- if (paramCount >= argc + 2) {
- printReissueRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
-
- XKMSReissueKeyBinding * pkb = rr->getReissueKeyBinding();
- if (pkb == NULL)
- pkb = rr->addReissueKeyBinding(XKMSStatus::Indeterminate);
-
-
- if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- proofOfPossessionKey = new OpenSSLCryptoKeyDSA(pkey);
- proofOfPossessionSm = DSIGConstants::s_unicodeStrURIDSA_SHA1;
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- pkb->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
-
- proofOfPossessionKey = new OpenSSLCryptoKeyRSA(pkey);
- proofOfPossessionSm = DSIGConstants::s_unicodeStrURIRSA_SHA1;
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- pkb->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "value dsa/rsa" */
-
-#endif
- else {
- printReissueRequestUsage();
- delete rr;
- (*doc)->release();
- return NULL;
- }
- }
-
- if (proofOfPossessionKey != NULL) {
-
- // Set up the proof of possession
- DSIGSignature * s =
- rr->addProofOfPossessionSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- proofOfPossessionSm,
- DSIGConstants::s_unicodeStrURISHA1);
-
- s->setSigningKey(proofOfPossessionKey);
- s->sign();
-
- }
-
- return rr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a RecoverRequest
-// --------------------------------------------------------------------------------
-
-void printRecoverRequestUsage(void) {
-
- cerr << "\nUsage RecoverRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
- cerr << " --add-name/-n <name> : Add name as a KeyInfoName\n";
- cerr << " --add-opaque/-o <data> : Add an opaque data string\n";
- cerr << " --add-usage-sig/-us : Add Signature Key Usage\n";
- cerr << " --add-usage-exc/-ux : Add Exchange Key Usage\n";
- cerr << " --add-usage-enc/-ue : Add Encryption Key Usage\n";
- cerr << " --add-usekeywith/-u <Application URI> <Identifier>\n";
- cerr << " : Add a UseKeyWith element\n";
- cerr << " --add-respondwith/-r <Identifier>\n";
- cerr << " : Add a RespondWith element\n";
- cerr << " --add-responsemechanism/-m <Identifier>\n";
- cerr << " : Add a ResponseMechanism element\n";
- cerr << " --sign-dsa/-sd <filename> <passphrase>\n";
- cerr << " : Sign using the DSA key in file protected by passphrase\n";
- cerr << " --add-value-dsa/-vd <filename> <passphrase>\n";
- cerr << " : Add the DSA key as a keyvalue\n";
- cerr << " --add-value-rsa/-vr <filename> <passphrase>\n";
- cerr << " : Add the RSA key as a keyvalue\n";
- cerr << " --kek/-k <phrase> : Key phrase to use for PrivateKey decryption\n";
-#if defined (XSEC_HAVE_OPENSSL)
- cerr << " --output-private-key/-p <file> <pass phrase>\n";
- cerr << " : Write PEM encoded private key to file\n";
-#endif
- cerr << " --authenticate/-a <phrase>\n";
- cerr << " : Use <phrase> as the authentication key for the request\n";
- cerr << " NOTE - This must come *after* adding of KeyInfo elements\n\n";
-
-}
-
-XKMSMessageAbstractType * createRecoverRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int ¶mCount, XKMSCompoundRequest * cr = NULL) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printRegisterRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSRecoverRequest * rr;
-
- if (cr == NULL)
- rr = factory->createRecoverRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
- else
- rr = cr->createRecoverRequest(MAKE_UNICODE_STRING(argv[paramCount++]));
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--add-name") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- if (++paramCount >= argc) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
-
- XKMSRecoverKeyBinding * rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
- rkb->appendKeyName(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-opaque") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendOpaqueClientDataItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-respondwith") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendRespondWithItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-responsemechanism") == 0 || _stricmp(argv[paramCount], "-m") == 0) {
- if (++paramCount >= argc) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- rr->appendResponseMechanismItem(MAKE_UNICODE_STRING(argv[paramCount]));
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-sig") == 0 || _stricmp(argv[paramCount], "-us") == 0) {
- XKMSRecoverKeyBinding * rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
- rkb->setSignatureKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-exc") == 0 || _stricmp(argv[paramCount], "-ux") == 0) {
- XKMSRecoverKeyBinding * rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
- rkb->setExchangeKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usage-enc") == 0 || _stricmp(argv[paramCount], "-ue") == 0) {
- XKMSRecoverKeyBinding * rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
- rkb->setEncryptionKeyUsage();
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "--add-usekeywith") == 0 || _stricmp(argv[paramCount], "-u") == 0) {
- if (++paramCount >= argc + 1) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- XKMSRecoverKeyBinding *rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
-
- rkb->appendUseKeyWithItem(MAKE_UNICODE_STRING(argv[paramCount]), MAKE_UNICODE_STRING(argv[paramCount + 1]));
- paramCount += 2;
- }
- else if (_stricmp(argv[paramCount], "--kek") == 0 || _stricmp(argv[paramCount], "-k") == 0) {
- if (++paramCount >= argc) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- g_authPassPhrase = argv[paramCount++];
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--output-private-key") == 0 || _stricmp(argv[paramCount], "-p") == 0) {
- if (paramCount >= argc + 2) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
- ++paramCount;
- g_privateKeyFile = argv[paramCount++];
- g_privateKeyPassPhrase = argv[paramCount++];
- }
-#endif
- else if (_stricmp(argv[paramCount], "--authenticate") == 0 || _stricmp(argv[paramCount], "-a") == 0) {
- if (++paramCount >= argc + 1) {
- printRecoverRequestUsage();
- delete rr;
- return NULL;
- }
-
- // Create the signature
-
- unsigned char keyBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSAuthenticationKey((unsigned char *) argv[paramCount], (int) strlen(argv[paramCount]), keyBuf, XSEC_MAX_HASH_SIZE);
- if (len <= 0) {
- cout << "Error creating key from pass phrase" << endl;
- delete rr;
- return NULL;
- }
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(keyBuf, len);
-
- // Set key and validate
- XKMSAuthentication * a = rr->addAuthentication();
- DSIGSignature * sig = a->addKeyBindingAuthenticationSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIHMAC_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
-
- sig->setSigningKey(k);
- sig->sign();
-
- paramCount++;
-
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0 ||
- _stricmp(argv[paramCount], "--sign-rsa") == 0 || _stricmp(argv[paramCount], "-sr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
- XSECCryptoKey *key;
- DSIGSignature * sig;
- if (_stricmp(argv[paramCount], "--sign-dsa") == 0 || _stricmp(argv[paramCount], "-sd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIDSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- // Create the XSEC OpenSSL interface
- key = new OpenSSLCryptoKeyDSA(pkey);
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- sig->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
- sig = rr->addSignature(
- DSIGConstants::s_unicodeStrURIC14N_NOC,
- DSIGConstants::s_unicodeStrURIRSA_SHA1,
- DSIGConstants::s_unicodeStrURISHA1);
- key = new OpenSSLCryptoKeyRSA(pkey);
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- sig->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- sig->setSigningKey(key);
- sig->sign();
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "sign dsa/rsa" */
- else if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0 ||
- _stricmp(argv[paramCount], "--add-value-rsa") == 0 || _stricmp(argv[paramCount], "-vr") == 0) {
- if (paramCount >= argc + 2) {
- printRegisterRequestUsage();
- delete rr;
- return NULL;
- }
-
- // DSA or RSA OpenSSL Key
- // For now just read a particular file
-
- BIO * bioKey;
- if ((bioKey = BIO_new(BIO_s_file())) == NULL) {
-
- cerr << "Error opening private key file\n\n";
- return NULL;
-
- }
-
- if (BIO_read_filename(bioKey, argv[paramCount+1]) <= 0) {
-
- cerr << "Error opening private key file : " << argv[paramCount+1] << endl;
- return NULL;
-
- }
-
- EVP_PKEY * pkey;
- pkey = PEM_read_bio_PrivateKey(bioKey,NULL,NULL,argv[paramCount + 2]);
-
- if (pkey == NULL) {
-
- BIO * bio_err;
-
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
- cerr << "Error loading private key\n\n";
- ERR_print_errors(bio_err);
- return NULL;
-
- }
-
- XKMSRecoverKeyBinding * rkb = rr->getRecoverKeyBinding();
- if (rkb == NULL)
- rkb = rr->addRecoverKeyBinding(XKMSStatus::Indeterminate);
-
-
- if (_stricmp(argv[paramCount], "--add-value-dsa") == 0 || _stricmp(argv[paramCount], "-vd") == 0) {
-
- // Check type is correct
-
- if (EVP_PKEY_id(pkey) != EVP_PKEY_DSA) {
- cerr << "DSA Key requested, but OpenSSL loaded something else\n";
- return NULL;
- }
-
- const BIGNUM *otherP = NULL, *otherQ = NULL, *otherG = NULL;
- DSA_get0_pqg(EVP_PKEY_get0_DSA(pkey), &otherP, &otherQ, &otherG);
- XMLCh * P = BN2b64(otherP);
- XMLCh * Q = BN2b64(otherQ);
- XMLCh * G = BN2b64(otherG);
- const BIGNUM *otherPriv = NULL, *otherPub = NULL;
- DSA_get0_key(EVP_PKEY_get0_DSA(pkey), &otherPub, &otherPriv);
- XMLCh * Y = BN2b64(otherPub);
-
- rkb->appendDSAKeyValue(P,Q,G,Y);
-
- XSEC_RELEASE_XMLCH(P);
- XSEC_RELEASE_XMLCH(Q);
- XSEC_RELEASE_XMLCH(G);
- XSEC_RELEASE_XMLCH(Y);
- }
- else {
- if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA) {
- cerr << "RSA Key requested, but OpenSSL loaded something else\n";
- exit (1);
- }
-
- const BIGNUM *n=NULL, *e=NULL, *d=NULL;
- RSA_get0_key(EVP_PKEY_get0_RSA(pkey), &n, &e, &d);
-
- XMLCh * mod = BN2b64(n);
- XMLCh * exp = BN2b64(e);
-
- rkb->appendRSAKeyValue(mod, exp);
- XSEC_RELEASE_XMLCH(mod);
- XSEC_RELEASE_XMLCH(exp);
-
- }
-
- EVP_PKEY_free(pkey);
- BIO_free(bioKey);
-
- paramCount += 3;
-
-
- } /* argv[1] = "value dsa/rsa" */
-
-#endif
- else {
- printRecoverRequestUsage();
- delete rr;
- (*doc)->release();
- return NULL;
- }
- }
-
- return rr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a PendingRequest
-// --------------------------------------------------------------------------------
-
-void printPendingRequestUsage(void) {
-
- cerr << "\nUsage PendingRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n";
- cerr << " --original-request-id/-o <id>\n";
- cerr << " : Set original request ID\n";
- cerr << " --response-id/-r <id>\n";
- cerr << " : Set Response ID\n\n";
-
-}
-
-XKMSMessageAbstractType * createPendingRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printPendingRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSPendingRequest * pr =
- factory->createPendingRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--original-request-id") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printPendingRequestUsage();
- delete pr;
- return NULL;
- }
-
- pr->setOriginalRequestId(MAKE_UNICODE_STRING(argv[paramCount++]));
- }
- else if (_stricmp(argv[paramCount], "--response-id") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printPendingRequestUsage();
- delete pr;
- return NULL;
- }
- pr->setResponseId(MAKE_UNICODE_STRING(argv[paramCount++]));
- }
- else {
- printPendingRequestUsage();
- delete pr;
- return NULL;
- }
- }
-
- return pr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a StatusRequest
-// --------------------------------------------------------------------------------
-
-void printStatusRequestUsage(void) {
-
- cerr << "\nUsage StatusRequest [--help|-h] <service URI> [options]\n";
- cerr << " --help/-h : print this screen and exit\n";
- cerr << " --original-request-id/-o <id>\n";
- cerr << " : Set original request ID\n";
- cerr << " --response-id/-r <id>\n";
- cerr << " : Set Response ID\n\n";
-
-}
-
-XKMSMessageAbstractType * createStatusRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printStatusRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSStatusRequest * sr =
- factory->createStatusRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
-
- while (paramCount < argc && _stricmp(argv[paramCount], "--") != 0) {
-
- if (_stricmp(argv[paramCount], "--original-request-id") == 0 || _stricmp(argv[paramCount], "-o") == 0) {
- if (++paramCount >= argc) {
- printStatusRequestUsage();
- delete sr;
- return NULL;
- }
-
- sr->setOriginalRequestId(MAKE_UNICODE_STRING(argv[paramCount++]));
- }
- else if (_stricmp(argv[paramCount], "--response-id") == 0 || _stricmp(argv[paramCount], "-r") == 0) {
- if (++paramCount >= argc) {
- printStatusRequestUsage();
- delete sr;
- return NULL;
- }
- sr->setResponseId(MAKE_UNICODE_STRING(argv[paramCount++]));
- }
- else {
- printStatusRequestUsage();
- delete sr;
- return NULL;
- }
- }
-
- return sr;
-}
-
-// --------------------------------------------------------------------------------
-// Create a CompoundRequest
-// --------------------------------------------------------------------------------
-
-void printCompoundRequestUsage(void) {
-
- cerr << "\nUsage CompoundRequest [--help|-h] <service URI> <LocateRequest|ValidateRequest> .... [-- LocateRequest|ValidateRequest|PendingRequest]*\n";
- cerr << " --help/-h : print this screen and exit\n\n";
-
-}
-
-XKMSMessageAbstractType * createCompoundRequest(XSECProvider &prov, DOMDocument **doc, int argc, char ** argv, int paramCount) {
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
-
- printCompoundRequestUsage();
- return NULL;
- }
-
- /* First create the basic request */
- XKMSMessageFactory * factory =
- prov.getXKMSMessageFactory();
- XKMSCompoundRequest * cr =
- factory->createCompoundRequest(MAKE_UNICODE_STRING(argv[paramCount++]), doc);
-
- while (paramCount < argc) {
-
- if ((_stricmp(argv[paramCount], "LocateRequest") == 0) ||
- (_stricmp(argv[paramCount], "lr") == 0)) {
-
- paramCount++;
- XKMSLocateRequest * r =
- (XKMSLocateRequest *) (createLocateRequest(prov, NULL, argc, argv, paramCount, cr));
-
- if (r == NULL) {
- delete cr;
- return NULL;
- }
-
- }
- else if ((_stricmp(argv[paramCount], "ValidateRequest") == 0) ||
- (_stricmp(argv[paramCount], "vr") == 0)) {
-
- paramCount++;
- XKMSValidateRequest * r =
- (XKMSValidateRequest *) (createValidateRequest(prov, NULL, argc, argv, paramCount, cr));
-
- if (r == NULL) {
- delete cr;
- return NULL;
- }
- }
-
- else {
- printCompoundRequestUsage();
- delete cr;
- (*doc)->release();
- return NULL;
- }
-
- if (paramCount < argc && _stricmp(argv[paramCount], "--") == 0)
- paramCount++;
- }
-
- return cr;
-}
-
-// --------------------------------------------------------------------------------
-// MsgDump
-// --------------------------------------------------------------------------------
-
-void doMessageAbstractTypeDump(XKMSMessageAbstractType *msg, unsigned int level) {
-
- cout << endl;
- levelSet(level);
- cout << "Base message information : " << endl << endl;
-
- char * s = XMLString::transcode(msg->getId());
- levelSet(level);
- cout << "Id = " << s << endl;
- XSEC_RELEASE_XMLCH(s);
-
- s = XMLString::transcode(msg->getService());
- levelSet(level);
- cout << "Service URI = " << s << endl;
- XSEC_RELEASE_XMLCH(s);
-
- s = XMLString::transcode(msg->getNonce());
- levelSet(level);
- if (s != NULL) {
- cout << "Nonce = " << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
- else
- cout << "Nonce = <NONE SET>" << endl;
-
- /* Check for OpaqueClientData */
- if (msg->getOpaqueClientDataSize() > 0) {
- levelSet(level);
- cout << "Opaque Client Data found : " << endl;
- for (int i = 0; i < msg->getOpaqueClientDataSize(); ++i) {
- s = XMLString::transcode(msg->getOpaqueClientDataItemStr(i));
- if (s != NULL) {
- levelSet(level + 1);
- cout << i << " : " << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
- }
- }
-}
-
-void doRequestAbstractTypeDump(XKMSRequestAbstractType *msg, unsigned int level) {
-
- levelSet(level);
- int i = msg->getRespondWithSize();
-
- cout << "Request message has " << i << " RespondWith elements" << endl << endl;
-
- for (int j = 0; j < i; ++j) {
- levelSet(level +1);
- char * s = XMLString::transcode(msg->getRespondWithItemStr(j));
- cout << "Item " << j+1 << " : " << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
-
-}
-
-void doResultTypeDump(XKMSResultType *msg, unsigned int level) {
-
- const XMLCh * rid = msg->getRequestId();
- char * s;
-
- if (rid != NULL) {
- levelSet(level);
- cout << "Result is in response to MsgID : ";
- s = XMLString::transcode(rid);
- cout << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
-
- levelSet(level);
- cout << "Result Major code = ";
- s = XMLString::transcode(XKMSConstants::s_tagResultMajorCodes[msg->getResultMajor()]);
- cout << s << endl;
- XSEC_RELEASE_XMLCH(s);
-
- XKMSResultType::ResultMinor rm = msg->getResultMinor();
- if (rm != XKMSResultType::NoneMinor) {
- levelSet(level);
- cout << "Result Minor code = ";
- char * s = XMLString::transcode(XKMSConstants::s_tagResultMinorCodes[rm]);
- cout << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
-
- rid = msg->getRequestSignatureValue();
- if (rid != NULL) {
- levelSet(level);
- cout << "RequestSignatureValue = ";
- s = XMLString::transcode(rid);
- cout << s << endl;
- XSEC_RELEASE_XMLCH(s);
- }
-}
-
-void doKeyInfoDump(DSIGKeyInfoList * l, unsigned int level) {
-
-
- int size = (int) l->getSize();
-
- for (int i = 0 ; i < size ; ++ i) {
-
- DSIGKeyInfoValue * kiv;
- DSIGKeyInfoName * kn;
- char * b;
-
- DSIGKeyInfo * ki = l->item(i);
-
- switch (ki->getKeyInfoType()) {
-
- case DSIGKeyInfo::KEYINFO_VALUE_RSA :
-
- kiv = (DSIGKeyInfoValue *) ki;
- levelSet(level);
- cout << "RSA Key Value" << endl;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getRSAExponent());
- cout << "Base64 encoded exponent = " << b << endl;
- delete[] b;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getRSAModulus());
- cout << "Base64 encoded modulus = " << b << endl;
- delete[] b;
-
- break;
-
- case DSIGKeyInfo::KEYINFO_VALUE_DSA :
-
- kiv = (DSIGKeyInfoValue *) ki;
- levelSet(level);
- cout << "DSA Key Value" << endl;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getDSAG());
- cout << "G = " << b << endl;
- delete[] b;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getDSAP());
- cout << "P = " << b << endl;
- delete[] b;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getDSAQ());
- cout << "Q = " << b << endl;
- delete[] b;
-
- levelSet(level+1);
- b = XMLString::transcode(kiv->getDSAY());
- cout << "Y = " << b << endl;
- delete[] b;
-
- break;
-
- case DSIGKeyInfo::KEYINFO_NAME :
-
- kn = (DSIGKeyInfoName *) ki;
- levelSet(level);
- cout << "Key Name" << endl;
-
- levelSet(level+1);
- b = XMLString::transcode(kn->getKeyName());
- cout << "Name = " << b << endl;
- delete[] b;
-
- break;
-
- default:
-
- levelSet(level);
- cout << "Unknown KeyInfo type" << endl;
-
- }
-
- }
-}
-
-
-void doKeyBindingAbstractDump(XKMSKeyBindingAbstractType * msg, unsigned int level) {
-
- levelSet(level);
- cout << "Key Binding found." << endl;
-
- levelSet(level+1);
- cout << "KeyUsage Encryption : ";
- if (msg->getEncryptionKeyUsage())
- cout << "yes" << endl;
- else
- cout << "no" << endl;
-
- levelSet(level+1);
- cout << "KeyUsage Exchange : ";
- if (msg->getExchangeKeyUsage())
- cout << "yes" << endl;
- else
- cout << "no" << endl;
-
- levelSet(level+1);
- cout << "KeyUsage Signature : ";
- if (msg->getSignatureKeyUsage())
- cout << "yes" << endl;
- else
- cout << "no" << endl;
-
- int n = msg->getUseKeyWithSize();
- levelSet(level+1);
- if (n == 0) {
- cout << "No UseKeyWith items found" << endl;
- }
- else {
- cout << "UseKeyWith items : \n";
- }
-
- for (int i = 0; i < msg->getUseKeyWithSize() ; ++i) {
-
- XKMSUseKeyWith * ukw = msg->getUseKeyWithItem(i);
- levelSet(level+2);
- char * a = XMLString::transcode(ukw->getApplication());
- char * id = XMLString::transcode(ukw->getIdentifier());
- cout << "Application : \"" << a << "\"\n";
- levelSet(level+2);
- cout << "Identifier : \"" << id << "\"" << endl;
- XSEC_RELEASE_XMLCH(a);
- XSEC_RELEASE_XMLCH(id);
-
- }
-
- // Now dump any KeyInfo
- levelSet(level+1);
- cout << "KeyInfo information:" << endl << endl;
-
- doKeyInfoDump(msg->getKeyInfoList(), level + 2);
-
-}
-
-void doUnverifiedKeyBindingDump(XKMSUnverifiedKeyBinding * ukb, unsigned int level) {
-
- doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) ukb, level);
-
-}
-
-void doStatusReasonDump(XKMSStatus::StatusValue v, XKMSStatus *s, int level) {
-
- char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[v]);
- for (XKMSStatus::StatusReason i = XKMSStatus::Signature; i > XKMSStatus::ReasonUndefined; i = (XKMSStatus::StatusReason) (i-1)) {
-
- if (s->getStatusReason(v, i)) {
- levelSet(level);
- char * rc = XMLString::transcode(XKMSConstants::s_tagStatusReasonCodes[i]);
- cout << sr << "Reason = " << rc << endl;
- XSEC_RELEASE_XMLCH(rc);
- }
- }
- XSEC_RELEASE_XMLCH(sr);
-
-}
-
-void doKeyBindingDump(XKMSKeyBinding * kb, unsigned int level) {
-
- /* Dump the status */
-
- XKMSStatus * s = kb->getStatus();
- if (s == NULL)
- return;
-
- char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
- levelSet(level);
- cout << "Status = " << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
-
- /* Dump the status reasons */
- doStatusReasonDump(XKMSStatus::Valid, s, level+1);
- doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
- doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
-
- /* Now the actual key */
- doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
-
-}
-
-void doRevokeKeyBindingDump(XKMSRevokeKeyBinding * kb, unsigned int level) {
-
- /* Dump the status */
-
- XKMSStatus * s = kb->getStatus();
- if (s == NULL)
- return;
-
- char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
- levelSet(level);
- cout << "Status = " << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
-
- /* Dump the status reasons */
- doStatusReasonDump(XKMSStatus::Valid, s, level+1);
- doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
- doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
-
- /* Now the actual key */
- doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
-
-}
-
-void doRecoverKeyBindingDump(XKMSRecoverKeyBinding * kb, unsigned int level) {
-
- /* Dump the status */
-
- XKMSStatus * s = kb->getStatus();
- if (s == NULL)
- return;
-
- char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
- levelSet(level);
- cout << "Status = " << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
-
- /* Dump the status reasons */
- doStatusReasonDump(XKMSStatus::Valid, s, level+1);
- doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
- doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
-
- /* Now the actual key */
- doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
-
-}
-
-void doReissueKeyBindingDump(XKMSReissueKeyBinding * kb, unsigned int level) {
-
- /* Dump the status */
-
- XKMSStatus * s = kb->getStatus();
- if (s == NULL)
- return;
-
- char * sr = XMLString::transcode(XKMSConstants::s_tagStatusValueCodes[s->getStatusValue()]);
- levelSet(level);
- cout << "Status = " << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
-
- /* Dump the status reasons */
- doStatusReasonDump(XKMSStatus::Valid, s, level+1);
- doStatusReasonDump(XKMSStatus::Invalid, s, level+1);
- doStatusReasonDump(XKMSStatus::Indeterminate, s, level+1);
-
- /* Now the actual key */
- doKeyBindingAbstractDump((XKMSKeyBindingAbstractType *) kb, level);
-
-}
-
-void doAuthenticationDump(XKMSAuthentication *a, unsigned int level) {
-
-
- if (a == NULL)
- return;
-
- DSIGSignature * sig = a->getKeyBindingAuthenticationSignature();
- if (sig != NULL) {
-
- levelSet(level);
- cout << "KeyBindingAuthentication Signature found. ";
- if (g_authPassPhrase == NULL) {
- cout << "Cannot check - no pass phrase set" << endl;
- return;
- }
-
- cout << "Checking.... ";
-
- // Create the key
- unsigned char keyBuf[XSEC_MAX_HASH_SIZE];
- int len = CalculateXKMSAuthenticationKey((unsigned char *) g_authPassPhrase, (int) strlen(g_authPassPhrase), keyBuf, XSEC_MAX_HASH_SIZE);
- if (len <= 0) {
- cout << "Error creating key from pass phrase" << endl;
- return;
- }
-
- XSECCryptoKeyHMAC * k = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
- k->setKey(keyBuf, len);
- //k->setKey((unsigned char *) g_authPassPhrase, strlen(g_authPassPhrase));
-
- // Set key and validate
- sig->setSigningKey(k);
- if (sig->verify())
- cout << "OK!" << endl;
- else
- cout << "Signature BAD!" << endl;
-
- }
-
- return;
-
-}
-
-int doLocateRequestDump(XKMSLocateRequest *msg) {
-
- cout << endl << "This is a LocateRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSQueryKeyBinding *qkb = msg->getQueryKeyBinding();
- if (qkb != NULL)
- doKeyBindingAbstractDump(qkb, level);
-
- return 0;
-}
-
-int doStatusRequestDump(XKMSStatusRequest *msg) {
-
- cout << endl << "This is a StatusRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- return 0;
-}
-
-int doValidateRequestDump(XKMSValidateRequest *msg) {
-
- cout << endl << "This is a ValidateRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSQueryKeyBinding *qkb = msg->getQueryKeyBinding();
- if (qkb != NULL)
- doKeyBindingAbstractDump(qkb, level);
-
- return 0;
-}
-
-int doLocateResultDump(XKMSLocateResult *msg) {
-
- cout << endl << "This is a LocateResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getUnverifiedKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Unverified Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doUnverifiedKeyBindingDump(msg->getUnverifiedKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- return 0;
-}
-
-int doValidateResultDump(XKMSValidateResult *msg) {
-
- cout << endl << "This is a ValidateResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- return 0;
-}
-
-int doRegisterResultDump(XKMSRegisterResult *msg) {
-
- cout << endl << "This is a RegisterResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- // Check if there is a private key
- if (g_authPassPhrase) {
- XKMSRSAKeyPair * kp = msg->getRSAKeyPair(g_authPassPhrase);
- if (kp != NULL) {
- cout << endl;
- levelSet(level);
- cout << "RSAKeyPair found" << endl << endl;
- level += 1;
-
- // Translate the parameters to char strings
- char * sModulus = XMLString::transcode(kp->getModulus());
- char * sExponent = XMLString::transcode(kp->getExponent());
- char * sP = XMLString::transcode(kp->getP());
- char * sQ = XMLString::transcode(kp->getQ());
- char * sDP = XMLString::transcode(kp->getDP());
- char * sDQ = XMLString::transcode(kp->getDQ());
- char * sInverseQ = XMLString::transcode(kp->getInverseQ());
- char * sD = XMLString::transcode(kp->getD());
-
-#if defined (XSEC_HAVE_OPENSSL)
-
- if (g_privateKeyFile != NULL) {
- levelSet(level);
- cout << "Writing private key to file " << g_privateKeyFile;
-
- // Create the RSA key file
- RSA * rsa = RSA_new();
-
- RSA_set0_key(rsa,
- OpenSSLCryptoBase64::b642BN(sModulus, (unsigned int) strlen(sModulus)),
- OpenSSLCryptoBase64::b642BN(sExponent, (unsigned int) strlen(sExponent)),
- OpenSSLCryptoBase64::b642BN(sD, (unsigned int) strlen(sD)));
- RSA_set0_factors(rsa,
- OpenSSLCryptoBase64::b642BN(sP, (unsigned int) strlen(sP)),
- OpenSSLCryptoBase64::b642BN(sQ, (unsigned int) strlen(sQ)));
-
- RSA_set0_crt_params(rsa,
- OpenSSLCryptoBase64::b642BN(sDP, (unsigned int) strlen(sDP)),
- OpenSSLCryptoBase64::b642BN(sDQ, (unsigned int) strlen(sDQ)),
- OpenSSLCryptoBase64::b642BN(sInverseQ, (unsigned int) strlen(sInverseQ)));
-
- // Write it to disk
- BIO *out;
- out = BIO_new_file(g_privateKeyFile, "w");
- if(!out) cout << "Error occurred in opening file!" << endl << endl;
- if (!PEM_write_bio_RSAPrivateKey(out, rsa, EVP_des_ede3_cbc(), NULL, 0, 0, g_privateKeyPassPhrase)) {
- cout << "Error creating PEM output" << endl << endl;
- }
- BIO_free(out);
- RSA_free(rsa);
-
- cout << " done" << endl << endl;
-
- }
-#endif
- // Now output
- levelSet(level);
- cout << "Modulus = " << sModulus << endl;
- XSEC_RELEASE_XMLCH(sModulus);
-
- levelSet(level);
- cout << "Exponent = " << sExponent << endl;
- XSEC_RELEASE_XMLCH(sExponent);
-
- levelSet(level);
- cout << "P = " << sP << endl;
- XSEC_RELEASE_XMLCH(sP);
-
- levelSet(level);
- cout << "Q = " << sQ << endl;
- XSEC_RELEASE_XMLCH(sQ);
-
- levelSet(level);
- cout << "DP = " << sDP << endl;
- XSEC_RELEASE_XMLCH(sDP);
-
- levelSet(level);
- cout << "DQ = " << sDQ << endl;
- XSEC_RELEASE_XMLCH(sDQ);
-
- levelSet(level);
- cout << "Inverse Q = " << sInverseQ << endl;
- XSEC_RELEASE_XMLCH(sInverseQ);
-
- levelSet(level);
- cout << "D = " << sD << endl;
- XSEC_RELEASE_XMLCH(sD);
- }
- }
- else {
- levelSet(level);
- cout << "Not checking for private key as no decryption phrase set";
- }
-
- return 0;
-}
-
-int doRecoverResultDump(XKMSRecoverResult *msg) {
-
- cout << endl << "This is a RecoverResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- // Check if there is a private key
- if (g_authPassPhrase) {
- XKMSRSAKeyPair * kp = msg->getRSAKeyPair(g_authPassPhrase);
- if (kp != NULL) {
- cout << endl;
- levelSet(level);
- cout << "RSAKeyPair found" << endl << endl;
- level += 1;
-
- // Translate the parameters to char strings
- char * sModulus = XMLString::transcode(kp->getModulus());
- char * sExponent = XMLString::transcode(kp->getExponent());
- char * sP = XMLString::transcode(kp->getP());
- char * sQ = XMLString::transcode(kp->getQ());
- char * sDP = XMLString::transcode(kp->getDP());
- char * sDQ = XMLString::transcode(kp->getDQ());
- char * sInverseQ = XMLString::transcode(kp->getInverseQ());
- char * sD = XMLString::transcode(kp->getD());
-
-#if defined (XSEC_HAVE_OPENSSL)
-
- if (g_privateKeyFile != NULL) {
- levelSet(level);
- cout << "Writing private key to file " << g_privateKeyFile;
-
- // Create the RSA key file
- RSA * rsa = RSA_new();
-
- RSA_set0_key(rsa,
- OpenSSLCryptoBase64::b642BN(sModulus, (unsigned int) strlen(sModulus)),
- OpenSSLCryptoBase64::b642BN(sExponent, (unsigned int) strlen(sExponent)),
- OpenSSLCryptoBase64::b642BN(sD, (unsigned int) strlen(sD)));
-
- RSA_set0_factors(rsa,
- OpenSSLCryptoBase64::b642BN(sP, (unsigned int) strlen(sP)),
- OpenSSLCryptoBase64::b642BN(sQ, (unsigned int) strlen(sQ)));
-
- RSA_set0_crt_params(rsa,
- OpenSSLCryptoBase64::b642BN(sDP, (unsigned int) strlen(sDP)),
- OpenSSLCryptoBase64::b642BN(sDQ, (unsigned int) strlen(sDQ)),
- OpenSSLCryptoBase64::b642BN(sInverseQ, (unsigned int) strlen(sInverseQ)));
-
- // Write it to disk
- BIO *out;
- out = BIO_new_file(g_privateKeyFile, "w");
- if(!out) cout << "Error occurred in opening file!" << endl << endl;
- if (!PEM_write_bio_RSAPrivateKey(out, rsa, EVP_des_ede3_cbc(), NULL, 0, 0, g_privateKeyPassPhrase)) {
- cout << "Error creating PEM output" << endl << endl;
- }
- BIO_free(out);
- RSA_free(rsa);
-
- cout << " done" << endl << endl;
-
- }
-#endif
- // Now output
- levelSet(level);
- cout << "Modulus = " << sModulus << endl;
- XSEC_RELEASE_XMLCH(sModulus);
-
- levelSet(level);
- cout << "Exponent = " << sExponent << endl;
- XSEC_RELEASE_XMLCH(sExponent);
-
- levelSet(level);
- cout << "P = " << sP << endl;
- XSEC_RELEASE_XMLCH(sP);
-
- levelSet(level);
- cout << "Q = " << sQ << endl;
- XSEC_RELEASE_XMLCH(sQ);
-
- levelSet(level);
- cout << "DP = " << sDP << endl;
- XSEC_RELEASE_XMLCH(sDP);
-
- levelSet(level);
- cout << "DQ = " << sDQ << endl;
- XSEC_RELEASE_XMLCH(sDQ);
-
- levelSet(level);
- cout << "Inverse Q = " << sInverseQ << endl;
- XSEC_RELEASE_XMLCH(sInverseQ);
-
- levelSet(level);
- cout << "D = " << sD << endl;
- XSEC_RELEASE_XMLCH(sD);
- }
- }
- else {
- levelSet(level);
- cout << "Not checking for private key as no decryption phrase set";
- }
-
- return 0;
-}
-
-int doRevokeResultDump(XKMSRevokeResult *msg) {
-
- cout << endl << "This is a RevokeResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- return 0;
-}
-
-int doReissueResultDump(XKMSReissueResult *msg) {
-
- cout << endl << "This is a ReissueResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- int j;
-
- if ((j = msg->getKeyBindingSize()) > 0) {
-
- cout << endl;
- levelSet(level);
- cout << "Key Bindings" << endl << endl;
-
- for (int i = 0; i < j ; ++i) {
-
- doKeyBindingDump(msg->getKeyBindingItem(i), level + 1);
-
- }
-
- }
-
- return 0;
-}
-
-int doStatusResultDump(XKMSStatusResult *msg) {
-
- cout << endl << "This is a StatusResult Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- return 0;
-}
-
-int doResultDump(XKMSResult *msg) {
-
- cout << endl << "This is a Result Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doResultTypeDump(msg, level);
-
- return 0;
-}
-
-int doRegisterRequestDump(XKMSRegisterRequest *msg) {
-
- cout << endl << "This is a RegisterRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSPrototypeKeyBinding *pkb = msg->getPrototypeKeyBinding();
- if (pkb != NULL) {
- const XMLCh * rci = pkb->getRevocationCodeIdentifier();
- if (rci != NULL) {
- levelSet(1);
- char * sr = XMLString::transcode(rci);
- cout << "Revocation Code found = " << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
- }
-
- doKeyBindingAbstractDump(pkb, level);
- }
-
- // Check authentication
- doAuthenticationDump(msg->getAuthentication(), level);
-
- // Check ProofOfPossession
- levelSet(1);
- DSIGSignature * sig = msg->getProofOfPossessionSignature();
- if (sig != NULL) {
-
- cout << "Proof of PossessionSignature signature found. Checking.... ";
-
- // Try to find the key
- XSECKeyInfoResolverDefault kir;
- XSECCryptoKey * k = kir.resolveKey(pkb->getKeyInfoList());
-
- if (k != NULL) {
-
- sig->setSigningKey(k);
- if (sig->verify())
- cout << "OK!" << endl;
- else
- cout << "Signature Bad!" << endl;
- }
- else
- cout << "Cannot obtain key from PrototypeKeyBinding" << endl;
-
- }
- else {
-
- cout << "No ProofOfPossession Signature found" << endl;
-
- }
-
- return 0;
-
-}
-
-int doRevokeRequestDump(XKMSRevokeRequest *msg) {
-
- cout << endl << "This is a RevokeRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSRevokeKeyBinding *rkb = msg->getRevokeKeyBinding();
- if (rkb != NULL) {
- doRevokeKeyBindingDump(rkb, level);
- }
-
- // Check authentication
- if (msg->getAuthentication())
- doAuthenticationDump(msg->getAuthentication(), level);
-
- if (msg->getRevocationCode()) {
-
- levelSet(1);
- cout << "RevocationCode found = ";
- char * sr = XMLString::transcode(msg->getRevocationCode());
- cout << sr << endl;
- XSEC_RELEASE_XMLCH(sr);
- }
-
- return 0;
-
-}
-
-int doRecoverRequestDump(XKMSRecoverRequest *msg) {
-
- cout << endl << "This is a RecoverRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSRecoverKeyBinding *rkb = msg->getRecoverKeyBinding();
- if (rkb != NULL) {
- doRecoverKeyBindingDump(rkb, level);
- }
-
- // Check authentication
- if (msg->getAuthentication())
- doAuthenticationDump(msg->getAuthentication(), level);
-
- return 0;
-
-}
-
-int doReissueRequestDump(XKMSReissueRequest *msg) {
-
- cout << endl << "This is a ReiussueRequest Message" << endl;
- unsigned int level = 1;
-
- doMessageAbstractTypeDump(msg, level);
- doRequestAbstractTypeDump(msg, level);
-
- XKMSReissueKeyBinding *rkb = msg->getReissueKeyBinding();
- if (rkb != NULL) {
- doReissueKeyBindingDump(rkb, level);
- }
-
- // Check authentication
- doAuthenticationDump(msg->getAuthentication(), level);
-
- // Check ProofOfPossession
- levelSet(1);
- DSIGSignature * sig = msg->getProofOfPossessionSignature();
- if (sig != NULL) {
-
- cout << "Proof of PossessionSignature signature found. Checking.... ";
-
- // Try to find the key
- XSECKeyInfoResolverDefault kir;
- XSECCryptoKey * k = kir.resolveKey(rkb->getKeyInfoList());
-
- if (k != NULL) {
-
- sig->setSigningKey(k);
- if (sig->verify())
- cout << "OK!" << endl;
- else
- cout << "Signature Bad!" << endl;
- }
- else
- cout << "Cannot obtain key from PrototypeKeyBinding" << endl;
-
- }
- else {
-
- cout << "No ProofOfPossession Signature found" << endl;
-
- }
-
- return 0;
-
-}
-
-int doMsgDump(XKMSMessageAbstractType * msg) {
-
- if (msg->isSigned()) {
-
- cout << "Message is signed. Checking signature ... ";
- try {
-
- XSECKeyInfoResolverDefault theKeyInfoResolver;
- DSIGSignature * sig = msg->getSignature();
-
- // The only way we can verify is using keys read directly from the KeyInfo list,
- // so we add a KeyInfoResolverDefault to the Signature.
-
- sig->setKeyInfoResolver(&theKeyInfoResolver);
-
- if (sig->verify())
- cout << "OK!" << endl;
- else
- cout << "Bad!" << endl;
-
- }
-
- catch (const XSECException &e) {
- cout << "Bad!. Caught exception : " << endl;
- char * msg = XMLString::transcode(e.getMsg());
- cout << msg << endl;
- XSEC_RELEASE_XMLCH(msg);
- }
- }
-
- int i;
-
- switch (msg->getMessageType()) {
-
- case XKMSMessageAbstractType::CompoundRequest :
-
- cout << "Compound Request\n\n";
-
- for (i = 0 ; i < ((XKMSCompoundRequest *) (msg))->getRequestListSize(); ++i) {
-
- cout << "Message " << i << endl;
- doMsgDump(((XKMSCompoundRequest *) msg)->getRequestListItem(i));
-
- }
- break;
-
- case XKMSMessageAbstractType::CompoundResult :
-
- cout << "Compound Result\n\n";
-
- for (i = 0 ; i < ((XKMSCompoundResult *)(msg))->getResultListSize(); ++i) {
-
- cout << "Message " << i << endl;
- doMsgDump(((XKMSCompoundResult *) msg)->getResultListItem(i));
-
- }
- break;
-
- case XKMSMessageAbstractType::LocateRequest :
-
- doLocateRequestDump((XKMSLocateRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::LocateResult :
-
- doLocateResultDump((XKMSLocateResult *) msg);
- break;
-
- case XKMSMessageAbstractType::StatusRequest :
-
- doStatusRequestDump((XKMSStatusRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::StatusResult :
-
- doStatusResultDump((XKMSStatusResult *) msg);
- break;
-
- case XKMSMessageAbstractType::Result :
-
- doResultDump((XKMSResult *) msg);
- break;
-
- case XKMSMessageAbstractType::ValidateRequest :
-
- doValidateRequestDump((XKMSValidateRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::ValidateResult :
-
- doValidateResultDump((XKMSValidateResult *) msg);
- break;
-
- case XKMSMessageAbstractType::RegisterRequest :
-
- doRegisterRequestDump((XKMSRegisterRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::RegisterResult :
-
- doRegisterResultDump((XKMSRegisterResult *) msg);
- break;
-
- case XKMSMessageAbstractType::RevokeRequest :
-
- doRevokeRequestDump((XKMSRevokeRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::RevokeResult :
-
- doRevokeResultDump((XKMSRevokeResult *) msg);
- break;
-
- case XKMSMessageAbstractType::RecoverRequest :
-
- doRecoverRequestDump((XKMSRecoverRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::RecoverResult :
-
- doRecoverResultDump((XKMSRecoverResult *) msg);
- break;
-
- case XKMSMessageAbstractType::ReissueRequest :
-
- doReissueRequestDump((XKMSReissueRequest *) msg);
- break;
-
- case XKMSMessageAbstractType::ReissueResult :
-
- doReissueResultDump((XKMSReissueResult *) msg);
- break;
-
- default :
-
- cout << "Unknown message type!" << endl;
-
- }
-
- return 0;
-}
-
-int doParsedMsgDump(DOMDocument * doc) {
-
- // Get an XKMS Message Factory
- XSECProvider prov;
- XKMSMessageFactory * factory = prov.getXKMSMessageFactory();
-
- try {
-
- XKMSMessageAbstractType * msg =
- factory->newMessageFromDOM(doc->getDocumentElement());
-
- if (msg == NULL) {
- cerr << "Unable to create XKMS msg from parsed DOM\n" << endl;
- return 2;
- }
-
- Janitor <XKMSMessageAbstractType> j_msg(msg);
-
- return doMsgDump(msg);
-
- }
-
- catch (const XSECException &e) {
- char * msg = XMLString::transcode(e.getMsg());
- cerr << "An error occurred during message loading\n Message: "
- << msg << endl;
- XSEC_RELEASE_XMLCH(msg);
- return 2;
- }
- catch (const XSECCryptoException &e) {
- cerr << "An error occurred during encryption/signature processing\n Message: "
- << e.getMsg() << endl;
-
-#if defined (XSEC_HAVE_OPENSSL)
- ERR_load_crypto_strings();
- BIO * bio_err;
- if ((bio_err=BIO_new(BIO_s_file())) != NULL)
- BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
-
- ERR_print_errors(bio_err);
-#endif
-
- return 2;
- }
- catch (...) {
-
- cerr << "Unknown Exception type occurred. Cleaning up and exitting\n" << endl;
- return 2;
-
- }
-
- // Clean up
-
- return 0;
-}
-
-// --------------------------------------------------------------------------------
-// Base MessageCreate module
-// --------------------------------------------------------------------------------
-
-void printMsgCreateUsage(void) {
-
- cerr << "\nUsage messagecreate [options] {LocateRequest} [msg specific options]\n";
- cerr << " --help/-h : print this screen and exit\n\n";
-
-}
-
-int doMsgCreate(int argc, char ** argv, int paramCount) {
-
- XSECProvider prov;
- DOMDocument * doc;
- XKMSMessageAbstractType *msg;
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
- printMsgCreateUsage();
- return -1;
- }
-
- if ((_stricmp(argv[paramCount], "LocateRequest") == 0) ||
- (_stricmp(argv[paramCount], "lr") == 0)) {
-
- paramCount++;
- msg = createLocateRequest(prov, &doc, argc, argv, paramCount);
- if (msg == NULL) {
- return -1;
- }
-
- }
- else {
-
- printMsgCreateUsage();
- return -1;
-
- }
-
- outputDoc(doc);
-
- // Cleanup message stuff
- delete msg;
- doc->release();
-
- return 0;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Base request module
-// --------------------------------------------------------------------------------
-
-void printDoRequestUsage(void) {
-
- cerr << "\nUsage request [options] {RequestType} [msg specific options]\n";
- cerr << " --help/-h : Print this screen and exit\n";
- cerr << " --two-phase/-t : Indicate Two-Phase support in the request message\n";
- cerr << " --nonce/-n [nonce]\n";
- cerr << " : Set two phase nonce value\n";
- cerr << " --original-requestid/-o [id]\n";
- cerr << " : set OriginalRequestId attribute in request\n";
- cerr << " --envelope-type/-e [NONE|SOAP11|SOAP12]\n";
- cerr << " : Set envelope wrapper for request\n";
- cerr << " NONE = No wrapper - straight HTTP request\n";
- cerr << " SOAP11 = Use a SOAP 1.1 envelope\n";
- cerr << " SOAP12 = Use a SOAP 1.2 envelope\n\n";
- cerr << " Where RequestType = one of :\n";
- cerr << " CompoundRequest (cr)\n";
- cerr << " LocateRequest (lr)\n";
- cerr << " ValidateRequest (vr)\n";
- cerr << " PendingRequest (pr)\n";
- cerr << " RegisterRequest (rr)\n";
- cerr << " ReissueRequest (ir)\n";
- cerr << " RecoverRequest (or)\n";
- cerr << " RevokeRequest (er)\n\n";
-
-}
-
-int doRequest(int argc, char ** argv, int paramCount) {
-
- XSECProvider prov;
- DOMDocument * doc;
- XKMSMessageAbstractType *msg = NULL;
- XSECSOAPRequestorSimple::envelopeType et = XSECSOAPRequestorSimple::ENVELOPE_SOAP11;
-
- bool twoPhase = false;
- bool parmsDone = false;
-
- char * nonce = NULL;
- char * originalRequestId = NULL;
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
- printDoRequestUsage();
- return -1;
- }
-
- while (!parmsDone) {
- if ((_stricmp(argv[paramCount], "--two-phase") == 0) ||
- (_stricmp(argv[paramCount], "-t") == 0)) {
-
- twoPhase = true;
- paramCount++;
-
- }
- else if ((_stricmp(argv[paramCount], "--nonce") == 0) ||
- (_stricmp(argv[paramCount], "-n") == 0)) {
-
- paramCount++;
- if (paramCount == argc) {
- printDoRequestUsage();
- return -1;
- }
-
- nonce=argv[paramCount++];
- }
- else if ((_stricmp(argv[paramCount], "--original-requestid") == 0) ||
- (_stricmp(argv[paramCount], "-o") == 0)) {
-
- paramCount++;
- if (paramCount == argc) {
- printDoRequestUsage();
- return -1;
- }
-
- originalRequestId=argv[paramCount++];
- }
- else if ((_stricmp(argv[paramCount], "--envelope") == 0) ||
- (_stricmp(argv[paramCount], "-e") == 0)) {
-
- // Set the wrapper envelope type
-
- paramCount++;
- if (paramCount == argc) {
- printDoRequestUsage();
- return -1;
- }
-
- if (_stricmp(argv[paramCount], "NONE") == 0) {
- et = XSECSOAPRequestorSimple::ENVELOPE_NONE;
- }
- else if (_stricmp(argv[paramCount], "SOAP11") == 0) {
- et = XSECSOAPRequestorSimple::ENVELOPE_SOAP11;
- }
- else if (_stricmp(argv[paramCount], "SOAP12") == 0) {
- et = XSECSOAPRequestorSimple::ENVELOPE_SOAP12;
- }
- else {
- printDoRequestUsage();
- return -1;
- }
- paramCount++;
- }
- else if ((_stricmp(argv[paramCount], "LocateRequest") == 0) ||
- (_stricmp(argv[paramCount], "lr") == 0)) {
-
- paramCount++;
- XKMSLocateRequest * r =
- (XKMSLocateRequest *) (createLocateRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
-
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "ValidateRequest") == 0) ||
- (_stricmp(argv[paramCount], "vr") == 0)) {
-
- paramCount++;
- XKMSValidateRequest * r =
- (XKMSValidateRequest *) (createValidateRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "RegisterRequest") == 0) ||
- (_stricmp(argv[paramCount], "rr") == 0)) {
-
- paramCount++;
- XKMSRegisterRequest * r =
- (XKMSRegisterRequest *) (createRegisterRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "RevokeRequest") == 0) ||
- (_stricmp(argv[paramCount], "er") == 0)) {
-
- paramCount++;
- XKMSRevokeRequest * r =
- (XKMSRevokeRequest *) (createRevokeRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "RecoverRequest") == 0) ||
- (_stricmp(argv[paramCount], "or") == 0)) {
-
- paramCount++;
- XKMSRecoverRequest * r =
- (XKMSRecoverRequest *) (createRecoverRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "ReissueRequest") == 0) ||
- (_stricmp(argv[paramCount], "ir") == 0)) {
-
- paramCount++;
- XKMSReissueRequest * r =
- (XKMSReissueRequest *) (createReissueRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "PendingRequest") == 0) ||
- (_stricmp(argv[paramCount], "pr") == 0)) {
-
- paramCount++;
- XKMSPendingRequest * r =
- (XKMSPendingRequest *) (createPendingRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "StatusRequest") == 0) ||
- (_stricmp(argv[paramCount], "sr") == 0)) {
-
- paramCount++;
- XKMSStatusRequest * r =
- (XKMSStatusRequest *) (createStatusRequest(prov, &doc, argc, argv, paramCount));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else if ((_stricmp(argv[paramCount], "CompoundRequest") == 0) ||
- (_stricmp(argv[paramCount], "cr") == 0)) {
-
- XKMSCompoundRequest * r =
- (XKMSCompoundRequest *) (createCompoundRequest(prov, &doc, argc, argv, paramCount + 1));
-
- if (r == NULL) {
- return -1;
- }
- if (twoPhase)
- r->appendResponseMechanismItem(XKMSConstants::s_tagRepresent);
-
- msg = r;
- parmsDone = true;
-
- }
- else {
-
- printDoRequestUsage();
- return -1;
-
- }
- }
-
- XKMSMessageFactory * f = prov.getXKMSMessageFactory();
- XKMSRequestAbstractType * request = f->toRequestAbstractType(msg);
-
- if (nonce != NULL)
- request->setNonce(MAKE_UNICODE_STRING(nonce));
- if (originalRequestId != NULL)
- request->setOriginalRequestId(MAKE_UNICODE_STRING(originalRequestId));
-
- try {
- if (g_txtOut) {
- outputDoc(doc);
- }
- }
- catch (...) {
- delete msg;
- doc->release();
- throw;
- }
-
- DOMDocument * responseDoc;
-
- try {
- XSECSOAPRequestorSimple req(msg->getService());
-#if !defined(_WIN32)
- struct timeval tv1, tv2;
- gettimeofday(&tv1, NULL);
-#endif
- req.setEnvelopeType(et);
-
- responseDoc = req.doRequest(doc);
-#if !defined(_WIN32)
- gettimeofday(&tv2, NULL);
- long seconds = tv2.tv_sec - tv1.tv_sec;
- long useconds;
- if (seconds != 0) {
- useconds = 1000000 - tv1.tv_usec + tv2.tv_usec;
- seconds--;
- }
- else {
- useconds = tv2.tv_usec - tv1.tv_usec;
- }
- if (useconds >= 1000000) {
- useconds -= 1000000;
- seconds++;
- }
-
- cout << "Time taken for request = " << seconds << " seconds, " << useconds << " useconds" << endl;
-#endif
- /* If two-phase - re-do the request */
- if (twoPhase) {
-
- XKMSResultType * r = f->toResultType(f->newMessageFromDOM(responseDoc->getDocumentElement()));
- if (r->getResultMajor() == XKMSResultType::Represent) {
-
- cerr << "Intermediate response of a two phase sequence received\n\n";
-
- if (g_txtOut) {
- outputDoc(responseDoc);
- }
- doParsedMsgDump(responseDoc);
-
- //XKMSRequestAbstractType * request = f->toRequestAbstractType(msg);
- for (int k = 0; k < request->getResponseMechanismSize(); ++k) {
- if (strEquals(request->getResponseMechanismItemStr(k),
- XKMSConstants::s_tagRepresent)) {
- request->removeResponseMechanismItem(k);
- break;
- }
- }
-
- request->setNonce(r->getNonce());
- request->setOriginalRequestId(request->getId());
- XMLCh * myId = generateId();
-
- request->setId(myId);
- XSEC_RELEASE_XMLCH(myId);
-
- responseDoc->release();
- responseDoc = req.doRequest(doc);
-
- }
- delete r;
- }
-
- }
- catch (const XSECException &e) {
-
- char * m = XMLString::transcode(e.getMsg());
- cerr << "Error sending request: " << m << endl;
- XSEC_RELEASE_XMLCH(m);
-
- delete msg;
- doc->release();
-
- return -1;
-
- }
- catch (...) {
- delete msg;
- doc->release();
-
- throw;
-
- }
-
- // Cleanup request stuff
- delete msg;
- doc->release();
-
- // Now lets process the result
-
- int ret;
-
- try {
- if (g_txtOut) {
- outputDoc(responseDoc);
- }
- ret = doParsedMsgDump(responseDoc);
- }
- catch (...) {
- responseDoc->release();
- throw;
- }
-
- responseDoc->release();
- return ret;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Base msgdump module
-// --------------------------------------------------------------------------------
-
-
-#if 0
-class XMLSchemaDTDResolver : public EntityResolver {
-
-public:
-
- XMLSchemaDTDResolver() {}
- ~XMLSchemaDTDResolver() {}
-
- InputSource * resolveEntity (const XMLCh* const publicId, const XMLCh* const systemId);
-
-};
-
-InputSource * XMLSchemaDTDResolver::resolveEntity (const XMLCh* const publicId,
- const XMLCh* const systemId) {
-
-
-
- if (strEquals(systemId, "http://www.w3.org/2001/XMLSchema")) {
- return new LocalFileInputSource(MAKE_UNICODE_STRING("C:\\prog\\SRC\\xml-security\\c\\Build\\Win32\\VC6\\Debug\\XMLSchema.dtd"));
- }
- else {
- return NULL;
- }
-
-}
-#endif
-void printMsgDumpUsage(void) {
-
- cerr << "\nUsage msgdump [options] <filename>\n";
- cerr << " --help/-h : print this screen and exit\n";
- cerr << " --validate/-v : validate the input messages\n";
- cerr << " --auth-phrase/-a <phrase>\n";
- cerr << " : use <phrase> for authentication/private key in X-KRSS messages\n";
-#if defined (XSEC_HAVE_OPENSSL)
- cerr << " --output-private-key/-p <filename> <passphrase>\n";
- cerr << " : Write private keys from Register or Recover requests to the file\n\n";
-#endif
- cerr << " filename = name of file containing XKMS msg to dump\n\n";
-
-}
-
-int doMsgDump(int argc, char ** argv, int paramCount) {
-
- char * inputFile = NULL;
- bool doValidate = false;
-
- if (paramCount >= argc ||
- (_stricmp(argv[paramCount], "--help") == 0) ||
- (_stricmp(argv[paramCount], "-h") == 0)) {
- printMsgDumpUsage();
- return -1;
- }
-
- while (paramCount < argc-1) {
- if ((_stricmp(argv[paramCount], "--validate") == 0) ||
- (_stricmp(argv[paramCount], "-v") == 0)) {
-
- doValidate = true;
- paramCount++;
-
- }
- else if ((_stricmp(argv[paramCount], "--auth-phrase") == 0) ||
- (_stricmp(argv[paramCount], "-a") == 0)) {
-
- paramCount++;
- g_authPassPhrase = argv[paramCount];
- paramCount++;
- }
-#if defined (XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--output-private-key") == 0 || _stricmp(argv[paramCount], "-p") == 0) {
- if (paramCount >= argc + 2) {
- printMsgDumpUsage();
- return -1;
- }
- ++paramCount;
- g_privateKeyFile = argv[paramCount++];
- g_privateKeyPassPhrase = argv[paramCount++];
- }
-#endif
- else {
-
- printMsgDumpUsage();
- return -1;
- }
- }
-
- if (paramCount >= argc) {
- printMsgDumpUsage();
- return -1;
- }
-
- inputFile = argv[paramCount];
-
- // Dump the details of an XKMS message to the console
- cout << "Decoding XKMS Message contained in " << inputFile << endl;
-
- // Create and set up the parser
-
- XercesDOMParser * parser = new XercesDOMParser;
- Janitor<XercesDOMParser> j_parser(parser);
-
- parser->setDoNamespaces(true);
- parser->setCreateEntityReferenceNodes(true);
-
- // Error handling
- xkmsErrorHandler xeh;
- parser->setErrorHandler(&xeh);
-
-#if 0
- // Local load of XMLSchema.dtd
- XMLSchemaDTDResolver sdr;
- parser->setEntityResolver(&sdr);
-#endif
-
- // Schema handling
- if (doValidate) {
- parser->setDoSchema(true);
- parser->setExternalSchemaLocation("http://www.w3.org/2002/03/xkms# http://www.w3.org/TR/xkms2/Schemas/xkms.xsd");
- }
-
- bool errorsOccured = false;
- XMLSize_t errorCount = 0;
- try
- {
- parser->parse(inputFile);
- errorCount = parser->getErrorCount();
- }
-
- catch (const XMLException& e)
- {
- char * msg = XMLString::transcode(e.getMessage());
- cerr << "An error occurred during parsing\n Message: "
- << msg << endl;
- XSEC_RELEASE_XMLCH(msg);
- errorsOccured = true;
- }
-
-
- catch (const DOMException& e)
- {
- cerr << "A DOM error occurred during parsing\n DOMException code: "
- << e.code << endl;
- errorsOccured = true;
- }
-
- if (errorCount > 0 || errorsOccured) {
-
- cout << "Errors during parse" << endl;
- return (2);
-
- }
-
- /*
-
- Now that we have the parsed file, get the DOM document and start looking at it
-
- */
-
- DOMDocument *doc = parser->getDocument();
-
- return doParsedMsgDump(doc);
-}
-
-
-// --------------------------------------------------------------------------------
-// Startup and main
-// --------------------------------------------------------------------------------
-
-void printUsage(void) {
-
- cerr << "\nUsage: xklient [base options] {msgdump|msgcreate|dorequest} [command specific options]\n\n";
- cerr << " msgdump : Read an XKMS message and print details\n";
- cerr << " msgcreate : Create a message of type :\n";
- cerr << " LocateRequest\n";
- cerr << " ValidateRequest\n";
- cerr << " PendingRequest\n";
- cerr << " RegisterRequest\n";
- cerr << " RecoverRequest\n";
- cerr << " ReissueRequest\n";
- cerr << " RevokeRequest\n";
- cerr << " PendingRequest\n";
- cerr << " send to service URI and output result\n\n";
- cerr << " Where options are :\n\n";
- cerr << " --text/-t\n";
- cerr << " Print any created XML to screen\n";
-
-}
-
-int evaluate(int argc, char ** argv) {
-
- if (argc < 2) {
-
- printUsage();
- return 2;
- }
-
- int paramCount = 1;
-
- // Run through parameters
-
- while (paramCount < argc) {
-
- if (_stricmp(argv[paramCount], "--text") == 0 || _stricmp(argv[paramCount], "-t") == 0) {
- g_txtOut = true;
- paramCount++;
- }
- else if (_stricmp(argv[paramCount], "MsgDump") == 0 || _stricmp(argv[paramCount], "md") == 0) {
-
- // Perform a MsgDump operation
- return doMsgDump(argc, argv, paramCount +1);
-
- }
- else if (_stricmp(argv[paramCount], "MsgCreate") == 0 || _stricmp(argv[paramCount], "mc") == 0) {
-
- // Perform a MsgDump operation
- return doMsgCreate(argc, argv, paramCount +1);
-
- }
- else if (_stricmp(argv[paramCount], "Request") == 0 || _stricmp(argv[paramCount], "req") == 0) {
-
- // Perform a MsgDump operation
- return doRequest(argc, argv, paramCount +1);
-
- }
- else {
- printUsage();
- return 2;
- }
- }
-
- return 1;
-
-}
-
-
-
-int main(int argc, char **argv) {
-
- int retResult;
-
- /* We output a version number to overcome a "feature" in Microsoft's memory
- leak detection */
-
- cout << "XKMS Client (Using Apache XML-Security-C Library v" << XSEC_VERSION_MAJOR <<
- "." << XSEC_VERSION_MEDIUM << "." << XSEC_VERSION_MINOR << ")\n";
-
-#if defined (_DEBUG) && defined (_MSC_VER)
-
- // Do some memory debugging under Visual C++
-
- _CrtMemState s1, s2, s3;
-
- // At this point we are about to start really using XSEC, so
- // Take a "before" checkpoing
-
- _CrtMemCheckpoint( &s1 );
-
-#endif
-
- // Initialise the XML system
-
- try {
-
- XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
- XSECPlatformUtils::Initialise();
-
- }
- catch (const XMLException &e) {
-
- cerr << "Error during initialisation of Xerces" << endl;
- cerr << "Error Message = : "
- << e.getMessage() << endl;
-
- }
-
- retResult = evaluate(argc, argv);
-
- XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
- XMLPlatformUtils::Terminate();
-
-#if defined (_DEBUG) && defined (_MSC_VER)
-
- _CrtMemCheckpoint( &s2 );
-
- if ( _CrtMemDifference( &s3, &s1, &s2 ) && s3.lCounts[1] > 1) {
-
- std::cerr << "Total count = " << (unsigned int) s3.lTotalCount << endl;
-
- // Send all reports to STDOUT
- _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
- _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
- _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
- _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
-
- // Dumpy memory stats
-
- _CrtMemDumpAllObjectsSince( &s3 );
- _CrtMemDumpStatistics( &s3 );
- }
-
- // Now turn off memory leak checking and end as there are some
- // Globals that are allocated that get seen as leaks (Xalan?)
-
- int dbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
- dbgFlag &= ~(_CRTDBG_LEAK_CHECK_DF);
- _CrtSetDbgFlag( dbgFlag );
-
-#endif
-
- return retResult;
-}
diff --git a/xsec/tools/xtest/xtest.cpp b/xsec/tools/xtest/xtest.cpp
index c5aed738..ec2d796a 100644
--- a/xsec/tools/xtest/xtest.cpp
+++ b/xsec/tools/xtest/xtest.cpp
@@ -55,24 +55,6 @@
#include <xsec/dsig/DSIGTransformXPathFilter.hpp>
#include <xsec/dsig/DSIGTransformC14n.hpp>
#include <xsec/dsig/DSIGObject.hpp>
-
-// XALAN
-
-#ifdef XSEC_HAVE_XALAN
-
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
-
// XSEC
#include <xsec/canon/XSECC14n20010315.hpp>
@@ -105,16 +87,6 @@ XALAN_USING_XALAN(XalanTransformer)
# include <openssl/evp.h>
# include <openssl/pem.h>
#endif
-#if defined (XSEC_HAVE_WINCAPI)
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyHMAC.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp>
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#endif
-#if defined (XSEC_HAVE_NSS)
-# include <xsec/enc/NSS/NSSCryptoKeyHMAC.hpp>
-# include <xsec/enc/NSS/NSSCryptoKeyRSA.hpp>
-# include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#endif
using std::ostream;
using std::cout;
@@ -135,8 +107,6 @@ XERCES_CPP_NAMESPACE_USE
// --------------------------------------------------------------------------------
bool g_printDocs = false;
-bool g_useWinCAPI = false;
-bool g_useNSS = false;
bool g_haveAES = true;
bool g_testGCM = true;
@@ -363,25 +333,11 @@ XSECCryptoKeyHMAC * createHMACKey(const unsigned char * str) {
// Create the HMAC key
XSECCryptoKeyHMAC * hmacKey = NULL;
-#if defined(XSEC_HAVE_WINCAPI)
-
- if (g_useWinCAPI == true) {
- hmacKey = new WinCAPICryptoKeyHMAC(0);
- }
-#endif
-
-# if defined (XSEC_HAVE_NSS)
- if (g_useNSS == true) {
- hmacKey = new NSSCryptoKeyHMAC();
- }
-#endif
-
#if defined (XSEC_HAVE_OPENSSL)
if (hmacKey == NULL)
hmacKey = new OpenSSLCryptoKeyHMAC();
-#endif
-
hmacKey->setKey((unsigned char *) str, (unsigned int) strlen((char *)str));
+#endif
return hmacKey;
@@ -1068,65 +1024,15 @@ void unitTestRSA(DOMImplementation * impl) {
XSECCryptoKeyRSA * rsaKey;
#if defined (XSEC_HAVE_OPENSSL)
- if (!g_useWinCAPI && !g_useNSS) {
- // Load the key
- BIO * bioMem = BIO_new(BIO_s_mem());
- BIO_puts(bioMem, s_tstRSAPrivateKey);
- EVP_PKEY * pk = PEM_read_bio_PrivateKey(bioMem, NULL, NULL, NULL);
+ // Load the key
+ BIO * bioMem = BIO_new(BIO_s_mem());
+ BIO_puts(bioMem, s_tstRSAPrivateKey);
+ EVP_PKEY * pk = PEM_read_bio_PrivateKey(bioMem, NULL, NULL, NULL);
- rsaKey = new OpenSSLCryptoKeyRSA(pk);
+ rsaKey = new OpenSSLCryptoKeyRSA(pk);
- BIO_free(bioMem);
- EVP_PKEY_free(pk);
- }
-#endif
-
-#if defined (XSEC_HAVE_WINCAPI)
- if (g_useWinCAPI) {
-
- // Use the internal key
- WinCAPICryptoProvider *cp = (WinCAPICryptoProvider *) (XSECPlatformUtils::g_cryptoProvider);
- HCRYPTPROV p = cp->getApacheKeyStore();
-
- rsaKey = new WinCAPICryptoKeyRSA(p, AT_KEYEXCHANGE, true);
- }
-
-#endif
-
-#if defined (XSEC_HAVE_NSS)
- if (g_useNSS) {
- // Heavily based on Mozilla example code
- SECKEYPrivateKey *prvKey = 0;
- SECKEYPublicKey *pubKey = 0;
- PK11SlotInfo *slot = 0;
- PK11RSAGenParams rsaParams;
-
- // Use a bog standard key size
- rsaParams.keySizeInBits = 1024;
- rsaParams.pe = 65537;
-
- // We need somewhere to temporarily store a generated key
- slot = PK11_GetInternalKeySlot();
- if (!slot) {
- cerr << "Error generating key - can't get NSS slot\n";
- exit (1);
- }
-
- // Do the generate
- prvKey = PK11_GenerateKeyPair(slot, CKM_RSA_PKCS_KEY_PAIR_GEN, &rsaParams,
- &pubKey, PR_FALSE, PR_TRUE, 0);
-
- if (!prvKey) {
- if (slot)
- PK11_FreeSlot(slot);
- cerr << "Error generating key within NSS\n";
- exit (1);
- }
-
- // Now use the key!
- rsaKey = new NSSCryptoKeyRSA(pubKey, prvKey);
-
- }
+ BIO_free(bioMem);
+ EVP_PKEY_free(pk);
#endif
cerr << "Unit testing RSA-SHA1 signature ... ";
@@ -1202,11 +1108,7 @@ void unitTestSignature(DOMImplementation * impl) {
// Test an enveloping signature
unitTestEnvelopingSignature(impl);
-#ifdef XSEC_HAVE_XALAN
- unitTestBase64NodeSignature(impl);
-#else
cerr << "Skipping base64 node test (Requires XPath)" << endl;
-#endif
// Test "long" sha hashes
if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA512))
@@ -1305,36 +1207,8 @@ void testSignature(DOMImplementation *impl) {
DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
ce->addInclusiveNamespace("foo");
-#ifndef XSEC_HAVE_XALAN
-
cerr << "WARNING : No testing of XPath being performed as Xalan not present" << endl;
refCount = 7;
-
-#else
- /*
- * Create some XPath/XPathFilter references
- */
-
-
- ref[7] = sig->createReference(MAKE_UNICODE_STRING(""),
- DSIGConstants::s_unicodeStrURISHA1);
- sig->setXPFNSPrefix(MAKE_UNICODE_STRING("xpf"));
- DSIGTransformXPathFilter * xpf = ref[7]->appendXPathFilterTransform();
- xpf->appendFilter(DSIGXPathFilterExpr::FILTER_INTERSECT, MAKE_UNICODE_STRING("//ADoc/category"));
-
- ref[8] = sig->createReference(MAKE_UNICODE_STRING(""),
- DSIGConstants::s_unicodeStrURISHA1);
- /* ref[5]->appendXPathTransform("ancestor-or-self::dsig:Signature",
- "xmlns:dsig=http://www.w3.org/2000/09/xmldsig#"); */
-
- DSIGTransformXPath * x = ref[8]->appendXPathTransform("count(ancestor-or-self::dsig:Signature | \
-here()/ancestor::dsig:Signature[1]) > \
-count(ancestor-or-self::dsig:Signature)");
- x->setNamespace("dsig", "http://www.w3.org/2000/09/xmldsig#");
-
- refCount = 9;
-
-#endif
/*
* Sign the document, using an HMAC algorithm and the key "secret"
@@ -2044,120 +1918,54 @@ void unitTestEncrypt(DOMImplementation *impl) {
cerr << "RSA key wrap... ";
#if defined (XSEC_HAVE_OPENSSL)
- if (!g_useWinCAPI && !g_useNSS) {
- // Load the key
- BIO * bioMem = BIO_new(BIO_s_mem());
- BIO_puts(bioMem, s_tstRSAPrivateKey);
- EVP_PKEY * pk = PEM_read_bio_PrivateKey(bioMem, NULL, NULL, NULL);
-
- OpenSSLCryptoKeyRSA * k = new OpenSSLCryptoKeyRSA(pk);
-
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_1_5);
-
- cerr << "RSA OAEP key wrap... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1, DSIGConstants::s_unicodeStrURIMGF1_SHA1);
-
- cerr << "RSA OAEP key wrap + params... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1, DSIGConstants::s_unicodeStrURIMGF1_SHA1,
- s_tstOAEPparams, (unsigned int) strlen((char *) s_tstOAEPparams));
+ // Load the key
+ BIO * bioMem = BIO_new(BIO_s_mem());
+ BIO_puts(bioMem, s_tstRSAPrivateKey);
+ EVP_PKEY * pk = PEM_read_bio_PrivateKey(bioMem, NULL, NULL, NULL);
- cerr << "RSA OAEP 1.1 key wrap... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA1);
+ OpenSSLCryptoKeyRSA * k = new OpenSSLCryptoKeyRSA(pk);
- if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA224)) {
- cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA224... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA224);
- }
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_1_5);
- if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA256)) {
- cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA256... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA256);
- }
+ cerr << "RSA OAEP key wrap... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1, DSIGConstants::s_unicodeStrURIMGF1_SHA1);
- if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA384)) {
- cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA384... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA384);
- }
+ cerr << "RSA OAEP key wrap + params... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1, DSIGConstants::s_unicodeStrURIMGF1_SHA1,
+ s_tstOAEPparams, (unsigned int) strlen((char *) s_tstOAEPparams));
- if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA512)) {
- cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA512... ";
- k = new OpenSSLCryptoKeyRSA(pk);
- unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA512);
- }
+ cerr << "RSA OAEP 1.1 key wrap... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA1);
- BIO_free(bioMem);
- EVP_PKEY_free(pk);
+ if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA224)) {
+ cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA224... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA224);
}
-#endif
-
-#if defined (XSEC_HAVE_WINCAPI)
- if (g_useWinCAPI) {
-
- // Use the internal key
- WinCAPICryptoProvider *cp = (WinCAPICryptoProvider *) (XSECPlatformUtils::g_cryptoProvider);
- HCRYPTPROV p = cp->getApacheKeyStore();
-
- WinCAPICryptoKeyRSA * rsaKey = new WinCAPICryptoKeyRSA(p, AT_KEYEXCHANGE, true);
- unitTestKeyEncrypt(impl, rsaKey, DSIGConstants::s_unicodeStrURIRSA_1_5);
-
- cerr << "RSA OAEP key wrap... ";
- rsaKey = new WinCAPICryptoKeyRSA(p, AT_KEYEXCHANGE, true);
- unitTestKeyEncrypt(impl, rsaKey, DSIGConstants::s_unicodeStrURIRSA_OAEP_MGFP1);
-
- cerr << "RSA OAEP 1.1 key wrap... ";
- rsaKey = new WinCAPICryptoKeyRSA(p, AT_KEYEXCHANGE, true);
- unitTestKeyEncrypt(impl, rsaKey, DSIGConstants::s_unicodeStrURIRSA_OAEP);
- }
-#endif
-
-#if defined (XSEC_HAVE_NSS)
- if (g_useNSS) {
- // Heavily based on Mozilla example code
- SECKEYPrivateKey *prvKey = 0;
- SECKEYPublicKey *pubKey = 0;
- PK11SlotInfo *slot = 0;
- PK11RSAGenParams rsaParams;
-
- // Use a bog standard key size
- rsaParams.keySizeInBits = 1024;
- rsaParams.pe = 65537;
-
- // We need somewhere to temporarily store a generated key
- slot = PK11_GetInternalKeySlot();
- if (!slot) {
- cerr << "Error generating key - can't get NSS slot\n";
- exit (1);
- }
-
- // Do the generate
- prvKey = PK11_GenerateKeyPair(slot, CKM_RSA_PKCS_KEY_PAIR_GEN, &rsaParams,
- &pubKey, PR_FALSE, PR_TRUE, 0);
-
- if (!prvKey) {
- if (slot)
- PK11_FreeSlot(slot);
- cerr << "Error generating key within NSS\n";
- exit (1);
- }
+ if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA256)) {
+ cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA256... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA256);
+ }
- // Now use the key!
- NSSCryptoKeyRSA * rsaKey = new NSSCryptoKeyRSA(pubKey, prvKey);
- unitTestKeyEncrypt(impl, rsaKey, DSIGConstants::s_unicodeStrURIRSA_1_5);
+ if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA384)) {
+ cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA384... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA384);
+ }
- if (slot)
- // Actual keys will be deleted by the provider
- PK11_FreeSlot(slot);
-
- cerr << "RSA OAEP key wrap skipped - not yet supported in NSS crypto provider\n";
-
+ if (XSECPlatformUtils::g_cryptoProvider->algorithmSupported(XSECCryptoHash::HASH_SHA512)) {
+ cerr << "RSA OAEP 1.1 key wrap with MGF1+SHA512... ";
+ k = new OpenSSLCryptoKeyRSA(pk);
+ unitTestKeyEncrypt(impl, k, DSIGConstants::s_unicodeStrURIRSA_OAEP, DSIGConstants::s_unicodeStrURIMGF1_SHA512);
}
+
+ BIO_free(bioMem);
+ EVP_PKEY_free(pk);
#endif
XSECCryptoSymmetricKey * ks;
@@ -2263,17 +2071,9 @@ void unitTestEncrypt(DOMImplementation *impl) {
cerr << "Unit testing 3DES CBC encryption" << endl;
unitTestElementContentEncrypt(impl, ks->clone(), DSIGConstants::s_unicodeStrURI3DES_CBC, false);
unitTestElementContentEncrypt(impl, ks, DSIGConstants::s_unicodeStrURI3DES_CBC, true);
-#ifdef XSEC_HAVE_XALAN
- if (g_haveAES) {
- cerr << "Unit testing CipherReference creation and decryption" << endl;
- unitTestCipherReference(impl);
- }
- else {
- cerr << "Skipped Cipher Reference Test (uses AES)" << endl;
- }
-#else
+
cerr << "Skipped Cipher Reference Test (requires XPath)" << endl;
-#endif
+
cerr << "Misc. encryption tests" << endl;
unitTestSmallElement(impl);
}
@@ -2557,14 +2357,6 @@ void printUsage(void) {
cerr << " Where options are :\n\n";
cerr << " --help/-h\n";
cerr << " This help message\n\n";
-#if defined (XSEC_HAVE_WINCAPI) && defined (XSEC_HAVE_OPENSSL)
- cerr << " --wincapi/-w\n";
- cerr << " Use Windows Crypto API for crypto functionality\n\n";
-#endif
-#if defined (XSEC_HAVE_NSS)
- cerr << " --nss/-n\n";
- cerr << " Use NSS Crypto API for crypto functionality\n\n";
-#endif
cerr << " --print-docs/-p\n";
cerr << " Print the test documents\n\n";
cerr << " --signature-only/-s\n";
@@ -2598,13 +2390,6 @@ int main(int argc, char **argv) {
bool doSignatureTest = true;
bool doSignatureUnitTests = true;
- // Testing for which Crypto API to use by default - only really useful on windows
-#if !defined(XSEC_HAVE_OPENSSL)
-#if defined(XSEC_HAVE_WINCAPI)
- g_useWinCAPI = true;
-#endif
-#endif
-
int paramCount = 1;
while (paramCount < argc) {
@@ -2617,18 +2402,6 @@ int main(int argc, char **argv) {
g_printDocs = true;
paramCount++;
}
-#if defined(XSEC_HAVE_WINCAPI) && defined(XSEC_HAVE_OPENSSL)
- else if (_stricmp(argv[paramCount], "--wincapi") == 0 || _stricmp(argv[paramCount], "-w") == 0) {
- g_useWinCAPI = true;
- paramCount++;
- }
-#endif
-#if defined(XSEC_HAVE_NSS)
- else if (_stricmp(argv[paramCount], "--nss") == 0 || _stricmp(argv[paramCount], "-n") == 0) {
- g_useNSS = true;
- paramCount++;
- }
-#endif
else if (_stricmp(argv[paramCount], "--signature-only") == 0 || _stricmp(argv[paramCount], "-s") == 0) {
doEncryptionTest = false;
@@ -2688,41 +2461,13 @@ int main(int argc, char **argv) {
// First initialise the XML system
try {
-
XMLPlatformUtils::Initialize();
-#ifdef XSEC_HAVE_XALAN
- XPathEvaluator::initialize();
- XalanTransformer::initialize();
-#endif
XSECPlatformUtils::Initialise();
-
-#if defined (XSEC_HAVE_OPENSSL) && defined (XSEC_HAVE_WINCAPI)
- if (g_useWinCAPI) {
- // Setup for Windows Crypt API
- WinCAPICryptoProvider * cp;
- // First set windows as the crypto provider
- cp = new WinCAPICryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
- }
-#endif
-#if defined (XSEC_HAVE_NSS)
- if (g_useNSS) {
- // Setup for NSS Crypt API
- NSSCryptoProvider * cp;
- // First set windows as the crypto provider
- cp = new NSSCryptoProvider();
- XSECPlatformUtils::SetCryptoProvider(cp);
- }
-#endif
-
-
}
catch (const XMLException &e) {
-
cerr << "Error during initialisation of Xerces" << endl;
cerr << "Error Message = : "
<< e.getMessage() << endl;
-
}
{
@@ -2786,10 +2531,6 @@ int main(int argc, char **argv) {
}
XSECPlatformUtils::Terminate();
-#ifdef XSEC_HAVE_XALAN
- XalanTransformer::terminate();
- XPathEvaluator::terminate();
-#endif
XMLPlatformUtils::Terminate();
#if defined (_DEBUG) && defined (_MSC_VER) && defined (_XSEC_DO_MEMDEBUG)
diff --git a/xsec/transformers/TXFMXPath.cpp b/xsec/transformers/TXFMXPath.cpp
deleted file mode 100644
index 36c09f2f..00000000
--- a/xsec/transformers/TXFMXPath.cpp
+++ /dev/null
@@ -1,579 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXPath := Class that performs XPath transforms
- *
- * $Id$
- *
- */
-
-
-#include <xsec/dsig/DSIGConstants.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/transformers/TXFMXPath.hpp>
-#include <xsec/transformers/TXFMParser.hpp>
-
-#ifdef XSEC_HAVE_XALAN
-
-#include "../utils/XSECDOMUtils.hpp"
-
-#if defined(_MSC_VER)
-# pragma warning(disable: 4267)
-#endif
-
-#include <xalanc/XPath/XObjectFactoryDefault.hpp>
-#include <xalanc/XPath/XPathExecutionContextDefault.hpp>
-
-#if defined(_MSC_VER)
-# pragma warning(default: 4267)
-#endif
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-// Xalan namespace usage
-XALAN_USING_XALAN(XPathProcessorImpl)
-XALAN_USING_XALAN(XercesDOMSupport)
-XALAN_USING_XALAN(XercesParserLiaison)
-XALAN_USING_XALAN(XercesDocumentWrapper)
-XALAN_USING_XALAN(XercesWrapperNavigator)
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XPathFactoryDefault)
-XALAN_USING_XALAN(XPathConstructionContextDefault)
-XALAN_USING_XALAN(XalanDocument)
-XALAN_USING_XALAN(XalanNode)
-XALAN_USING_XALAN(XalanDOMChar)
-XALAN_USING_XALAN(XPathEnvSupportDefault)
-XALAN_USING_XALAN(XObjectFactoryDefault)
-XALAN_USING_XALAN(XPathExecutionContextDefault)
-XALAN_USING_XALAN(ElementPrefixResolverProxy)
-XALAN_USING_XALAN(XPath)
-XALAN_USING_XALAN(NodeRefListBase)
-XALAN_USING_XALAN(XSLTResultTarget)
-XALAN_USING_XALAN(XSLException)
-
-#endif
-
-XERCES_CPP_NAMESPACE_USE
-
-#ifdef XSEC_HAVE_XPATH
-
-#include <iostream>
-
-#define KLUDGE_PREFIX "berindsig"
-
-// Helper function
-
-void setXPathNS(DOMDocument *d,
- DOMNamedNodeMap *xAtts,
- XSECXPathNodeList &addedNodes,
- XSECSafeBufferFormatter *formatter,
- XSECNameSpaceExpander * nse) {
-
- // if set then set the name spaces in the attribute list else clear them
-
- DOMElement * e = d->getDocumentElement();
-
- if (e == NULL) {
-
- throw XSECException(XSECException::XPathError, "Element node not found in Document");
-
- }
-
- if (xAtts != 0) {
-
- int xAttsCount = xAtts->getLength();
-
- // Check all is OK with the Xalan Document and first element
-
- if (d == NULL) {
-
- throw XSECException(XSECException::XPathError, "Attempt to define XPath Name Space before setInput called");
-
- }
-
- // Run through each attribute looking for name spaces
- const XMLCh *xpName;
- safeBuffer xpNameSB;
- const XMLCh *xpLocalName;
- const XMLCh *xpValue;
-
- for (int xCounter = 0; xCounter < xAttsCount; ++xCounter) {
-
- if (nse == NULL || !nse->nodeWasAdded(xAtts->item(xCounter))) {
-
- xpName = xAtts->item(xCounter)->getNodeName();
- xpNameSB << (*formatter << xpName);
-
- if (xpNameSB.sbStrncmp("xmlns", 5) == 0) {
-
- // Check whether a node of this name already exists
- xpLocalName = xAtts->item(xCounter)->getLocalName();
- xpValue = xAtts->item(xCounter)->getNodeValue();
- if (e->hasAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, xpLocalName) == false) {
-
- // Nope
-
- e->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, xpName, xpValue);
- addedNodes.addNode(e->getAttributeNodeNS(DSIGConstants::s_unicodeStrURIXMLNS, xpLocalName));
- }
-
- }
-
- }
-
- }
-
- }
-
- // Insert the kludge namespace
- safeBuffer k("xmlns:");
- k.sbStrcatIn(KLUDGE_PREFIX);
-
- e->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- MAKE_UNICODE_STRING(k.rawCharBuffer()),
- DSIGConstants::s_unicodeStrURIDSIG);
-}
-
-void clearXPathNS(DOMDocument *d,
- XSECXPathNodeList &toRemove,
- XSECSafeBufferFormatter *formatter,
- XSECNameSpaceExpander * nse) {
-
- // Clear the XPath name spaces in the document element attribute list
-
- DOMElement * e = d->getDocumentElement();
-
- if (e == NULL) {
-
- throw XSECException(XSECException::XPathError, "Element node not found in Document");
-
- }
-
- // Run through each node in the added nodes
-
- const DOMNode * r = toRemove.getFirstNode();
- while (r != NULL) {
- e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- r->getLocalName());
- r = toRemove.getNextNode();
- }
-
- e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- MAKE_UNICODE_STRING(KLUDGE_PREFIX));
-
-}
-
-TXFMXPath::TXFMXPath(DOMDocument *doc) :
- TXFMBase(doc) {
-
- document = NULL;
- XPathAtts = NULL;
-
- // Formatter is used for handling attribute name space inputs
-
- XSECnew(formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
- XMLFormatter::UnRep_CharRef));
-
-}
-
-TXFMXPath::~TXFMXPath() {
-
- if (formatter != NULL)
- delete formatter;
-
-}
-
-void TXFMXPath::setNameSpace(DOMNamedNodeMap *xpAtts) {
-
- // A name space needs to be set on the document
-
- XPathAtts = xpAtts;
-
-}
-
-// Methods to set the inputs
-
-void TXFMXPath::setInput(TXFMBase *newInput) {
-
- if (newInput->getOutputType() == TXFMBase::BYTE_STREAM) {
-
- //throw XSECException(XSECException::TransformInputOutputFail, "C14n canonicalisation transform requires DOM_NODES input");
- // Need to parse into DOM_NODES
- TXFMParser * parser;
- XSECnew(parser, TXFMParser(mp_expansionDoc));
- try{
- parser->setInput(newInput);
- }
- catch (...) {
- delete parser;
- input = newInput;
- throw;
- }
-
- input = parser;
- parser->expandNameSpaces();
- }
- else
- input = newInput;
-
- // Set up for the new document
- document = input->getDocument();
-
- // Expand if necessary
- this->expandNameSpaces();
-
- keepComments = input->getCommentsStatus();
-
-}
-
-bool separator(unsigned char c) {
-
- if (c >= 'a' && c <= 'z')
- return false;
-
- if (c >= 'A' && c <= 'Z')
- return false;
-
- return true;
-
-}
-
-XalanNode * findHereNodeFromXalan(XercesWrapperNavigator * xwn, XalanNode * n, DOMNode *h) {
-
- const DOMNode * m = xwn->mapNode(n);
- const XalanNode * ret;
-
- if (m == h)
- return n;
-
- // Not this one - check the children
-
- XalanNode * c = n->getFirstChild();
-
- while (c != 0) {
- ret = findHereNodeFromXalan(xwn, c, h);
- if (ret != 0)
- return (XalanNode *) ret;
- c = c->getNextSibling();
- }
-
- return 0;
-}
-
-
-
-void TXFMXPath::evaluateExpr(DOMNode *h, safeBuffer inexpr) {
-
- // Temporarily add any necessary name spaces into the document
-
- XSECXPathNodeList addedNodes;
- setXPathNS(document, XPathAtts, addedNodes, formatter, mp_nse);
-
- XPathProcessorImpl xppi; // The processor
- XercesParserLiaison xpl;
- XercesDOMSupport xds(xpl);
- XPathEvaluator xpe;
- XPathFactoryDefault xpf;
- XPathConstructionContextDefault xpcc;
-
- XalanDocument * xd;
- XalanNode * contextNode;
-
- // Xalan can throw exceptions in all functions, so do one broad catch point.
-
- try {
-
- // Map to Xalan
- xd = xpl.createDocument(document);
-
- // For performing mapping
- XercesDocumentWrapper *xdw = xpl.mapDocumentToWrapper(xd);
- XercesWrapperNavigator xwn(xdw);
-
- // Map the "here" node - but only if part of current document
-
- XalanNode * hereNode = NULL;
-
- if (h->getOwnerDocument() == document) {
-
- hereNode = xwn.mapNode(h);
-
- if (hereNode == NULL) {
-
- hereNode = findHereNodeFromXalan(&xwn, xd, h);
-
- if (hereNode == NULL) {
-
- throw XSECException(XSECException::XPathError,
- "Unable to find here node in Xalan Wrapper map");
- }
-
- }
- }
-
- // Now work out what we have to set up in the new processing
-
- TXFMBase::nodeType inputType = input->getNodeType();
-
- XalanDOMString cd; // For the moment assume the root is the context
-
- const XalanDOMChar * cexpr;
-
- safeBuffer contextExpr;
-
- switch (inputType) {
-
- case DOM_NODE_DOCUMENT :
- case DOM_NODE_XPATH_NODESET :
- // do XPath over the whole document and, if the input was an
- // XPath Nodeset, then later intersect the result with the input nodelist
- cd = XalanDOMString("/"); // Root node
- cexpr = cd.c_str();
-
- // The context node is the "root" node
- contextNode =
- xpe.selectSingleNode(
- xds,
- xd,
- cexpr,
- xd->getDocumentElement());
-
- break;
-
- case DOM_NODE_DOCUMENT_FRAGMENT :
- {
-
- // Need to map the DOM_Node that we are given from the input to the appropriate XalanNode
-
- // Create the XPath expression to find the node
-
- if (input->getFragmentId() != NULL) {
-
- contextExpr.sbTranscodeIn("//descendant-or-self::node()[attribute::Id='");
- contextExpr.sbXMLChCat(input->getFragmentId());
- contextExpr.sbXMLChCat("']");
-
- // Map the node
-
- contextNode =
- xpe.selectSingleNode(
- xds,
- xd,
- contextExpr.rawXMLChBuffer(), //XalanDOMString((char *) contextExpr.rawBuffer()).c_str(),
- xd->getDocumentElement());
-
-
- if (contextNode == NULL) {
- // Last Ditch
- contextNode = xwn.mapNode(input->getFragmentNode());
-
- }
-
- }
- else
- contextNode = xwn.mapNode(input->getFragmentNode());
-
- if (contextNode == NULL) {
-
- // Something wrong
- throw XSECException(XSECException::XPathError, "Error mapping context node");
-
- }
-
- break;
- }
-
- default :
-
- throw XSECException(XSECException::XPathError); // Should never get here
-
- }
-
- safeBuffer str;
- XPathEnvSupportDefault xpesd;
- XObjectFactoryDefault xof;
- XPathExecutionContextDefault xpec(xpesd, xds, xof);
-
- ElementPrefixResolverProxy pr(xd->getDocumentElement(), xpesd, xds);
-
- // Work around the fact that the XPath implementation is designed for XSLT, so does
- // not allow here() as a NCName.
-
- // THIS IS A KLUDGE AND SHOULD BE DONE BETTER
-
- safeBuffer k(KLUDGE_PREFIX);
- k.sbStrcatIn(":");
-
- XMLSSize_t offset = inexpr.sbStrstr("here()");
-
- while (offset >= 0) {
-
- if (offset == 0 || offset == 1 ||
- (!(inexpr[offset - 1] == ':' && inexpr[offset - 2] != ':') &&
- separator(inexpr[offset - 1]))) {
-
- inexpr.sbStrinsIn(k.rawCharBuffer(), offset);
-
- }
-
- offset = inexpr.sbOffsetStrstr("here()", offset + 11);
-
- }
-
- // Install the External function in the Environment handler
-
- if (hereNode != NULL) {
-
- xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
-
- }
-
- str.sbStrcpyIn("(descendant-or-self::node() | descendant-or-self::node()/attribute::* | descendant-or-self::node()/namespace::*)[");
- str.sbStrcatIn(inexpr);
- str.sbStrcatIn("]");
-
- XPath * xp = xpf.create();
-
- XalanDOMString Xexpr((char *) str.rawBuffer());
- xppi.initXPath(*xp, xpcc, Xexpr, pr);
-
- // Now resolve
-
- XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
-
- // Now map to a list that others can use (naieve list at this time)
-
- const NodeRefListBase& lst = xObj->nodeset();
-
- int size = (int) lst.getLength();
- const DOMNode *item;
-
- for (int i = 0; i < size; ++ i) {
-
- if (lst.item(i) == xd)
- m_XPathMap.addNode(document);
- else {
- item = xwn.mapNode(lst.item(i));
- m_XPathMap.addNode(item);
- }
- }
-
- if (inputType == DOM_NODE_XPATH_NODESET) {
- //the input list was a XPATH nodeset, so we must intersect the
- // results of the XPath processing done above with the input nodeset
- m_XPathMap.intersect(input->getXPathNodeList());
- }
- }
-
- catch (const XSLException &e) {
-
- safeBuffer msg;
-
- // Whatever happens - fix any changes to the original document
- clearXPathNS(document, addedNodes, formatter, mp_nse);
-
- // Collate the exception message into an XSEC message.
- msg.sbTranscodeIn("Xalan Exception : ");
- msg.sbXMLChCat(e.getType());
- msg.sbXMLChCat(" caught. Message : ");
- msg.sbXMLChCat(e.getMessage().c_str());
-
- throw XSECException(XSECException::XPathError,
- msg.rawXMLChBuffer());
- }
-
- clearXPathNS(document, addedNodes, formatter, mp_nse);
-
-}
-
-void TXFMXPath::evaluateEnvelope(DOMNode *t) {
-
- // A special case where the XPath expression is already known
-
- if (document == NULL) {
-
- throw XSECException(XSECException::XPathError,
- "Attempt to define XPath Name Space before setInput called");
-
- }
-
- DOMElement * e = document->getDocumentElement();
-
- if (e == NULL) {
-
- throw XSECException(XSECException::XPathError,
- "Element node not found in Document");
-
- }
-
- // Set the xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
-
- e->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, MAKE_UNICODE_STRING("xmlns:dsig"), DSIGConstants::s_unicodeStrURIDSIG);
-
-
- // Evaluate
-
- evaluateExpr(t, XPATH_EXPR_ENVELOPE);
-
- // Now we are done, remove the namespace
-
- e->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, MAKE_UNICODE_STRING("dsig"));
-
-}
-
-// Methods to get tranform output type and input requirement
-
-TXFMBase::ioType TXFMXPath::getInputType(void) const {
-
- return TXFMBase::DOM_NODES;
-
-}
-TXFMBase::ioType TXFMXPath::getOutputType(void) const {
-
- return TXFMBase::DOM_NODES;
-
-}
-
-TXFMBase::nodeType TXFMXPath::getNodeType(void) const {
-
- return TXFMBase::DOM_NODE_XPATH_NODESET;
-
-}
-
-// Methods to get output data
-
-unsigned int TXFMXPath::readBytes(XMLByte * const toFill, unsigned int maxToFill) {
-
- return 0;
-
-}
-
-DOMDocument *TXFMXPath::getDocument() const {
-
- return document;
-
-}
-
-#endif /* XSEC_HAVE_XPATH */
diff --git a/xsec/transformers/TXFMXPath.hpp b/xsec/transformers/TXFMXPath.hpp
deleted file mode 100644
index d4f71093..00000000
--- a/xsec/transformers/TXFMXPath.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXPath := Class that performs XPath transforms
- *
- * $Id$
- *
- */
-
-#ifndef TXFMXPATH_INCLUDE
-#define TXFMXPATH_INCLUDE
-
-#include <xsec/transformers/TXFMBase.hpp>
-#include <xsec/utils/XSECSafeBuffer.hpp>
-#include <xsec/canon/XSECC14n20010315.hpp>
-#include <xsec/dsig/DSIGXPathHere.hpp>
-#include <xsec/utils/XSECSafeBufferFormatter.hpp>
-
-// Xerces
-
-XSEC_DECLARE_XERCES_CLASS(DOMNode);
-XSEC_DECLARE_XERCES_CLASS(DOMNamedNodeMap);
-
-// Xalan
-
-#ifdef XSEC_HAVE_XALAN
-
-#include <xalanc/XalanDOM/XalanDocument.hpp>
-#include <xalanc/XercesParserLiaison/XercesDocumentWrapper.hpp>
-#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
-#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XPath/XPathProcessorImpl.hpp>
-#include <xalanc/XPath/XPathFactoryDefault.hpp>
-#include <xalanc/XPath/NodeRefList.hpp>
-#include <xalanc/XPath/XPathEnvSupportDefault.hpp>
-#include <xalanc/XPath/XPathConstructionContextDefault.hpp>
-#include <xalanc/XPath/ElementPrefixResolverProxy.hpp>
-
-#endif
-
-#ifdef XSEC_HAVE_XPATH
-
-/**
- * \brief Transformer to handle XPath transforms
- * @ingroup internal
- */
-
-
-class XSEC_EXPORT TXFMXPath : public TXFMBase {
-
-private:
-
- safeBuffer expr; // The expression being worked with
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * document;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap * XPathAtts; // Attributes that came through from the doc
-
- static bool XPathInitDone;
-
- DSIGXPathHere * here; // The function to implement here()
- XSECSafeBufferFormatter * formatter;
-
-public:
-
- TXFMXPath(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc);
- virtual ~TXFMXPath();
-
- // Methods to set the inputs
-
- void setInput(TXFMBase *newInput);
-
- // Methods to get tranform output type and input requirement
-
- virtual TXFMBase::ioType getInputType(void) const;
- virtual TXFMBase::ioType getOutputType(void) const;
- virtual TXFMBase::nodeType getNodeType(void) const;
-
- // XPath unique
-
- void setNameSpace(XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap *xpAtts);
- void evaluateExpr(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *h, safeBuffer inexpr);
- void evaluateEnvelope(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *t);
-
- // Methods to get output data
-
- virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill);
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument() const;
-private:
- TXFMXPath();
-};
-
-#endif
-
-#endif
diff --git a/xsec/transformers/TXFMXPathFilter.cpp b/xsec/transformers/TXFMXPathFilter.cpp
deleted file mode 100644
index 464f4acb..00000000
--- a/xsec/transformers/TXFMXPathFilter.cpp
+++ /dev/null
@@ -1,658 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXPathFilter := Class that performs XPath transforms
- *
- * $Id$
- *
- */
-
-
-#include <xsec/dsig/DSIGConstants.hpp>
-#include <xsec/dsig/DSIGXPathFilterExpr.hpp>
-#include <xsec/dsig/DSIGXPathHere.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/transformers/TXFMXPathFilter.hpp>
-#include <xsec/transformers/TXFMParser.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-#ifdef XSEC_HAVE_XALAN
-
-#include "../utils/XSECDOMUtils.hpp"
-
-#include <xercesc/util/Janitor.hpp>
-
-#if defined(_MSC_VER)
-# pragma warning(disable: 4267)
-#endif
-
-#include <xalanc/XalanDOM/XalanDocument.hpp>
-#include <xalanc/XalanDOM/XalanDOMString.hpp>
-#include <xalanc/XercesParserLiaison/XercesDocumentWrapper.hpp>
-#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
-#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
-#include <xalanc/XPath/XPathEvaluator.hpp>
-#include <xalanc/XPath/XPathProcessorImpl.hpp>
-#include <xalanc/XPath/XPathFactoryDefault.hpp>
-#include <xalanc/XPath/NodeRefList.hpp>
-#include <xalanc/XPath/XPathEnvSupportDefault.hpp>
-#include <xalanc/XPath/XPathConstructionContextDefault.hpp>
-#include <xalanc/XPath/ElementPrefixResolverProxy.hpp>
-#include <xalanc/XPath/XObjectFactoryDefault.hpp>
-#include <xalanc/XPath/XPathExecutionContextDefault.hpp>
-#include <xalanc/XSLT/XSLTResultTarget.hpp>
-
-#if defined(_MSC_VER)
-# pragma warning(default: 4267)
-#endif
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-// Xalan namespace usage
-XALAN_USING_XALAN(XPathProcessorImpl)
-XALAN_USING_XALAN(XalanDOMString)
-XALAN_USING_XALAN(XercesDOMSupport)
-XALAN_USING_XALAN(XercesParserLiaison)
-XALAN_USING_XALAN(XercesDocumentWrapper)
-XALAN_USING_XALAN(XercesWrapperNavigator)
-XALAN_USING_XALAN(XPathEvaluator)
-XALAN_USING_XALAN(XPathFactoryDefault)
-XALAN_USING_XALAN(XPathConstructionContextDefault)
-XALAN_USING_XALAN(XalanDocument)
-XALAN_USING_XALAN(XalanNode)
-XALAN_USING_XALAN(XalanDOMChar)
-XALAN_USING_XALAN(XPathEnvSupportDefault)
-XALAN_USING_XALAN(XObjectFactoryDefault)
-XALAN_USING_XALAN(XObjectPtr)
-XALAN_USING_XALAN(XPathExecutionContextDefault)
-XALAN_USING_XALAN(ElementPrefixResolverProxy)
-XALAN_USING_XALAN(XPath)
-XALAN_USING_XALAN(NodeRefListBase)
-XALAN_USING_XALAN(XSLTResultTarget)
-XALAN_USING_XALAN(XSLException)
-
-#endif
-
-#ifdef XSEC_HAVE_XPATH
-
-#include <iostream>
-
-#define KLUDGE_PREFIX "berindsig"
-
-// Helper functions - come from DSIGXPath
-
-void setXPathNS(DOMDocument* d,
- DOMNamedNodeMap* xAtts,
- XSECXPathNodeList& addedNodes,
- XSECSafeBufferFormatter* formatter,
- XSECNameSpaceExpander* nse);
-
-void clearXPathNS(DOMDocument*d,
- XSECXPathNodeList& toRemove,
- XSECSafeBufferFormatter* formatter,
- XSECNameSpaceExpander* nse);
-
-bool separator(unsigned char c);
-XalanNode* findHereNodeFromXalan(XercesWrapperNavigator* xwn, XalanNode* n, DOMNode* h);
-
-
-TXFMXPathFilter::TXFMXPathFilter(DOMDocument* doc) :
- TXFMBase(doc) {
-
- document = NULL;
- XSECnew(mp_formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
- XMLFormatter::UnRep_CharRef));
-}
-
-TXFMXPathFilter::~TXFMXPathFilter() {
-
- lstsVectorType::iterator i;
-
- for (i = m_lsts.begin(); i != m_lsts.end(); ++i) {
-
- if ((*i)->lst != NULL)
- delete ((*i)->lst);
-
- delete (*i);
- }
-
- if (mp_formatter != NULL)
- delete mp_formatter;
-}
-
-// Methods to set the inputs
-
-void TXFMXPathFilter::setInput(TXFMBase* newInput) {
-
- if (newInput->getOutputType() == TXFMBase::BYTE_STREAM) {
-
- // Need to parse into DOM_NODES
-
- TXFMParser * parser;
- XSECnew(parser, TXFMParser(mp_expansionDoc));
- try{
- parser->setInput(newInput);
- }
- catch (...) {
- delete parser;
- input = newInput;
- throw;
- }
-
- input = parser;
- parser->expandNameSpaces();
- }
- else {
- input = newInput;
- }
-
- // Set up for the new document
- document = input->getDocument();
-
- // Expand if necessary
- this->expandNameSpaces();
-
- keepComments = input->getCommentsStatus();
-}
-
-XSECXPathNodeList* TXFMXPathFilter::evaluateSingleExpr(DSIGXPathFilterExpr* expr) {
-
- // Have a single expression that we wish to find the resultant nodeset for
-
- XSECXPathNodeList addedNodes;
- setXPathNS(document, expr->mp_NSMap, addedNodes, mp_formatter, mp_nse);
-
- XPathProcessorImpl xppi; // The processor
- XercesParserLiaison xpl;
- XercesDOMSupport xds(xpl);
- XPathEvaluator xpe;
- XPathFactoryDefault xpf;
- XPathConstructionContextDefault xpcc;
-
- XalanDocument * xd;
- XalanNode * contextNode;
-
- // Xalan can throw exceptions in all functions, so do one broad catch point.
-
- try {
-
- // Map to Xalan
- xd = xpl.createDocument(document);
-
- // For performing mapping
- XercesDocumentWrapper *xdw = xpl.mapDocumentToWrapper(xd);
- XercesWrapperNavigator xwn(xdw);
-
- // Map the "here" node
-
- XalanNode * hereNode = NULL;
-
- hereNode = xwn.mapNode(expr->mp_xpathFilterNode);
-
- if (hereNode == NULL) {
-
- hereNode = findHereNodeFromXalan(&xwn, xd, expr->mp_exprTextNode);
-
- if (hereNode == NULL) {
- throw XSECException(XSECException::XPathFilterError,
- "Unable to find here node in Xalan Wrapper map");
- }
- }
-
- // Now work out what we have to set up in the new processing
-
- XalanDOMString cd; // For XPath Filter, the root is always the context node
-
- cd = XalanDOMString("/"); // Root node
-
- // The context node is the "root" node
- contextNode =
- xpe.selectSingleNode(
- xds,
- xd,
- cd.c_str(),
- xd->getDocumentElement());
-
- XPathEnvSupportDefault xpesd;
- XObjectFactoryDefault xof;
- XPathExecutionContextDefault xpec(xpesd, xds, xof);
-
- ElementPrefixResolverProxy pr(xd->getDocumentElement(), xpesd, xds);
-
- // Work around the fact that the XPath implementation is designed for XSLT, so does
- // not allow here() as a NCName.
-
- // THIS IS A KLUDGE AND SHOULD BE DONE BETTER
-
- safeBuffer k(KLUDGE_PREFIX);
- k.sbStrcatIn(":");
-
- // Map the expression into a local code page string (silly - should be XMLCh)
- safeBuffer exprSB;
- exprSB << (*mp_formatter << expr->m_expr.rawXMLChBuffer());
-
- XMLSSize_t offset = exprSB.sbStrstr("here()");
-
- while (offset >= 0) {
-
- if (offset == 0 || offset == 1 ||
- (!(exprSB[offset - 1] == ':' && exprSB[offset - 2] != ':') &&
- separator(exprSB[offset - 1]))) {
-
- exprSB.sbStrinsIn(k.rawCharBuffer(), offset);
- }
-
- offset = exprSB.sbOffsetStrstr("here()", offset + 11);
- }
-
- // Install the External function in the Environment handler
-
- if (hereNode != NULL) {
- xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
- }
-
- XPath * xp = xpf.create();
-
- XalanDOMString Xexpr((char *) exprSB.rawBuffer());
- xppi.initXPath(*xp, xpcc, Xexpr, pr);
-
- // Now resolve
-
- XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
-
- // Now map to a list that others can use (naieve list at this time)
-
- const NodeRefListBase& lst = xObj->nodeset();
-
- int size = (int) lst.getLength();
- const DOMNode *item;
-
- XSECXPathNodeList * ret;
- XSECnew(ret, XSECXPathNodeList);
- Janitor<XSECXPathNodeList> j_ret(ret);
-
- for (int i = 0; i < size; ++ i) {
-
- if (lst.item(i) == xd)
- ret->addNode(document);
- else {
- item = xwn.mapNode(lst.item(i));
- ret->addNode(item);
- }
- }
-
- xpesd.uninstallExternalFunctionGlobal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"));
-
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
-
- j_ret.release();
- return ret;
- }
- catch (const XSLException &e) {
-
- safeBuffer msg;
-
- // Whatever happens - fix any changes to the original document
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
-
- // Collate the exception message into an XSEC message.
- msg.sbTranscodeIn("Xalan Exception : ");
- msg.sbXMLChCat(e.getType());
- msg.sbXMLChCat(" caught. Message : ");
- msg.sbXMLChCat(e.getMessage().c_str());
-
- throw XSECException(XSECException::XPathFilterError,
- msg.rawXMLChBuffer());
- }
- catch (...) {
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
- throw;
- }
-
- return NULL;
-}
-
-bool TXFMXPathFilter::checkNodeInInput(DOMNode* n, DOMNode* attParent) {
-
- if (mp_fragment != NULL) {
-
- DOMNode * p = n;
-
- /* Check attParent here to reduce cycles */
- if (attParent != NULL) {
- if (p == mp_fragment)
- return true;
- p = attParent;
- }
-
- while (p != NULL) {
-
- if (p == mp_fragment)
- return true;
-
- p = p->getParentNode();
- }
-
- return false;
- }
-
- return mp_inputList->hasNode(n);
-}
-
-bool TXFMXPathFilter::checkNodeInScope(DOMNode* n) {
-
- // Walk backwards through the lists
- lstsVectorType::iterator lstsIter;
-
- lstsIter = m_lsts.end();
- filterSetHolder *sh;
-
- while (lstsIter != m_lsts.begin()) {
-
- lstsIter--;
- sh = *lstsIter;
- if (sh->ancestorInScope != NULL) {
-
- // Have an ancestor in scope, so this node is in this list
- if (sh->type == DSIGXPathFilterExpr::FILTER_UNION)
- // Got this far, must be OK!
- return true;
- if (sh->type == DSIGXPathFilterExpr::FILTER_SUBTRACT)
- return false;
- }
- else {
- if (sh->type == DSIGXPathFilterExpr::FILTER_INTERSECT)
- return false;
- }
- }
-
- return true;
-}
-
-#if 1
-
-void TXFMXPathFilter::walkDocument(DOMNode* n) {
-
- // Non-recursive version
-
- DOMNode * current = n;
- DOMNode * next;
- DOMNode * attParent = NULL; /* Assign NULL to remove spurious Forte warning */
- bool done = false;
- bool treeUp = false;
- DOMNamedNodeMap * atts = n->getAttributes();
- int attsSize = -1;
- int currentAtt = -1;
- lstsVectorType::iterator lstsIter;
-
- while (done == false && current != NULL) {
-
- if (treeUp == true) {
-
- if (current == n) {
- // We are complete.
- done = true;
- }
- else {
- // Remove this node from the ancestor lists
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == current) {
- (*lstsIter)->ancestorInScope = NULL;
- }
- }
-
- // Check for another sibling
- next = current->getNextSibling();
-
- if (next == NULL) {
- current = current->getParentNode();
- treeUp = true;
- }
- else {
- current = next;
- treeUp = false;
- }
- }
- } /* treeUp == true */
- else {
- // Check if the current node is in the result set. The walk the children
-
- // First check if this node is in any lists, and if so,
- // set the appropriate ancestor nodes (if necessary)
-
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == NULL &&
- (*lstsIter)->lst->hasNode(current)) {
-
- (*lstsIter)->ancestorInScope = current;
- }
- }
-
- // Now that the ancestor setup is done, check to see if this node is
- // in scope.
-
- if (checkNodeInScope(current) &&
- checkNodeInInput(current, (atts != NULL ? attParent : NULL))) {
-
- m_xpathFilterMap.addNode(current);
- }
-
- // Now find the next node!
-
- if (atts != NULL) {
-
- // Working on an attribute list
- currentAtt++;
-
- if (currentAtt == attsSize) {
-
- // Attribute list complete
- atts = NULL;
- current = attParent;
- next = current->getFirstChild();
- if (next == NULL)
- treeUp = true;
- else {
- current = next;
- treeUp = false;
- }
- }
- else {
- current = atts->item(currentAtt);
- }
- }
- else {
- // Working on an element or other non-attribute node
- atts = current->getAttributes();
-
- if (atts != NULL && ((attsSize = atts->getLength()) > 0)) {
- currentAtt = 0;
- attParent = current;
- current = atts->item(0);
- treeUp = false;
- }
- else {
- atts = NULL;
-
- next = current->getFirstChild();
-
- if (next != NULL) {
- current = next;
- treeUp = false;
- }
- else {
- treeUp = true;
- }
- }
- } /* ! atts == NULL */
- }
- } /* while */
-}
-#endif
-
-#if 0
-
-void TXFMXPathFilter::walkDocument(DOMNode * n) {
-
- // Check if the current node is in the result set. The walk the children
- lstsVectorType::iterator lstsIter;
-
- // First check if this node is in any lists, and if so,
- // set the appropriate ancestor nodes (if necessary)
-
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == NULL && (*lstsIter)->lst->hasNode(n)) {
- (*lstsIter)->ancestorInScope = n;
- }
- }
-
- // Now that the ancestor setup is done, check to see if this node is
- // in scope.
-
- if (checkNodeInScope(n) && checkNodeInInput(n)) {
- m_xpathFilterMap.addNode(n);
- }
-
- // Do any attributes
-
- DOMNamedNodeMap * atts = n->getAttributes();
- if (atts != NULL) {
- unsigned int s = atts->getLength();
- for (unsigned int i = 0; i < s; ++i) {
- walkDocument(atts->item(i));
- }
- }
-
- // Do any childeren
-
- DOMNode * c = n->getFirstChild();
-
- while (c != NULL) {
- walkDocument(c);
- c = c->getNextSibling();
- }
-
- // Now remove from ancestor lists if we are that ancestor
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == n) {
- (*lstsIter)->ancestorInScope = NULL;
- }
- }
-}
-#endif
-
-void TXFMXPathFilter::evaluateExprs(DSIGTransformXPathFilter::exprVectorType* exprs) {
-
- if (exprs == NULL || exprs->size() < 1) {
- throw XSECException(XSECException::XPathFilterError,
- "TXFMXPathFilter::evaluateExpr - no expression list set");
- }
-
- DSIGTransformXPathFilter::exprVectorType::iterator i;
-
- for (i = exprs->begin(); i != exprs->end(); ++i) {
-
- XSECXPathNodeList * lst = evaluateSingleExpr(*i);
- filterSetHolder * sh;
- XSECnew(sh, filterSetHolder);
-
- sh->lst = lst;
- sh->type = (*i)->m_filterType;
- sh->ancestorInScope = NULL;
-
- if (lst != NULL) {
- m_lsts.push_back(sh);
- }
- }
-
- // Well we appear to have successfully run through all the nodelists!
-
- mp_fragment = NULL;
- mp_inputList = NULL;
-
- // Find the input nodeset
- TXFMBase::nodeType inputType = input->getNodeType();
- switch (inputType) {
-
- case DOM_NODE_DOCUMENT :
- mp_fragment = document;
- break;
-
- case DOM_NODE_DOCUMENT_FRAGMENT :
- mp_fragment = input->getFragmentNode();
- break;
-
- case DOM_NODE_XPATH_NODESET :
- mp_inputList = &(input->getXPathNodeList());
- break;
-
- default :
- throw XSECException(XSECException::XPathFilterError,
- "TXFMXPathFilter::evaluateExprs - unknown input type");
-
- }
-
- // Now just recurse through each node in the document
- walkDocument(document);
-}
-
-
-// Methods to get tranform output type and input requirement
-
-TXFMBase::ioType TXFMXPathFilter::getInputType() const {
- return TXFMBase::DOM_NODES;
-}
-
-TXFMBase::ioType TXFMXPathFilter::getOutputType() const {
- return TXFMBase::DOM_NODES;
-}
-
-TXFMBase::nodeType TXFMXPathFilter::getNodeType() const {
- return TXFMBase::DOM_NODE_XPATH_NODESET;
-}
-
-// Methods to get output data
-
-unsigned int TXFMXPathFilter::readBytes(XMLByte* const toFill, unsigned int maxToFill) {
- return 0;
-}
-
-DOMDocument* TXFMXPathFilter::getDocument() const {
- return document;
-}
-
-XSECXPathNodeList& TXFMXPathFilter::getXPathNodeList() {
- return m_xpathFilterMap;
-}
-
-#endif /* XSEC_HAVE_XPATH */
-
-
-
diff --git a/xsec/transformers/TXFMXPathFilter.hpp b/xsec/transformers/TXFMXPathFilter.hpp
deleted file mode 100644
index 42d2a8c0..00000000
--- a/xsec/transformers/TXFMXPathFilter.hpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXPath := Class that performs XPath transforms
- *
- * $Id$
- *
- */
-
-#if !defined (TXFMXPATHFILTER_HEADER)
-#define TXFMXPATHFILTER_HEADER
-
-#include <xsec/transformers/TXFMBase.hpp>
-#include <xsec/utils/XSECXPathNodeList.hpp>
-#include <xsec/dsig/DSIGTransformXPathFilter.hpp>
-#include <xsec/dsig/DSIGConstants.hpp>
-
-// Xerces
-
-XSEC_DECLARE_XERCES_CLASS(DOMNode);
-XSEC_DECLARE_XERCES_CLASS(DOMNamedNodeMap);
-
-class TXFMXPathFilterExpr;
-class XSECSafeBufferFormatter;
-
-struct filterSetHolder {
- XSECXPathNodeList* lst;
- DSIGXPathFilterExpr::XPathFilterType type;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* ancestorInScope;
-};
-
-
-#ifdef XSEC_HAVE_XPATH
-
-/**
- * \brief Transformer to handle XPath transforms
- * @ingroup internal
- */
-
-
-class XSEC_EXPORT TXFMXPathFilter : public TXFMBase {
-
-public:
-
- TXFMXPathFilter(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc);
- virtual ~TXFMXPathFilter();
-
- // Methods to set the inputs
-
- void setInput(TXFMBase* newInput);
-
- // Methods to get tranform output type and input requirement
-
- virtual TXFMBase::ioType getInputType() const;
- virtual TXFMBase::ioType getOutputType() const;
- virtual TXFMBase::nodeType getNodeType() const;
-
- // XPathFilter unique
-
- void evaluateExprs(DSIGTransformXPathFilter::exprVectorType* exprs);
- XSECXPathNodeList* evaluateSingleExpr(DSIGXPathFilterExpr* expr);
-
- // Methods to get output data
-
- virtual unsigned int readBytes(XMLByte* const toFill, const unsigned int maxToFill);
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* getDocument() const;
- virtual XSECXPathNodeList& getXPathNodeList();
-
-private:
- typedef std::vector<filterSetHolder*> lstsVectorType;
- TXFMXPathFilter();
- void walkDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n);
- bool checkNodeInScope(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n);
- bool checkNodeInInput(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* attParent);
-
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document;
- XSECXPathNodeList m_xpathFilterMap;
- lstsVectorType m_lsts;
-
- XSECSafeBufferFormatter* mp_formatter;
-
- /* Used to hold details during tree-walk */
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* mp_fragment;
- XSECXPathNodeList* mp_inputList;
-};
-
-#endif
-
-#endif /* XPATHFILTER_HEADER */
diff --git a/xsec/transformers/TXFMXSL.cpp b/xsec/transformers/TXFMXSL.cpp
deleted file mode 100644
index f1b6f778..00000000
--- a/xsec/transformers/TXFMXSL.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXSL := Class that performs XPath transforms
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGConstants.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/transformers/TXFMXSL.hpp>
-
-#ifdef XSEC_HAVE_XSLT
-
-// Xerces
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/dom/DOMImplementation.hpp>
-#include <xercesc/dom/DOMImplementationLS.hpp>
-#include <xercesc/parsers/XercesDOMParser.hpp>
-#include <xercesc/framework/MemBufInputSource.hpp>
-#include <xercesc/util/Janitor.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-#include <iostream>
-#include <strstream>
-#include <fstream>
-
-XALAN_USING_XALAN(XSLTResultTarget)
-
-// Function used to output data to a safeBuffer
-extern "C" {
-
-typedef struct TransformXSLOutputHolderStruct {
-
- safeBuffer buffer;
- int offset;
-
-} TransformXSLOutputHolder;
-
-CallbackSizeType TransformXSLOutputFn(const char * s, CallbackSizeType sz, void * data) {
-
- TransformXSLOutputHolder * output = (TransformXSLOutputHolder *) data;
-
- output->buffer.sbMemcpyIn(output->offset, s, (int) sz);
- output->offset += (int) sz;
- output->buffer[output->offset] = '\0';
-
- return sz;
-
-}
-}
-
-// -----------------------------------------------------------------------
-// For expanding name spaces when necessary
-// -----------------------------------------------------------------------
-
-bool TXFMXSL::nameSpacesExpanded(void) const {
-
- // NOTE : Do not check inputs as this has its own document
-
- return (mp_nse != NULL);
-
-}
-
-void TXFMXSL::expandNameSpaces(void) {
-
- if (mp_nse != NULL)
- return; // Already done
-
- if (docOut != NULL) {
-
- XSECnew(mp_nse, XSECNameSpaceExpander(docOut));
-
- mp_nse->expandNameSpaces();
-
- }
-
-}
-
-// -----------------------------------------------------------------------
-// Transform functions
-// -----------------------------------------------------------------------
-
-
-TXFMXSL::TXFMXSL(DOMDocument *doc) :
- TXFMBase(doc), xds(xpl)
-{
-
- // Zeroise all the pointers
-
- xd = NULL;
-
-}
-
-TXFMXSL::~TXFMXSL() {
-
- if (docOut != NULL) {
- if (mp_nse != NULL) {
- delete mp_nse; // Don't bother collapsing
- mp_nse = NULL;
- }
- docOut->release();
- }
-}
-
-// Methods to set the inputs
-
-void TXFMXSL::setInput(TXFMBase *newInput) {
-
- input = newInput;
-
- if (newInput->getOutputType() != TXFMBase::BYTE_STREAM) {
-
- throw XSECException(XSECException::TransformInputOutputFail, "XSL requires DOM_NODES input type");
-
- }
-
- // Should have a method to check if the input is a straight URL - if it is, just read the
- // URL name and create an XSLTInputSource with this as the input ID.
-
- int size = 0;
- int count = 0;
- unsigned char buf[512];
-
- while ((count = input->readBytes((XMLByte *) buf, 512)) != 0) {
-
- sbInDoc.sbMemcpyIn(size, buf, count);
- size += count;
-
- }
-
- sbInDoc[size] = '\0';
-
-}
-
-void TXFMXSL::evaluateStyleSheet(const safeBuffer &sbStyleSheet) {
-
- // Set up iostreams for input
- std::istrstream theXMLStream((char *) sbInDoc.rawBuffer(), (int) strlen((char *) sbInDoc.rawBuffer()));
- std::istrstream theXSLStream((char *) sbStyleSheet.rawBuffer(), (int) strlen((char *) sbStyleSheet.rawBuffer()));
-
- // Now resolve
-
- XalanTransformer xt;
- TransformXSLOutputHolder txoh;
- txoh.buffer.sbStrcpyIn("");
- txoh.offset = 0;
-
- /*int res = */
- xt.transform(&theXMLStream, &theXSLStream, (void *) & txoh, TransformXSLOutputFn);
-
- // Should check res
-
- // Now use xerces to "re parse" this back into a DOM_Nodes document
- XercesDOMParser * parser = new XercesDOMParser;
- Janitor<XercesDOMParser> j_parser(parser);
-
- parser->setDoNamespaces(true);
- parser->setCreateEntityReferenceNodes(true);
- parser->setLoadExternalDTD(false);
- parser->setDoSchema(true);
-
- SecurityManager securityManager;
- parser->setSecurityManager(&securityManager);
-
- // Create an input source
-
- MemBufInputSource* memIS = new MemBufInputSource ((const XMLByte*) txoh.buffer.rawBuffer(), txoh.offset, "XSECMem");
- Janitor<MemBufInputSource> j_memIS(memIS);
-
- int errorCount = 0;
-
- parser->parse(*memIS);
- errorCount = parser->getErrorCount();
- if (errorCount > 0)
- throw XSECException(XSECException::XSLError, "Errors occurred when XSL result was parsed back to DOM_Nodes");
-
- docOut = parser->adoptDocument();
-
- // Janitors clean up
-
-}
-
-// Methods to get tranform output type and input requirement
-
-TXFMBase::ioType TXFMXSL::getInputType(void) const {
-
- return TXFMBase::DOM_NODES;
-
-}
-TXFMBase::ioType TXFMXSL::getOutputType(void) const {
-
- return TXFMBase::DOM_NODES;
-
-}
-
-TXFMBase::nodeType TXFMXSL::getNodeType(void) const {
-
- return TXFMBase::DOM_NODE_DOCUMENT;
-
-}
-
-// Methods to get output data
-
-unsigned int TXFMXSL::readBytes(XMLByte * const toFill, unsigned int maxToFill) {
-
- return 0;
-
-}
-
-DOMDocument * TXFMXSL::getDocument() const {
-
- return docOut;
-
-}
-
-#endif /* XSEC_HAVE_XSLT */
diff --git a/xsec/transformers/TXFMXSL.hpp b/xsec/transformers/TXFMXSL.hpp
deleted file mode 100644
index afead98d..00000000
--- a/xsec/transformers/TXFMXSL.hpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * TXFMXSL := Class that performs XML Stylesheet Language transforms
- *
- * $Id$
- *
- */
-
-#include <xsec/transformers/TXFMBase.hpp>
-
-// Xerces
-
-#include <xercesc/dom/DOM.hpp>
-
-// Xalan
-
-#ifdef XSEC_HAVE_XPATH
-
-#include <xalanc/XalanDOM/XalanDocument.hpp>
-#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
-#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
-#include <xalanc/XPath/NodeRefList.hpp>
-#include <xalanc/XPath/ElementPrefixResolverProxy.hpp>
-#include <xalanc/XalanTransformer/XalanTransformer.hpp>
-
-// If this isn't defined, we're on Xalan 1.12+ and require modern C++
-#ifndef XALAN_USING_XALAN
-# define XALAN_USING_XALAN(NAME) using xalanc :: NAME;
-#endif
-
-// Xalan Namespace usage
-XALAN_USING_XALAN(XercesDOMSupport)
-XALAN_USING_XALAN(XercesParserLiaison)
-XALAN_USING_XALAN(XalanDocument)
-XALAN_USING_XALAN(XalanTransformer)
-
-#endif
-
-#ifdef XSEC_HAVE_XSLT
-
-/**
- * \brief Transformer to handle XSLT transforms
- * @ingroup internal
- */
-
-class XSEC_EXPORT TXFMXSL : public TXFMBase {
-
-private:
-
- safeBuffer expr; // The expression being worked with
-
- XercesDOMSupport xds;
- XercesParserLiaison xpl;
-
- XalanDocument * xd;
-
- safeBuffer sbInDoc;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
- * document;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
- * docOut; // The output from the transformation
-
-public:
-
- TXFMXSL(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc);
- virtual ~TXFMXSL();
-
- // Methods to set the inputs
-
- void setInput(TXFMBase *newInput);
-
- // Methods to get tranform output type and input requirement
-
- virtual TXFMBase::ioType getInputType(void) const;
- virtual TXFMBase::ioType getOutputType(void) const;
- virtual nodeType getNodeType(void) const;
-
- // We do our own name spaces - we have a new document!
-
- virtual bool nameSpacesExpanded(void) const;
- virtual void expandNameSpaces(void);
-
-
- // XSL Unique
-
- void evaluateStyleSheet(const safeBuffer &sbStyleSheet);
-
- // Methods to get output data
-
- virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill);
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument() const;
-
-private:
- TXFMXSL();
-
-};
-
-
-#endif /* No XSLT */
diff --git a/xsec/utils/XSECDOMUtils.cpp b/xsec/utils/XSECDOMUtils.cpp
index d551e092..2f7626c2 100644
--- a/xsec/utils/XSECDOMUtils.cpp
+++ b/xsec/utils/XSECDOMUtils.cpp
@@ -29,7 +29,6 @@
// XSEC
#include <xsec/framework/XSECError.hpp>
-#include <xsec/xkms/XKMSConstants.hpp>
#include "XSECDOMUtils.hpp"
@@ -111,18 +110,6 @@ const XMLCh * getXENC11LocalName(const DOMNode *node) {
}
-#ifdef XSEC_XKMS_ENABLED
-const XMLCh * getXKMSLocalName(const DOMNode *node) {
-
- // XKMS namespace node
-
- if (!strEquals(node->getNamespaceURI(), XKMSConstants::s_unicodeStrURIXKMS))
- return NULL;
- else
- return node->getLocalName();
-
-}
-#endif
// --------------------------------------------------------------------------------
// Find a nominated DSIG node in a document
diff --git a/xsec/utils/XSECDOMUtils.hpp b/xsec/utils/XSECDOMUtils.hpp
index ec5f7c2b..6c16e328 100644
--- a/xsec/utils/XSECDOMUtils.hpp
+++ b/xsec/utils/XSECDOMUtils.hpp
@@ -77,9 +77,7 @@ const XMLCh XSEC_EXPORT * getECLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DO
const XMLCh XSEC_EXPORT * getXPFLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh XSEC_EXPORT * getXENCLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
const XMLCh XSEC_EXPORT * getXENC11LocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
-#ifdef XSEC_XKMS_ENABLED
-const XMLCh XSEC_EXPORT * getXKMSLocalName(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *node);
-#endif
+
// --------------------------------------------------------------------------------
// Do UTF-8 <-> UTF-16 transcoding
// --------------------------------------------------------------------------------
diff --git a/xsec/utils/XSECNameSpaceExpander.hpp b/xsec/utils/XSECNameSpaceExpander.hpp
index 21bca16e..a2454954 100644
--- a/xsec/utils/XSECNameSpaceExpander.hpp
+++ b/xsec/utils/XSECNameSpaceExpander.hpp
@@ -94,13 +94,7 @@ struct XSECNameSpaceEntry {
class XSEC_EXPORT XSECNameSpaceExpander {
-
-#if defined(XALAN_NO_NAMESPACES)
- typedef vector<XSECNameSpaceEntry *> NameSpaceEntryListVectorType;
-#else
typedef std::vector<XSECNameSpaceEntry *> NameSpaceEntryListVectorType;
-#endif
-
public:
diff --git a/xsec/utils/XSECPlatformUtils.cpp b/xsec/utils/XSECPlatformUtils.cpp
index 85557222..c766f6b5 100644
--- a/xsec/utils/XSECPlatformUtils.cpp
+++ b/xsec/utils/XSECPlatformUtils.cpp
@@ -34,7 +34,6 @@
#include <xsec/framework/XSECError.hpp>
#include <xsec/dsig/DSIGConstants.hpp>
#include <xsec/dsig/DSIGSignature.hpp>
-#include <xsec/xkms/XKMSConstants.hpp>
#include <xsec/framework/XSECAlgorithmMapper.hpp>
#include <xsec/transformers/TXFMOutputFile.hpp>
@@ -46,14 +45,6 @@ XERCES_CPP_NAMESPACE_USE
# include <xsec/enc/OpenSSL/OpenSSLCryptoProvider.hpp>
#endif
-#if defined (XSEC_HAVE_WINCAPI)
-# include <xsec/enc/WinCAPI/WinCAPICryptoProvider.hpp>
-#endif
-
-#if defined (XSEC_HAVE_NSS)
-# include <xsec/enc/NSS/NSSCryptoProvider.hpp>
-#endif
-
// Static data used by all of XSEC
int XSECPlatformUtils::initCount = 0;
XSECCryptoProvider * XSECPlatformUtils::g_cryptoProvider = NULL;
@@ -69,14 +60,6 @@ XSECPlatformUtils::TransformFactory* XSECPlatformUtils::g_loggingSink = NULL;
#if defined (XSEC_HAVE_OPENSSL)
# define XSEC_DEFAULT_PROVIDER OpenSSLCryptoProvider()
-#else
-# if defined (XSEC_HAVE_WINCAPI)
-# define XSEC_DEFAULT_PROVIDER WinCAPICryptoProvider()
-# else
-# if defined (XSEC_HAVE_NSS)
-# define XSEC_DEFAULT_PROVIDER NSSCryptoProvider()
-# endif
-# endif
#endif
TXFMBase* TXFMOutputFileFactory(DOMDocument* doc) {
@@ -105,9 +88,6 @@ void XSECPlatformUtils::Initialise(XSECCryptoProvider * p) {
// Set up necessary constants
DSIGConstants::create();
-#ifdef XSEC_XKMS_ENABLED
- XKMSConstants::create();
-#endif
// Initialise the safeBuffer system
safeBuffer::init();
@@ -155,14 +135,9 @@ void XSECPlatformUtils::Terminate(void) {
// Clean out the algorithm mapper
delete internalMapper;
- if (g_cryptoProvider != NULL)
- delete g_cryptoProvider;
+ delete g_cryptoProvider;
DSIGConstants::destroy();
-#ifdef XSEC_XKMS_ENABLED
- XKMSConstants::destroy();
-#endif
-
}
void XSECPlatformUtils::registerAlgorithmHandler(
diff --git a/xsec/utils/XSECSOAPRequestor.hpp b/xsec/utils/XSECSOAPRequestor.hpp
deleted file mode 100644
index 587efa6e..00000000
--- a/xsec/utils/XSECSOAPRequestor.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECSOAPRequestor:= Interface class used by the XKMS client code to
- * perform a SOAP request and receive response.
- *
- *
- * $Id$
- *
- */
-
-#ifndef XSECSOAPREQUESTOR_INCLUDE
-#define XSECSOAPREQUESTOR_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-XSEC_DECLARE_XERCES_CLASS(DOMDocument);
-
-/**
- * @brief Interface for SOAP Requests
- * @ingroup interfaces
- *
- * The XKMS client code needs to be able to call on a SOAP requestor
- * implementation that will handle wrapping the request in a SOAP msg
- * and transporting it to the SOAP server. This class defines the
- * interface used by the client code to make this happen.
- *
- * Implementors need to wrap the passed in DOM document in a SOAP 1.1
- * or SOAP 1.2 msg. E.g. (SOAP 1.2)
- * \verbatim
- <?xml version='1.0' encoding="utf-8"?>
- <env:Envelope xmlns:env="http://www.w3.org/2002/06/soap-envelope">
- <env:Header>
- <env:Body>
- XKMS Request Message element
- </env:Body>
- </env:Header>
- </env:Envelope>
-\endverbatim
- *
- * SOAP implentors may want/need to add other headers.
- *
- */
-
-
-class XSEC_EXPORT XSECSOAPRequestor {
-
-public :
-
- /** @name Constructors and Destructors */
- //@{
-
- XSECSOAPRequestor() {}
- virtual ~XSECSOAPRequestor() {}
-
- //@}
-
- /** @name Interface methods */
-
- /**
- * \brief Do a SOAP request
- *
- * Performs a request based on the passed in DOM document and
- * the indicated URI. The function is expected to return a pointer
- * to the parsed result message (with the SOAP envelope removed)
- *
- * The implementing object is expected to know how to get the
- * wrapped message to the server that will process the request
- *
- * @param request The DOM document containing the message to be
- * wrapped and sent.
- * @returns The DOM document representing the result, with all
- * SOAP headers removed
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *
- doRequest(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * request) = 0;
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XSECSOAPREQUESTOR_INCLUDE */
diff --git a/xsec/utils/XSECSOAPRequestorSimple.cpp b/xsec/utils/XSECSOAPRequestorSimple.cpp
deleted file mode 100644
index a5ab242b..00000000
--- a/xsec/utils/XSECSOAPRequestorSimple.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECSOAPRequestorSimple := (Very) Basic implementation of a SOAP
- * HTTP wrapper for testing the client code.
- *
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/utils/XSECSafeBuffer.hpp>
-#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XSECAutoPtr.hpp"
-#include "XSECDOMUtils.hpp"
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/parsers/XercesDOMParser.hpp>
-#include <xercesc/framework/XMLFormatter.hpp>
-#include <xercesc/framework/MemBufFormatTarget.hpp>
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLNetAccessor.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/framework/MemBufInputSource.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Strings for constructing SOAP envelopes
-// --------------------------------------------------------------------------------
-
-static XMLCh s_prefix[] = {
-
- chLatin_e,
- chLatin_n,
- chLatin_v,
- chNull
-};
-
-static XMLCh s_Envelope[] = {
-
- chLatin_E,
- chLatin_n,
- chLatin_v,
- chLatin_e,
- chLatin_l,
- chLatin_o,
- chLatin_p,
- chLatin_e,
- chNull
-};
-
-static XMLCh s_Body[] = {
-
- chLatin_B,
- chLatin_o,
- chLatin_d,
- chLatin_y,
- chNull
-};
-
-// --------------------------------------------------------------------------------
-// Constructors and Destructors
-// --------------------------------------------------------------------------------
-
-
-/* NOTE: This is initialised via the platform specific code */
-
-XSECSOAPRequestorSimple::~XSECSOAPRequestorSimple() {
-}
-
-
-// --------------------------------------------------------------------------------
-// Wrap and serialise the request message
-// --------------------------------------------------------------------------------
-
-char * XSECSOAPRequestorSimple::wrapAndSerialise(DOMDocument * request) {
-
- // Prepare the serialiser
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
- DOMLSSerializer *theSerializer = ((DOMImplementationLS*)impl)->createLSSerializer();
- Janitor<DOMLSSerializer> j_theSerializer(theSerializer);
-
- // Get the config so we can set up pretty printing
- DOMConfiguration *dc = theSerializer->getDomConfig();
- dc->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, false);
-
- // Now create an output object to format to UTF-8
- DOMLSOutput *theOutput = ((DOMImplementationLS*)impl)->createLSOutput();
- Janitor<DOMLSOutput> j_theOutput(theOutput);
- MemBufFormatTarget *formatTarget = new MemBufFormatTarget;
- Janitor<MemBufFormatTarget> j_formatTarget(formatTarget);
-
- theOutput->setEncoding(MAKE_UNICODE_STRING("UTF-8"));
- theOutput->setByteStream(formatTarget);
-
- if (m_envelopeType != ENVELOPE_NONE) {
-
- // Create a new document to wrap the request in
- safeBuffer str;
-
- makeQName(str, s_prefix, s_Envelope);
-
- DOMDocument *doc;
-
- if (m_envelopeType == ENVELOPE_SOAP11) {
- doc = impl->createDocument(
- XKMSConstants::s_unicodeStrURISOAP11,
- str.rawXMLChBuffer(),
- NULL);
- DOMElement *rootElem = doc->getDocumentElement();
-
- makeQName(str, s_prefix, s_Body);
- DOMElement *body = doc->createElementNS(
- XKMSConstants::s_unicodeStrURISOAP11,
- str.rawXMLChBuffer());
-
- rootElem->appendChild(body);
-
- // Now replicate the request into the document
- DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
- body->appendChild(reqElement);
- }
- else {
- doc = impl->createDocument(
- XKMSConstants::s_unicodeStrURISOAP12,
- str.rawXMLChBuffer(),
- NULL);
- DOMElement *rootElem = doc->getDocumentElement();
-
- makeQName(str, s_prefix, s_Body);
- DOMElement *body = doc->createElementNS(
- XKMSConstants::s_unicodeStrURISOAP12,
- str.rawXMLChBuffer());
-
- rootElem->appendChild(body);
-
- // Now replicate the request into the document
- DOMElement * reqElement = (DOMElement *) doc->importNode(request->getDocumentElement(), true);
- body->appendChild(reqElement);
- }
-
-
- // OK - Now we have the SOAP request as a document, we serialise to a string buffer
- // and return
-
- theSerializer->write(doc, theOutput);
- doc->release();
-
- }
- else {
- theSerializer->write(request, theOutput);
- }
-
- // Now replicate the buffer
- return XMLString::replicate((const char *) formatTarget->getRawBuffer());
-
-}
-
-// --------------------------------------------------------------------------------
-// UnWrap and de-serialise the response message
-// --------------------------------------------------------------------------------
-
-DOMDocument * XSECSOAPRequestorSimple::parseAndUnwrap(const char * buf, unsigned int len) {
-
- XercesDOMParser parser;
- parser.setDoNamespaces(true);
- parser.setLoadExternalDTD(false);
-
- SecurityManager securityManager;
- securityManager.setEntityExpansionLimit(XSEC_ENTITY_EXPANSION_LIMIT);
- parser.setSecurityManager(&securityManager);
-
- // Create an input source
-
- MemBufInputSource memIS((const XMLByte*) buf, len, "XSECMem");
-
- parser.parse(memIS);
- XMLSize_t errorCount = parser.getErrorCount();
- if (errorCount > 0)
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error parsing response message");
-
- if (m_envelopeType == ENVELOPE_NONE) {
-
- return parser.adoptDocument();
-
- }
-
- DOMDocument * responseDoc = parser.getDocument();
-
- // Must be a SOAP message of some kind - so lets remove the wrapper.
- // First create a new document for the Response message
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- DOMDocument * retDoc = impl->createDocument();
-
- // Find the base of the response
-
-
- DOMNode * e = responseDoc->getDocumentElement();
-
- e = e->getFirstChild();
-
- while (e != NULL && (e->getNodeType() != DOMNode::ELEMENT_NODE || !strEquals(e->getLocalName(), "Body")))
- e = e->getNextSibling();
-
- if (e == NULL)
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Could not find SOAP body");
-
- e = findFirstChildOfType(e, DOMNode::ELEMENT_NODE);
-
- if (e == NULL)
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Could not find message within SOAP body");
-
- /* See if this is a soap fault */
- if (strEquals(e->getLocalName(), "Fault")) {
-
- // Something has gone wrong somewhere!
- safeBuffer sb;
- sb.sbTranscodeIn("SOAP Fault : ");
-
- // Find the fault code
-
- e = findFirstElementChild(e);
- while (e != NULL && !strEquals(e->getLocalName(), "Code"))
- e = findNextElementChild(e);
-
- if (e != NULL) {
- DOMNode * c = findFirstElementChild(e);
- while (c != NULL && !strEquals(c->getLocalName(), "Value"))
- c = findNextElementChild(c);
- if (c != NULL) {
- DOMNode * t = findFirstChildOfType(c, DOMNode::TEXT_NODE);
- if (t != NULL) {
- sb.sbXMLChCat(t->getNodeValue());
- sb.sbXMLChCat(" : ");
- }
- }
- }
-
- // Find the reason
- while (e != NULL && !strEquals(e->getLocalName(), "Reason"))
- e = findNextElementChild(e);
-
- if (e != NULL) {
- DOMNode * t = findFirstChildOfType(e, DOMNode::TEXT_NODE);
- if (t != NULL) {
- sb.sbXMLChCat(t->getNodeValue());
- }
-
- }
-
- retDoc->release();
-
- XSECAutoPtrChar msg(sb.rawXMLChBuffer());
-
- throw XSECException(XSECException::HTTPURIInputStreamError,
- msg.get());
- }
-
-
- retDoc->appendChild(retDoc->importNode(e, true));
-
- return retDoc;
-
-}
-
-// --------------------------------------------------------------------------------
-// Envelope Type handling
-// --------------------------------------------------------------------------------
-
-void XSECSOAPRequestorSimple::setEnvelopeType(envelopeType et) {
-
- m_envelopeType = et;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/utils/XSECSOAPRequestorSimple.hpp b/xsec/utils/XSECSOAPRequestorSimple.hpp
deleted file mode 100644
index 62e4364d..00000000
--- a/xsec/utils/XSECSOAPRequestorSimple.hpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECSOAPRequestorSimple := (Very) Basic implementation of a SOAP
- * HTTP wrapper for testing the client code.
- *
- *
- * $Id$
- *
- */
-
-#ifndef XSECSOAPREQUESTORSIMPLE_INCLUDE
-#define XSECSOAPREQUESTORSIMPLE_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/utils/XSECSOAPRequestor.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xercesc/util/XMLUri.hpp>
-
-XSEC_DECLARE_XERCES_CLASS(DOMDocument);
-
-/**
- * @ingroup xkms
- */
-/*\@{*/
-
-/**
- * @brief Basic HTTP implementation for SOAP Requests
- *
- * The XKMS client code needs to be able to call on a SOAP requestor
- * implementation that will handle wrapping the request in a SOAP msg
- * and transporting it to the SOAP server. This class provides a very
- * naieve implementation that wraps the message and does a basic
- * HTTP POST to get the message to the end server.
- *
- */
-
-
-class XSEC_EXPORT XSECSOAPRequestorSimple : public XSECSOAPRequestor {
-
-public :
-
- /**
- * Envelope Enumeration
- */
-
- enum envelopeType {
-
- ENVELOPE_NONE, /** No envelope - straight HTTP request */
- ENVELOPE_SOAP11, /** SOAP 1.1 envelope (default) */
- ENVELOPE_SOAP12 /** SOAP 1.2 envelope */
-
- };
-
- /** @name Constructors and Destructors */
- //@{
-
- /**
- * \brief Constructor
- *
- * Create a SOAP requestor that can be used to access a specific
- * server
- *
- * @param uri The URI of the server that will be accessed.
- * @note The URI must be http://...
- */
-
- XSECSOAPRequestorSimple(const XMLCh * uri);
- virtual ~XSECSOAPRequestorSimple();
-
- //@}
-
- /** @name Interface methods */
- //@{
-
- /**
- * \brief Do a SOAP request
- *
- * Performs a request based on the passed in DOM document and
- * the indicated URI. The function is returns a pointer
- * to the parsed result message (with the SOAP envelope removed)
- *
- * @param request The DOM document containing the message to be
- * wrapped and sent.
- * @returns The DOM document representing the result, with all
- * SOAP headers removed
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *
- doRequest(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * request);
-
- //@}
-
- /** @name Configuration methods */
- //@{
-
- /**
- * \brief Set the envelope type
- *
- * The requestor can do a SOAP 1.1, SOAP 1.2 or no envelope around the
- * message. This call allows the apllication to set the type.
- *
- * By default, the requestor uses a SOAP 1.1 envelope
- *
- * @param et - the type of envelope to use
- */
-
- void setEnvelopeType(envelopeType et);
-
-
-private:
-
- char * wrapAndSerialise(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * request);
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *
- parseAndUnwrap(const char * buf, unsigned int len);
-
- XERCES_CPP_NAMESPACE_QUALIFIER XMLUri
- m_uri;
-
- envelopeType m_envelopeType;
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XSECSOAPREQUESTORSIMPLE_INCLUDE */
diff --git a/xsec/utils/unixutils/XSECSOAPRequestorSimpleUnix.cpp b/xsec/utils/unixutils/XSECSOAPRequestorSimpleUnix.cpp
deleted file mode 100644
index 5d94f2d2..00000000
--- a/xsec/utils/unixutils/XSECSOAPRequestorSimpleUnix.cpp
+++ /dev/null
@@ -1,356 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECSOAPRequestorSimple := (Very) Basic implementation of a SOAP
- * HTTP wrapper for testing the client code.
- *
- *
- * $Id$
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <errno.h>
-
-#include <string>
-#include <sstream>
-
-#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
-#include <xsec/utils/XSECSafeBuffer.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECAutoPtr.hpp"
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLNetAccessor.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-using std::string;
-using std::ostringstream;
-
-// --------------------------------------------------------------------------------
-// Platform specific constructor
-// --------------------------------------------------------------------------------
-
-
-XSECSOAPRequestorSimple::XSECSOAPRequestorSimple(const XMLCh * uri) : m_uri(uri), m_envelopeType(ENVELOPE_NONE) {
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Interface
-// --------------------------------------------------------------------------------
-
-
-DOMDocument * XSECSOAPRequestorSimple::doRequest(DOMDocument * request) {
-
-
- char* content = wrapAndSerialise(request);
-
- // First we need to serialise
-
- //
- // Pull all of the parts of the URL out of th m_uri object, and transcode them
- // and transcode them back to ASCII.
- //
- const XMLCh* hostName = m_uri.getHost();
- XSECAutoPtrChar hostNameAsCharStar(hostName);
-
- const XMLCh* path = m_uri.getPath();
- XSECAutoPtrChar pathAsCharStar(path);
-
- const XMLCh* fragment = m_uri.getFragment();
- XSECAutoPtrChar fragmentAsCharStar(fragment);
-
- const XMLCh* query = m_uri.getQueryString();
- XSECAutoPtrChar queryAsCharStar(query);
-
- unsigned short portNumber = (unsigned short) m_uri.getPort();
-
- // If no number is set, go with port 80
- if (portNumber == USHRT_MAX)
- portNumber = 80;
-
- //
- // Set up a socket.
- //
- struct hostent* hostEntPtr = 0;
- struct sockaddr_in sa;
-
-
- if ((hostEntPtr = gethostbyname(hostNameAsCharStar.get())) == NULL)
- {
- unsigned long numAddress = inet_addr(hostNameAsCharStar.get());
- if (numAddress == 0)
- {
- ThrowXML(NetAccessorException,
- XMLExcepts::NetAcc_TargetResolution);
- }
- if ((hostEntPtr =
- gethostbyaddr((char *) &numAddress,
- sizeof(unsigned long), AF_INET)) == NULL)
- {
- ThrowXML(NetAccessorException,
- XMLExcepts::NetAcc_TargetResolution);
- }
- }
-
- memcpy((void *) &sa.sin_addr,
- (const void *) hostEntPtr->h_addr, hostEntPtr->h_length);
- sa.sin_family = hostEntPtr->h_addrtype;
- sa.sin_port = htons(portNumber);
-
- int s = socket(hostEntPtr->h_addrtype, SOCK_STREAM, 0);
- if (s < 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error creating socket");
- }
-
- if (connect(s, (struct sockaddr *) &sa, sizeof(sa)) < 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error connecting to end server");
- }
-
- // The port is open and ready to go.
- // Build up the http GET command to send to the server.
- // To do: We should really support http 1.1. This implementation
- // is weak.
-
- ostringstream outBuffer;
-
- outBuffer << "POST " << pathAsCharStar.get();
-
- if (queryAsCharStar.get() != 0)
- {
- // Tack on a ? before the fragment
- outBuffer << '?' << queryAsCharStar.get();
- }
-
- if (fragmentAsCharStar.get() != 0)
- {
- outBuffer << fragmentAsCharStar.get();
- }
-
- outBuffer << "HTTP/1.0\r\n"
- << "Content-Type: text/xml; charset=utf-8\r\n";
-
- outBuffer << "Host: " << hostNameAsCharStar.get();
- if (portNumber != 80)
- {
- outBuffer << ':' << portNumber;
- }
- outBuffer << "\r\n";
-
- outBuffer << "Content-Length: " << strlen(content) << "\r\n"
- << "SOAPAction: \"\"\r\n"
- << "\r\n";
-
- // Now the content
- outBuffer << content;
-
- // Send the http request
- string ostr = outBuffer.str();
- size_t lent = ostr.length();
- int aLent = 0;
- if ((aLent = write(s, (void *) ostr.c_str(), lent)) != lent)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error writing to socket");
- }
-
- char inBuffer[4000];
- char* inBufferEnd;
- char* inBufferPos;
-
- //
- // get the response, check the http header for errors from the server.
- //
- aLent = read(s, (void *)inBuffer, sizeof(inBuffer)-1);
- if (aLent <= 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- inBufferEnd = inBuffer+aLent;
- *inBufferEnd = 0;
-
- // Find the break between the returned http header and any data.
- // (Delimited by a blank line)
- // Hang on to any data for use by the first read from this BinHTTPURLInputStream.
- //
- bool headerRead = false;
- do {
- inBufferPos = strstr(inBuffer, "\r\n\r\n");
- if (inBufferPos != 0) {
- inBufferPos += 4;
- *(inBufferPos-2) = 0;
- headerRead = true;
- }
- else {
- inBufferPos = strstr(inBuffer, "\n\n");
- if (inBufferPos != 0) {
- inBufferPos += 2;
- *(inBufferPos-1) = 0;
- headerRead = true;
- }
- else {
- //
- // Header is not yet read, do another recv() to get more data...
- aLent = read(s,
- inBufferEnd,
- (sizeof(inBuffer) - 1) - (inBufferEnd - inBuffer));
- if (aLent <= 0) {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
- inBufferEnd = inBufferEnd + aLent;
- *inBufferEnd = 0;
- }
- }
- } while(headerRead == false);
-
- // Make sure the header includes an HTTP 200 OK response.
- //
- char *p = strstr(inBuffer, "HTTP");
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- p = strchr(p, ' ');
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- int httpResponse = atoi(p);
-
- if (httpResponse == 302 || httpResponse == 301) {
- //Once grows, should use a switch
- char redirectBuf[256];
- int q;
-
- // Find the "Location:" string
- p = strstr(p, "Location:");
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
- p = strchr(p, ' ');
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- // Now read
- p++;
- for (q=0; q < 255 && p[q] != '\r' && p[q] !='\n'; ++q)
- redirectBuf[q] = p[q];
-
- redirectBuf[q] = '\0';
-
- // Try to find this location
- XMLCh * recString = XMLString::transcode(redirectBuf);
-
- XSECSOAPRequestorSimple recurse(recString);
- XSEC_RELEASE_XMLCH(recString);
- return recurse.doRequest(request);
-
- }
-
- else if (httpResponse != 200)
- {
- // Most likely a 404 Not Found error.
- // Should recognize and handle the forwarding responses.
- //
- char * q = strstr(p, "\n");
- if (q == NULL)
- q = strstr(p, "\r");
- if (q != NULL)
- *q = '\0';
- safeBuffer sb;
- sb.sbStrcpyIn("SOAPRequestorSimple HTTP Error : ");
- if (strlen(p) < 256)
- sb.sbStrcatIn(p);
- throw XSECException(XSECException::HTTPURIInputStreamError, sb.rawCharBuffer());
-
- }
-
- /* Now find out how long the return is */
-
- p = strstr(inBuffer, "Content-Length:");
- int responseLength;
-
- if (p == NULL) {
- // Need to work it out from the amount of data returned
- responseLength = -1;
- }
- else {
-
- p = strchr(p, ' ');
- p++;
-
- responseLength = atoi(p);
- }
-
- safeBuffer responseBuffer;
- lent = inBufferEnd - inBufferPos;
- responseBuffer.sbMemcpyIn(inBufferPos, lent);
-
- while (responseLength == -1 || lent < responseLength) {
- aLent = read(s, (void *)inBuffer, sizeof(inBuffer)-1);
- if (aLent > 0) {
- responseBuffer.sbMemcpyIn(lent, inBuffer, aLent);
- lent += aLent;
- }
- else {
- responseLength = 0;
- }
- }
-
- return parseAndUnwrap(responseBuffer.rawCharBuffer(), lent);
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp b/xsec/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp
deleted file mode 100644
index 8675d197..00000000
--- a/xsec/utils/winutils/XSECSOAPRequestorSimpleWin32.cpp
+++ /dev/null
@@ -1,400 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XSECSOAPRequestorSimpleWin32 := (Very) Basic implementation of a SOAP
- * HTTP wrapper for testing the client code.
- *
- *
- * $Id$
- *
- */
-
-
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/utils/XSECSafeBuffer.hpp>
-#include <xsec/utils/XSECSOAPRequestorSimple.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include "../../utils/XSECAutoPtr.hpp"
-#include "../../utils/XSECDOMUtils.hpp"
-
-#define _WINSOCKAPI_
-
-#define INCL_WINSOCK_API_TYPEDEFS 1
-#include <winsock2.h>
-#include <windows.h>
-#include <tchar.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include <string>
-#include <sstream>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/parsers/XercesDOMParser.hpp>
-#include <xercesc/framework/XMLFormatter.hpp>
-#include <xercesc/framework/MemBufFormatTarget.hpp>
-#include <xercesc/util/PlatformUtils.hpp>
-#include <xercesc/util/XMLNetAccessor.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/XMLExceptMsgs.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-using std::string;
-using std::ostringstream;
-
-
-// --------------------------------------------------------------------------------
-// Constructors and Destructors
-// --------------------------------------------------------------------------------
-
-
-XSECSOAPRequestorSimple::XSECSOAPRequestorSimple(const XMLCh * uri) : m_uri(uri) {
-
- m_envelopeType = ENVELOPE_SOAP11;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Interface
-// --------------------------------------------------------------------------------
-
-
-DOMDocument * XSECSOAPRequestorSimple::doRequest(DOMDocument * request) {
-
-
- char* content = wrapAndSerialise(request);
-
- // First we need to serialise
-
- //
- // Pull all of the parts of the URL out of th m_uri object, and transcode them
- // and transcode them back to ASCII.
- //
- const XMLCh* hostName = m_uri.getHost();
- XSECAutoPtrChar hostNameAsCharStar(hostName);
-
- const XMLCh* path = m_uri.getPath();
- XSECAutoPtrChar pathAsCharStar(path);
-
- const XMLCh* fragment = m_uri.getFragment();
- XSECAutoPtrChar fragmentAsCharStar(fragment);
-
- const XMLCh* query = m_uri.getQueryString();
- XSECAutoPtrChar queryAsCharStar(query);
-
- unsigned short portNumber = (unsigned short) m_uri.getPort();
-
- // If no number is set, go with port 80
- if (portNumber == USHRT_MAX)
- portNumber = 80;
-
- //
- // Set up a socket.
- //
- struct hostent* hostEntPtr = 0;
- struct sockaddr_in sa;
-
-
- if ((hostEntPtr = gethostbyname(hostNameAsCharStar.get())) == NULL)
- {
- unsigned long numAddress = inet_addr(hostNameAsCharStar.get());
- if (numAddress == INADDR_NONE)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported resolving IP address");
- }
- if ((hostEntPtr =
- gethostbyaddr((const char *) &numAddress,
- sizeof(unsigned long), AF_INET)) == NULL)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported resolving IP address");
- }
- }
-
- memcpy((void *) &sa.sin_addr,
- (const void *) hostEntPtr->h_addr, hostEntPtr->h_length);
- sa.sin_family = hostEntPtr->h_addrtype;
- sa.sin_port = htons(portNumber);
-
- SOCKET s = socket(hostEntPtr->h_addrtype, SOCK_STREAM, 0);
- if (s == INVALID_SOCKET)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported creating socket");
- }
-
- if (connect((unsigned short) s,
- (struct sockaddr *) &sa, sizeof(sa)) == SOCKET_ERROR)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported connecting to socket");
- }
-
-
- // Set a flag so we know that the headers have not been read yet.
- bool fHeaderRead = false;
-
- // The port is open and ready to go.
- // Build up the http POST command to send to the server.
- // To do: We should really support http 1.1. This implementation
- // is weak.
-
- ostringstream outBuffer;
-
- outBuffer << "POST " << pathAsCharStar.get();
-
- if (queryAsCharStar.get() != 0)
- {
- // Tack on a ? before the fragment
- outBuffer << '?' << queryAsCharStar.get();
- }
-
- if (fragmentAsCharStar.get() != 0)
- {
- outBuffer << fragmentAsCharStar.get();
- }
-
- outBuffer << "HTTP/1.0\r\n"
- << "Content-Type: text/xml; charset=utf-8\r\n";
-
- outBuffer << "Host: " << hostNameAsCharStar.get();
- if (portNumber != 80)
- {
- outBuffer << ':' << portNumber;
- }
- outBuffer << "\r\n";
-
- outBuffer << "Content-Length: " << strlen(content) << "\r\n"
- << "SOAPAction: \"\"\r\n"
- << "\r\n";
-
- // Send the http request
- string ostr = outBuffer.str();
- size_t lent = ostr.length();
- int aLent = 0;
- if ((aLent = send((unsigned short) s,
- ostr.c_str(), lent, 0)) != lent)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported writing to socket");
- }
-
- // Now the content
- lent = strlen(content);
- aLent = 0;
- if ((aLent = send((unsigned short) s,
- content, lent, 0)) != lent)
- {
- XSEC_RELEASE_XMLCH(content);
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported writing to socket");
- }
- XSEC_RELEASE_XMLCH(content);
-
- //
- // get the response, check the http header for errors from the server.
- //
-
- char inBuffer[4000];
- char* inBufferEnd;
- char* inBufferPos;
-
- memset(inBuffer, 0, sizeof(inBuffer));
- aLent = recv((unsigned short) s, inBuffer, sizeof(inBuffer)-1, 0);
- if (aLent == SOCKET_ERROR || aLent == 0)
- {
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- inBufferEnd = inBuffer+aLent;
- *inBufferEnd = 0;
-
- do {
- // Find the break between the returned http header and any data.
- // (Delimited by a blank line)
- // Hang on to any data for use by the first read from this XSECBinHTTPURIInputStream.
- //
- inBufferPos = strstr(inBuffer, "\r\n\r\n");
- if (inBufferPos != 0)
- {
- inBufferPos += 4;
- *(inBufferPos-2) = 0;
- fHeaderRead = true;
- }
- else
- {
- inBufferPos = strstr(inBuffer, "\n\n");
- if (inBufferPos != 0)
- {
- inBufferPos += 2;
- *(inBufferPos-1) = 0;
- fHeaderRead = true;
- }
- else
- {
- //
- // Header is not yet read, do another recv() to get more data...
- aLent = recv((unsigned short) s, inBufferEnd, ((int) sizeof(inBuffer) - 1) - (int)(inBufferEnd - inBuffer), 0);
- if (aLent == SOCKET_ERROR || aLent == 0)
- {
- // Call WSAGetLastError() to get the error number.
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
- inBufferEnd = inBufferEnd + aLent;
- *inBufferEnd = 0;
- }
- }
- } while(fHeaderRead == false);
-
- // Make sure the header includes an HTTP 200 OK response.
- //
- char *p = strstr(inBuffer, "HTTP");
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- p = strchr(p, ' ');
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "XSECSOAPRequestorSimple - Error reported reading socket");
- }
-
- int httpResponse = atoi(p);
-
- // Check for redirect or permanently moved
- if (httpResponse == 302 || httpResponse == 301)
- {
- //Once grows, should use a switch
- char redirectBuf[256];
- int q;
-
- // Find the "Location:" string
- p = strstr(p, "Location:");
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
- p = strchr(p, ' ');
- if (p == 0)
- {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "Error reported reading socket");
- }
-
- // Now read
- p++;
- for (q=0; q < 255 && p[q] != '\r' && p[q] !='\n'; ++q)
- redirectBuf[q] = p[q];
-
- redirectBuf[q] = '\0';
-
- // Try to find this location
- m_uri = XMLUri(XMLString::transcode(redirectBuf));
-
- return doRequest(request);
-
- }
- else if (httpResponse != 200)
- {
- // Most likely a 404 Not Found error.
- // Should recognize and handle the forwarding responses.
- //
- char * q = strstr(p, "\n");
- if (q == NULL)
- q = strstr(p, "\r");
- if (q != NULL)
- *q = '\0';
- safeBuffer sb;
- sb.sbStrcpyIn("SOAPRequestorSimple HTTP Error : ");
- if (strlen(p) < 256)
- sb.sbStrcatIn(p);
- throw XSECException(XSECException::HTTPURIInputStreamError, sb.rawCharBuffer());
- }
-
- /* Now find out how long the return is */
-
- p = strstr(inBuffer, "Content-Length:");
- int responseLength;
-
- if (p == NULL) {
- // Need to work it out from the amount of data returned
- responseLength = -1;
- }
- else {
-
- p = strchr(p, ' ');
- p++;
-
- responseLength = atoi(p);
- }
-
- safeBuffer responseBuffer;
- lent = (int) (inBufferEnd - inBufferPos);
- responseBuffer.sbMemcpyIn(inBufferPos, lent);
-
- while (responseLength == -1 || lent < responseLength) {
- aLent = recv((unsigned short)s, inBuffer, sizeof(inBuffer)-1, 0);
- if (aLent > 0) {
- responseBuffer.sbMemcpyIn(lent, inBuffer, aLent);
- lent += aLent;
- }
- else {
- responseLength = 0;
- }
- }
-
- if (lent <= 0) {
- throw XSECException(XSECException::HTTPURIInputStreamError,
- "XSECSOAPRequestorSimple - Zero length response from server");
- }
-
- return parseAndUnwrap(responseBuffer.rawCharBuffer(), lent);
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/XKMSAuthentication.hpp b/xsec/xkms/XKMSAuthentication.hpp
deleted file mode 100644
index 78378df9..00000000
--- a/xsec/xkms/XKMSAuthentication.hpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSAuthentication := Interface for ValidityInterval elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSAUTHENTICATION_INCLUDE
-#define XKMSAUTHENTICATION_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/dsig/DSIGConstants.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class DSIGSignature;
-class XKMSNotBoundAuthentication;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the Authentication elements
- *
- * The \<Authentication\> Element used within a number of X-KRSS requests
- * as the mechanism for authentication a request from a client to the server
- *
- * It can contain either a standard XML-Signature element (via a
- * KeyBindingAuthentication element) or a straight password (not otherwise
- * protected).
- *
- * The schema definition for ValidityInterval is as follows :
- *
- * \verbatim
- <!-- Authentication -->
- <element name="Authentication" type="xkms:AuthenticationType"/>
- <complexType name="AuthenticationType">
- <sequence>
- <element ref="xkms:KeyBindingAuthentication" minOccurs="0"/>
- <element ref="xkms:NotBoundAuthentication" minOccurs="0"/>
- </sequence>
- </complexType>
- <!-- /Authentication -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSAuthentication {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSAuthentication() {};
-
-public:
-
- virtual ~XKMSAuthentication() {};
-
- //@}
-
- /** @name Get Methods */
- //@{
-
- /**
- * \brief Get KeyBindingAuthentication signature construct
- *
- * A \<XKMSAuthentication\> can have a \<KeyBindingAuthentication\>
- * element as an immediate child. This element is used to hold a
- * XML-Signature over the PrototypeKeyBinding.
- *
- * @return The signature held in the KeyBindingAuthentication - or NULL
- * if none is set.
- */
-
- virtual DSIGSignature * getKeyBindingAuthenticationSignature(void) const = 0;
-
- /**
- * \brief Get the NotBoundAuthentication structure
- *
- * The NotBoundAuthentication element is used to pass a plaintext key
- * along with the request message as the authentication mechanism.
- *
- * @note The XKMS Spec indicates that this element MUST NOT be used unless
- * there is another form of security being used to wrap the requests -
- * e.g. authenticated SSL.
- *
- * @return The NotBoundAuthentication structure (or NULL if none is defined)
- */
-
- virtual XKMSNotBoundAuthentication * getNotBoundAuthentication(void) const = 0;
-
- //@}
-
- /** @name Set Methods */
- //@{
-
- /**
- * \brief Add a KeyBindingAuthentication signature to the message
- *
- * Allows the application to add a new signature into a
- * KeyBindingAuthentication element
- *
- * @returns the new Signature structure
- */
-
- virtual DSIGSignature * addKeyBindingAuthenticationSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) = 0;
-
- /**
- * \brief Set the NotBoundAuthentication value
- *
- * Allows applications to set a authentication value
- *
- * @param uri URI defining the authentication protocol
- * @param value Base64 encoded value to set as the authentication value
- */
-
- virtual void setNotBoundAuthentication(const XMLCh * uri, const XMLCh * value) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSAuthentication(const XKMSAuthentication &);
- XKMSAuthentication & operator = (const XKMSAuthentication &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSAUTHENTICATION_INCLUDE */
diff --git a/xsec/xkms/XKMSCompoundRequest.hpp b/xsec/xkms/XKMSCompoundRequest.hpp
deleted file mode 100644
index 89c094cc..00000000
--- a/xsec/xkms/XKMSCompoundRequest.hpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundRequest := Interface for CompoundRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSCOMPOUNDREQUEST_INCLUDE
-#define XKMSCOMPOUNDREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class XKMSLocateRequest;
-class XKMSValidateRequest;
-class XKMSRegisterRequest;
-class XKMSRevokeRequest;
-class XKMSReissueRequest;
-class XKMSRecoverRequest;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the CompoundRequest elements
- *
- * The \<CompoundRequest\> is used to merge a number of separate requests
- * into a single message. It is a very simple type - simply a holding
- * Request that has all the sub-requests held within it.
- *
- * The schema definition for CompoundRequest is as follows :
- *
- * \verbatim
- <!-- CompoundRequest -->
- <element name="CompoundRequest" type="xkms:CompoundRequestType"/>
- <complexType name="CompoundRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <choice maxOccurs="unbounded">
- <element ref="xkms:LocateRequest"/>
- <element ref="xkms:ValidateRequest"/>
- <element ref="xkms:RegisterRequest"/>
- <element ref="xkms:ReissueRequest"/>
- <element ref="xkms:RecoverRequest"/>
- <element ref="xkms:RevokeRequest"/>
- </choice>
- </extension>
- </complexContent>
- </complexType>
- <!-- /CompoundRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSCompoundRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSCompoundRequest() {};
-
-public:
-
- virtual ~XKMSCompoundRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the number of requests within the compound request
- *
- * This class holds a list of requests that can be accessed using the
- * getRequestListItem method. This method allows an application to determine
- * how many request items there are.
- *
- * @returns The size of the request list
- */
-
- virtual int getRequestListSize(void) = 0;
-
- /**
- * \brief Obtain a request item
- *
- * Obtain a particular request from the list of requests held in this
- * compound object
- *
- * @returns The nominated item
- */
-
- virtual XKMSRequestAbstractType * getRequestListItem(int item) = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a LocateRequest item
- *
- * Appends a LocateRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSLocateRequest structure
- */
-
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- /** \brief Add a ValidateRequest item
- *
- * Appends a ValidateRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSValidateRequest structure
- */
-
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- /** \brief Add a RegisterRequest item
- *
- * Appends a RegisterRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSValidateRequest structure
- */
-
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- /** \brief Add a RevokeRequest item
- *
- * Appends a RevokeRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRevokeRequest structure
- */
-
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- /** \brief Add a RecoverRequest item
- *
- * Appends a RecoverRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRecoverRequest structure
- */
-
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- /** \brief Add a ReissueRequest item
- *
- * Appends a ReissueRequest to the CompoundRequest object and returns the newly
- * created object
- *
- * @param service URI
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSReissueRequest structure
- */
-
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- const XMLCh * id = NULL) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSCompoundRequest(const XKMSCompoundRequest &);
- XKMSCompoundRequest & operator = (const XKMSCompoundRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSCOMPOUNDREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSCompoundResult.hpp b/xsec/xkms/XKMSCompoundResult.hpp
deleted file mode 100644
index f4c00468..00000000
--- a/xsec/xkms/XKMSCompoundResult.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundResult := Interface for CompoundResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSCOMPOUNDRESULT_INCLUDE
-#define XKMSCOMPOUNDRESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-
-class XKMSLocateResult;
-class XKMSLocateRequest;
-class XKMSValidateResult;
-class XKMSStatusResult;
-class XKMSStatusRequest;
-class XKMSValidateRequest;
-class XKMSRegisterRequest;
-class XKMSRegisterResult;
-class XKMSRevokeRequest;
-class XKMSRevokeResult;
-class XKMSReissueRequest;
-class XKMSReissueResult;
-class XKMSRecoverRequest;
-class XKMSRecoverResult;
-class XKMSResult;
-class XKMSRequestAbstractType;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the CompoundResult elements
- *
- * The \<CompoundResult\> is used to merge a number of separate requests
- * into a single message. It is a very simple type - simply a holding
- * Result that has all the sub-Results held within it.
- *
- * The schema definition for CompoundResult is as follows :
- *
- * \verbatim
- <!-- CompoundResult -->
- <element name="CompoundResult" type="xkms:CompoundResultType"/>
- <complexType name="CompoundResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="xkms:LocateResult"/>
- <element ref="xkms:ValidateResult"/>
- <element ref="xkms:RegisterResult"/>
- <element ref="xkms:ReissueResult"/>
- <element ref="xkms:RecoverResult"/>
- <element ref="xkms:RevokeResult"/>
- </choice>
- </extension>
- </complexContent>
- </complexType>
- <!-- /CompoundResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSCompoundResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSCompoundResult() {};
-
-public:
-
- virtual ~XKMSCompoundResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the number of results within the compound result
- *
- * This class holds a list of results that can be accessed using the
- * getResultListItem method. This method allows an application to determine
- * how many result items there are.
- *
- * @returns The size of the Result list
- */
-
- virtual int getResultListSize(void) = 0;
-
- /**
- * \brief Obtain a Result item
- *
- * Obtain a particular Result from the list of Results held in this
- * compound object
- *
- * @returns The nominated item
- */
-
- virtual XKMSResultType * getResultListItem(int item) = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /**
- * \brief Create a new \<LocateResult\> message.
- *
- * Generates a new LocateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input LocateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSLocateResponse structure
- */
-
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ValidateResult\> message.
- *
- * Generates a new ValidateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSLocateResponse structure
- */
-
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<StatusResult\> message.
- *
- * Generates a new StatusResult message from scratch, building the DOM
- * as it goes. The response will be based on a input StatusRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSStatusResponse structure
- */
-
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
-
- /**
- * \brief Create a new \<RegisterResult\> message.
- *
- * Generates a new RegisterResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RegisterRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSRegisterResult structure
- */
-
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RevokeResult\> message.
- *
- * Generates a new RevokeResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RevokeRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSRevokeResult structure
- */
-
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RecoverResult\> message.
- *
- * Generates a new RecoverResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RevokeRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSRecoverResult structure
- */
-
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ReissueResult\> message.
- *
- * Generates a new ReissueResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RevokeRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSReissueResult structure
- */
-
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<Result\> message.
- *
- * Generates a new Result message from scratch, building the DOM
- * as it goes. The response will be based on an input Request message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param id Value to set in the Id field. If NULL, the library will
- * @param rmaj Major result code
- * @param rmin Minor result code
- * generate a new Unique Id value.
- * @returns the new XKMSResult structure
- */
-
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSCompoundResult(const XKMSCompoundResult &);
- XKMSCompoundResult & operator = (const XKMSCompoundResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSCOMPOUNDRESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSConstants.cpp b/xsec/xkms/XKMSConstants.cpp
deleted file mode 100644
index 80c64948..00000000
--- a/xsec/xkms/XKMSConstants.cpp
+++ /dev/null
@@ -1,1833 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSConstants := Definitions of varius XKMSconstants (mainly strings)
- *
- * $Id$
- *
- */
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/XMLString.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-
-// --------------------------------------------------------------------------------
-// Constant Strings Storage
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSConstants::s_unicodeStrURIXKMS;
-const XMLCh * XKMSConstants::s_unicodeStrURISOAP11;
-const XMLCh * XKMSConstants::s_unicodeStrURISOAP12;
-
-// NOTE All tags are unicode (UTF-16) - but are not marked as such
-
-const XMLCh XKMSConstants::s_tagApplication[] = {
-
- chLatin_A,
- chLatin_p,
- chLatin_p,
- chLatin_l,
- chLatin_i,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagAuthentication[] = {
-
- chLatin_A,
- chLatin_u,
- chLatin_t,
- chLatin_h,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagCompoundRequest[] = {
-
- chLatin_C,
- chLatin_o,
- chLatin_m,
- chLatin_p,
- chLatin_o,
- chLatin_u,
- chLatin_n,
- chLatin_d,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagCompoundResult[] = {
-
- chLatin_C,
- chLatin_o,
- chLatin_m,
- chLatin_p,
- chLatin_o,
- chLatin_u,
- chLatin_n,
- chLatin_d,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagD[] = {
-
- chLatin_D,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagDP[] = {
-
- chLatin_D,
- chLatin_P,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagDQ[] = {
-
- chLatin_D,
- chLatin_Q,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagEncryption[] = {
-
- chLatin_E,
- chLatin_n,
- chLatin_c,
- chLatin_r,
- chLatin_y,
- chLatin_p,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagExchange[] = {
-
- chLatin_E,
- chLatin_x,
- chLatin_c,
- chLatin_h,
- chLatin_a,
- chLatin_n,
- chLatin_g,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagExponent[] = {
-
- chLatin_E,
- chLatin_x,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagFailure[] = {
-
- chLatin_F,
- chLatin_a,
- chLatin_i,
- chLatin_l,
- chLatin_u,
- chLatin_r,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagId[] = {
-
- chLatin_I,
- chLatin_d,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagIdentifier[] = {
-
- chLatin_I,
- chLatin_d,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_f,
- chLatin_i,
- chLatin_e,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagInvalidReason[] = {
-
- chLatin_I,
- chLatin_n,
- chLatin_v,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_R,
- chLatin_e,
- chLatin_a,
- chLatin_s,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagInverseQ[] = {
-
- chLatin_I,
- chLatin_n,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chLatin_s,
- chLatin_e,
- chLatin_Q,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagIndeterminateReason[] = {
-
- chLatin_I,
- chLatin_n,
- chLatin_d,
- chLatin_e,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_m,
- chLatin_i,
- chLatin_n,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_a,
- chLatin_s,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyBinding[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyBindingAuthentication[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chLatin_A,
- chLatin_u,
- chLatin_t,
- chLatin_h,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyInfo[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_I,
- chLatin_n,
- chLatin_f,
- chLatin_o,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyName[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_N,
- chLatin_a,
- chLatin_m,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyUsage[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_U,
- chLatin_s,
- chLatin_a,
- chLatin_g,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagKeyValue[] = {
-
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_u,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagLocateRequest[] = {
-
- chLatin_L,
- chLatin_o,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagLocateResult[] = {
-
- chLatin_L,
- chLatin_o,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagMessageExtension[] = {
-
- chLatin_M,
- chLatin_e,
- chLatin_s,
- chLatin_s,
- chLatin_a,
- chLatin_g,
- chLatin_e,
- chLatin_E,
- chLatin_x,
- chLatin_t,
- chLatin_e,
- chLatin_n,
- chLatin_s,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagModulus[] = {
-
- chLatin_M,
- chLatin_o,
- chLatin_d,
- chLatin_u,
- chLatin_l,
- chLatin_u,
- chLatin_s,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagNonce[] = {
-
- chLatin_N,
- chLatin_o,
- chLatin_n,
- chLatin_c,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagNotBoundAuthentication[] = {
-
- chLatin_N,
- chLatin_o,
- chLatin_t,
- chLatin_B,
- chLatin_o,
- chLatin_u,
- chLatin_n,
- chLatin_d,
- chLatin_A,
- chLatin_u,
- chLatin_t,
- chLatin_h,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagNotBefore[] = {
-
- chLatin_N,
- chLatin_o,
- chLatin_t,
- chLatin_B,
- chLatin_e,
- chLatin_f,
- chLatin_o,
- chLatin_r,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagNotOnOrAfter[] = {
-
- chLatin_N,
- chLatin_o,
- chLatin_t,
- chLatin_O,
- chLatin_n,
- chLatin_O,
- chLatin_r,
- chLatin_A,
- chLatin_f,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagOpaqueClientData[] = {
-
- chLatin_O,
- chLatin_p,
- chLatin_a,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_C,
- chLatin_l,
- chLatin_i,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_D,
- chLatin_a,
- chLatin_t,
- chLatin_a,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagOpaqueData[] = {
-
- chLatin_O,
- chLatin_p,
- chLatin_a,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_D,
- chLatin_a,
- chLatin_t,
- chLatin_a,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagOriginalRequestId[] = {
-
- chLatin_O,
- chLatin_r,
- chLatin_i,
- chLatin_g,
- chLatin_i,
- chLatin_n,
- chLatin_a,
- chLatin_l,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chLatin_I,
- chLatin_d,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagP[] = {
-
- chLatin_P,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagPending[] = {
-
- chLatin_P,
- chLatin_e,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagPendingRequest[] = {
-
- chLatin_P,
- chLatin_e,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagPrivateKey[] = {
-
- chLatin_P,
- chLatin_r,
- chLatin_i,
- chLatin_v,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagProofOfPossession[] = {
-
- chLatin_P,
- chLatin_r,
- chLatin_o,
- chLatin_o,
- chLatin_f,
- chLatin_O,
- chLatin_f,
- chLatin_P,
- chLatin_o,
- chLatin_s,
- chLatin_s,
- chLatin_e,
- chLatin_s,
- chLatin_s,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagProtocol[] = {
-
- chLatin_P,
- chLatin_r,
- chLatin_o,
- chLatin_t,
- chLatin_o,
- chLatin_c,
- chLatin_o,
- chLatin_l,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagPrototypeKeyBinding[] = {
-
- chLatin_P,
- chLatin_r,
- chLatin_o,
- chLatin_t,
- chLatin_o,
- chLatin_t,
- chLatin_y,
- chLatin_p,
- chLatin_e,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagQ[] = {
-
- chLatin_Q,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagQueryKeyBinding[] = {
-
- chLatin_Q,
- chLatin_u,
- chLatin_e,
- chLatin_r,
- chLatin_y,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRecoverKeyBinding[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_c,
- chLatin_o,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRecoverRequest[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_c,
- chLatin_o,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRecoverResult[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_c,
- chLatin_o,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRegisterRequest[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_g,
- chLatin_i,
- chLatin_s,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRegisterResult[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_g,
- chLatin_i,
- chLatin_s,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagReissueKeyBinding[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_i,
- chLatin_s,
- chLatin_s,
- chLatin_u,
- chLatin_e,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagReissueRequest[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_i,
- chLatin_s,
- chLatin_s,
- chLatin_u,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagReissueResult[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_i,
- chLatin_s,
- chLatin_s,
- chLatin_u,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRepresent[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_p,
- chLatin_r,
- chLatin_e,
- chLatin_s,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRequestId[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chLatin_I,
- chLatin_d,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRequestSignatureValue[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chLatin_S,
- chLatin_i,
- chLatin_g,
- chLatin_n,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_r,
- chLatin_e,
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_u,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRespondWith[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_d,
- chLatin_W,
- chLatin_i,
- chLatin_t,
- chLatin_h,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResponseId[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_s,
- chLatin_e,
- chLatin_I,
- chLatin_d,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResponseLimit[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_s,
- chLatin_e,
- chLatin_L,
- chLatin_i,
- chLatin_m,
- chLatin_i,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResponseMechanism[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_s,
- chLatin_e,
- chLatin_M,
- chLatin_e,
- chLatin_c,
- chLatin_h,
- chLatin_a,
- chLatin_n,
- chLatin_i,
- chLatin_s,
- chLatin_m,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResult[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResultMajor[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chLatin_M,
- chLatin_a,
- chLatin_j,
- chLatin_o,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResultMinor[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chLatin_M,
- chLatin_i,
- chLatin_n,
- chLatin_o,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRevocationCode[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chLatin_C,
- chLatin_o,
- chLatin_d,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRevocationCodeIdentifier[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chLatin_C,
- chLatin_o,
- chLatin_d,
- chLatin_e,
- chLatin_I,
- chLatin_d,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_f,
- chLatin_i,
- chLatin_e,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRevokeKeyBinding[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_k,
- chLatin_e,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRevokeRequest[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_k,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRevokeResult[] = {
-
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_k,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagRSAKeyPair[] = {
-
- chLatin_R,
- chLatin_S,
- chLatin_A,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_P,
- chLatin_a,
- chLatin_i,
- chLatin_r,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagService[] = {
-
- chLatin_S,
- chLatin_e,
- chLatin_r,
- chLatin_v,
- chLatin_i,
- chLatin_c,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagSignature[] = {
-
- chLatin_S,
- chLatin_i,
- chLatin_g,
- chLatin_n,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_r,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagStatus[] = {
-
- chLatin_S,
- chLatin_t,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_s,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagStatusRequest[] = {
-
- chLatin_S,
- chLatin_t,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_s,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagStatusResult[] = {
-
- chLatin_S,
- chLatin_t,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_s,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagStatusValue[] = {
-
- chLatin_S,
- chLatin_t,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_s,
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_u,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagSuccess[] = {
-
- chLatin_S,
- chLatin_u,
- chLatin_c,
- chLatin_c,
- chLatin_e,
- chLatin_s,
- chLatin_s,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagUnverifiedKeyBinding[] = {
-
- chLatin_U,
- chLatin_n,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chLatin_i,
- chLatin_f,
- chLatin_i,
- chLatin_e,
- chLatin_d,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_B,
- chLatin_i,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagUseKeyWith[] = {
-
- chLatin_U,
- chLatin_s,
- chLatin_e,
- chLatin_K,
- chLatin_e,
- chLatin_y,
- chLatin_W,
- chLatin_i,
- chLatin_t,
- chLatin_h,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagValidateRequest[] = {
-
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_e,
- chLatin_s,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagValidateResult[] = {
-
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_u,
- chLatin_l,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagValidReason[] = {
-
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_R,
- chLatin_e,
- chLatin_a,
- chLatin_s,
- chLatin_o,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagValidityInterval[] = {
-
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_i,
- chLatin_t,
- chLatin_y,
- chLatin_I,
- chLatin_n,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_v,
- chLatin_a,
- chLatin_l,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagValue[] = {
-
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_u,
- chLatin_e,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagX509Cert[] = {
-
- chLatin_X,
- chDigit_5,
- chDigit_0,
- chDigit_9,
- chLatin_C,
- chLatin_e,
- chLatin_r,
- chLatin_t,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagX509Chain[] = {
-
- chLatin_X,
- chDigit_5,
- chDigit_0,
- chDigit_9,
- chLatin_C,
- chLatin_h,
- chLatin_a,
- chLatin_i,
- chLatin_n,
- chNull
-};
-
-const XMLCh XKMSConstants::s_tagResultMajorCodes[][16] = {
-
- {
- chLatin_N,
- chLatin_o,
- chLatin_n,
- chLatin_e,
- chNull
- },
-
- {
- chLatin_S,
- chLatin_u,
- chLatin_c,
- chLatin_c,
- chLatin_e,
- chLatin_s,
- chLatin_s,
- chNull
- },
-
- {
- chLatin_V,
- chLatin_e,
- chLatin_r,
- chLatin_s,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chLatin_M,
- chLatin_i,
- chLatin_s,
- chLatin_m,
- chLatin_a,
- chLatin_t,
- chLatin_c,
- chLatin_h,
- chNull
- },
-
- {
- chLatin_S,
- chLatin_e,
- chLatin_n,
- chLatin_d,
- chLatin_e,
- chLatin_r,
- chNull
- },
-
- {
- chLatin_R,
- chLatin_e,
- chLatin_c,
- chLatin_e,
- chLatin_i,
- chLatin_v,
- chLatin_e,
- chLatin_r,
- chNull
- },
-
- {
- chLatin_R,
- chLatin_e,
- chLatin_p,
- chLatin_r,
- chLatin_e,
- chLatin_s,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chNull
- },
-
- {
- chLatin_P,
- chLatin_e,
- chLatin_n,
- chLatin_d,
- chLatin_i,
- chLatin_n,
- chLatin_g,
- chNull
- },
-
-};
-
-const XMLCh XKMSConstants::s_tagResultMinorCodes[][20] = {
-
- {
-
- chLatin_N,
- chLatin_o,
- chLatin_n,
- chLatin_e,
- chNull
- },
-
- {
- chLatin_N,
- chLatin_o,
- chLatin_M,
- chLatin_a,
- chLatin_t,
- chLatin_c,
- chLatin_h,
- chNull
- },
-
- {
- chLatin_T,
- chLatin_o,
- chLatin_o,
- chLatin_M,
- chLatin_a,
- chLatin_n,
- chLatin_y,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_s,
- chLatin_e,
- chLatin_s,
- chNull
- },
-
- {
- chLatin_I,
- chLatin_n,
- chLatin_c,
- chLatin_o,
- chLatin_m,
- chLatin_p,
- chLatin_l,
- chLatin_e,
- chLatin_t,
- chLatin_e,
- chNull
- },
-
- {
- chLatin_F,
- chLatin_a,
- chLatin_i,
- chLatin_l,
- chLatin_u,
- chLatin_r,
- chLatin_e,
- chNull
- },
-
- {
- chLatin_R,
- chLatin_e,
- chLatin_f,
- chLatin_u,
- chLatin_s,
- chLatin_e,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_N,
- chLatin_o,
- chLatin_A,
- chLatin_u,
- chLatin_t,
- chLatin_h,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_i,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chNull
- },
-
- {
- chLatin_M,
- chLatin_e,
- chLatin_s,
- chLatin_s,
- chLatin_a,
- chLatin_g,
- chLatin_e,
- chLatin_N,
- chLatin_o,
- chLatin_t,
- chLatin_S,
- chLatin_u,
- chLatin_p,
- chLatin_p,
- chLatin_o,
- chLatin_r,
- chLatin_t,
- chLatin_e,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_U,
- chLatin_n,
- chLatin_k,
- chLatin_n,
- chLatin_o,
- chLatin_w,
- chLatin_n,
- chLatin_R,
- chLatin_e,
- chLatin_s,
- chLatin_p,
- chLatin_o,
- chLatin_n,
- chLatin_s,
- chLatin_e,
- chLatin_I,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_R,
- chLatin_e,
- chLatin_p,
- chLatin_r,
- chLatin_e,
- chLatin_s,
- chLatin_e,
- chLatin_n,
- chLatin_t,
- chLatin_R,
- chLatin_e,
- chLatin_q,
- chLatin_u,
- chLatin_i,
- chLatin_r,
- chLatin_e,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_N,
- chLatin_o,
- chLatin_t,
- chLatin_S,
- chLatin_y,
- chLatin_n,
- chLatin_c,
- chLatin_h,
- chLatin_r,
- chLatin_o,
- chLatin_n,
- chLatin_o,
- chLatin_u,
- chLatin_s,
- chNull
- },
-
-};
-
-const XMLCh XKMSConstants::s_tagStatusValueCodes[][15] = {
-
- {
- chLatin_U,
- chLatin_n,
- chLatin_d,
- chLatin_e,
- chLatin_f,
- chLatin_i,
- chLatin_n,
- chLatin_e,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_I,
- chLatin_n,
- chLatin_v,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_I,
- chLatin_n,
- chLatin_d,
- chLatin_e,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_m,
- chLatin_i,
- chLatin_n,
- chLatin_a,
- chLatin_t,
- chLatin_e,
- chNull
- },
-
-};
-
-const XMLCh XKMSConstants::s_tagStatusReasonCodes[][17] = {
-
- {
- chLatin_U,
- chLatin_n,
- chLatin_d,
- chLatin_e,
- chLatin_f,
- chLatin_i,
- chLatin_n,
- chLatin_e,
- chLatin_d,
- chNull
- },
-
- {
- chLatin_I,
- chLatin_s,
- chLatin_s,
- chLatin_u,
- chLatin_e,
- chLatin_r,
- chLatin_T,
- chLatin_r,
- chLatin_u,
- chLatin_s,
- chLatin_t,
- chNull
- },
-
- {
- chLatin_R,
- chLatin_e,
- chLatin_v,
- chLatin_o,
- chLatin_c,
- chLatin_a,
- chLatin_t,
- chLatin_i,
- chLatin_o,
- chLatin_n,
- chLatin_S,
- chLatin_t,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_s,
- chNull
- },
-
- {
- chLatin_V,
- chLatin_a,
- chLatin_l,
- chLatin_i,
- chLatin_d,
- chLatin_i,
- chLatin_t,
- chLatin_y,
- chLatin_I,
- chLatin_n,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chLatin_v,
- chLatin_a,
- chLatin_l,
- chNull
- },
-
- {
- chLatin_S,
- chLatin_i,
- chLatin_g,
- chLatin_n,
- chLatin_a,
- chLatin_t,
- chLatin_u,
- chLatin_r,
- chLatin_e,
- chNull
- },
-
-};
-
- // --------------------------------------------------------------------------------
-// Constant Strings Creation and Deletion
-// --------------------------------------------------------------------------------
-
-void XKMSConstants::create() {
-
- // Set up the static strings
-
- s_unicodeStrURIXKMS = XMLString::transcode(URI_ID_XKMS);
- s_unicodeStrURISOAP11 = XMLString::transcode(URI_ID_SOAP11);
- s_unicodeStrURISOAP12 = XMLString::transcode(URI_ID_SOAP12);
-
-}
-
-void XKMSConstants::destroy() {
-
- XMLCh* temp1 = const_cast<XMLCh*>(s_unicodeStrURIXKMS);
- XMLCh* temp2 = const_cast<XMLCh*>(s_unicodeStrURISOAP11);
- XMLCh* temp3 = const_cast<XMLCh*>(s_unicodeStrURISOAP12);
- XSEC_RELEASE_XMLCH(temp1);
- XSEC_RELEASE_XMLCH(temp2);
- XSEC_RELEASE_XMLCH(temp3);
- s_unicodeStrURIXKMS = NULL;
- s_unicodeStrURISOAP11 = NULL;
- s_unicodeStrURISOAP12 = NULL;
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/XKMSConstants.hpp b/xsec/xkms/XKMSConstants.hpp
deleted file mode 100644
index 11b8d7bf..00000000
--- a/xsec/xkms/XKMSConstants.hpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSConstants := Definitions of varius XKMS constants (mainly strings)
- *
- * $Id$
- *
- */
-
-#ifndef XKMSCONSTANTS_HEADER
-#define XKMSCONSTANTS_HEADER
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-
-// Name Spaces
-
-#define URI_ID_XKMS "http://www.w3.org/2002/03/xkms#"
-//#define URI_ID_XKMS "http://www.w3.org/2004/07/xkms#"
-#define URI_ID_SOAP11 "http://schemas.xmlsoap.org/soap/envelope/"
-#define URI_ID_SOAP12 "http://www.w3.org/2003/05/soap-envelope"
-
-
-// --------------------------------------------------------------------------------
-// Constant Strings Class
-// --------------------------------------------------------------------------------
-
-class XSEC_EXPORT XKMSConstants {
-
-public:
-
- // URI_IDs
- static const XMLCh * s_unicodeStrURIXKMS;
- static const XMLCh * s_unicodeStrURISOAP11;
- static const XMLCh * s_unicodeStrURISOAP12;
-
- // Tags - note all are UTF-16, but not marked as such
- static const XMLCh s_tagApplication[];
- static const XMLCh s_tagAuthentication[];
- static const XMLCh s_tagCompoundRequest[];
- static const XMLCh s_tagCompoundResult[];
- static const XMLCh s_tagD[];
- static const XMLCh s_tagDP[];
- static const XMLCh s_tagDQ[];
- static const XMLCh s_tagEncryption[];
- static const XMLCh s_tagExchange[];
- static const XMLCh s_tagExponent[];
- static const XMLCh s_tagFailure[];
- static const XMLCh s_tagId[];
- static const XMLCh s_tagIdentifier[];
- static const XMLCh s_tagIndeterminateReason[];
- static const XMLCh s_tagInvalidReason[];
- static const XMLCh s_tagInverseQ[];
- static const XMLCh s_tagKeyBinding[];
- static const XMLCh s_tagKeyBindingAuthentication[];
- static const XMLCh s_tagKeyInfo[];
- static const XMLCh s_tagKeyName[];
- static const XMLCh s_tagKeyUsage[];
- static const XMLCh s_tagKeyValue[];
- static const XMLCh s_tagLocateRequest[];
- static const XMLCh s_tagLocateResult[];
- static const XMLCh s_tagMessageExtension[];
- static const XMLCh s_tagModulus[];
- static const XMLCh s_tagNonce[];
- static const XMLCh s_tagNotBoundAuthentication[];
- static const XMLCh s_tagNotBefore[];
- static const XMLCh s_tagNotOnOrAfter[];
- static const XMLCh s_tagOpaqueClientData[];
- static const XMLCh s_tagOpaqueData[];
- static const XMLCh s_tagOriginalRequestId[];
- static const XMLCh s_tagP[];
- static const XMLCh s_tagPending[];
- static const XMLCh s_tagPendingRequest[];
- static const XMLCh s_tagPrivateKey[];
- static const XMLCh s_tagProofOfPossession[];
- static const XMLCh s_tagProtocol[];
- static const XMLCh s_tagPrototypeKeyBinding[];
- static const XMLCh s_tagQ[];
- static const XMLCh s_tagQueryKeyBinding[];
- static const XMLCh s_tagRecoverKeyBinding[];
- static const XMLCh s_tagRecoverRequest[];
- static const XMLCh s_tagRecoverResult[];
- static const XMLCh s_tagRegisterRequest[];
- static const XMLCh s_tagRegisterResult[];
- static const XMLCh s_tagReissueKeyBinding[];
- static const XMLCh s_tagReissueRequest[];
- static const XMLCh s_tagReissueResult[];
- static const XMLCh s_tagRepresent[];
- static const XMLCh s_tagRequestId[];
- static const XMLCh s_tagRequestSignatureValue[];
- static const XMLCh s_tagRespondWith[];
- static const XMLCh s_tagResponseId[];
- static const XMLCh s_tagResponseLimit[];
- static const XMLCh s_tagResponseMechanism[];
- static const XMLCh s_tagResult[];
- static const XMLCh s_tagResultMajor[];
- static const XMLCh s_tagResultMinor[];
- static const XMLCh s_tagRevocationCodeIdentifier[];
- static const XMLCh s_tagRevocationCode[];
- static const XMLCh s_tagRevokeKeyBinding[];
- static const XMLCh s_tagRevokeRequest[];
- static const XMLCh s_tagRevokeResult[];
- static const XMLCh s_tagRSAKeyPair[];
- static const XMLCh s_tagService[];
- static const XMLCh s_tagSignature[];
- static const XMLCh s_tagStatus[];
- static const XMLCh s_tagStatusRequest[];
- static const XMLCh s_tagStatusResult[];
- static const XMLCh s_tagStatusValue[];
- static const XMLCh s_tagSuccess[];
- static const XMLCh s_tagUnverifiedKeyBinding[];
- static const XMLCh s_tagUseKeyWith[];
- static const XMLCh s_tagValidateRequest[];
- static const XMLCh s_tagValidateResult[];
- static const XMLCh s_tagValidReason[];
- static const XMLCh s_tagValidityInterval[];
- static const XMLCh s_tagValue[];
- static const XMLCh s_tagX509Cert[];
- static const XMLCh s_tagX509Chain[];
-
- // ResultMajor codes
-
- static const XMLCh s_tagResultMajorCodes[][16];
- static const XMLCh s_tagResultMinorCodes[][20];
- static const XMLCh s_tagStatusValueCodes[][15];
- static const XMLCh s_tagStatusReasonCodes[][17];
-
- XKMSConstants();
-
- static void create();
- static void destroy();
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSCONSTANTS_HEADER */
diff --git a/xsec/xkms/XKMSKeyBinding.hpp b/xsec/xkms/XKMSKeyBinding.hpp
deleted file mode 100644
index 2a976673..00000000
--- a/xsec/xkms/XKMSKeyBinding.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBinding := Interface for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSKEYBINDING_INCLUDE
-#define XKMSKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the KeyBinding elements
- *
- * The \<KeyBinding\> Element is used in a result message to a client
- * to provide information on a particular key.
- *
- * The schema definition for KeyBinding is as follows :
- *
- * \verbatim
- <!-- KeyBinding -->
- <element name="KeyBinding" type="xkms:KeyBindingType"/>
- <complexType name="KeyBindingType">
- <complexContent>
- <extension base="xkms:UnverifiedKeyBindingType">
- <sequence>
- <element ref="xkms:Status"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /KeyBinding -->\endverbatim
- */
-
-class XKMSStatus;
-
-class XSEC_EXPORT XKMSKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSKeyBinding() {};
-
-public:
-
- virtual ~XKMSKeyBinding() {};
-
- //@}
-
- /** @name Status handling */
- //@{
-
- /**
- * \brief Obtain the status element for this KeyBinding
- *
- * The \<Status\> element is used to describe to the caller the
- * validity of they key being described. This call is used to
- * obtain the status element
- *
- * @return A pointer to the XKMSStatus element
- */
-
- virtual XKMSStatus * getStatus(void) const = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSKeyBinding(const XKMSKeyBinding &);
- XKMSKeyBinding & operator = (const XKMSKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSKeyBindingAbstractType.hpp b/xsec/xkms/XKMSKeyBindingAbstractType.hpp
deleted file mode 100644
index 3def5e2d..00000000
--- a/xsec/xkms/XKMSKeyBindingAbstractType.hpp
+++ /dev/null
@@ -1,376 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBindingAbstractType := Interface for base schema of XKMS messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSKEYBINDINGABSTRACTTYPE_INCLUDE
-#define XKMSKEYBINDINGABSTRACTTYPE_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class DSIGKeyInfoList;
-class DSIGKeyInfoMgmtData;
-class DSIGKeyInfoName;
-class DSIGKeyInfoPGPData;
-class DSIGKeyInfoSPKIData;
-class DSIGKeyInfoValue;
-class DSIGKeyInfoX509;
-class XKMSUseKeyWith;
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the KeyBindingAbstractType
- *
- * The \<KeyBindingAbstractType\> is an abstract type on which all
- * KeyBinding components are build.
- *
- * The schema definition for KeyBindingAbstractType is as follows :
- *
- * \verbatim
- <!-- KeyBindingAbstractType-->
- <complexType name="KeyBindingAbstractType" abstract="true">
- <sequence>
- <element ref="ds:KeyInfo" minOccurs="0"/>
- <element ref="xkms:KeyUsage" minOccurs="0" maxOccurs="3"/>
- <element ref="xkms:UseKeyWith" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="Id" type="ID" use="optional"/>
- </complexType>
- <!-- /KeyBindingAbstractType-->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSKeyBindingAbstractType() {};
-
-public:
-
- virtual ~XKMSKeyBindingAbstractType() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /*
- * \brief Obtain the base Element for this structure
- *
- * @returns the Element node at the head of the DOM structure
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Get the Id for the KeyBinding
- *
- * All KeyBinding elements MAY have an Id attribute that
- * identifies the binding. This method is used to retrieve a pointer
- * to the Id string.
- *
- * @returns a pointer to the Id string (owned by the library)
- */
-
- virtual const XMLCh * getId(void) const = 0;
-
- /**
- * \brief Obtain the KeyInfo elements for this KeyBinding
- *
- * KeyBinding elements may provide information about the keys that are being
- * bound.
- *
- * @returns A KeyInfoList object containing all the KeyInfo elements
- */
-
- virtual DSIGKeyInfoList * getKeyInfoList(void) const = 0;
-
- /**
- * \brief Determine if an Encryption key usage is set
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key.
- *
- * @returns whether the Encryption KeyUsage element is set
- */
-
- virtual bool getEncryptionKeyUsage(void) const = 0;
-
- /**
- * \brief Determine if an Signature key usage is set
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key.
- *
- * @returns whether the Signature KeyUsage element is set
- */
-
- virtual bool getSignatureKeyUsage(void) const = 0;
-
- /**
- * \brief Determine if an Exchange key usage is set
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key.
- *
- * @returns whether the Exchange KeyUsage element is set
- */
-
- virtual bool getExchangeKeyUsage(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set the Id URI for the Message
- *
- * Allows a calling application to set a new Id for the
- * KeyBinding
- *
- * @param id The Id to set - if NULL, the library will generate a random Id
- */
-
- virtual void setId(const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Set Encryption key usage on
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key. When first created, all these elements
- * are off (which indicates that all are permitted).
- *
- * This call activates the Encryption key usage for this KeyBinding
- */
-
- virtual void setEncryptionKeyUsage(void) = 0;
-
- /**
- * \brief Set Signature key usage on
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key. When first created, all these elements
- * are off (which indicates that all are permitted).
- *
- * This call activates the Signature key usage for this KeyBinding
- */
-
- virtual void setSignatureKeyUsage(void) = 0;
-
- /**
- * \brief Set Exchange key usage on
- *
- * KeyBinding elements may define Encryption, Signature of Exchange as being
- * permitted for a particular key. When first created, all these elements
- * are off (which indicates that all are permitted).
- *
- * This call activates the Exchange key usage for this KeyBinding
- */
-
- virtual void setExchangeKeyUsage(void) = 0;
-
- //@}
-
- /** @name KeyInfo Element Manipulation */
-
- //@{
-
- /**
- * \brief Get the list of \<KeyInfo\> elements.
- *
- * <p>This function recovers list that contains the KeyInfo elements
- * read in from the DOM document.</p>
- *
- * @returns A pointer to the (library owned) KeyInfo list, or NULL
- * if none exists in the KeyBinding.
- */
-
- virtual DSIGKeyInfoList * getKeyInfoList(void) = 0;
-
- /**
- * \brief Clear out all KeyInfo elements in the KeyBinding.
- *
- * This function will delete all KeyInfo elements from both the KeyBinding
- * object <em>and the associated DOM</em>.
- *
- */
-
- virtual void clearKeyInfo(void) = 0;
-
- /**
- * \brief Append a DSA KeyValue element
- *
- * Add a new KeyInfo element for a DSA Value
- *
- * @param P Base64 encoded value of P
- * @param Q Base64 encoded value of Q
- * @param G Base64 encoded value of G
- * @param Y Base64 encoded value of Y
- * @returns A pointer to the created object.
- */
-
- virtual DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P,
- const XMLCh * Q,
- const XMLCh * G,
- const XMLCh * Y) = 0;
-
- /**
- * \brief Append a RSA KeyValue element
- *
- * Add a new KeyInfo element for a RSA Value
- *
- * @param modulus Base64 encoded value of the modulus
- * @param exponent Base64 encoded value of exponent
- * @returns A pointer to the created object.
- */
-
- virtual DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus,
- const XMLCh * exponent) = 0;
-
- /**
- * \brief Append a X509Data element.
- *
- * Add a new KeyInfo element for X509 data.
- *
- * @note The added element is empty. The caller must make use of the
- * returned object to set the required values.
- *
- * @returns A pointer to the created object.
- */
-
- virtual DSIGKeyInfoX509 * appendX509Data(void) = 0;
-
- /**
- * \brief Append a KeyName element.
- *
- * Add a new KeyInfo element for a key name.
- *
- * @param name The name of the key to set in the XML
- * @param isDName Treat the name as a Distinguished name and encode accordingly
- * @returns A pointer to the created object
- */
-
- virtual DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false) = 0;
-
- /**
- * \brief Append a PGPData element.
- *
- * Add a new KeyInfo element for a PGP key.
- *
- * @param id The ID of the key to set in the XML (base64 encoded - NULL if none)
- * @param packet The Packet information to set in the XML (base64 encoded -
- * NULL if none)
- * @returns A pointer to the created object
- */
-
- virtual DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet) = 0;
-
- /**
- * \brief Append a SPKIData element
- *
- * Add a new KeyInfo element for a set of SPKI S-expressions
- *
- * @param sexp The initial S-expression to set in the SPKIData element
- * @returns A pointer to the created object
- */
-
- virtual DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp) = 0;
-
- /**
- * \brief Append a MgmtData element
- *
- * Add a new KeyInfo element for Management Data
- *
- * @param data The string to set in the MgmtData element
- * @returns A pointer to the created object
- */
-
- virtual DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data) = 0;
-
- //@}
-
- /** @name UseKeyWith handling */
- //@{
-
- /**
- * \brief Find number of UseKeyWith elements
- *
- * @returns the number of UseKeyWith items within the KeyBinding
- */
-
- virtual int getUseKeyWithSize(void) const = 0;
-
- /*
- * \brief Obtain an UseKeyWith item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the UseKeyWith referenced by "item"
- */
-
- virtual XKMSUseKeyWith * getUseKeyWithItem(int item) const = 0;
-
- /*
- * \brief Append a new UnverifiedKeyBinding element
- *
- * Allows callers to append a new UnverifiedKeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @returns the newly created UnverifiedKeyBinding object (already inserted
- * in the LocateResult
- */
-
- virtual XKMSUseKeyWith * appendUseKeyWithItem(
- const XMLCh * application,
- const XMLCh * identifier) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSKeyBindingAbstractType(const XKMSKeyBindingAbstractType &);
- XKMSKeyBindingAbstractType & operator = (const XKMSKeyBindingAbstractType &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSKEYBINDINGABSTRACTTYPE_INCLUDE */
diff --git a/xsec/xkms/XKMSLocateRequest.hpp b/xsec/xkms/XKMSLocateRequest.hpp
deleted file mode 100644
index b13af24c..00000000
--- a/xsec/xkms/XKMSLocateRequest.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateRequest := Interface for LocateRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSLOCATEREQUEST_INCLUDE
-#define XKMSLOCATEREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class XKMSQueryKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the LocateRequest elements
- *
- * The \<LocateRequest\> is one of the fundamental message types of
- * the XKISS service. It is used by the Locate service to find a key
- * and return a set of key bindings for that key.
- *
- * The schema definition for LocateRequest is as follows :
- *
- * \verbatim
- <!-- LocateRequest -->
- <element name="LocateRequest" type="xkms:LocateRequestType"/>
- <complexType name="LocateRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:QueryKeyBinding"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /LocateRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSLocateRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSLocateRequest() {};
-
-public:
-
- virtual ~XKMSLocateRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the QueryKeyBinding element
- *
- * The QueryKeyBinding element is the core of the LocateRequest message, and
- * defines the public key information that will be sent to the server.
- *
- * @returns A pointer to the XKMSQueryKeyBinding element
- */
-
- virtual XKMSQueryKeyBinding * getQueryKeyBinding(void) = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a QueryKeyBinding element
- *
- * Set a QueryKeyBinding element in the LocateRequest message. The returned
- * object can be manipulated to add KeyInfo elements to the LocateRequest.
- *
- * @returns A pointer to the newly created QueryKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSQueryKeyBinding * addQueryKeyBinding(void) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSLocateRequest(const XKMSLocateRequest &);
- XKMSLocateRequest & operator = (const XKMSLocateRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSLOCATEREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSLocateResult.hpp b/xsec/xkms/XKMSLocateResult.hpp
deleted file mode 100644
index 96d3a52e..00000000
--- a/xsec/xkms/XKMSLocateResult.hpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateResult := Interface for LocateResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSLOCATERESULT_INCLUDE
-#define XKMSLOCATERESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-
-class XKMSQueryKeyBinding;
-class XKMSUnverifiedKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the LocateResult elements
- *
- * The \<LocateResult\> is one of the fundamental message types of
- * the XKISS service. It is used by the Locate service to return a key
- * and the bindings for that key.
- *
- * The schema definition for LocateResponse is as follows :
- *
- * \verbatim
- <!-- LocateResult -->
- <element name="LocateResult" type="xkms:LocateResultType"/>
- <complexType name="LocateResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:UnverifiedKeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /LocateResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSLocateResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSLocateResult() {};
-
-public:
-
- virtual ~XKMSLocateResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name UnverifiedKeyBinding handling */
- //@{
-
- /**
- * \brief Find number of UnverifiedKeyBinding elements
- *
- * @returns the number of UnverifiedKeyBinding items within the LocateResult
- */
-
- virtual int getUnverifiedKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an UnverifiedKeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the UnverifiedKeyBinding referenced by "item"
- */
-
- virtual XKMSUnverifiedKeyBinding * getUnverifiedKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new UnverifiedKeyBinding element
- *
- * Allows callers to append a new UnverifiedKeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @returns the newly created UnverifiedKeyBinding object (already inserted
- * in the LocateResult
- */
-
- virtual XKMSUnverifiedKeyBinding * appendUnverifiedKeyBindingItem(void ) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSLocateResult(const XKMSLocateResult &);
- XKMSLocateResult & operator = (const XKMSLocateResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSLOCATERESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSMessageAbstractType.hpp b/xsec/xkms/XKMSMessageAbstractType.hpp
deleted file mode 100644
index b4bc1ab0..00000000
--- a/xsec/xkms/XKMSMessageAbstractType.hpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageAbstractType := Interface for base schema of XKMS messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSMESSAGEABSTRACTTYPE_INCLUDE
-#define XKMSMESSAGEABSTRACTTYPE_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/dsig/DSIGConstants.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class DSIGSignature;
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the MessageAbstractType
- *
- * The \<MessageAbstractType\> is an abstract type on which all
- * other XKMS messages are built. All request/response messages
- * have :
- * <ul>
- * <li><b>Id</b> The unique ID of this message</li>
- * <li><b>Service</b> The URI of the service for which this message is
- * destined or comes from.</li>
- * <li><b>Nonce</b> (Optional) Random data used to defend against replay attacks.
- * </ul>
- *
- * In addition, such messages may have :
- *
- * <ul>
- * <li><b>Signature</b> Validating authenticity of this message</li>
- * <li><b>MessageExtension</b> Used for extensibility</li>
- * <li><b>OpaqueClientData</b> Used for application specific info</li>
- * </ul>
- *
- * The schema definition for MessageAbstractType is as follows :
- *
- * \verbatim
- <!-- MessageAbstractType -->
- <complexType name="MessageAbstractType" abstract="true">
- <sequence>
- <element ref="ds:Signature" minOccurs="0"/>
- <element ref="xkms:MessageExtension" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:OpaqueClientData" minOccurs="0"/>
- </sequence>
- <attribute name="Id" type="ID" use="required"/>
- <attribute name="Service" type="anyURI" use="required"/>
- <attribute name="Nonce" type="base64Binary" use="optional"/>
- </complexType>
- <!-- /MessageAbstractType -->
-
- \endverbatim
- */
-
-
-class XSEC_EXPORT XKMSMessageAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSMessageAbstractType() {};
-
-public:
-
- enum messageType {
-
- None, /** A default value that indicates something hasn't been set */
-
- /* X-KISS messages */
-
- CompoundRequest, /** A CompoundRequest message - holding multiple requests */
- CompoundResult, /** A CompoundResult message - holding multiple results */
- LocateRequest, /** A LocateRequest message */
- LocateResult, /** A LocateResult message */
- ValidateRequest, /** A ValidateRequest message */
- ValidateResult, /** A ValidateResult message */
- PendingRequest, /** A PendingRequest message (Asynchronous protocol) */
- StatusRequest, /** A StatusRequest message (Asynchronous protocol) */
- StatusResult, /** A StatusResult message (Asynchronous protocol) */
- Result, /** A non-specific result message */
-
- /* X-KRSS messages */
-
- RegisterRequest, /** A RegisterReqeust message */
- RegisterResult, /** A RegisterResult message */
- RevokeRequest, /** A RevokeRequest message */
- RevokeResult, /** A RevokeResult message */
- RecoverRequest, /** A RecoverRequest message */
- RecoverResult, /** A RecoverResult message */
- ReissueRequest, /** A ReissueRequest message */
- ReissueResult /** A ReissueResult message */
-
- };
-
- virtual ~XKMSMessageAbstractType() {};
-
- /** @name Message Manipulation Methods */
- //@{
-
- virtual messageType getMessageType(void) = 0;
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Find out whether this is a signed Message
- *
- * @returns true if the message is signed
- */
-
- virtual bool isSigned(void) const = 0;
-
- /**
- * \brief Retrieve the Signature information (if any is attached)
- *
- * All XKMS messages MAY have a \<Signature\> node that is used
- * to attest to the validity of the message.
- *
- * @returns The DSIGSignature object associated with this Message,
- * or NULL if none is defined
- */
-
- virtual DSIGSignature * getSignature(void) const = 0;
-
- /*
- * \brief Obtain the base Element for this structure
- *
- * @returns the Element node at the head of the DOM structure
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Get the Id for the Message
- *
- * All messages are required to have an Id attribute that uniquely
- * identifies the message. This method is used to retrieve a pointer
- * to the Id string.
- *
- * @returns a pointer to the Id string (owned by the library)
- */
-
- virtual const XMLCh * getId(void) const = 0;
-
- /**
- * \brief Get the Service identifier for this message
- *
- * All Messages are associated with a particular XKMS service. This
- * method can be used to retrieve the Service URI for a particular
- * message.
- *
- * @returns a pointer to the Service URI string (owned by the library)
- *
- */
-
- virtual const XMLCh * getService(void) const = 0;
-
- /**
- * \brief Get the Nonce of the message
- *
- * All messages MAY have a nonce, used to provide cryptographically
- * random data that will help defend against a replay attack.
- *
- * @returns A string (owned by the library) providing the nonce data in
- * base64 encoded form. If no Nonce is set, NULL is returned.
- */
-
- virtual const XMLCh * getNonce(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set the Id URI for the Message
- *
- * Allows a calling application to set a new Id for the
- * message
- *
- * Note: Great care should be taken on resetting Id attributes, as
- * they are used to track a particular transaction through its
- * liefcycle.
- *
- * @param id The Id to set
- */
-
- virtual void setId(const XMLCh * id) = 0;
-
- /**
- * \brief Set the Service for the Message
- *
- * Used to set a new service URI for a particular message. In general,
- * the service attribute would not be expected to change.
- *
- *
- * @param service String to set in the Service attribute.
- */
-
- virtual void setService(const XMLCh * service) = 0;
-
- /**
- * \brief Set the Nonce value
- *
- * Allows the application to set a new Nonce value (overwriting any
- * that is currently set).
- *
- * @param uri String (base64 encoded data) to set in the Nonce attribute.
- * @note no checking of this string is done by the library - it
- * is assumed that it is a valid base64 encoding.
- */
-
- virtual void setNonce(const XMLCh * uri) = 0;
-
- /**
- * \brief Add a signature to the message
- *
- * Allows an application to sign the message
- *
- * @returns the new Signature structure
- */
-
- virtual DSIGSignature * addSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) = 0;
-
- //@}
-
- /** @name Opaque client data handling */
- //@{
-
- /**
- * \brief Find the number of \<OpaqueData\> elements
- *
- * The \<OpaqueClientData\> element can have multiple
- * \<OpaqueData\> children. This method allows an application
- * to determine how many such children exist
- *
- * @return Number of \<OpaqueData\> elements
- */
-
- virtual int getOpaqueClientDataSize(void) = 0;
-
- /*
- * \brief Get the nth item in the OpaqueClientData list
- *
- * @param item The item to return
- * @returns the string of the nth item in the OpaqueClientData list.
- *
- */
-
- virtual const XMLCh * getOpaqueClientDataItemStr(int item) = 0;
-
- /*
- * \brief Append an item to the OpaqueClientData list
- *
- * @param item Base64 string to append to the list. Will be
- * wrapped in a OpaqueData element.
- */
-
- virtual void appendOpaqueClientDataItem(const XMLCh * item) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSMessageAbstractType(const XKMSMessageAbstractType &);
- XKMSMessageAbstractType & operator = (const XKMSMessageAbstractType &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSMESSAGEABSTRACTTYPE_INCLUDE */
diff --git a/xsec/xkms/XKMSMessageFactory.hpp b/xsec/xkms/XKMSMessageFactory.hpp
deleted file mode 100644
index 88c7424a..00000000
--- a/xsec/xkms/XKMSMessageFactory.hpp
+++ /dev/null
@@ -1,1047 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageFactory := Interface for the factory used to produce XKMS msgs
- *
- * $Id$
- *
- */
-
-#ifndef XKMSMESSAGEFACTORY_INCLUDE
-#define XKMSMESSAGEFACTORY_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-#include <xsec/xkms/XKMSResultType.hpp>
-
-class DSIGSignature;
-class XKMSCompoundRequest;
-class XKMSCompoundResult;
-class XKMSLocateRequest;
-class XKMSLocateResult;
-class XKMSRequestAbstractType;
-class XKMSResult;
-class XKMSValidateRequest;
-class XKMSValidateResult;
-class XKMSPendingRequest;
-class XKMSStatusRequest;
-class XKMSStatusResult;
-class XKMSRegisterRequest;
-class XKMSRegisterResult;
-class XKMSRevokeResult;
-class XKMSRevokeRequest;
-class XKMSRecoverResult;
-class XKMSRecoverRequest;
-class XKMSReissueResult;
-class XKMSReissueRequest;
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-
-/**
- * @defgroup xkms XML Key Management System Implementation
- *
- * <p>The classes in this group implement the W3C XKMS 2.0
- * specification. Users should interact with these classes
- * via the XKMSMessageFactory class (for consuming and producing
- * XKMS messages) and the XKMSClient class (for actually
- * performing XKMS calls to a server)</p>
- *
- */
-/*@{*/
-
-/**
- * @brief Interface definition for the XKMSMessageFactory class
- *
- * The XKMSMessageFactory classes are used to provide an interface
- * to applicataions to produce and consume XKMS messages. No logic
- * is defined within the class, other than that necessary to (for
- * example) generate a response message using a request message as
- * a base.
- *
- * Client apps that wish to make use of XKMS should generally use
- * the XKMSClient class.
- */
-
-
-class XSEC_EXPORT XKMSMessageFactory {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSMessageFactory() {};
-
-public:
-
- virtual ~XKMSMessageFactory() {};
-
- /** @name Methods to build XKMS message objects from existing XML */
- //@{
-
- /**
- * \brief Load a message from an existing XML document
- *
- * Reads in the XML document and produces the corresponding XKMS
- * message object. Callers should make use of the ::getMessageType
- * method to determine what type of message they are actually
- * working with.
- *
- * @param elt The element at the head of the XKMS structure
- */
-
- virtual XKMSMessageAbstractType * newMessageFromDOM(
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * elt) = 0;
-
-
- //@}
-
- /** @name Methods for building new X-KISS messages from scratch */
- //@{
-
- /**
- * \brief Create a new \<CompoundRequest\> message.
- *
- * Generates a new CompoundRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSCompoundRequest structure
- */
-
- virtual XKMSCompoundRequest * createCompoundRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<CompoundRequest\> message and surrounding document
- *
- * Generates a new CompoundRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSCompoundRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleteing the CompoundRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSCompoundRequest * createCompoundRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<LocateRequest\> message.
- *
- * Generates a new LocateRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSLocateRequest structure
- */
-
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<LocateRequest\> message and surrounding document
- *
- * Generates a new LocateRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSLocateRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleteing the LocateRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ValidateRequest\> message.
- *
- * Generates a new ValidateRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSValidateRequest structure
- */
-
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ValidateRequest\> message and surrounding document
- *
- * Generates a new ValidateRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSValidateRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the LocateRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<PendingRequest\> message.
- *
- * Generates a new PendingRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSPendingRequest structure
- */
-
- virtual XKMSPendingRequest * createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<PendingRequest\> message and surrounding document
- *
- * Generates a new PendingRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSPendingRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the PendingRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSPendingRequest * createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<StatusRequest\> message.
- *
- * Generates a new StatusRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSStatusRequest structure
- */
-
- virtual XKMSStatusRequest * createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<StatusRequest\> message and surrounding document
- *
- * Generates a new StatusRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSStatusRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the StatusRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSStatusRequest * createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<LocateResult\> message.
- *
- * Generates a new LocateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input LocateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSLocateResponse structure
- */
-
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<LocateResult\> message and surrounding document
- *
- * Generates a new LocateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input LocateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSLocateResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleteing the LocateRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ValidateResult\> message.
- *
- * Generates a new ValidateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSLocateResponse structure
- */
-
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ValidateResult\> message and surrounding document
- *
- * Generates a new ValidateResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSValidateResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleteing the ValidateRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<CompoundResult\> message.
- *
- * Generates a new CompoundResult message from scratch, building the DOM
- * as it goes. The response will be based on a input CompoundRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSLocateResponse structure
- */
-
- virtual XKMSCompoundResult * createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<CompoundResult\> message and surrounding document
- *
- * Generates a new CompoundResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSCompoundResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleteing the ValidateRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSCompoundResult * createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<Result\> message.
- *
- * Generates a new Result message from scratch, building the DOM
- * as it goes. The response will be based on an input Request message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSResult structure
- */
-
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<Result\> message and surrounding document
- *
- * Generates a new Result message from scratch, building the DOM
- * as it goes. The response will be based on a input Request message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new Response structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the Request object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<StatusResult\> message.
- *
- * Generates a new StatusResult message from scratch, building the DOM
- * as it goes. The response will be based on a input StatusRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSStatusRessult structure
- */
-
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<StatusResult\> message and surrounding document
- *
- * Generates a new StatusResult message from scratch, building the DOM
- * as it goes. The response will be based on a input StatusRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSStatusResult structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the StatusResult object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- //@}
-
- /** @name Methods for building new X-KRSS messages from scratch */
- //@{
-
- /**
- * \brief Create a new \<RegisterRequest\> message.
- *
- * Generates a new RegisterRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRegisterRequest structure
- */
-
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RegisterRequest\> message and surrounding document
- *
- * Generates a new RegisterRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRegisterRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RegisterRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RegisterResult\> message.
- *
- * Generates a new RegisterResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRegisterResponse structure
- */
-
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RegisterResult\> message and surrounding document
- *
- * Generates a new RegisterResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ValidateRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRegisterResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RegisterRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RevokeRequest\> message.
- *
- * Generates a new RevokeRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRevokeRequest structure
- */
-
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RevokeRequest\> message and surrounding document
- *
- * Generates a new RevokeRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRevokeRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RevokeRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RevokeResult\> message.
- *
- * Generates a new RevokeResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RevokeRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRevokeResponse structure
- */
-
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RevokeResult\> message and surrounding document
- *
- * Generates a new RevokeResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RevokeRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRevokeResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RevokeRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RecoverRequest\> message.
- *
- * Generates a new RecoverRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRecoverRequest structure
- */
-
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RecoverRequest\> message and surrounding document
- *
- * Generates a new RecoverRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSRecoverRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RecoverRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RecoverResult\> message.
- *
- * Generates a new RecoverResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RecoverRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRecoverResponse structure
- */
-
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<RecoverResult\> message and surrounding document
- *
- * Generates a new RecoverResult message from scratch, building the DOM
- * as it goes. The response will be based on a input RecoverRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSRecoverResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the RecoverRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ReissueRequest\> message.
- *
- * Generates a new ReissueRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Document to create the DOM structure within. The caller
- * will need to embed the DOM structure at the appropriate place in the
- * document (using a call to getElement to find the top level element)
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSReissueRequest structure
- */
-
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ReissueRequest\> message and surrounding document
- *
- * Generates a new ReissueRequest message from scratch, building the DOM
- * as it goes.
- *
- * @param service URI
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @returns the new XKMSReissueRequest structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the ReissueRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ReissueResult\> message.
- *
- * Generates a new ReissueResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ReissueRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSReissueResponse structure
- */
-
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- /**
- * \brief Create a new \<ReissueResult\> message and surrounding document
- *
- * Generates a new ReissueResult message from scratch, building the DOM
- * as it goes. The response will be based on a input ReissueRequest message
- * which is used to provide Id etc.
- *
- * @param request Request to base response on
- * @param doc Will be used to return the newly created document element in.
- * @param id Value to set in the Id field. If NULL, the library will
- * generate a new Unique Id value.
- * @param rmaj Major result code
- * @param rmin Minor result code
- * @returns the new XKMSReissueResponse structure
- * @note Like all the xsec library functions, the document is owned by
- * the calling application. Deleting the ReissueRequest object will not
- * delete the DOM document as well.
- */
-
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL) = 0;
-
- //@}
-
- /** @name Environment Manipulation Functions */
- //@{
-
- /**
- * \brief Set the prefix be used for the DSIG namespace.
- *
- * @param prefix The UTF-16 encoided NS prefix to use for the XML
- * Digital Signature nodes
- */
-
- virtual void setDSIGNSPrefix(const XMLCh * prefix) = 0;
-
- /**
- * \brief Set the prefix be used for the Exclusive Canonicalisation namespace.
- *
- * The Exclusive Canonicalisation specification defines a new namespace for the
- * InclusiveNamespaces node. This function can be used to set the prefix
- * that the library will use when creating nodes within this namespace.
- *
- * <p>xmlns:ds="http://www.w3.org/2001/10/xml-exc-c14n#"</p>
- *
- * If no prefix is set, the default namespace will be used
- *
- * @param prefix The UTF-16 encoided NS prefix to use for the XML
- * Exclusive Canonicalisation nodes
- */
-
- virtual void setECNSPrefix(const XMLCh * prefix) = 0;
-
- /**
- * \brief Set the prefix be used for the XPath-Filter2 namespace.
- *
- * The XPathFilter definition uses its own namespace. This
- * method can be used to set the prefix that the library will use
- * when creating elements in this namespace
- *
- * <p>xmlns:ds="http://www.w3.org/2002/06/xmldsig-filter2"</p>
- *
- * If no prefix is set, the default namespace will be used
- *
- * @param prefix The UTF-16 encoided NS prefix to use for the XPath
- * filter nodes
- */
-
- virtual void setXPFNSPrefix(const XMLCh * prefix) = 0;
-
- /**
- * \brief Set the prefix be used for the XML Encryption namespace.
- *
- * @param prefix The UTF-16 encoided NS prefix to use for the XML
- * Encryption nodes
- */
-
- virtual void setXENCNSPrefix(const XMLCh * prefix) = 0;
-
- /**
- * \brief Set the prefix be used for the XKMS Namespace
- *
- * @param prefix The UTF-16 encoided NS prefix to use for the XKMS
- * nodes
- */
-
- virtual void setXKMSNSPrefix(const XMLCh * prefix) = 0;
-
- //@}
-
- /** @name Message Conversions */
- //@{
-
- /**
- * \brief Convert to a Request type
- *
- * Used to convert a MessageAbstractType to a RequestAbstractType
- *
- * @param msg The message to convert
- * @return the same message typecast to a RequestAbstractType (if NULL otherwise)
- * otherwise
- */
-
- virtual XKMSRequestAbstractType * toRequestAbstractType(XKMSMessageAbstractType *msg) = 0;
-
- /**
- * \brief Convert to a Result type
- *
- * Used to convert a MessageAbstractType to a ResultType
- *
- * @param msg The message to convert
- * @return the same message typecast to a ResultType (if OK - NULL otherwise)
- * otherwise
- */
-
- virtual XKMSResultType * toResultType(XKMSMessageAbstractType *msg) = 0;
-
- //@}
-private:
-
- // Unimplemented
- XKMSMessageFactory(const XKMSMessageFactory &);
- XKMSMessageFactory & operator = (const XKMSMessageFactory &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSMESSAGEFACTORY_INCLUDE */
diff --git a/xsec/xkms/XKMSNotBoundAuthentication.hpp b/xsec/xkms/XKMSNotBoundAuthentication.hpp
deleted file mode 100644
index a382dfff..00000000
--- a/xsec/xkms/XKMSNotBoundAuthentication.hpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSNotBoundAuthentication := Interface for ValidityInterval elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSNOTBOUNDAUTHENTICATION_INCLUDE
-#define XKMSNOTBOUNDAUTHENTICATION_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the NotBoundAuthentication elements
- *
- * The \<NotBoundAuthentication\> Element used within an \<Authentication\>
- * element to pass a pass phrase of some kind that authenticates the X-KRSS
- * request.
- *
- * The schema definition for NotBoundAuthentication is as follows :
- *
- * \verbatim
- <!-- NotBoundAuthentication -->
- <element name="NotBoundAuthentication"
- type="xkms:NotBoundAuthenticationType"/>
- <complexType name="NotBoundAuthenticationType">
- <attribute name="Protocol" type="anyURI" use="required"/>
- <attribute name="Value" type="base64Binary" use="required"/>
- </complexType>
- <!-- /NotBoundAuthentication -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSNotBoundAuthentication {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSNotBoundAuthentication() {};
-
-public:
-
- virtual ~XKMSNotBoundAuthentication() {};
-
- //@}
-
- /** @name Get Methods */
- //@{
-
- /**
- * \brief Get the protocol URI
- *
- * A \<XKMSNotBoundAuthentication\> has a protocol attribute defining the
- * protocol being used to authenticate the request.
- *
- * @return The string holding the URI of the protocol
- */
-
- virtual const XMLCh * getProtocol(void) const = 0;
-
- /**
- * \brief Get the value
- *
- * Returns the authentication value.
- *
- * @return A string holding the base64 encoded authentication value
- */
-
- virtual const XMLCh * getValue(void) const = 0;
-
- //@}
-
- /** @name Set Methods */
- //@{
-
- /**
- * \brief Set the protocol
- *
- * @param uri String containing the URI to set as the protocol
- */
-
- virtual void setProtocol(const XMLCh * uri) = 0;
-
- /**
- * \brief Set the authentication value
- *
- * @param value Base64 encoded value to set as the authentication value
- */
-
- virtual void setValue(const XMLCh * value) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSNotBoundAuthentication(const XKMSNotBoundAuthentication &);
- XKMSNotBoundAuthentication & operator = (const XKMSNotBoundAuthentication &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSNOTBOUNDAUTHENTICATION_INCLUDE */
diff --git a/xsec/xkms/XKMSPendingRequest.hpp b/xsec/xkms/XKMSPendingRequest.hpp
deleted file mode 100644
index c2be2a30..00000000
--- a/xsec/xkms/XKMSPendingRequest.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPendingRequest := Interface for PendingRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSPENDINGREQUEST_INCLUDE
-#define XKMSPENDINGREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class XKMSQueryKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the PendingRequest elements
- *
- * The \<PendingRequest\> is used in Asynchronous processing. A client
- * uses the PendingRequest element to request a response to a request that
- * was placed in the past, and to which the service originally provided
- * a "Pending" response - i.e. work yet to be done.
- *
- * The schema definition for PendingRequest is as follows :
- *
- * \verbatim
- <!-- PendingRequest -->
- <element name="PendingRequest" type="xkms:PendingRequestType"/>
- <complexType name="PendingRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <attribute name="ResponseId" type="NCName" use="required"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- /PendingRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSPendingRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSPendingRequest() {};
-
-public:
-
- virtual ~XKMSPendingRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Return the ResponseId
- *
- * The ResponseId equates to the Id of the first response the service returned,
- * which must (by definition) have had a response code of "Pending". Together
- * with the OriginalRequestId, this can be used by the service to uniquley
- * identify the original request for which this PendingRequest refers.
- *
- * @return A pointer to the XMLCh string holding the ResponseId
- */
-
- virtual const XMLCh * getResponseId(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /**
- * \brief Set the ResponseId
- *
- * Allows a calling application to over-ride the configured responseId
- *
- * @param responseId The new responseId for this element
- */
-
- virtual void setResponseId(const XMLCh * responseId) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSPendingRequest(const XKMSPendingRequest &);
- XKMSPendingRequest & operator = (const XKMSPendingRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSPENDINGREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSPrototypeKeyBinding.hpp b/xsec/xkms/XKMSPrototypeKeyBinding.hpp
deleted file mode 100644
index d9a90449..00000000
--- a/xsec/xkms/XKMSPrototypeKeyBinding.hpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPrototypeKeyBinding := Interface for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSPROTOTYPEKEYBINDING_INCLUDE
-#define XKMSPROTOTYPEKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-class XKMSValidityInterval;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the KeyBinding elements
- *
- * The \<KeyBinding\> Element is used in a result message to a client
- * to provide information on a particular key.
- *
- * The schema definition for KeyBinding is as follows :
- *
- * \verbatim
- <!-- PrototypeKeyBinding -->
- <element name="PrototypeKeyBinding" type="xkms:PrototypeKeyBindingType"/>
- <complexType name="PrototypeKeyBindingType">
- <complexContent>
- <extension base="xkms:KeyBindingAbstractType">
- <sequence>
- <element ref="xkms:ValidityInterval" minOccurs="0"/>
- <element ref="xkms:RevocationCodeIdentifier" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /PrototypeKeyBinding -->
-\endverbatim
- */
-
-class XKMSStatus;
-
-class XSEC_EXPORT XKMSPrototypeKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSPrototypeKeyBinding() {};
-
-public:
-
- virtual ~XKMSPrototypeKeyBinding() {};
-
- //@}
-
- /** @name Get Methods */
- //@{
-
- /**
- * \brief Get the suggested ValidityInterval for this key
- *
- * Clients can suggest a Validity period for a key using this element.
- * Such requests can (of course) be ignored by the server
- *
- * @return The ValditityInterval object or NULL if none was defined
- */
-
- virtual XKMSValidityInterval * getValidityInterval(void) const = 0;
-
- /**
- * \brief Obtain the RevocationCodeIdentifier to be used for this key
- *
- * The client can provide a revocation code when registering a new key.
- * The code provided initially is a double MACd version of the client's
- * revocation pass phrase.
- *
- * Should the client later wish to later revoke their key, they should provde
- * the single MACd version which can then be converted to the double MAC by
- * the server - thus validating the code without ever passing anything over
- * the wire that will directly compromise the key until the final revoke request
- *
- * @return A pointer to the base64 encoded HMAC output
- */
-
- virtual const XMLCh * getRevocationCodeIdentifier(void) const = 0;
-
- //@}
-
- /** @name Set Methods */
- //@{
-
- /**
- * \brief Set the Validity Interval for this key
- *
- * @param notBefore - dateTime string to set the NotBefore item as (NULL to clear)
- * @param notOnOrAfter - dateTime string to set the NotOnOrAfter item as (NULL to clear)
- */
-
- virtual void setValidityInterval(const XMLCh * notBefore, const XMLCh * notOnOrAfter) = 0;
-
- /**
- * \brief Set the RevocationCodeIdentifier
- *
- * Sets the revocation code identifer
- *
- * @param identifier string containing base64 encoded HMAC value
- */
-
- virtual void setRevocationCodeIdentifier(const XMLCh * identifier) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSPrototypeKeyBinding(const XKMSPrototypeKeyBinding &);
- XKMSPrototypeKeyBinding & operator = (const XKMSPrototypeKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSPROTOTYPEKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSQueryKeyBinding.hpp b/xsec/xkms/XKMSQueryKeyBinding.hpp
deleted file mode 100644
index 2c033cd8..00000000
--- a/xsec/xkms/XKMSQueryKeyBinding.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSQueryKeyBinding := Interface for QueryKeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSQUERYKEYBINDING_INCLUDE
-#define XKMSQUERYKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the QueryKeyBinding elements
- *
- * The \<QueryKeyBinding\> Element is used in a request message to a server
- * to ask the server as to whether particular key bindings are permitted for
- * a given key.
- *
- * The schema definition for QueryKeyBinding is as follows :
- *
- * \verbatim
- <!-- QueryKeyBinding -->
- <element name="QueryKeyBinding" type="xkms:QueryKeyBindingType"/>
- <complexType name="QueryKeyBindingType">
- <complexContent>
- <extension base="xkms:KeyBindingAbstractType">
- <sequence>
- <element ref="xkms:TimeInstant" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /QueryKeyBinding -->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSQueryKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSQueryKeyBinding() {};
-
-public:
-
- virtual ~XKMSQueryKeyBinding() {};
-
-
-private:
-
- // Unimplemented
- XKMSQueryKeyBinding(const XKMSQueryKeyBinding &);
- XKMSQueryKeyBinding & operator = (const XKMSQueryKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSQUERYKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSRSAKeyPair.hpp b/xsec/xkms/XKMSRSAKeyPair.hpp
deleted file mode 100644
index b3a1ddad..00000000
--- a/xsec/xkms/XKMSRSAKeyPair.hpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRSAKeyPair := Interface for RSAKeyPair elements
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSRSAKEYPAIR_INCLUDE
-#define XKMSRSAKEYPAIR_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RSAKeyPair
- *
- * The \<RSAKeyPair\> is one of the few XKMS elements that is not
- * directly part of an XKMS Message. It is sent in RegisterResult
- * and RecoverResult messages as a CipherData.
- *
- * This element allows the service to provide back to the user
- * a complete RSA key - including the private components. The various
- * components that make up an RSA key are all provided in Base64 format
- * (CryptoBinary type)
- *
- * The schema definition for RSAKeyPair is as follows :
- *
- * \verbatim
- <!-- RSAKeyPair -->
- <element name="RSAKeyPair" type="xkms:RSAKeyPairType"/>
- <complexType name="RSAKeyPairType">
- <sequence>
- <element ref="xkms:Modulus"/>
- <element ref="xkms:Exponent"/>
- <element ref="xkms:P"/>
- <element ref="xkms:Q"/>
- <element ref="xkms:DP"/>
- <element ref="xkms:DQ"/>
- <element ref="xkms:InverseQ"/>
- <element ref="xkms:D"/>
- </sequence>
- </complexType>
- <element name="Modulus" type="ds:CryptoBinary"/>
- <element name="Exponent" type="ds:CryptoBinary"/>
- <element name="P" type="ds:CryptoBinary"/>
- <element name="Q" type="ds:CryptoBinary"/>
- <element name="DP" type="ds:CryptoBinary"/>
- <element name="DQ" type="ds:CryptoBinary"/>
- <element name="InverseQ" type="ds:CryptoBinary"/>
- <element name="D" type="ds:CryptoBinary"/>
- <!-- /RSAKeyPair -->
-\endverbatim
- *
- * @note There are no "set" methods for this class. It is designed
- * to be created "atomically" via the XKMSMessageFactory class and not
- * altered.
- */
-
-
-class XSEC_EXPORT XKMSRSAKeyPair {
-
-public:
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRSAKeyPair() {};
-
-public:
-
- virtual ~XKMSRSAKeyPair() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Get the Modulus of the key pair
- *
- * @returns The Modulus in base64 encoding
- */
-
- virtual const XMLCh * getModulus(void) const = 0;
-
- /**
- * \brief Get the Exponent of the key pair
- *
- * @returns The Exponent in base64 encoding
- */
-
- virtual const XMLCh * getExponent(void) const = 0;
-
- /**
- * \brief Get the P of the key pair
- *
- * @returns The P in base64 encoding
- */
-
- virtual const XMLCh * getP(void) const = 0;
-
- /**
- * \brief Get the Q of the key pair
- *
- * @returns The Q in base64 encoding
- */
-
- virtual const XMLCh * getQ(void) const = 0;
-
- /**
- * \brief Get the DP of the key pair
- *
- * @returns The DP in base64 encoding
- */
-
- virtual const XMLCh * getDP(void) const = 0;
-
- /**
- * \brief Get the DQ of the key pair
- *
- * @returns The DQ in base64 encoding
- */
-
- virtual const XMLCh * getDQ(void) const = 0;
-
- /**
- * \brief Get the InverseQ of the key pair
- *
- * @returns The InverseQ in base64 encoding
- */
-
- virtual const XMLCh * getInverseQ(void) const = 0;
-
- /**
- * \brief Get the D of the key pair
- *
- * @returns The D in base64 encoding
- */
-
- virtual const XMLCh * getD(void) const = 0;
-
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRSAKeyPair(const XKMSRSAKeyPair &);
- XKMSRSAKeyPair & operator = (const XKMSRSAKeyPair &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRSAKEYPAIR_INCLUDE */
diff --git a/xsec/xkms/XKMSRecoverKeyBinding.hpp b/xsec/xkms/XKMSRecoverKeyBinding.hpp
deleted file mode 100644
index 3001e8d9..00000000
--- a/xsec/xkms/XKMSRecoverKeyBinding.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverKeyBinding := Interface for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERKEYBINDING_INCLUDE
-#define XKMSRECOVERKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RecoverKeyBinding elements
- *
- * The \<RecoverKeyBinding\> Element is used in a request to Recover
- * a particular key from an XKRS service
- *
- * The schema definition for RecoverKeyBinding is as follows :
- *
- * \verbatim
- <!-- RecoverKeyBinding -->
- <element name="RecoverKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /RecoverKeyBinding -->
- \endverbatim
- */
-
-class XKMSStatus;
-
-class XSEC_EXPORT XKMSRecoverKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRecoverKeyBinding() {};
-
-public:
-
- virtual ~XKMSRecoverKeyBinding() {};
-
- //@}
-
- /** @name Status handling */
- //@{
-
- /**
- * \brief Obtain the status element for this KeyBinding
- *
- * The \<Status\> element is used to describe to the caller the
- * validity of they key being described. This call is used to
- * obtain the status element
- *
- * @return A pointer to the XKMSStatus element
- */
-
- virtual XKMSStatus * getStatus(void) const = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRecoverKeyBinding(const XKMSRecoverKeyBinding &);
- XKMSRecoverKeyBinding & operator = (const XKMSRecoverKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRECOVERKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSRecoverRequest.hpp b/xsec/xkms/XKMSRecoverRequest.hpp
deleted file mode 100644
index 3fb96721..00000000
--- a/xsec/xkms/XKMSRecoverRequest.hpp
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverRequest := Interface for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERREQUEST_INCLUDE
-#define XKMSRECOVERREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class DSIGSignature;
-class XKMSAuthentication;
-class XKMSRecoverKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RecoverRequest elements
- *
- * The \<RecoverRequest\> is one of the message types of
- * the X-KRMS service. It is used when a client wishes to recover
- * a private key known to the service.
- *
- * The schema definition for RecoverRequest is as follows :
- *
- * \verbatim
- <!-- RecoverRequest -->
- <element name="RecoverRequest" type="xkms:RecoverRequestType"/>
- <complexType name="RecoverRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:RecoverKeyBinding"/>
- <element ref="xkms:Authentication"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <element name="RecoverKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /RecoverRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRecoverRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRecoverRequest() {};
-
-public:
-
- virtual ~XKMSRecoverRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the RecoverKeyBinding element
- *
- * The RecoverKeyBinding element is the core of the RecoverRequest message, and
- * defines the key information that a recover is required for.
- *
- * @returns A pointer to the XKMSPrototypeKeyBinding element
- */
-
- virtual XKMSRecoverKeyBinding * getRecoverKeyBinding(void) const = 0;
-
- /**
- * \brief Get the Authentication element
- *
- * The Authentication element of the RecoverRequest is used by the client to
- * authenticate the request to the server.
- *
- * @return A pointer to the Authentication structure
- */
-
- virtual XKMSAuthentication * getAuthentication (void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a RecoverKeyBinding element
- *
- * Set a RecoverKeyBinding element in the Request message. The returned
- * object can be manipulated to add KeyInfo elements to the Request.
- *
- * @param status The status value to add into the RecoverKeyBinding structure
- * @returns A pointer to the newly created RecoverKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSRecoverKeyBinding * addRecoverKeyBinding(XKMSStatus::StatusValue status) = 0;
-
- /** \brief Add an Authentication element
- *
- * Set a Authentication element in the Request message. The returned
- * object can be manipulated to add Authentication information to the request.
- *
- * @returns A pointer to the newly created Authenticaton object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSAuthentication * addAuthentication(void) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRecoverRequest(const XKMSRecoverRequest &);
- XKMSRecoverRequest & operator = (const XKMSRecoverRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRECOVERREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSRecoverResult.hpp b/xsec/xkms/XKMSRecoverResult.hpp
deleted file mode 100644
index 342feb5e..00000000
--- a/xsec/xkms/XKMSRecoverResult.hpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverResult := Interface for RecoverResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERRESULT_INCLUDE
-#define XKMSRECOVERRESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class XKMSKeyBinding;
-class XKMSUnverifiedKeyBinding;
-class XKMSRSAKeyPair;
-class XENCCipherData;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RecoverResult elements
- *
- * The \<RecoverResult\> is used by the X-KRSS service to response to
- * a user request to Recover a new key with the service.
- *
- * The schema definition for RecoverResult is as follows :
- *
- * \verbatim
- <!-- RecoverResult -->
- <element name="RecoverResult" type="xkms:RecoverResultType"/>
- <complexType name="RecoverResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:KeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:PrivateKey" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /RecoverResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRecoverResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRecoverResult() {};
-
-public:
-
- virtual ~XKMSRecoverResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name KeyBinding handling */
- //@{
-
- /**
- * \brief Find number of KeyBinding elements
- *
- * @returns the number of KeyBinding items within the RecoverResult
- */
-
- virtual int getKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an KeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the KeyBinding referenced by "item"
- */
-
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new KeyBinding element
- *
- * Allows callers to append a new KeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @param status The status (Valid, Invalid or Indeterminate) of this
- * key
- * @returns the newly created KeyBinding object (already inserted
- * in the RecoverResult
- */
-
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
-
- //@}
-
- /** @name PrivateKey handling */
- //@{
-
- /**
- * \brief Return the RSAKeyPair
- *
- * This call requires the passphrase used to encrypt the private key.
- * The implementation decrypts the PrivateKey element in the
- * RecoverResult and returns the resulting RSAKeyPair.
- *
- * @note The decryption is performed *inside* the RecoverResult, so
- * this actually modified the contents of the XML. It should never
- * be called twice!
- *
- * @param passPhrase The local code page version of the pass phrase
- * @returns the number of KeyBinding items within the RecoverResult
- */
-
- virtual XKMSRSAKeyPair * getRSAKeyPair(const char * passPhrase) = 0;
-
- /**
- * \brief Add the RSAKeyPair in an encrypted PrivateKey
- *
- * This call requires the passphrase to encrypt the private key.
- * The implementation encrypts the RSAKeyPair and adds the result
- * to the resulting RSAKey Pair. It returns the CipherData element
- * to the caller (not a structure for the PrivateKey)
- *
- * @note The encryption is performed *inside* the RecoverResult, so
- * this actually modified the contents of the XML. It should never
- * be called twice!
- *
- * @param passPhrase The local code page version of the pass phrase
- * @param Modulus Base64 encoded string with the modulus
- * @param Exponent Base64 encoded string with the exponent
- * @param P Base64 encoded string with p
- * @param Q Base64 encoded string with q
- * @param DP Base64 encoded string with dp
- * @param DQ Base64 encoded string with dq
- * @param InverseQ Base64 encoded string with inverseq
- * @param D Base64 encoded string with d
- * @param algorithmURI algorithm URI
- * @returns The encrypted result of adding the info
- */
-
- virtual XENCEncryptedData * setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI) = 0;
-
- //@}
-
-
-private:
-
- // Unimplemented
- XKMSRecoverResult(const XKMSRecoverResult &);
- XKMSRecoverResult & operator = (const XKMSRecoverResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRECOVERRESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSRegisterRequest.hpp b/xsec/xkms/XKMSRegisterRequest.hpp
deleted file mode 100644
index 5306fe76..00000000
--- a/xsec/xkms/XKMSRegisterRequest.hpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterRequest := Interface for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREGISTERREQUEST_INCLUDE
-#define XKMSREGISTERREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class DSIGSignature;
-class XKMSAuthentication;
-class XKMSPrototypeKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RegisterRequest elements
- *
- * The \<RegisterRequest\> is one of the fundamental message types of
- * the X-KRMS service. It is used by a client wishing to register a
- * key with a service.
- *
- * The schema definition for RegisterRequest is as follows :
- *
- * \verbatim
- <!-- RegisterRequest -->
- <element name="RegisterRequest" type="xkms:RegisterRequestType"/>
- <complexType name="RegisterRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:PrototypeKeyBinding"/>
- <element ref="xkms:Authentication"/>
- <element ref="xkms:ProofOfPossession" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /RegisterRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRegisterRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRegisterRequest() {};
-
-public:
-
- virtual ~XKMSRegisterRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the PrototypKeyBinding element
- *
- * The PrototypeKeyBinding element is the core of the RegisterRequest message, and
- * defines the key information that will be sent to the server for registration.
- *
- * @returns A pointer to the XKMSPrototypeKeyBinding element
- */
-
- virtual XKMSPrototypeKeyBinding * getPrototypeKeyBinding(void) const = 0;
-
- /**
- * \brief Get the Authentication element
- *
- * The Authentication element of the RegisterRequest is used by the client to
- * authenticate the request to the server.
- *
- * @return A pointer to the Authentication structure
- */
-
- virtual XKMSAuthentication * getAuthentication (void) const = 0;
-
- /**
- * \brief Get the signature used to prove possession of the private key
- *
- * When the client presents a request for a key generated by them, this element
- * is used to show that the client is authorised to make this request using this
- * key.
- *
- * @return A pointer to the proof of possession Signature object (or NULL if none
- * was defined
- */
-
- virtual DSIGSignature * getProofOfPossessionSignature(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a PrototypeKeyBinding element
- *
- * Set a PrototypeKeyBinding element in the Request message. The returned
- * object can be manipulated to add KeyInfo elements to the Request.
- *
- * @returns A pointer to the newly created PrototypeKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSPrototypeKeyBinding * addPrototypeKeyBinding(void) = 0;
-
- /** \brief Add an Authentication element
- *
- * Set a Authentication element in the Request message. The returned
- * object can be manipulated to add Authentication information to the request.
- *
- * @returns A pointer to the newly created Authenticaton object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSAuthentication * addAuthentication(void) = 0;
-
- /**
- * \brief Add a ProofOfPossession signature to the message
- *
- * Allows the application to add a new ProofOfPossession signature into a
- * RegisterRequest element
- *
- * @note the client application will need to set the key and sign the
- * message - however the appropriate reference (to the PrototypeKeyBinding
- * element) will be set. This implies that the PrototypeKeyBinding *must*
- * be added prior to the call to this method.
- *
- * @returns the new Signature structure
- */
-
- virtual DSIGSignature * addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRegisterRequest(const XKMSRegisterRequest &);
- XKMSRegisterRequest & operator = (const XKMSRegisterRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREGISTERREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSRegisterResult.hpp b/xsec/xkms/XKMSRegisterResult.hpp
deleted file mode 100644
index 2134eec9..00000000
--- a/xsec/xkms/XKMSRegisterResult.hpp
+++ /dev/null
@@ -1,206 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterResult := Interface for RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREGISTERRESULT_INCLUDE
-#define XKMSREGISTERRESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class XKMSKeyBinding;
-class XKMSUnverifiedKeyBinding;
-class XKMSRSAKeyPair;
-class XENCCipherData;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RegisterResult elements
- *
- * The \<RegisterResult\> is used by the X-KRSS service to response to
- * a user request to register a new key with the service.
- *
- * The schema definition for RegisterResult is as follows :
- *
- * \verbatim
- <!-- RegisterResult -->
- <element name="RegisterResult" type="xkms:RegisterResultType"/>
- <complexType name="RegisterResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:KeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:PrivateKey" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /RegisterResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRegisterResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRegisterResult() {};
-
-public:
-
- virtual ~XKMSRegisterResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name KeyBinding handling */
- //@{
-
- /**
- * \brief Find number of KeyBinding elements
- *
- * @returns the number of KeyBinding items within the RegisterResult
- */
-
- virtual int getKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an KeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the KeyBinding referenced by "item"
- */
-
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new KeyBinding element
- *
- * Allows callers to append a new KeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @param status The status (Valid, Invalid or Indeterminate) of this
- * key
- * @returns the newly created KeyBinding object (already inserted
- * in the RegisterResult
- */
-
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
-
- //@}
-
- /** @name PrivateKey handling */
- //@{
-
- /**
- * \brief Return the RSAKeyPair
- *
- * This call requires the passphrase used to encrypt the private key.
- * The implementation decrypts the PrivateKey element in the
- * RegisterResult and returns the resulting RSAKeyPair.
- *
- * @note The decryption is performed *inside* the RegisterResult, so
- * this actually modified the contents of the XML. It should never
- * be called twice!
- *
- * @param passPhrase The local code page version of the pass phrase
- * @returns the number of KeyBinding items within the RegisterResult
- */
-
- virtual XKMSRSAKeyPair * getRSAKeyPair(const char * passPhrase) = 0;
-
- /**
- * \brief Add the RSAKeyPair in an encrypted PrivateKey
- *
- * This call requires the passphrase to encrypt the private key.
- * The implementation encrypts the RSAKeyPair and adds the result
- * to the resulting RSAKey Pair. It returns the CipherData element
- * to the caller (not a structure for the PrivateKey)
- *
- * @note The encryption is performed *inside* the RegisterResult, so
- * this actually modified the contents of the XML. It should never
- * be called twice!
- *
- * @param passPhrase The local code page version of the pass phrase
- * @param Modulus Base64 encoded string with the modulus
- * @param Exponent Base64 encoded string with the exponent
- * @param P Base64 encoded string with p
- * @param Q Base64 encoded string with q
- * @param DP Base64 encoded string with dp
- * @param DQ Base64 encoded string with dq
- * @param InverseQ Base64 encoded string with inverseq
- * @param D Base64 encoded string with d
- * @param algorithmURI algorithm URI
- * @returns The encrypted result of adding the info
- */
-
- virtual XENCEncryptedData * setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI) = 0;
-
- //@}
-
-
-private:
-
- // Unimplemented
- XKMSRegisterResult(const XKMSRegisterResult &);
- XKMSRegisterResult & operator = (const XKMSRegisterResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREGISTERRESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSReissueKeyBinding.hpp b/xsec/xkms/XKMSReissueKeyBinding.hpp
deleted file mode 100644
index 6e69b6bc..00000000
--- a/xsec/xkms/XKMSReissueKeyBinding.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeKeyBinding := Interface for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUEKEYBINDING_INCLUDE
-#define XKMSREISSUEKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ReissueKeyBinding elements
- *
- * The \<ReissueKeyBinding\> Element is used in a request to reissue
- * a particular key from an XKRS service
- *
- * The schema definition for ReissueKeyBinding is as follows :
- *
- * \verbatim
- <!-- ReissueKeyBinding -->
- <element name="ReissueKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /ReissueKeyBinding -->
- \endverbatim
- */
-
-class XKMSStatus;
-
-class XSEC_EXPORT XKMSReissueKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSReissueKeyBinding() {};
-
-public:
-
- virtual ~XKMSReissueKeyBinding() {};
-
- //@}
-
- /** @name Status handling */
- //@{
-
- /**
- * \brief Obtain the status element for this KeyBinding
- *
- * The \<Status\> element is used to describe to the caller the
- * validity of they key being described. This call is used to
- * obtain the status element
- *
- * @return A pointer to the XKMSStatus element
- */
-
- virtual XKMSStatus * getStatus(void) const = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSReissueKeyBinding(const XKMSReissueKeyBinding &);
- XKMSReissueKeyBinding & operator = (const XKMSReissueKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREISSUEKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSReissueRequest.hpp b/xsec/xkms/XKMSReissueRequest.hpp
deleted file mode 100644
index 6c128223..00000000
--- a/xsec/xkms/XKMSReissueRequest.hpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueRequest := Interface for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUEREQUEST_INCLUDE
-#define XKMSREISSUEREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class DSIGSignature;
-class XKMSAuthentication;
-class XKMSReissueKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ReissueRequest elements
- *
- * The \<ReissueRequest\> is one of the message types of
- * the X-KRMS service. It is used when a client wishes to request
- * the service reissue a key binding (e.g. a cert).
- *
- * The schema definition for ReissueRequest is as follows :
- *
- * \verbatim
- <!-- ReissueRequest -->
- <element name="ReissueRequest" type="xkms:ReissueRequestType"/>
- <complexType name="ReissueRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:ReissueKeyBinding"/>
- <element ref="xkms:Authentication"/>
- <element ref="xkms:ProofOfPossession" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <element name="ReissueKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /ReissueRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSReissueRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSReissueRequest() {};
-
-public:
-
- virtual ~XKMSReissueRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the ReissueKeyBinding element
- *
- * The ReissueKeyBinding element is the core of the ReissueRequest message, and
- * defines the key information that a Reissue is required for.
- *
- * @returns A pointer to the XKMSPrototypeKeyBinding element
- */
-
- virtual XKMSReissueKeyBinding * getReissueKeyBinding(void) const = 0;
-
- /**
- * \brief Get the Authentication element
- *
- * The Authentication element of the ReissueRequest is used by the client to
- * authenticate the request to the server.
- *
- * @return A pointer to the Authentication structure
- */
-
- virtual XKMSAuthentication * getAuthentication (void) const = 0;
-
- /**
- * \brief Get the signature used to prove possession of the private key
- *
- * When the client presents a request for a key generated by them, this element
- * is used to show that the client is authorised to make this request using this
- * key.
- *
- * @return A pointer to the proof of possession Signature object (or NULL if none
- * was defined
- */
-
- virtual DSIGSignature * getProofOfPossessionSignature(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a ReissueKeyBinding element
- *
- * Set a ReissueKeyBinding element in the Request message. The returned
- * object can be manipulated to add KeyInfo elements to the Request.
- *
- * @param status The status value to add into the ReissueKeyBinding structure
- * @returns A pointer to the newly created ReissueKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSReissueKeyBinding * addReissueKeyBinding(XKMSStatus::StatusValue status) = 0;
-
- /** \brief Add an Authentication element
- *
- * Set a Authentication element in the Request message. The returned
- * object can be manipulated to add Authentication information to the request.
- *
- * @returns A pointer to the newly created Authenticaton object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSAuthentication * addAuthentication(void) = 0;
-
-
- /**
- * \brief Add a ProofOfPossession signature to the message
- *
- * Allows the application to add a new ProofOfPossession signature into a
- * ReissueRequest element
- *
- * @note the client application will need to set the key and sign the
- * message - however the appropriate reference (to the ReissueKeyBinding
- * element) will be set. This implies that the ReissueKeyBinding *must*
- * be added prior to the call to this method.
- *
- * @returns the new Signature structure
- */
-
- virtual DSIGSignature * addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSReissueRequest(const XKMSReissueRequest &);
- XKMSReissueRequest & operator = (const XKMSReissueRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREISSUEREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSReissueResult.hpp b/xsec/xkms/XKMSReissueResult.hpp
deleted file mode 100644
index 74df4a1f..00000000
--- a/xsec/xkms/XKMSReissueResult.hpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueResult := Interface for RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUERESULT_INCLUDE
-#define XKMSREISSUERESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class XKMSKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ReissueResult elements
- *
- * The \<ReissueResult\> is used by the X-KRSS service to response to
- * a user request to reissue a key from the service - e.g. for a new
- * cert
- *
- * The schema definition for ReissueResult is as follows :
- *
- * \verbatim
- <!-- ReissueResult -->
- <element name="ReissueResult" type="xkms:ReissueResultType"/>
- <complexType name="ReissueResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:KeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /ReissueResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSReissueResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSReissueResult() {};
-
-public:
-
- virtual ~XKMSReissueResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name KeyBinding handling */
- //@{
-
- /**
- * \brief Find number of KeyBinding elements
- *
- * @returns the number of KeyBinding items within the ReissueResult
- */
-
- virtual int getKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an KeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the KeyBinding referenced by "item"
- */
-
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new KeyBinding element
- *
- * Allows callers to append a new KeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @param status The status (Valid, Invalid or Indeterminate) of this
- * key
- * @returns the newly created KeyBinding object (already inserted
- * in the ReissueResult
- */
-
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSReissueResult(const XKMSReissueResult &);
- XKMSReissueResult & operator = (const XKMSReissueResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREISSUERESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSRequestAbstractType.hpp b/xsec/xkms/XKMSRequestAbstractType.hpp
deleted file mode 100644
index e7a32a5d..00000000
--- a/xsec/xkms/XKMSRequestAbstractType.hpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRequestAbstractType := Interface for base schema of XKMS Request messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREQUESTABSTRACTTYPE_INCLUDE
-#define XKMSREQUESTABSTRACTTYPE_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-
-class XKMSRespondWith;
-class XKMSResponseMechanism;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RequestAbstractType
- *
- * The \<RequestAbstractType\> is an abstract type on which all
- * XKMS Request messages are built.
- *
- * The schema definition for RequestAbstractType is as follows :
- *
- * \verbatim
- <!-- RequestAbstractType -->
- <complexType name="RequestAbstractType" abstract="true">
- <complexContent>
- <extension base="xkms:MessageAbstractType">
- <sequence>
- <element ref="xkms:ResponseMechanism" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:RespondWith" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:PendingNotification" minOccurs="0"/>
- </sequence>
- <attribute name="OriginalRequestId" type="NCName"
- use="optional"/>
- <attribute name="ResponseLimit" type="integer" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- /RequestAbstractType -->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSRequestAbstractType : public XKMSMessageAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRequestAbstractType() {};
-
-public:
-
- virtual ~XKMSRequestAbstractType() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Get the Original Request Id for the Message
- *
- * For transactions that use multipt request/response sessions (e.g.
- * two stage commit or asyncronous processing), this attribute can be
- * used to identify the id of the original message that was processed.
- *
- * @returns a pointer to the Original Request Id string (owned by the library)
- */
-
- virtual const XMLCh * getOriginalRequestId(void) const = 0;
-
- /**
- * \brief Get the ResponseLimit size
- *
- * A client can limit the number of keys to be returned by the service by
- * setting this value to the required limit.
- *
- * @returns Value of the ResponseLimit within the message. 0 if none was set
- */
-
- virtual unsigned int getResponseLimit(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set the Original Reqeust Id for the Message
- *
- * Allows a calling application to set a new original request Id for the
- * message
- *
- * @param id The Id to set as the OriginalRequestId
- */
-
- virtual void setOriginalRequestId(const XMLCh * id) = 0;
-
- /**
- * \brief Set the ResponseLimit size
- *
- * A client can limit the number of keys to be returned by the service by
- * setting this value to the required limit.
- *
- * @param limit Value to set the ResponseLimit within the message
- */
-
- virtual void setResponseLimit(unsigned int limit) = 0;
-
- //@}
-
- /** @name \<RespondWith\> handling */
- //@{
-
- /**
- * \brief Number of RespondWith elements in this Request
- *
- * Returns the number of RespondWith elements held within this request
- *
- * @returns Number of RespondWith elements
- */
-
- virtual int getRespondWithSize(void) = 0;
-
- /**
- * \brief Get the nth item in the RespondWith list
- *
- * @param item The item to return
- * @returns the nth item in the RespondWith list.
- *
- */
-
- virtual XKMSRespondWith * getRespondWithItem(int item) = 0;
-
- /**
- * \brief Get the string of the nth item in the RespondWith list
- *
- * @param item The item whose string is to be returned
- * @returns the string of the nth item in the RespondWith list.
- *
- */
-
- virtual const XMLCh * getRespondWithItemStr(int item) = 0;
-
- /**
- * \brief Append an item to the RespondWith list
- *
- * @param item XKMSRespondWith object to append to the list.
- * @note Once passed in, this item will be owned by the library.
- */
-
- virtual void appendRespondWithItem(XKMSRespondWith * item) = 0;
-
- /**
- * \brief Shortcut for appending an item to the RespondWith list
- *
- * @param item String to create a RespondWith element around and
- * append to the list.
- */
-
- virtual void appendRespondWithItem(const XMLCh * item) = 0;
-
- //@}
-
- /** @name \<ResponseMechanism\> handling */
- //@{
-
- /**
- * \brief Number of ResponseMechanism elements in this Request
- *
- * Returns the number of ResponseMechanism elements held within this request
- *
- * @returns Number of ResponseMechanism elements
- */
-
- virtual int getResponseMechanismSize(void) = 0;
-
- /**
- * \brief Get the nth item in the ResponseMechanism list
- *
- * @param item The item to return
- * @returns the nth item in the ResponseMechanism list.
- *
- */
-
- virtual XKMSResponseMechanism * getResponseMechanismItem(int item) = 0;
-
- /**
- * \brief Get the string of the nth item in the ResponseMechanism list
- *
- * @param item The item whose string is to be returned
- * @returns the string of the nth item in the RespondWith list.
- *
- */
-
- virtual const XMLCh * getResponseMechanismItemStr(int item) = 0;
-
- /**
- * \brief Append an item to the ResponseMechanism list
- *
- * @param item XKMSResponseMechanism object to append to the list.
- * @note Once passed in, this item will be owned by the library.
- */
-
- virtual void appendResponseMechanismItem(XKMSResponseMechanism * item) = 0;
-
- /**
- * \brief Shortcut for appending an item to the ResponseMechanism list
- *
- * @param item String to create a ResponseMechanism element around and
- * append to the list.
- */
-
- virtual void appendResponseMechanismItem(const XMLCh * item) = 0;
-
- /**
- * \brief Remove a ResponseMechanism
- *
- * Removes the identified ResponseMechanism from the item
- *
- * @param item Item to remove
- */
-
- virtual void removeResponseMechanismItem(int item) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRequestAbstractType(const XKMSRequestAbstractType &);
- XKMSRequestAbstractType & operator = (const XKMSRequestAbstractType &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREQUESTABSTRACTTYPE_INCLUDE */
diff --git a/xsec/xkms/XKMSRespondWith.hpp b/xsec/xkms/XKMSRespondWith.hpp
deleted file mode 100644
index 30ee892b..00000000
--- a/xsec/xkms/XKMSRespondWith.hpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRespondWith:= Interface for RespondWith elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESPONDWITH_INCLUDE
-#define XKMSRESPONDWITH_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RespondWith element
- *
- * The \<RespondWith\> is a very simple element structure that
- * allows a requestor to instruct the service on what kind of information
- * is to be presented back to the caller.
- *
- * The schema definition for RespondWith is as follows :
- *
- * \verbatim
- <!-- RespondWith -->
- <element name="RespondWith" type="QName"/>
- <!-- /RespondWith -->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSRespondWith {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRespondWith() {};
-
-public:
-
- virtual ~XKMSRespondWith() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /*
- * \brief Obtain the element at the head of this structure
- *
- * @returns the owning Element for this structure
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Get the RespondWith string for this element
- *
- * Each RespondWith element has a text node that defines the Key type to
- * be returned.
- *
- * @returns a pointer to the RespondWith string for this element - note that the
- * xkms namespace part of the QName (if any) is stripped away.
- */
-
- virtual const XMLCh * getRespondWithString(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set the String within the RespondWith element
- *
- * Allows a calling application to set a new RespondWith string
- *
- * @param str The string to set (overwriting any previous value). Do not add
- * any local name part - this will be added by the implementation.
- * @note The library does not check that the string is a value RespondWith string.
- */
-
- virtual void setRespondWithString(const XMLCh * str) = 0;
-
- //@}
-
-
-private:
-
- // Unimplemented
- XKMSRespondWith(const XKMSRespondWith &);
- XKMSRespondWith & operator = (const XKMSRespondWith &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRESPONDWITH_INCLUDE */
diff --git a/xsec/xkms/XKMSResponseMechanism.hpp b/xsec/xkms/XKMSResponseMechanism.hpp
deleted file mode 100644
index a69b9c7b..00000000
--- a/xsec/xkms/XKMSResponseMechanism.hpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResponseMechanism:= Interface for ResponseMechanism elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESPONSEMECHANISM_INCLUDE
-#define XKMSRESPONSEMECHANISM_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ResponseMechanism element
- *
- * The \<ResponseMechanism\> is a very simple element structure that
- * allows a requestor to pass extended protocol information
- *
- * The schema definition for ResponseMechanism is as follows :
- *
- * \verbatim
- <!-- ResponseMechanism -->
- <element name="ResponseMechanism" type="QName"/>
- <!-- /ResponseMechanism -->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSResponseMechanism {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSResponseMechanism() {};
-
-public:
-
- virtual ~XKMSResponseMechanism() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /*
- * \brief Obtain the element at the head of this structure
- *
- * @returns the owning Element for this structure
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Get the ResponseMechanism string for this element
- *
- * Each ResponseMechanism element has a text node that defines the Key type to
- * be returned.
- *
- * @returns a pointer to the ResponseMechanism string for this element - note that the
- * xkms namespace part of the QName (if any) is stripped away.
- */
-
- virtual const XMLCh * getResponseMechanismString(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set the String within the ResponseMechanism element
- *
- * Allows a calling application to set a new ResponseMechanism string
- *
- * @param str The string to set (overwriting any previous value). Do not add
- * any local name part - this will be added by the library.
- * @note The library does not check that the string is a valid ResponseMechanism string.
- */
-
- virtual void setResponseMechanismString(const XMLCh * str) = 0;
-
- //@}
-
-
-private:
-
- // Unimplemented
- XKMSResponseMechanism(const XKMSResponseMechanism &);
- XKMSResponseMechanism & operator = (const XKMSResponseMechanism &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRESPONSEMECHANISM_INCLUDE */
diff --git a/xsec/xkms/XKMSResult.hpp b/xsec/xkms/XKMSResult.hpp
deleted file mode 100644
index d37f91b8..00000000
--- a/xsec/xkms/XKMSResult.hpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResult := Interface for Result Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESULT_INCLUDE
-#define XKMSRESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the Result elements
- *
- * The \<Result\> is used when an XKMS service cannot return a result
- * of a more specific type - e.g. when a pending request comes in for which
- * there is no result. It is a straight instantiation of the ResultType
- */
-
-class XSEC_EXPORT XKMSResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSResult() {};
-
-public:
-
- virtual ~XKMSResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSResult(const XKMSResult &);
- XKMSResult & operator = (const XKMSResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSResultType.hpp b/xsec/xkms/XKMSResultType.hpp
deleted file mode 100644
index d7fc7b01..00000000
--- a/xsec/xkms/XKMSResultType.hpp
+++ /dev/null
@@ -1,228 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResultType := Interface for base schema of XKMS Request messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESULTTYPE_INCLUDE
-#define XKMSRESULTTYPE_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ResultType
- *
- * The \<ResultType\> is the base type on which Result messages
- * are built. (The \<Result\> element is a direct implementation)
- *
- * The schema definition for ResultType is as follows :
- *
- * \verbatim
- <!-- ResultType -->
- <element name="Result" type="xkms:ResultType"/>
- <complexType name="ResultType">
- <complexContent>
- <extension base="xkms:MessageAbstractType">
- <sequence>
- <element ref="xkms:RequestSignatureValue" minOccurs="0"/>
- </sequence>
- <attribute name="ResultMajor" type="QName" use="required"/>
- <attribute name="ResultMinor" type="QName" use="optional"/>
- <attribute name="RequestId" type="NCName" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- /ResultType -->
-\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSResultType : public XKMSMessageAbstractType {
-
-public:
-
- /**
- * \brief Definition of Major Result codes
- */
-
- enum ResultMajor {
- NoneMajor=0, /** No code - error! */
- Success, /** Final - The operation succeeded. */
- VersionMismatch, /** Final - The service does not support the protocol version specified in the request.*/
- Sender, /** Final - An error occurred that was due to the message sent by the sender. */
- Receiver, /** Final - An error occurred at the receiver. */
- Represent, /** Not Final - The service has not acted on the request. In order for the request to be acted upon the request MUST be represented with the specified nonce in accordance with the two phase protocol */
- Pending /** The request has been accepted for processing and the service will return the result asynchronously */
- };
-
- enum ResultMinor {
- NoneMinor=0, /** No code - no code was returned */
- NoMatch, /** No match was found for the search prototype provided.
- Success The result code Success.NoMatch indicates that the service is authoritative for the search prototype specified and that the service positively asserts that no matches exist.
- Receiver The result code Receiver.NoMatch indicates that the service is not authoritative for the search prototype provided.*/
- TooManyResponses, /** The request resulted in the number of responses that exceeded either the ResponseLimit value specified in the request or some other limit determined by the service. The service MAY either return a subset of the possible responses or none at all.
- Success The service has returned one or more responses that represent a subset of the possible responses.
- Receiver The service has returned no responses. */
- Incomplete, /** Success Only part of the information requested could be provided. */
- Failure, /** The service attempted to perform the request but the operation failed for unspecified reasons.
- Sender The reason for failure is attributed to the sender (e.g. the request failed schema validation).
- Receiver The reason for failure is attributed to the receiver (e.g. a database lookup failed).*/
- Refused, /** The operation was refused. The service did not attempt to perform the request.
- Sender The sender failed to provide sufficient information to authenticate or authorize the request (e.g. payment not supplied)
- Receiver The receiver is currently refusing certain requests for unspecified reasons. */
- NoAuthentication, /** Sender The operation was refused because the necessary authentication information was incorrect or missing.*/
- MessageNotSupported,/** Sender The receiver does not implement the specified operation. */
- UnknownResponseId, /** Sender The ResponseId for which pending status was requested is unknown to the service.*/
- RepresentRequired, /** Sender The responder requires that the sender offer the represent protocol option in order to process the request.*/
- NotSynchronous /** Receiver The receiver does not support synchronous processing of this type of request */
- };
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSResultType() {};
-
-public:
-
- virtual ~XKMSResultType() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Get the ResultMajor code for the message
- *
- * All result messages contain a Major Result code defining the overall
- * status of the request performed by the client
- *
- * @returns The ResultMajor code
- */
-
- virtual ResultMajor getResultMajor(void) const = 0;
-
- /**
- * \brief Get the ResultMinor code for the message
- *
- * Messages may contain a minor result code that better defines the result
- * returned in the ResultMajor code
- *
- * @returns The ResultMinor code
- */
-
- virtual ResultMinor getResultMinor(void) const = 0;
-
- /**
- * \brief Obtain the RequestId attribute
- *
- * The RequestId attribute matches the Id of the request message to which
- * this response is related.
- *
- * @returns the RequestId string
- */
-
- virtual const XMLCh * getRequestId(void) const = 0;
-
- /**
- * \brief Obtain the value of the RequestSignatureValue element
- *
- * A request can have a ResponseMechanism of RequestSignatureValue. When this
- * is set, the service can place the text within the SignatureValue element into
- * the Result. This call allows a consumer of the result to find the value
- *
- * @returns The original signature that was on the request message
- */
-
- virtual const XMLCh * getRequestSignatureValue(void) const = 0;
-
- //@}
-
- /** @name Setter interface methods */
- //@{
-
- /**
- * \brief Set a new value for the ResultMajor of this response
- *
- * @param rmaj New value for ResultMajor for this messag
- */
-
- virtual void setResultMajor(ResultMajor rmaj) = 0;
-
- /**
- * \brief Set a new value for the ResultMinor of this response
- *
- * @param rmin New value for ResultMajor for this message
- */
-
- virtual void setResultMinor(ResultMinor rmin) = 0;
-
- /**
- * \brief Set the Request Id for the Message
- *
- * Allows a calling application to set a new request Id for the
- * message
- *
- * @param id The Id to set as the RequestId
- */
-
- virtual void setRequestId(const XMLCh * id) = 0;
-
- /**
- * \brief Set the value of the RequestSignatureValue element
- *
- * A request can have a ResponseMechanism of RequestSignatureValue. When this
- * is set, the service can place the text within the SignatureValue element into
- * the Result. This call allows a service to set this value in a response
- *
- * @param value The base64 encoded signature value of the original request
- */
-
- virtual void setRequestSignatureValue(const XMLCh * value) = 0;
-
- //@}
-
-
-private:
-
- // Unimplemented
- XKMSResultType(const XKMSResultType &);
- XKMSResultType & operator = (const XKMSResultType &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSRESULTTYPE_INCLUDE */
diff --git a/xsec/xkms/XKMSRevokeKeyBinding.hpp b/xsec/xkms/XKMSRevokeKeyBinding.hpp
deleted file mode 100644
index 90e71bc6..00000000
--- a/xsec/xkms/XKMSRevokeKeyBinding.hpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeKeyBinding := Interface for KeyBinding elements
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSREVOKEKEYBINDING_INCLUDE
-#define XKMSREVOKEKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RevokeKeyBinding elements
- *
- * The \<RevokeKeyBinding\> Element is used in a request to revoke
- * a particular key from an XKRS service
- *
- * The schema definition for RevokeKeyBinding is as follows :
- *
- * \verbatim
- <!-- RevokeKeyBinding -->
- <element name="RevokeKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /RevokeKeyBinding -->\endverbatim
- */
-
-class XKMSStatus;
-
-class XSEC_EXPORT XKMSRevokeKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRevokeKeyBinding() {};
-
-public:
-
- virtual ~XKMSRevokeKeyBinding() {};
-
- //@}
-
- /** @name Status handling */
- //@{
-
- /**
- * \brief Obtain the status element for this KeyBinding
- *
- * The \<Status\> element is used to describe to the caller the
- * validity of they key being described. This call is used to
- * obtain the status element
- *
- * @return A pointer to the XKMSStatus element
- */
-
- virtual XKMSStatus * getStatus(void) const = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRevokeKeyBinding(const XKMSRevokeKeyBinding &);
- XKMSRevokeKeyBinding & operator = (const XKMSRevokeKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREVOKEKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSRevokeRequest.hpp b/xsec/xkms/XKMSRevokeRequest.hpp
deleted file mode 100644
index 5decf0f3..00000000
--- a/xsec/xkms/XKMSRevokeRequest.hpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeRequest := Interface for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREVOKEREQUEST_INCLUDE
-#define XKMSREVOKEREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class DSIGSignature;
-class XKMSAuthentication;
-class XKMSRevokeKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RevokeRequest elements
- *
- * The \<RevokeRequest\> is one of the message types of
- * the X-KRMS service. It is used when a client wishes to revoke
- * a key known to the service.
- *
- * The schema definition for RevokeRequest is as follows :
- *
- * \verbatim
- <!-- RevokeRequest -->
- <element name="RevokeRequest" type="xkms:RevokeRequestType"/>
- <complexType name="RevokeRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:RevokeKeyBinding"/>
- <choice>
- <element ref="xkms:Authentication"/>
- <element ref="xkms:RevocationCode"/>
- </choice>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <element name="RevokeKeyBinding" type="xkms:KeyBindingType"/>
- <!-- /RevokeRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRevokeRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRevokeRequest() {};
-
-public:
-
- virtual ~XKMSRevokeRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the PrototypKeyBinding element
- *
- * The PrototypeKeyBinding element is the core of the RegisterRequest message, and
- * defines the key information that will be sent to the server for registration.
- *
- * @returns A pointer to the XKMSPrototypeKeyBinding element
- */
-
- virtual XKMSRevokeKeyBinding * getRevokeKeyBinding(void) const = 0;
-
- /**
- * \brief Get the Authentication element
- *
- * The Authentication element of the RegisterRequest is used by the client to
- * authenticate the request to the server.
- *
- * @return A pointer to the Authentication structure
- */
-
- virtual XKMSAuthentication * getAuthentication (void) const = 0;
-
- /**
- * \brief Get the revocation code for the request
- *
- * This element is used by the client to provide a MAC of a pass phrase that
- * proves to the service tha the client has the authority to revoke this
- * key.
- *
- * @return A pointer to string representing the base64 encoded
- * revocation code, or NULL if none was defined
- */
-
- virtual const XMLCh * getRevocationCode(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a RevokeKeyBinding element
- *
- * Set a RevokeKeyBinding element in the Request message. The returned
- * object can be manipulated to add KeyInfo elements to the Request.
- *
- * @param status The status value to add into the RevokeKeyBinding structure
- * @returns A pointer to the newly created RevokeKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSRevokeKeyBinding * addRevokeKeyBinding(XKMSStatus::StatusValue status) = 0;
-
- /** \brief Add an Authentication element
- *
- * Set a Authentication element in the Request message. The returned
- * object can be manipulated to add Authentication information to the request.
- *
- * @returns A pointer to the newly created Authenticaton object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSAuthentication * addAuthentication(void) = 0;
-
- /**
- * \brief Add a RevocationCode to the message
- *
- * Allows the client to add a new Revocation Code string
- * RevokeRequest element
- *
- * @param code the base64 representation of the revocation code
- */
-
- virtual void addRevocationCode(const XMLCh * code) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRevokeRequest(const XKMSRevokeRequest &);
- XKMSRevokeRequest & operator = (const XKMSRevokeRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREVOKEREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSRevokeResult.hpp b/xsec/xkms/XKMSRevokeResult.hpp
deleted file mode 100644
index e9101031..00000000
--- a/xsec/xkms/XKMSRevokeResult.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeResult := Interface for RegisterResult Messages
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSREVOKERESULT_INCLUDE
-#define XKMSREVOKERESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class XKMSKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the RegisterResult elements
- *
- * The \<RegisterResult\> is used by the X-KRSS service to response to
- * a user request to register a new key with the service.
- *
- * The schema definition for RegisterResult is as follows :
- *
- * \verbatim
- <!-- RevokeResult -->
- <element name="RevokeResult" type="xkms:RevokeResultType"/>
- <complexType name="RevokeResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:KeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /RevokeResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSRevokeResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSRevokeResult() {};
-
-public:
-
- virtual ~XKMSRevokeResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name KeyBinding handling */
- //@{
-
- /**
- * \brief Find number of KeyBinding elements
- *
- * @returns the number of KeyBinding items within the RegisterResult
- */
-
- virtual int getKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an KeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the KeyBinding referenced by "item"
- */
-
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new KeyBinding element
- *
- * Allows callers to append a new KeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @param status The status (Valid, Invalid or Indeterminate) of this
- * key
- * @returns the newly created KeyBinding object (already inserted
- * in the RegisterResult
- */
-
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSRevokeResult(const XKMSRevokeResult &);
- XKMSRevokeResult & operator = (const XKMSRevokeResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSREVOKERESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSStatus.hpp b/xsec/xkms/XKMSStatus.hpp
deleted file mode 100644
index 11841ec0..00000000
--- a/xsec/xkms/XKMSStatus.hpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatus := Interface for Status elements (in KeyBinding)
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUS_INCLUDE
-#define XKMSSTATUS_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the Status elements
- *
- * The \<Status\> Element is used in a KeyBinding message to a client
- * to provide status information for keys that are returned in a
- * ValidateResult message
- *
- * The schema definition for KeyBinding is as follows :
- *
- * \verbatim
- <!-- Status -->
- <element name="Status" type="xkms:StatusType"/>
- <complexType name="StatusType">
- <sequence>
- <element ref="xkms:ValidReason" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:IndeterminateReason" minOccurs="0"
- maxOccurs="unbounded"/>
- <element ref="xkms:InvalidReason" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="StatusValue" type="xkms:KeyBindingStatus"
- use="required"/>
- </complexType>
- <simpleType name="KeyBindingStatus">
- <restriction base="QName">
- <enumeration value="xkms:Valid"/>
- <enumeration value="xkms:Invalid"/>
- <enumeration value="xkms:Indeterminate"/>
- </restriction>
- </simpleType>
- <!-- /Status -->
- \endverbatim
- */
-
-
-class XSEC_EXPORT XKMSStatus {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSStatus() {};
-
-public:
-
- virtual ~XKMSStatus() {};
-
- //@}
-
- enum StatusValue {
-
- StatusUndefined = 0, /** Error - the status value is undefined */
- Valid = 1, /** Good key! */
- Invalid = 2, /** Bad key! */
- Indeterminate = 3 /** Smarmy key! */
-
- };
-
- enum StatusReason {
-
- ReasonUndefined = 0, /** The reason is undefined or unknown */
- IssuerTrust = 1, /** The issuer of the info is considered good */
- RevocationStatus = 2, /** Key is/is not revoked */
- ValidityInterval = 3, /** Key not expired */
- Signature = 4 /** Signature on the provided data is good */
-
- };
-
- /** @name Getter methods */
- //@{
-
- /**
- * \brief Get the KeyBinding status assertion
- *
- * The Status element has a StatusValue attribute that defines
- * the validity of the key in question
- *
- * @return the status assertion
- */
-
- virtual StatusValue getStatusValue(void) const = 0;
-
- /**
- * \brief Find the Reason for a particular facet of status codes
- *
- * For each status reason, a Status can define a number of reasons
- * to return to a client. There are some controls on this (e.g. you cannot
- * have an InvalidReason if the actual KeyBindingStatus is Valid), but
- * you can have things in ValidReason and IndeterminateReason for an Invalid
- * result. This call allows you to find out about any facet of a reason
- *
- * @param status The particular status value you want to find a reason for
- * @param reason The particular reason that you want to determine is or is not
- * set
- * @return true if the particular reason is set for the given status, false
- * otherwise
- */
-
- virtual bool getStatusReason(StatusValue status, StatusReason reason) const = 0;
-
- //@}
-
- /** @name Setter Methods */
- //@{
-
- /**
- * \brief Activate or de-activate a particular reason in the status result
- *
- * For each status reason, a Status can define a number of reasons
- * to return to a client. There are some controls on this (e.g. you cannot
- * have an InvalidReason if the actual KeyBindingStatus is Valid), but
- * you can have things in ValidReason and IndeterminateReason for an Invalid
- * result. This call allows you to set any facet of a reason
- *
- * @param status The particular status value you want to set a reason for
- * @param reason The particular reason that you want to set
- * @param value true to turn on the reason, false to turn it off
- */
-
- virtual void setStatusReason(StatusValue status, StatusReason reason, bool value) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSStatus(const XKMSStatus &);
- XKMSStatus & operator = (const XKMSStatus &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSSTATUS_INCLUDE */
diff --git a/xsec/xkms/XKMSStatusRequest.hpp b/xsec/xkms/XKMSStatusRequest.hpp
deleted file mode 100644
index 2c9f3211..00000000
--- a/xsec/xkms/XKMSStatusRequest.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusRequest := Interface for StatusRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUSREQUEST_INCLUDE
-#define XKMSSTATUSREQUEST_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class XKMSQueryKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the StatusRequest elements
- *
- * The \<StatusRequest\> is used in Asynchronous processing. A client
- * uses the StatusRequest element to request a determine whether a
- * request for which the original response was "Pending" is now ready.
- *
- * The schema definition for StatusRequest is as follows :
- *
- * \verbatim
- <!-- StatusRequest -->
- <element name="StatusRequest" type="xkms:StatusRequestType"/>
- <complexType name="StatusRequestType">
- <complexContent>
- <extension base="xkms:PendingRequestType"/>
- </complexContent>
- </complexType>
- <!-- /StatusRequest -->\endverbatim
- */
-
-class XSEC_EXPORT XKMSStatusRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSStatusRequest() {};
-
-public:
-
- virtual ~XKMSStatusRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Return the ResponseId
- *
- * The ResponseId equates to the Id of the first response the service returned,
- * which must (by definition) have had a response code of "Pending". Together
- * with the OriginalRequestId, this can be used by the service to uniquley
- * identify the original request for which this StatusRequest refers.
- *
- * @return A pointer to the XMLCh string holding the ResponseId
- */
-
- virtual const XMLCh * getResponseId(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /**
- * \brief Set the ResponseId
- *
- * Allows a calling application to over-ride the configured responseId
- *
- * @param responseId The new responseId for this element
- */
-
- virtual void setResponseId(const XMLCh * responseId) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSStatusRequest(const XKMSStatusRequest &);
- XKMSStatusRequest & operator = (const XKMSStatusRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSSTATUSREQUEST_INCLUDE */
diff --git a/xsec/xkms/XKMSStatusResult.hpp b/xsec/xkms/XKMSStatusResult.hpp
deleted file mode 100644
index c27e0187..00000000
--- a/xsec/xkms/XKMSStatusResult.hpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusResult := Interface for StatusResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUSRESULT_INCLUDE
-#define XKMSSTATUSRESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-
-class XKMSQueryKeyBinding;
-class XKMSUnverifiedKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the StatusResult elements
- *
- * The \<StatusResult\> is used for Asynchronous processing and
- * allows a client to determing whether a Pending response is ready
- * for return.
- *
- * The schema definition for StatusResponse is as follows :
- *
- * \verbatim
- <!-- StatusResult -->
- <element name="StatusResult" type="xkms:StatusResultType"/>
- <complexType name="StatusResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <attribute name="Success" type="integer" use="optional"/>
- <attribute name="Failure" type="integer" use="optional"/>
- <attribute name="Pending" type="integer" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
- <!-- /StatusResult -->\endverbatim
- */
-
-class XSEC_EXPORT XKMSStatusResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSStatusResult() {};
-
-public:
-
- virtual ~XKMSStatusResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name Count handling */
- //@{
-
- /**
- * \brief Find number of Success messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Success result code.
- *
- * @returns the number of Success messages in a pending CompoundResponse
- */
-
- virtual int getSuccessCount(void) const = 0;
-
- /**
- * \brief Find number of Failed messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Failure result type.
- *
- * @returns the number of Failed messages in a pending CompoundResponse
- */
-
- virtual int getFailureCount(void) const = 0;
-
- /**
- * \brief Find number of Pending messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Pending result code.
- *
- * @returns the number of Pending messages in a pending CompoundResponse
- */
-
- virtual int getPendingCount(void) const = 0;
-
- /**
- * \brief Set the number of Success messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Success result code.
- *
- * @param count the number of Success messages in a pending CompoundResponse
- */
-
- virtual void setSuccessCount(int count) = 0;
-
- /**
- * \brief Set the number of Failed messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Failed result code.
- *
- * @param count the number of Failed messages in a pending CompoundResponse
- */
-
- virtual void setFailureCount(int count) = 0;
-
- /**
- * \brief Set the number of Pending messages
- *
- * A StatusResult can have a count of messages within a pending CompoundResponse
- * with a Pending result code.
- *
- * @param count the number of Pending messages in a pending CompoundResponse
- */
-
- virtual void setPendingCount(int count) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSStatusResult(const XKMSStatusResult &);
- XKMSStatusResult & operator = (const XKMSStatusResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSSTATUSRESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSUnverifiedKeyBinding.hpp b/xsec/xkms/XKMSUnverifiedKeyBinding.hpp
deleted file mode 100644
index ff17abf2..00000000
--- a/xsec/xkms/XKMSUnverifiedKeyBinding.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUnverifiedKeyBinding := Interface for UnverifiedKeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSUNVERIFIEDKEYBINDING_INCLUDE
-#define XKMSUNVERIFIEDKEYBINDING_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the UnverifiedKeyBinding elements
- *
- * The \<UnverifiedKeyBinding\> Element is used in a LocateResult message to
- * provide results to a client. Such results should be treated by the client
- * without any trust - they are literally "unverified"
- *
- * The schema definition for UnverifiedKeyBinding is as follows :
- *
- * \verbatim
- <!-- UnverifiedKeyBinding -->
- <element name="UnverifiedKeyBinding"
- type="xkms:UnverifiedKeyBindingType"/>
- <complexType name="UnverifiedKeyBindingType">
- <complexContent>
- <extension base="xkms:KeyBindingAbstractType">
- <sequence>
- <element ref="xkms:ValidityInterval" minOccurs="0"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /UnverifiedKeyBinding -->\endverbatim
- */
-
-
-class XSEC_EXPORT XKMSUnverifiedKeyBinding : public XKMSKeyBindingAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSUnverifiedKeyBinding() {};
-
-public:
-
- virtual ~XKMSUnverifiedKeyBinding() {};
-
-private:
-
- // Unimplemented
- XKMSUnverifiedKeyBinding(const XKMSUnverifiedKeyBinding &);
- XKMSUnverifiedKeyBinding & operator = (const XKMSUnverifiedKeyBinding &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSUNVERIFIEDKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/XKMSUseKeyWith.hpp b/xsec/xkms/XKMSUseKeyWith.hpp
deleted file mode 100644
index 95198979..00000000
--- a/xsec/xkms/XKMSUseKeyWith.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUseKeyWith := Interface for UseKeyWith Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSUSEKEYWITH_INCLUDE
-#define XKMSUSEKEYWITH_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition UseKeyWith elements
- *
- * \<UseKeyWith\> elements are played insied KeyBinding elements and identify
- * applications and application identifiers that correspond with the keys being
- * found.
- *
- * The schema definition for UseKeyWith is as follows :
- *
- * \verbatim
- <!-- UseKeyWith -->
- <element name="UseKeyWith" type="xkms:UseKeyWithType"/>
- <complexType name="UseKeyWithType">
- <attribute name="Application" type="anyURI" use="required"/>
- <attribute name="Identifier" type="string" use="required"/>
- </complexType>
- <!-- /UseKeyWith -->
-
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSUseKeyWith {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSUseKeyWith() {};
-
-public:
-
- virtual ~XKMSUseKeyWith() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the URI associated with the application for which this
- * identifier applies
- *
- * @returns a library owned XMLCh string containing the URI
- */
-
- virtual const XMLCh * getApplication(void) const = 0;
-
- /**
- * \brief Obtain the identifier string that should be used to locate a key
- *
- * @returns a library owned XMLCh string containing the URI
- */
-
- virtual const XMLCh * getIdentifier(void) const = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /**
- * \brief Set the Application string
- *
- * param uri URI String identifying the application
- */
-
- virtual void setApplication(const XMLCh * uri) = 0;
-
- /**
- * \brief Set the Identifier string
- *
- * param identifier String identifying the key
- */
-
- virtual void setIdentifier(const XMLCh * identifier) = 0;
-
- //@}
-
-
-
-private:
-
- // Unimplemented
- XKMSUseKeyWith(const XKMSUseKeyWith &);
- XKMSUseKeyWith & operator = (const XKMSUseKeyWith &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSUSEKEYWITH_INCLUDE */
diff --git a/xsec/xkms/XKMSValidateRequest.hpp b/xsec/xkms/XKMSValidateRequest.hpp
deleted file mode 100644
index a86bf0c2..00000000
--- a/xsec/xkms/XKMSValidateRequest.hpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateRequest := Interface for ValidateRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDATEREQUETS_INCLUDE
-#define XKMSVALIDATEREQUETS_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-class XKMSQueryKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ValidateRequest elements
- *
- * The \<ValidateRequest\> is one of the fundamental message types of
- * the XKISS service. It is used by the Validate service to find a key
- * and return a set of key bindings for that key.
- *
- * The schema definition for ValidateRequest is as follows :
- *
- * \verbatim
- <!-- ValidateRequest -->
- <element name="ValidateRequest" type="xkms:ValidateRequestType"/>
- <complexType name="ValidateRequestType">
- <complexContent>
- <extension base="xkms:RequestAbstractType">
- <sequence>
- <element ref="xkms:QueryKeyBinding"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /ValidateRequest -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSValidateRequest : public XKMSRequestAbstractType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSValidateRequest() {};
-
-public:
-
- virtual ~XKMSValidateRequest() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- /**
- * \brief Obtain the QueryKeyBinding element
- *
- * The QueryKeyBinding element is the core of the ValidateRequest message, and
- * defines the public key information that will be sent to the server.
- *
- * @returns A pointer to the XKMSQueryKeyBinding element
- */
-
- virtual XKMSQueryKeyBinding * getQueryKeyBinding(void) = 0;
-
- //@}
-
- /** @name Setter Interface Methods */
- //@{
-
- /** \brief Add a QueryKeyBinding element
- *
- * Set a QueryKeyBinding element in the ValidateRequest message. The returned
- * object can be manipulated to add KeyInfo elements to the ValidateRequest.
- *
- * @returns A pointer to the newly created QueryKeyBinding object, or
- * the pointer to extant object if one already existed.
- */
-
- virtual XKMSQueryKeyBinding * addQueryKeyBinding(void) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSValidateRequest(const XKMSValidateRequest &);
- XKMSValidateRequest & operator = (const XKMSValidateRequest &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSVALIDATEREQUETS_INCLUDE */
diff --git a/xsec/xkms/XKMSValidateResult.hpp b/xsec/xkms/XKMSValidateResult.hpp
deleted file mode 100644
index 526980a5..00000000
--- a/xsec/xkms/XKMSValidateResult.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateResult := Interface for ValidateResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDATERESULT_INCLUDE
-#define XKMSVALIDATERESULT_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <xsec/xkms/XKMSResultType.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-class XKMSKeyBinding;
-class XKMSUnverifiedKeyBinding;
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ValidateResult elements
- *
- * The \<ValidateResult\> is one of the fundamental message types of
- * the XKISS service. It is used by the Validate service to return a key
- * and the bindings for that key.
- *
- * The schema definition for ValidateResult is as follows :
- *
- * \verbatim
- <!-- ValidateResult -->
- <element name="ValidateResult" type="xkms:ValidateResultType"/>
- <complexType name="ValidateResultType">
- <complexContent>
- <extension base="xkms:ResultType">
- <sequence>
- <element ref="xkms:KeyBinding" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- <!-- /ValidateResult -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSValidateResult : public XKMSResultType {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSValidateResult() {};
-
-public:
-
- virtual ~XKMSValidateResult() {};
-
- /** @name Getter Interface Methods */
- //@{
-
- /**
- * \brief Return the element at the base of the message
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const = 0;
-
- //@}
-
- /** @name KeyBinding handling */
- //@{
-
- /**
- * \brief Find number of KeyBinding elements
- *
- * @returns the number of KeyBinding items within the ValidateResult
- */
-
- virtual int getKeyBindingSize(void) const = 0;
-
- /*
- * \brief Obtain an KeyBinding item
- *
- * @param item Index of the item to return (0 = first element)
- * @returns the KeyBinding referenced by "item"
- */
-
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const = 0;
-
- /*
- * \brief Append a new KeyBinding element
- *
- * Allows callers to append a new KeyBinding item.
- * The item is initially empty of KeyInfo elements - these must be added
- * by the caller.
- *
- * @param status The status (Valid, Invalid or Indeterminate) of this
- * key
- * @returns the newly created KeyBinding object (already inserted
- * in the ValidateResult
- */
-
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSValidateResult(const XKMSValidateResult &);
- XKMSValidateResult & operator = (const XKMSValidateResult &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSVALIDATERESULT_INCLUDE */
diff --git a/xsec/xkms/XKMSValidityInterval.hpp b/xsec/xkms/XKMSValidityInterval.hpp
deleted file mode 100644
index ae50ea89..00000000
--- a/xsec/xkms/XKMSValidityInterval.hpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidityInterval := Interface for ValidityInterval elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDITYINTERVAL_INCLUDE
-#define XKMSVALIDITYINTERVAL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-/**
- * @ingroup xkms
- */
-
-/**
- * @brief Interface definition for the ValidityInterval elements
- *
- * The \<ValidityInterval\> Element is used to define the dates within which
- * a key is valid.
- *
- * The schema definition for ValidityInterval is as follows :
- *
- * \verbatim
- <!-- ValidityInterval -->
- <element name="ValidityInterval" type="xkms:ValidityIntervalType"/>
- <complexType name="ValidityIntervalType">
- <attribute name="NotBefore" type="dateTime" use="optional"/>
- <attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
- </complexType>
- <!-- /ValidityInterval -->
-\endverbatim
- */
-
-class XSEC_EXPORT XKMSValidityInterval {
-
- /** @name Constructors and Destructors */
- //@{
-
-protected:
-
- XKMSValidityInterval() {};
-
-public:
-
- virtual ~XKMSValidityInterval() {};
-
- //@}
-
- /** @name Get Methods */
- //@{
-
- /**
- * \brief Get the start date for the key
- *
- * Defines the first instance in time from which the key is valid. At any time
- * before this, the key is invalid.
- *
- * @return The NotBefore value (or NULL if none was defined)
- */
-
- virtual const XMLCh * getNotBefore(void) const = 0;
-
- /**
- * \brief Get the end date for the key
- *
- * Defines the first instance in time from which the key is invalid. At this time
- * or after, the key is invalid.
- *
- * @return The NotOnOrAfter value (or NULL if none was defined)
- */
-
- virtual const XMLCh * getNotOnOrAfter(void) const = 0;
-
- //@}
-
- /** @name Set Methods */
- //@{
-
- /**
- * \brief Set the start date for the key
- *
- * Defines the first instance in time from which the key is valid. At any time
- * before this, the key is invalid.
- *
- * @param val value to set
- */
-
- virtual void setNotBefore(const XMLCh * val) = 0;
-
- /**
- * \brief Set the end date for the key
- *
- * Defines the first instance in time from which the key is invalid. At this time
- * or after, the key is invalid.
- *
- * @param val value to set
- */
-
- virtual void setNotOnOrAfter(const XMLCh * val) = 0;
-
- //@}
-
-private:
-
- // Unimplemented
- XKMSValidityInterval(const XKMSValidityInterval &);
- XKMSValidityInterval & operator = (const XKMSValidityInterval &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-
-#endif /* XKMSVALIDITYINTERVAL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSAuthenticationImpl.cpp b/xsec/xkms/impl/XKMSAuthenticationImpl.cpp
deleted file mode 100644
index 1da4b6eb..00000000
--- a/xsec/xkms/impl/XKMSAuthenticationImpl.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSAuthenticationImpl := Implementation of Authentication elements
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSAuthenticationImpl.hpp"
-#include "XKMSNotBoundAuthenticationImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Constructor/Destructor
-// --------------------------------------------------------------------------------
-
-XKMSAuthenticationImpl::XKMSAuthenticationImpl(const XSECEnv * env) :
-mp_env(env),
-mp_authenticationElement(NULL),
-mp_keyBindingAuthenticationSignatureElement(NULL),
-mp_keyBindingAuthenticationSignature(NULL),
-mp_notBoundAuthentication(NULL)
-{
-}
-
-XKMSAuthenticationImpl::XKMSAuthenticationImpl(const XSECEnv * env, DOMElement * node) :
-mp_env(env),
-mp_authenticationElement(node),
-mp_keyBindingAuthenticationSignatureElement(NULL),
-mp_keyBindingAuthenticationSignature(NULL),
-mp_notBoundAuthentication(NULL)
-{
-}
-
-XKMSAuthenticationImpl::~XKMSAuthenticationImpl() {
-
- if (mp_notBoundAuthentication != NULL)
- delete mp_notBoundAuthentication;
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSAuthenticationImpl::load(const XMLCh * id) {
-
- if (mp_authenticationElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSAuthenticationImpl::load - called on empty DOM");
- }
-
- // Store for later use
- mp_keyBindingId = id;
-
- DOMElement * tmpElt = findFirstElementChild(mp_authenticationElement);
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagKeyBindingAuthentication)) {
-
- // Find the signature
- mp_keyBindingAuthenticationSignatureElement =
- (DOMElement *) findFirstElementChild(tmpElt);
-
- while (mp_keyBindingAuthenticationSignatureElement != NULL &&
- !strEquals(getDSIGLocalName(mp_keyBindingAuthenticationSignatureElement),
- XKMSConstants::s_tagSignature)) {
-
- mp_keyBindingAuthenticationSignatureElement=
- findNextElementChild(mp_keyBindingAuthenticationSignatureElement);
-
- }
-
- // The provider will take care of cleaning this up later.
-
- if (mp_keyBindingAuthenticationSignatureElement != NULL) {
-
- mp_keyBindingAuthenticationSignature = m_prov.newSignatureFromDOM(
- mp_keyBindingAuthenticationSignatureElement->getOwnerDocument(),
- mp_keyBindingAuthenticationSignatureElement);
- mp_keyBindingAuthenticationSignature->load();
-
- // Check the signature is across the correct input
-
- DSIGReferenceList * rl =
- mp_keyBindingAuthenticationSignature->getReferenceList();
-
- if (rl->getSize() != 1) {
- throw XSECException(XSECException::XKMSError,
- "XKMSAuthenticationImpl::load - KeyBindingAuthentication Signature with incorrect number of references found (should be 1)");
- }
-
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_keyBindingId);
-
- if (!strEquals(rl->item(0)->getURI(), sb.rawXMLChBuffer())) {
- throw XSECException(XSECException::XKMSError,
- "XKMSAuthenticationImpl::load - KeyBindingAuthentication Signature refers to incorrect Id (should be for KeyBinding)");
- }
-
- // We don't actually check the signature as we have no key material to do so!
- }
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagNotBoundAuthentication)) {
-
- XSECnew(mp_notBoundAuthentication, XKMSNotBoundAuthenticationImpl(mp_env, tmpElt));
- mp_notBoundAuthentication->load();
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSAuthenticationImpl::createBlankAuthentication(const XMLCh * id) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagAuthentication);
-
- mp_authenticationElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(mp_authenticationElement);
-
- // This isn't used immediately - it is simply held for when we create a signature
- mp_keyBindingId = id;
-
- return mp_authenticationElement;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Interfacet - Get
-// --------------------------------------------------------------------------------
-
-DSIGSignature * XKMSAuthenticationImpl::getKeyBindingAuthenticationSignature(void) const {
-
- return mp_keyBindingAuthenticationSignature;
-
-}
-
-XKMSNotBoundAuthentication * XKMSAuthenticationImpl::getNotBoundAuthentication(void) const {
-
- return mp_notBoundAuthentication;
-
-}
-
-// --------------------------------------------------------------------------------
-// Interface - Set
-// --------------------------------------------------------------------------------
-
-DSIGSignature * XKMSAuthenticationImpl::addKeyBindingAuthenticationSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) {
-
- if (mp_keyBindingId == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSAuthenticationImpl::addKeyBindingAuthenticationSignature - called prior to key infos being added");
- }
-
- DSIGSignature * ret = m_prov.newSignature();
- DOMElement * elt = ret->createBlankSignature(mp_env->getParentDocument(), c14nAlgorithm, signatureAlgorithm);
-
- /* Create the enveloping reference */
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_keyBindingId);
-
- DSIGReference *ref = ret->createReference(sb.rawXMLChBuffer(), hashAlgorithm);
- ref->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
-
- /* Embed the signature in the document inside a KeyBindingAuthentication element */
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagKeyBindingAuthentication);
-
- DOMElement * t = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(t);
- t->appendChild(elt);
- mp_env->doPrettyPrint(t);
-
- mp_authenticationElement->appendChild(t);
- mp_env->doPrettyPrint(mp_authenticationElement);
-
- return ret;
-}
-
-void XKMSAuthenticationImpl::setNotBoundAuthentication(
- const XMLCh * uri,
- const XMLCh * value) {
-
- XSECnew(mp_notBoundAuthentication, XKMSNotBoundAuthenticationImpl(mp_env));
- mp_authenticationElement->appendChild(mp_notBoundAuthentication->createBlankNotBoundAuthentication(uri, value));
- mp_env->doPrettyPrint(mp_authenticationElement);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSAuthenticationImpl.hpp b/xsec/xkms/impl/XKMSAuthenticationImpl.hpp
deleted file mode 100644
index 0dd355b5..00000000
--- a/xsec/xkms/impl/XKMSAuthenticationImpl.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSAuthenticationImpl := Implementation of Authentication elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSAUTHENTICATIONIMPL_INCLUDE
-#define XKMSAUTHENTICATIONIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECProvider.hpp>
-#include <xsec/xkms/XKMSAuthentication.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XKMSKeyBindingAuthenticationImpl;
-class XKMSNotBoundAuthenticationImpl;
-class XSECEnv;
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-
-class XKMSAuthenticationImpl : public XKMSAuthentication {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSAuthenticationImpl(
- const XSECEnv * env
- );
-
- XKMSAuthenticationImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSAuthenticationImpl() ;
-
- // Load
- // The Authentication load is a bit different to others, as it needs
- // to know the Id of the KeyBinding that it is authentication so that it
- // can check it is valid in the signature
-
- void load(const XMLCh * id);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankAuthentication(const XMLCh * id);
-
- // Interface GET methods
-
- virtual DSIGSignature * getKeyBindingAuthenticationSignature(void) const;
- virtual XKMSNotBoundAuthentication * getNotBoundAuthentication(void) const;
-
- // Interface Set methods
-
- virtual DSIGSignature * addKeyBindingAuthenticationSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm);
- virtual void setNotBoundAuthentication(const XMLCh * uri, const XMLCh * value);
-
-private:
-
- const XSECEnv * mp_env;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_authenticationElement;
-
- XSECProvider m_prov;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyBindingAuthenticationSignatureElement;
- DSIGSignature * mp_keyBindingAuthenticationSignature;
- XKMSNotBoundAuthenticationImpl * mp_notBoundAuthentication;
-
- const XMLCh * mp_keyBindingId;
-
- // Unimplemented
- XKMSAuthenticationImpl(void);
- XKMSAuthenticationImpl(const XKMSAuthenticationImpl &);
- XKMSAuthenticationImpl & operator = (const XKMSAuthenticationImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSAUTHENTICATIONIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSCompoundRequestImpl.cpp b/xsec/xkms/impl/XKMSCompoundRequestImpl.cpp
deleted file mode 100644
index 80319b67..00000000
--- a/xsec/xkms/impl/XKMSCompoundRequestImpl.cpp
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundRequestImpl := Implementation of CompoundRequest Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSCompoundRequestImpl.hpp"
-#include "XKMSLocateRequestImpl.hpp"
-#include "XKMSValidateRequestImpl.hpp"
-#include "XKMSRegisterRequestImpl.hpp"
-#include "XKMSRevokeRequestImpl.hpp"
-#include "XKMSReissueRequestImpl.hpp"
-#include "XKMSRecoverRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSCompoundRequestImpl::XKMSCompoundRequestImpl(
- const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg) {
-
-}
-
-XKMSCompoundRequestImpl::XKMSCompoundRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg) {
-
-}
-
-XKMSCompoundRequestImpl::~XKMSCompoundRequestImpl() {
-
- RequestListVectorType::iterator i;
-
- for (i = m_requestList.begin() ; i != m_requestList.end(); ++i) {
-
- delete (*i);
-
- }
-
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSCompoundRequestImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagCompoundRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundRequest::load - called incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now find all Request elements
- DOMElement * e = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (e != NULL) {
-
- if (strEquals(getXKMSLocalName(e), XKMSConstants::s_tagLocateRequest) ||
- strEquals(getXKMSLocalName(e), XKMSConstants::s_tagValidateRequest)) {
-
- // Have a legitimate request to load
- XKMSMessageAbstractTypeImpl * m =
- (XKMSMessageAbstractTypeImpl *) m_factory.newMessageFromDOM(e);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl *) m);
-
- }
-
- e = findNextElementChild(e);
-
- }
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSCompoundRequestImpl::createBlankCompoundRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagCompoundRequest, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSCompoundRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::CompoundRequest;
-
-}
-
-int XKMSCompoundRequestImpl::getRequestListSize(void) {
-
- return (int) m_requestList.size();
-
-}
-
-XKMSRequestAbstractType * XKMSCompoundRequestImpl::getRequestListItem(int item) {
-
- if (item < 0 || item >= (int) m_requestList.size()) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundRequest::getRequestListItem - item out of range");
- }
-
- return m_requestList[item];
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-XKMSLocateRequest * XKMSCompoundRequestImpl::createLocateRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSLocateRequest * r = m_factory.createLocateRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSValidateRequest * XKMSCompoundRequestImpl::createValidateRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSValidateRequest * r = m_factory.createValidateRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-}
-
-XKMSRegisterRequest * XKMSCompoundRequestImpl::createRegisterRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSRegisterRequest * r = m_factory.createRegisterRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-}
-
-XKMSRevokeRequest * XKMSCompoundRequestImpl::createRevokeRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSRevokeRequest * r = m_factory.createRevokeRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-}
-
-XKMSReissueRequest * XKMSCompoundRequestImpl::createReissueRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSReissueRequest * r = m_factory.createReissueRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-}
-
-XKMSRecoverRequest * XKMSCompoundRequestImpl::createRecoverRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- XKMSRecoverRequest * r = m_factory.createRecoverRequest(service, m_msg.mp_env->getParentDocument(), id);
- m_requestList.push_back((XKMSRequestAbstractTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSCompoundRequestImpl.hpp b/xsec/xkms/impl/XKMSCompoundRequestImpl.hpp
deleted file mode 100644
index 9f078dff..00000000
--- a/xsec/xkms/impl/XKMSCompoundRequestImpl.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundRequestImpl := Implementation of CompoundRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSCOMPOUNDREQUESTIMPL_INCLUDE
-#define XKMSCOMPOUNDREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSCompoundRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-#include "XKMSMessageFactoryImpl.hpp"
-
-class XKMSQueryKeyRequestImpl;
-
-class XKMSCompoundRequestImpl : public XKMSCompoundRequest {
-
-public:
-
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-
-public:
-
- XKMSCompoundRequestImpl(
- const XSECEnv * env
- );
-
- XKMSCompoundRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSCompoundRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankCompoundRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
- // Getter methods
-
- virtual int getRequestListSize(void);
- virtual XKMSRequestAbstractType * getRequestListItem(int item);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- // Setter Methods
-
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSRequestAbstractTypeImpl *> RequestListVectorType;
-#else
- typedef std::vector<XKMSRequestAbstractTypeImpl *> RequestListVectorType;
-#endif
-
- RequestListVectorType m_requestList;
-
- /* Used to consume and produce messages in the list */
- XKMSMessageFactoryImpl m_factory;
-
- // Unimplemented
- XKMSCompoundRequestImpl(const XKMSCompoundRequestImpl &);
- XKMSCompoundRequestImpl & operator = (const XKMSCompoundRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSCOMPOUNDREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSCompoundResultImpl.cpp b/xsec/xkms/impl/XKMSCompoundResultImpl.cpp
deleted file mode 100644
index 1f6c24b4..00000000
--- a/xsec/xkms/impl/XKMSCompoundResultImpl.cpp
+++ /dev/null
@@ -1,310 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundResultImpl := Implementation of CompoundResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSCompoundResultImpl.hpp"
-#include "XKMSLocateResultImpl.hpp"
-#include "XKMSStatusResultImpl.hpp"
-#include "XKMSValidateResultImpl.hpp"
-#include "XKMSRegisterResultImpl.hpp"
-#include "XKMSRevokeResultImpl.hpp"
-#include "XKMSReissueResultImpl.hpp"
-#include "XKMSRecoverResultImpl.hpp"
-#include "XKMSResultImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSCompoundResultImpl::XKMSCompoundResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSCompoundResultImpl::XKMSCompoundResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg){
-
-}
-
-XKMSCompoundResultImpl::~XKMSCompoundResultImpl() {
-
- ResultListVectorType::iterator i;
-
- for (i = m_resultList.begin() ; i != m_resultList.end(); ++i) {
-
- delete (*i);
-
- }
-
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSCompoundResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagCompoundResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundResult::load - called incorrect node");
-
- }
-
- // Load the base message
- m_result.load();
-
- // Now find all Result elements
- DOMElement * e = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (e != NULL) {
-
- if (strEquals(getXKMSLocalName(e), XKMSConstants::s_tagLocateResult) ||
- strEquals(getXKMSLocalName(e), XKMSConstants::s_tagValidateResult)) {
-
- // Have a legitimate Result to load
- XKMSMessageAbstractTypeImpl * m =
- (XKMSMessageAbstractTypeImpl *) m_factory.newMessageFromDOM(e);
- m_resultList.push_back((XKMSResultTypeImpl *) m);
-
- }
-
- e = findNextElementChild(e);
-
- }
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSCompoundResultImpl::createBlankCompoundResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagCompoundResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSCompoundResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::CompoundResult;
-
-}
-
-int XKMSCompoundResultImpl::getResultListSize(void) {
-
- return (int) m_resultList.size();
-
-}
-
-XKMSResultType * XKMSCompoundResultImpl::getResultListItem(int item) {
-
- if (item < 0 || item >= (int) m_resultList.size()) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSCompoundResult::getResultListItem - item out of range");
- }
-
- return m_resultList[item];
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-XKMSLocateResult * XKMSCompoundResultImpl::createLocateResult(
- XKMSLocateRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSLocateResult * r = m_factory.createLocateResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSValidateResult * XKMSCompoundResultImpl::createValidateResult(
- XKMSValidateRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSValidateResult * r = m_factory.createValidateResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSStatusResult * XKMSCompoundResultImpl::createStatusResult(
- XKMSStatusRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSStatusResult * r = m_factory.createStatusResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSRegisterResult * XKMSCompoundResultImpl::createRegisterResult(
- XKMSRegisterRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRegisterResult * r = m_factory.createRegisterResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSRevokeResult * XKMSCompoundResultImpl::createRevokeResult(
- XKMSRevokeRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRevokeResult * r = m_factory.createRevokeResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSRecoverResult * XKMSCompoundResultImpl::createRecoverResult(
- XKMSRecoverRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRecoverResult * r = m_factory.createRecoverResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-XKMSReissueResult * XKMSCompoundResultImpl::createReissueResult(
- XKMSReissueRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSReissueResult * r = m_factory.createReissueResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-
-XKMSResult * XKMSCompoundResultImpl::createResult(
- XKMSRequestAbstractType * request,
- ResultMajor rmaj,
- ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSResult * r = m_factory.createResult(request, m_msg.mp_env->getParentDocument(), rmaj, rmin, id);
- m_resultList.push_back((XKMSResultTypeImpl*) r);
-
- m_msg.mp_messageAbstractTypeElement->appendChild(r->getElement());
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return r;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSCompoundResultImpl.hpp b/xsec/xkms/impl/XKMSCompoundResultImpl.hpp
deleted file mode 100644
index 26025db1..00000000
--- a/xsec/xkms/impl/XKMSCompoundResultImpl.hpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSCompoundResultImpl := Implementation of CompoundResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSCOMPOUNDRESULTIMPL_INCLUDE
-#define XKMSCOMPOUNDRESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSCompoundResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-#include "XKMSMessageFactoryImpl.hpp"
-
-class XKMSCompoundResultImpl : public XKMSCompoundResult {
-
-public:
-
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-
-public:
-
- XKMSCompoundResultImpl(
- const XSECEnv * env
- );
-
- XKMSCompoundResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSCompoundResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankCompoundResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Getter methods
-
- virtual int getResultListSize(void);
- virtual XKMSResultType * getResultListItem(int item);
-
- // Setter Methods
-
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- ResultMajor rmaj,
- ResultMinor rmin = XKMSResultTypeImpl::NoneMinor,
- const XMLCh * id = NULL);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSResultTypeImpl *> ResultListVectorType;
-#else
- typedef std::vector<XKMSResultTypeImpl *> ResultListVectorType;
-#endif
-
- ResultListVectorType m_resultList;
-
- /* Used to consume and produce messages in the list */
- XKMSMessageFactoryImpl m_factory;
-
- // Unimplemented
- XKMSCompoundResultImpl(const XKMSCompoundResultImpl &);
- XKMSCompoundResultImpl & operator = (const XKMSCompoundResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSCOMPOUNDRESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.cpp b/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.cpp
deleted file mode 100644
index d90c0f1d..00000000
--- a/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.cpp
+++ /dev/null
@@ -1,521 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBindingAbstractTypeImpl := Implementation of base for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGKeyInfoList.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-#include "XKMSUseKeyWithImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-// --------------------------------------------------------------------------------
-// Constructor/Destructor
-// --------------------------------------------------------------------------------
-
-XKMSKeyBindingAbstractTypeImpl::XKMSKeyBindingAbstractTypeImpl(
- const XSECEnv * env) :
-mp_keyBindingAbstractTypeElement(NULL),
-mp_env(env),
-mp_idAttr(NULL),
-mp_keyUsageSignatureElement(NULL),
-mp_keyUsageEncryptionElement(NULL),
-mp_keyUsageExchangeElement(NULL),
-mp_keyInfoElement(NULL) {
-
- XSECnew(mp_keyInfoList, DSIGKeyInfoList(mp_env));
-
-}
-
-XKMSKeyBindingAbstractTypeImpl::XKMSKeyBindingAbstractTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-mp_keyBindingAbstractTypeElement(node),
-mp_env(env),
-mp_idAttr(NULL),
-mp_keyUsageSignatureElement(NULL),
-mp_keyUsageEncryptionElement(NULL),
-mp_keyUsageExchangeElement(NULL),
-mp_keyInfoElement(NULL) {
-
- XSECnew(mp_keyInfoList, DSIGKeyInfoList(mp_env));
-
-}
-
-XKMSKeyBindingAbstractTypeImpl::~XKMSKeyBindingAbstractTypeImpl() {
-
- if (mp_keyInfoList != NULL)
- delete mp_keyInfoList;
-
- UseKeyWithVectorType::iterator i;
- for (i = m_useKeyWithList.begin(); i != m_useKeyWithList.end(); ++i)
- delete (*i);
-
-}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSKeyBindingAbstractTypeImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSKeyBindingAbstractTypeImpl::load - called on empty DOM");
- }
-
- // Id
- mp_idAttr =
- mp_keyBindingAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagId);
-
- DOMElement * tmpElt = findFirstElementChild(mp_keyBindingAbstractTypeElement);
-
- if (tmpElt != NULL && strEquals(getDSIGLocalName(tmpElt), XKMSConstants::s_tagKeyInfo)) {
-
- if (mp_keyInfoList != NULL)
- delete mp_keyInfoList;
-
- XSECnew(mp_keyInfoList, DSIGKeyInfoList(mp_env));
-
- mp_keyInfoList->loadListFromXML(tmpElt);
- mp_keyInfoElement = tmpElt;
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
-
- while (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagKeyUsage)) {
-
- DOMNode * txt = findFirstChildOfType(tmpElt, DOMNode::TEXT_NODE);
-
- if (txt == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSKeyBindingAbstractTypeImpl::load - Require text node beneath <KeyUsage>");
- }
-
- const XMLCh * usageStr = txt->getNodeValue();
- int index = XMLString::indexOf(usageStr, chPound);
- if (index == -1 || XMLString::compareNString(usageStr, XKMSConstants::s_unicodeStrURIXKMS, index)) {
- throw XSECException(XSECException::XKMSError,
- "XKMSResultType::load - KeyUsage not in XKMS Name Space");
- }
-
- usageStr = &usageStr[index+1];
-
-
- if (strEquals(usageStr, XKMSConstants::s_tagEncryption)) {
- mp_keyUsageEncryptionElement = tmpElt;
- } else if (strEquals(usageStr, XKMSConstants::s_tagExchange)) {
- mp_keyUsageExchangeElement = tmpElt;
- } else if (strEquals(usageStr, XKMSConstants::s_tagSignature)) {
- mp_keyUsageSignatureElement = tmpElt;
- } else {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSKeyBindingAbstractTypeImpl::load - require Encryption, Exchange or Signature text node beneath <KeyUsage>");
- }
-
- tmpElt = findNextElementChild(tmpElt);
- }
-
- while (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagUseKeyWith)) {
-
- XKMSUseKeyWithImpl *ukw;
- XSECnew(ukw, XKMSUseKeyWithImpl(mp_env, tmpElt));
-
- m_useKeyWithList.push_back(ukw);
- ukw->load();
-
- tmpElt = findNextElementChild(tmpElt);
- }
-}
-
-// --------------------------------------------------------------------------------
-// Create Blank
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSKeyBindingAbstractTypeImpl::createBlankKeyBindingAbstractType(const XMLCh * tag) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, tag);
-
- mp_keyBindingAbstractTypeElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(mp_keyBindingAbstractTypeElement);
-
- return mp_keyBindingAbstractTypeElement;
-
-}
-
-// --------------------------------------------------------------------------------
-// Getter methods
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSKeyBindingAbstractTypeImpl::getElement(void) const {
-
- return mp_keyBindingAbstractTypeElement;
-
-}
-
-const XMLCh * XKMSKeyBindingAbstractTypeImpl::getId(void) const {
-
- return (mp_idAttr != NULL ? mp_idAttr->getNodeValue() : NULL);
-
-}
-
-DSIGKeyInfoList * XKMSKeyBindingAbstractTypeImpl::getKeyInfoList(void) const {
-
- return mp_keyInfoList;
-
-}
-
-bool XKMSKeyBindingAbstractTypeImpl::getEncryptionKeyUsage(void) const {
-
- return (mp_keyUsageEncryptionElement != NULL ||
- (mp_keyUsageExchangeElement == NULL && mp_keyUsageSignatureElement == NULL));
-
-}
-
-bool XKMSKeyBindingAbstractTypeImpl::getSignatureKeyUsage(void) const {
-
- return (mp_keyUsageSignatureElement != NULL ||
- (mp_keyUsageExchangeElement == NULL && mp_keyUsageEncryptionElement == NULL));
-
-}
-
-bool XKMSKeyBindingAbstractTypeImpl::getExchangeKeyUsage(void) const {
-
- return (mp_keyUsageExchangeElement != NULL ||
- (mp_keyUsageEncryptionElement == NULL && mp_keyUsageSignatureElement == NULL));
-
-}
-
-// --------------------------------------------------------------------------------
-// KeyInfo elements
-// --------------------------------------------------------------------------------
-
-DSIGKeyInfoList * XKMSKeyBindingAbstractTypeImpl::getKeyInfoList() {
-
- return mp_keyInfoList;
-
-}
-
-void XKMSKeyBindingAbstractTypeImpl::clearKeyInfo(void) {
-
- if (mp_keyInfoElement == NULL)
- return;
-
- if (mp_keyBindingAbstractTypeElement->removeChild(mp_keyInfoElement) != mp_keyInfoElement) {
-
- throw XSECException(XSECException::ExpectedDSIGChildNotFound,
- "Attempted to remove KeyInfo node but it is no longer a child of <KeyBindingAbstractType>");
-
- }
-
- mp_keyInfoElement->release(); // No longer required
-
- mp_keyInfoElement = NULL;
-
- // Clear out the list
- mp_keyInfoList->empty();
-
-}
-
-void XKMSKeyBindingAbstractTypeImpl::createKeyInfoElement(void) {
-
- if (mp_keyInfoElement != NULL)
- return;
-
- safeBuffer str;
-
- const XMLCh * prefixNS = mp_env->getDSIGNSPrefix();
- makeQName(str, prefixNS, "KeyInfo");
-
- mp_keyInfoElement = mp_keyInfoList->createKeyInfo();
-
- // Needs to be first element
- DOMNode * insertBefore = mp_keyBindingAbstractTypeElement->getFirstChild();
-
- if (insertBefore != NULL) {
-
- if (mp_env->getPrettyPrintFlag() == true)
- mp_keyBindingAbstractTypeElement->insertBefore(mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), insertBefore);
- mp_keyBindingAbstractTypeElement->insertBefore(mp_keyInfoElement, insertBefore);
-
- }
-
- else {
-
- mp_keyBindingAbstractTypeElement->appendChild(mp_keyInfoElement);
- mp_env->doPrettyPrint(mp_keyBindingAbstractTypeElement);
-
- }
-
- // Need to add the DS namespace
-
- if (prefixNS[0] == '\0') {
- str.sbTranscodeIn("xmlns");
- }
- else {
- str.sbTranscodeIn("xmlns:");
- str.sbXMLChCat(prefixNS);
- }
-
- mp_keyInfoElement->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- str.rawXMLChBuffer(),
- DSIGConstants::s_unicodeStrURIDSIG);
-
-}
-
-
-DSIGKeyInfoName * XKMSKeyBindingAbstractTypeImpl::appendKeyName(const XMLCh * name, bool isDName) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendKeyName(name, isDName);
-
-}
-
-
-DSIGKeyInfoValue * XKMSKeyBindingAbstractTypeImpl::appendDSAKeyValue(const XMLCh * P,
- const XMLCh * Q,
- const XMLCh * G,
- const XMLCh * Y) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendDSAKeyValue(P, Q, G, Y);
-
-}
-
-DSIGKeyInfoValue * XKMSKeyBindingAbstractTypeImpl::appendRSAKeyValue(const XMLCh * modulus,
- const XMLCh * exponent) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendRSAKeyValue(modulus, exponent);
-
-}
-
-
-DSIGKeyInfoX509 * XKMSKeyBindingAbstractTypeImpl::appendX509Data(void) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendX509Data();
-
-}
-
-DSIGKeyInfoPGPData * XKMSKeyBindingAbstractTypeImpl::appendPGPData(const XMLCh * id, const XMLCh * packet) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendPGPData(id, packet);
-
-}
-
-DSIGKeyInfoSPKIData * XKMSKeyBindingAbstractTypeImpl::appendSPKIData(const XMLCh * sexp) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendSPKIData(sexp);
-
-}
-
-DSIGKeyInfoMgmtData * XKMSKeyBindingAbstractTypeImpl::appendMgmtData(const XMLCh * data) {
-
- createKeyInfoElement();
- return mp_keyInfoList->appendMgmtData(data);
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-void XKMSKeyBindingAbstractTypeImpl::setId(const XMLCh * id) {
-
- // Setup the id
- XMLCh * myId;
-
- if (id == NULL)
- myId = generateId();
-
- mp_keyBindingAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagId, id ? id : myId);
- if (id == NULL)
- XSEC_RELEASE_XMLCH(myId);
- mp_keyBindingAbstractTypeElement->setIdAttributeNS(NULL, XKMSConstants::s_tagId, true);
- mp_idAttr =
- mp_keyBindingAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagId);
-
-}
-
-DOMElement * XKMSKeyBindingAbstractTypeImpl::setKeyUsage(const XMLCh * usage) {
-
- /* Create the element and string*/
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagKeyUsage);
-
- /* Create the element */
- DOMElement * e = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- str.sbXMLChCat(usage);
- e->appendChild(doc->createTextNode(str.rawXMLChBuffer()));
-
- /* Now find where it goes */
-
- DOMElement * t = findFirstElementChild(mp_keyBindingAbstractTypeElement);
- while (t != NULL) {
- if (!strEquals(getDSIGLocalName(t), XKMSConstants::s_tagKeyInfo) &&
- !strEquals(getXKMSLocalName(t), XKMSConstants::s_tagKeyUsage))
- break;
-
- t = findNextElementChild(t);
- }
-
- // Append the element
- if (t == NULL) {
- mp_keyBindingAbstractTypeElement->appendChild(e);
- mp_env->doPrettyPrint(mp_keyBindingAbstractTypeElement);
- }
- else {
- mp_keyBindingAbstractTypeElement->insertBefore(e, t);
- if (mp_env->getPrettyPrintFlag()) {
- mp_keyBindingAbstractTypeElement->insertBefore(
- mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- t);
- }
- }
-
- return e;
-
-}
-
-void XKMSKeyBindingAbstractTypeImpl::setEncryptionKeyUsage(void) {
-
- if (mp_keyUsageEncryptionElement != NULL)
- return;
-
- mp_keyUsageEncryptionElement = setKeyUsage(XKMSConstants::s_tagEncryption);
-
-}
-void XKMSKeyBindingAbstractTypeImpl::setSignatureKeyUsage(void) {
-
- if (mp_keyUsageSignatureElement != NULL)
- return;
-
- mp_keyUsageSignatureElement = setKeyUsage(XKMSConstants::s_tagSignature);
-
-}
-void XKMSKeyBindingAbstractTypeImpl::setExchangeKeyUsage(void) {
-
- if (mp_keyUsageExchangeElement != NULL)
- return;
-
- mp_keyUsageExchangeElement = setKeyUsage(XKMSConstants::s_tagExchange);
-
-}
-
-
-// --------------------------------------------------------------------------------
-// UseKeyWith handling
-// --------------------------------------------------------------------------------
-
-int XKMSKeyBindingAbstractTypeImpl::getUseKeyWithSize(void) const {
-
- return (int) m_useKeyWithList.size();
-
-}
-
-XKMSUseKeyWith * XKMSKeyBindingAbstractTypeImpl::getUseKeyWithItem(int item) const {
-
- if (item < 0 || item >= (int) m_useKeyWithList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSKeyBindingAbstractType::getUseKeyWithItem - item out of range");
- }
-
- return m_useKeyWithList[item];
-
-}
-
-XKMSUseKeyWith * XKMSKeyBindingAbstractTypeImpl::appendUseKeyWithItem(
- const XMLCh * application,
- const XMLCh * identifier) {
-
- XKMSUseKeyWithImpl * u;
-
- XSECnew(u, XKMSUseKeyWithImpl(mp_env));
-
- m_useKeyWithList.push_back(u);
-
- DOMElement * e = u->createBlankUseKeyWith(application, identifier);
-
- // Find where to append the element
- DOMElement * t = findFirstElementChild(mp_keyBindingAbstractTypeElement);
- while (t != NULL) {
- if (!strEquals(getDSIGLocalName(t), XKMSConstants::s_tagKeyInfo) &&
- !strEquals(getXKMSLocalName(t), XKMSConstants::s_tagKeyUsage) &&
- !strEquals(getXKMSLocalName(t), XKMSConstants::s_tagUseKeyWith))
- break;
-
- t = findNextElementChild(t);
- }
-
- // Append the element
- if (t == NULL) {
- mp_keyBindingAbstractTypeElement->appendChild(e);
- mp_env->doPrettyPrint(mp_keyBindingAbstractTypeElement);
- }
- else {
- mp_keyBindingAbstractTypeElement->insertBefore(e, t);
- if (mp_env->getPrettyPrintFlag()) {
- mp_keyBindingAbstractTypeElement->insertBefore(
- mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- t);
- }
- }
-
- return u;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.hpp b/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.hpp
deleted file mode 100644
index c889bac3..00000000
--- a/xsec/xkms/impl/XKMSKeyBindingAbstractTypeImpl.hpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBindingAbstractTypeImpl := Implementation of base for KeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE
-#define XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSKeyBindingAbstractType.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include <vector>
-
-XSEC_DECLARE_XERCES_CLASS(DOMNode);
-
-class XSECEnv;
-class DSIGKeyInfoList;
-class XKMSUseKeyWithImpl;
-
-class XKMSKeyBindingAbstractTypeImpl : public XKMSKeyBindingAbstractType {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSKeyBindingAbstractTypeImpl(
- const XSECEnv * env
- );
-
- XKMSKeyBindingAbstractTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSKeyBindingAbstractTypeImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankKeyBindingAbstractType(const XMLCh * tag);
-
- /* Getter Interface Methods */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const;
-
- virtual const XMLCh * getId(void) const;
- virtual DSIGKeyInfoList * getKeyInfoList(void) const;
- virtual bool getEncryptionKeyUsage(void) const;
- virtual bool getSignatureKeyUsage(void) const;
- virtual bool getExchangeKeyUsage(void) const;
-
- /* Setter interface methods */
-
- virtual void setId(const XMLCh * id = NULL);
- virtual void setEncryptionKeyUsage(void);
- virtual void setSignatureKeyUsage(void);
- virtual void setExchangeKeyUsage(void);
-
- /* Key Info methods */
- virtual DSIGKeyInfoList * getKeyInfoList();
- virtual void clearKeyInfo(void);
- virtual DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P,
- const XMLCh * Q,
- const XMLCh * G,
- const XMLCh * Y);
- virtual DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus,
- const XMLCh * exponent);
- virtual DSIGKeyInfoX509 * appendX509Data(void);
- virtual DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false);
- virtual DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet);
- virtual DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp);
- virtual DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data);
-
- /* UseKeyWith handling */
-
- virtual int getUseKeyWithSize(void) const;
- virtual XKMSUseKeyWith * getUseKeyWithItem(int item) const;
- virtual XKMSUseKeyWith * appendUseKeyWithItem(
- const XMLCh * application,
- const XMLCh * identifier);
-
-protected:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyBindingAbstractTypeElement;
- const XSECEnv * mp_env;
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- setKeyUsage(const XMLCh * usage);
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSUseKeyWithImpl *> UseKeyWithVectorType;
-#else
- typedef std::vector<XKMSUseKeyWithImpl *> UseKeyWithVectorType;
-#endif
-
- UseKeyWithVectorType m_useKeyWithList;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_idAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyUsageSignatureElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyUsageEncryptionElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyUsageExchangeElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_keyInfoElement;
- DSIGKeyInfoList * mp_keyInfoList;
-
- void createKeyInfoElement(void);
-
- // Unimplemented
- XKMSKeyBindingAbstractTypeImpl(void);
- XKMSKeyBindingAbstractTypeImpl(const XKMSKeyBindingAbstractTypeImpl &);
- XKMSKeyBindingAbstractTypeImpl & operator = (const XKMSKeyBindingAbstractTypeImpl &);
-
-};
-
-// Define imported methods for classes that inherit them (makes things easier)
-
-#define XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS \
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getElement();} \
- virtual const XMLCh * getId(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getId();} \
- virtual DSIGKeyInfoList * getKeyInfoList(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getKeyInfoList();} \
- virtual bool getEncryptionKeyUsage(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getEncryptionKeyUsage();} \
- virtual bool getSignatureKeyUsage(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getSignatureKeyUsage();} \
- virtual bool getExchangeKeyUsage(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getExchangeKeyUsage();} \
- virtual void setId(const XMLCh * id) \
- {XKMSKeyBindingAbstractTypeImpl::setId(id);} \
- virtual void setEncryptionKeyUsage(void) \
- {XKMSKeyBindingAbstractTypeImpl::setEncryptionKeyUsage();} \
- virtual void setSignatureKeyUsage(void) \
- {XKMSKeyBindingAbstractTypeImpl::setSignatureKeyUsage();} \
- virtual void setExchangeKeyUsage(void) \
- {XKMSKeyBindingAbstractTypeImpl::setExchangeKeyUsage();} \
- virtual DSIGKeyInfoList * getKeyInfoList() \
- {return XKMSKeyBindingAbstractTypeImpl::getKeyInfoList();} \
- virtual void clearKeyInfo(void) \
- {XKMSKeyBindingAbstractTypeImpl::clearKeyInfo();} \
- virtual DSIGKeyInfoValue * appendDSAKeyValue(const XMLCh * P, \
- const XMLCh * Q, \
- const XMLCh * G, \
- const XMLCh * Y) \
- {return XKMSKeyBindingAbstractTypeImpl::appendDSAKeyValue(P,Q,G,Y);} \
- virtual DSIGKeyInfoValue * appendRSAKeyValue(const XMLCh * modulus, \
- const XMLCh * exponent) \
- {return XKMSKeyBindingAbstractTypeImpl::appendRSAKeyValue(modulus,exponent);} \
- virtual DSIGKeyInfoX509 * appendX509Data(void) \
- {return XKMSKeyBindingAbstractTypeImpl::appendX509Data();} \
- virtual DSIGKeyInfoName * appendKeyName(const XMLCh * name, bool isDName = false) \
- {return XKMSKeyBindingAbstractTypeImpl::appendKeyName(name,isDName);} \
- virtual DSIGKeyInfoPGPData * appendPGPData(const XMLCh * id, const XMLCh * packet) \
- {return XKMSKeyBindingAbstractTypeImpl::appendPGPData(id,packet);} \
- virtual DSIGKeyInfoSPKIData * appendSPKIData(const XMLCh * sexp) \
- {return XKMSKeyBindingAbstractTypeImpl::appendSPKIData(sexp);} \
- virtual DSIGKeyInfoMgmtData * appendMgmtData(const XMLCh * data) \
- {return XKMSKeyBindingAbstractTypeImpl::appendMgmtData(data);} \
- virtual int getUseKeyWithSize(void) const \
- {return XKMSKeyBindingAbstractTypeImpl::getUseKeyWithSize();} \
- virtual XKMSUseKeyWith * getUseKeyWithItem(int item) const \
- {return XKMSKeyBindingAbstractTypeImpl::getUseKeyWithItem(item);} \
- virtual XKMSUseKeyWith * appendUseKeyWithItem( \
- const XMLCh * application, \
- const XMLCh * identifier) \
- {return XKMSKeyBindingAbstractTypeImpl::appendUseKeyWithItem(application, identifier);}
-
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSKEYBINDINGABSTRACTTYPEIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSKeyBindingImpl.cpp
deleted file mode 100644
index 25691559..00000000
--- a/xsec/xkms/impl/XKMSKeyBindingImpl.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBindingImpl := Implementation for KeyBinding
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingImpl.hpp"
-#include "XKMSStatusImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSKeyBindingImpl::XKMSKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
- mp_status = NULL;
-}
-
-XKMSKeyBindingImpl::XKMSKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
- mp_status = NULL;
-}
-
-XKMSKeyBindingImpl::~XKMSKeyBindingImpl() {
-
- if (mp_status != NULL)
- delete mp_status;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
- /* Find the status element */
- DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagStatus);
-
- if (nl == NULL || nl->getLength() != 1) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSKeyBinding::load - Status value not found");
- }
-
- XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
- mp_status->load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSKeyBindingImpl::createBlankKeyBinding(XKMSStatus::StatusValue status) {
-
- DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagKeyBinding);
-
- mp_env->doPrettyPrint(ret);
-
- // Create the status element
- XSECnew(mp_status, XKMSStatusImpl(mp_env));
- ret->appendChild(mp_status->createBlankStatus(status));
- mp_env->doPrettyPrint(ret);
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Status handling
-// --------------------------------------------------------------------------------
-
-XKMSStatus * XKMSKeyBindingImpl::getStatus(void) const {
-
- return mp_status;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSKeyBindingImpl.hpp
deleted file mode 100644
index ea972f64..00000000
--- a/xsec/xkms/impl/XKMSKeyBindingImpl.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSKeyBindingImpl := Implementation for KeyBinding
- *
- * $Id$
- *
- */
-
-#ifndef XKMSKEYBINDINGIMPL_INCLUDE
-#define XKMSKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSKeyBinding.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSStatusImpl;
-
-class XKMSKeyBindingImpl : public XKMSKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankKeyBinding(XKMSStatus::StatusValue status);
-
- // Interface
- virtual XKMSStatus * getStatus(void) const;
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XKMSStatusImpl * mp_status;
-
- // Unimplemented
- XKMSKeyBindingImpl(void);
- XKMSKeyBindingImpl(const XKMSKeyBindingImpl &);
- XKMSKeyBindingImpl & operator = (const XKMSKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSLocateRequestImpl.cpp b/xsec/xkms/impl/XKMSLocateRequestImpl.cpp
deleted file mode 100644
index 4ab770aa..00000000
--- a/xsec/xkms/impl/XKMSLocateRequestImpl.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateRequestImpl := Implementation of LocateRequest Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSLocateRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSLocateRequestImpl::XKMSLocateRequestImpl(
- const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_queryKeyBindingElement(NULL),
-mp_queryKeyBinding(NULL) {
-
-}
-
-XKMSLocateRequestImpl::XKMSLocateRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_queryKeyBinding(NULL) {
-
-}
-
-XKMSLocateRequestImpl::~XKMSLocateRequestImpl() {
-
- if (mp_queryKeyBinding != NULL)
- delete mp_queryKeyBinding;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSLocateRequestImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSLocateRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagLocateRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSLocateRequest::load - called incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any QueryKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL &&
- !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagQueryKeyBinding))
- tmpElt = findNextElementChild(tmpElt);
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_queryKeyBinding, XKMSQueryKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_queryKeyBinding->load();
- mp_queryKeyBindingElement = tmpElt;
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSLocateRequestImpl::createBlankLocateRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagLocateRequest, service, id);
-// return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
-// MAKE_UNICODE_STRING("ValidateRequest"), service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSLocateRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::LocateRequest;
-
-}
-
-
-XKMSQueryKeyBinding * XKMSLocateRequestImpl::getQueryKeyBinding(void) {
-
- return mp_queryKeyBinding;
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-XKMSQueryKeyBinding * XKMSLocateRequestImpl::addQueryKeyBinding(void) {
-
- if (mp_queryKeyBinding != NULL)
- return mp_queryKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_queryKeyBinding, XKMSQueryKeyBindingImpl(m_msg.mp_env));
- mp_queryKeyBindingElement = mp_queryKeyBinding->createBlankQueryKeyBinding();
-
- if (m_msg.mp_messageAbstractTypeElement->getFirstChild() == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
- m_msg.mp_messageAbstractTypeElement->appendChild(mp_queryKeyBindingElement);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return mp_queryKeyBinding;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSLocateRequestImpl.hpp b/xsec/xkms/impl/XKMSLocateRequestImpl.hpp
deleted file mode 100644
index 64c3ffc6..00000000
--- a/xsec/xkms/impl/XKMSLocateRequestImpl.hpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateRequestImpl := Implementation of LocateRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSLOCATEREQUESTIMPL_INCLUDE
-#define XKMSLOCATEREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSLocateRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-#include "XKMSQueryKeyBindingImpl.hpp"
-
-class XKMSQueryKeyRequestImpl;
-
-class XKMSLocateRequestImpl : public XKMSLocateRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSLocateRequestImpl(
- const XSECEnv * env
- );
-
- XKMSLocateRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSLocateRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankLocateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
-
- virtual XKMSQueryKeyBinding * getQueryKeyBinding(void);
-
- /* Setter interface methods */
- virtual XKMSQueryKeyBinding * addQueryKeyBinding(void);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_queryKeyBindingElement;
- XKMSQueryKeyBindingImpl * mp_queryKeyBinding;
-
- // Unimplemented
- XKMSLocateRequestImpl(const XKMSLocateRequestImpl &);
- XKMSLocateRequestImpl & operator = (const XKMSLocateRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSLOCATEREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSLocateResultImpl.cpp b/xsec/xkms/impl/XKMSLocateResultImpl.cpp
deleted file mode 100644
index e2e2268f..00000000
--- a/xsec/xkms/impl/XKMSLocateResultImpl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateResultImpl := Implementation of LocateResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSLocateResultImpl.hpp"
-#include "XKMSUnverifiedKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSLocateResultImpl::XKMSLocateResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSLocateResultImpl::XKMSLocateResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSLocateResultImpl::~XKMSLocateResultImpl() {
-
- XKMSLocateResultImpl::UnverifiedKeyBindingVectorType::iterator i;
-
- for (i = m_unverifiedKeyBindingList.begin() ; i != m_unverifiedKeyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSLocateResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSLocateResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagLocateResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSLocateResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagUnverifiedKeyBinding);
-
- if (nl != NULL) {
-
- XKMSUnverifiedKeyBindingImpl * ukb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(ukb, XKMSUnverifiedKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_unverifiedKeyBindingList.push_back(ukb);
- ukb->load();
-
- }
-
- }
-
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSLocateResultImpl::createBlankLocateResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagLocateResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSLocateResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::LocateResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSLocateResultImpl::getUnverifiedKeyBindingSize(void) const {
-
- return (int) m_unverifiedKeyBindingList.size();
-
-}
-
-XKMSUnverifiedKeyBinding * XKMSLocateResultImpl::getUnverifiedKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_unverifiedKeyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSLocateResult::getUnverifiedKeyBindingItem - item out of range");
- }
-
- return m_unverifiedKeyBindingList[item];
-
-}
-
-XKMSUnverifiedKeyBinding * XKMSLocateResultImpl::appendUnverifiedKeyBindingItem(void) {
-
- XKMSUnverifiedKeyBindingImpl * u;
-
- XSECnew(u, XKMSUnverifiedKeyBindingImpl(m_msg.mp_env));
-
- m_unverifiedKeyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankUnverifiedKeyBinding();
-
- // Append the element
-
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return u;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSLocateResultImpl.hpp b/xsec/xkms/impl/XKMSLocateResultImpl.hpp
deleted file mode 100644
index 917286d2..00000000
--- a/xsec/xkms/impl/XKMSLocateResultImpl.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSLocateResultImpl := Implementation of LocateResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSLOCATERESULTIMPL_INCLUDE
-#define XKMSLOCATERESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSLocateResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSUnverifiedKeyBindingImpl;
-
-
-class XKMSLocateResultImpl : public XKMSLocateResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSLocateResultImpl(
- const XSECEnv * env
- );
-
- XKMSLocateResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSLocateResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankLocateResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getUnverifiedKeyBindingSize(void) const;
- virtual XKMSUnverifiedKeyBinding * getUnverifiedKeyBindingItem(int item) const;
- virtual XKMSUnverifiedKeyBinding * appendUnverifiedKeyBindingItem(void);
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSUnverifiedKeyBindingImpl *> UnverifiedKeyBindingVectorType;
-#else
- typedef std::vector<XKMSUnverifiedKeyBindingImpl *> UnverifiedKeyBindingVectorType;
-#endif
-
- UnverifiedKeyBindingVectorType m_unverifiedKeyBindingList;
-
- // Unimplemented
- XKMSLocateResultImpl(const XKMSLocateResultImpl &);
- XKMSLocateResultImpl & operator = (const XKMSLocateResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSLOCATERESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.cpp b/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.cpp
deleted file mode 100644
index 1352f6a8..00000000
--- a/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageAbstractTypeImpl := Implementation class for base XKMS messages
- *
- * $Id$
- *
- */
-
-#include <xsec/dsig/DSIGSignature.hpp>
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSMessageAbstractTypeImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-#include <xercesc/util/Janitor.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractTypeImpl::XKMSMessageAbstractTypeImpl(
- const XSECEnv * env) :
-
-mp_env(env),
-mp_messageAbstractTypeElement(NULL),
-mp_idAttr(NULL),
-mp_serviceAttr(NULL),
-mp_nonceAttr(NULL),
-mp_signatureElement(NULL),
-mp_opaqueClientDataElement(NULL),
-mp_signature(NULL) {
-
- m_opaqueClientDataSize = 0;
-}
-
-XKMSMessageAbstractTypeImpl::XKMSMessageAbstractTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-
-mp_env(env),
-mp_messageAbstractTypeElement(node),
-mp_idAttr(NULL),
-mp_serviceAttr(NULL),
-mp_nonceAttr(NULL),
-mp_signatureElement(NULL),
-mp_opaqueClientDataElement(NULL),
-mp_signature(NULL) {
-
- m_opaqueClientDataSize = 0;
-}
-
-XKMSMessageAbstractTypeImpl::~XKMSMessageAbstractTypeImpl() {
-
- // We own the environment, so we delete it.
-
- delete mp_env;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSMessageAbstractTypeImpl::load(void) {
-
- if (mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::load - called on empty DOM");
-
- }
-
- // Id
- mp_idAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagId);
- // Service
- mp_serviceAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagService);
- // Nonce
- mp_nonceAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagNonce);
-
- // Id and Service MUST be set for a message to be OK
-
- if (mp_idAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSMessageAbstractType::load - Id attribute not found");
- }
-
- if (mp_serviceAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSMessageAbstractType::load - Service attribute not found");
- }
-
- // Check for <Signature> node
- mp_signatureElement = (DOMElement *) findFirstChildOfType(mp_messageAbstractTypeElement, DOMNode::ELEMENT_NODE);
-
- while (mp_signatureElement != NULL &&
- !strEquals(getDSIGLocalName(mp_signatureElement), XKMSConstants::s_tagSignature)) {
-
- mp_signatureElement = findNextElementChild(mp_signatureElement);
-
- }
-
- // The provider will take care of cleaning this up later.
-
- if (mp_signatureElement != NULL) {
-
- mp_signature = m_prov.newSignatureFromDOM(mp_signatureElement->getOwnerDocument(),
- mp_signatureElement);
- mp_signature->load();
-
- }
-
- // Cheque for OpaqueClientData
- mp_opaqueClientDataElement = (DOMElement *) findFirstChildOfType(mp_messageAbstractTypeElement, DOMNode::ELEMENT_NODE);
- while (mp_opaqueClientDataElement != NULL &&
- !strEquals(getXKMSLocalName(mp_opaqueClientDataElement), XKMSConstants::s_tagOpaqueClientData)) {
-
- mp_opaqueClientDataElement = findNextElementChild(mp_opaqueClientDataElement);
-
- }
-
- if (mp_opaqueClientDataElement != NULL) {
-
- DOMElement * c = findFirstElementChild(mp_opaqueClientDataElement);
- while (c != NULL) {
-
- if (!strEquals(getXKMSLocalName(c), XKMSConstants::s_tagOpaqueData)) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSMessageAbstractType::load - Only <OpaqueData> children allowed for <OpaqueClientData>");
- }
-
- if (findFirstChildOfType(c, DOMNode::TEXT_NODE) == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSMessageAbstractType::load - OpaqueData elements require a text child containing Base64 data");
- }
-
- ++m_opaqueClientDataSize;
-
- c = findNextElementChild(c);
-
- }
-
- }
-}
-
-// --------------------------------------------------------------------------------
-// Create blank
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSMessageAbstractTypeImpl::createBlankMessageAbstractType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, tag);
-
- mp_messageAbstractTypeElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- // Set namespace
- if (prefix[0] == chNull) {
- str.sbTranscodeIn("xmlns");
- }
- else {
- str.sbTranscodeIn("xmlns:");
- str.sbXMLChCat(prefix);
- }
-
- mp_messageAbstractTypeElement->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- str.rawXMLChBuffer(),
- XKMSConstants::s_unicodeStrURIXKMS);
-
- mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
-
- // Setup the service URI
- mp_messageAbstractTypeElement->setAttributeNS(NULL,
- XKMSConstants::s_tagService,
- service);
- mp_serviceAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagService);
-
-
- // Setup the id
- XMLCh * myId;
-
- if (id == NULL)
- myId = generateId();
-
- mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagId, id ? id : myId);
- if (id == NULL)
- XSEC_RELEASE_XMLCH(myId);
- mp_messageAbstractTypeElement->setIdAttributeNS(NULL, XKMSConstants::s_tagId, true);
- mp_idAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagId);
-
- // Nonce is blank at start
- mp_nonceAttr = NULL;
-
- return mp_messageAbstractTypeElement;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Getter interfaces
-// --------------------------------------------------------------------------------
-
-bool XKMSMessageAbstractTypeImpl::isSigned(void) const {
-
- return mp_signature != NULL;
-
-}
-
-DSIGSignature * XKMSMessageAbstractTypeImpl::getSignature(void) const {
-
- return mp_signature;
-
-}
-
-
-DOMElement * XKMSMessageAbstractTypeImpl::getElement(void) const {
-
- return mp_messageAbstractTypeElement;
-
-}
-
-const XMLCh * XKMSMessageAbstractTypeImpl::getId(void) const {
-
- return (mp_idAttr != NULL ? mp_idAttr->getNodeValue() : NULL);
-
-}
-
-const XMLCh * XKMSMessageAbstractTypeImpl::getService(void) const {
-
- return (mp_serviceAttr != NULL ? mp_serviceAttr->getNodeValue() : NULL);
-
-}
-
-const XMLCh * XKMSMessageAbstractTypeImpl::getNonce(void) const {
-
- return (mp_nonceAttr != NULL ? mp_nonceAttr->getNodeValue() : NULL);
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter Interfaces
-// --------------------------------------------------------------------------------
-
-void XKMSMessageAbstractTypeImpl::setId(const XMLCh * id) {
-
- if (mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::setId - called on non-initialised structure");
-
- }
-
- mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagId, id);
- mp_messageAbstractTypeElement->setIdAttributeNS(NULL, XKMSConstants::s_tagId, true);
- mp_idAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagId);
-
-}
-
-void XKMSMessageAbstractTypeImpl::setService(const XMLCh * service) {
-
- if (mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::setService - called on non-initialised structure");
-
- }
-
- mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagService, service);
- mp_serviceAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagService);
-
-}
-
-void XKMSMessageAbstractTypeImpl::setNonce(const XMLCh * uri) {
-
- if (mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::setNonce - called on non-initialised structure");
-
- }
-
- mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagNonce, uri);
- mp_nonceAttr =
- mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagNonce);
-
-}
-
-DSIGSignature * XKMSMessageAbstractTypeImpl::addSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) {
-
- DSIGSignature * ret = m_prov.newSignature();
- DOMElement * elt = ret->createBlankSignature(mp_env->getParentDocument(), c14nAlgorithm, signatureAlgorithm);
-
- /* Create the enveloping reference */
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(getId());
-
- DSIGReference *ref = ret->createReference(sb.rawXMLChBuffer(), hashAlgorithm);
- ref->appendEnvelopedSignatureTransform();
- ref->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
-
- /* Embed the signature in the document */
- DOMNode * c = mp_messageAbstractTypeElement->getFirstChild();
- if (c != NULL) {
- if (mp_env->getPrettyPrintFlag() == true) {
- mp_messageAbstractTypeElement->insertBefore(
- mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- c);
- }
- mp_messageAbstractTypeElement->insertBefore(elt, c);
- }
- else
- mp_messageAbstractTypeElement->appendChild(elt);
-
- mp_signature = ret;
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Opaque Client Data interface
-// --------------------------------------------------------------------------------
-
-int XKMSMessageAbstractTypeImpl::getOpaqueClientDataSize(void) {
-
- return m_opaqueClientDataSize;
-
-}
-const XMLCh * XKMSMessageAbstractTypeImpl::getOpaqueClientDataItemStr(int item) {
-
- if (item < 0 || item > m_opaqueClientDataSize) {
-
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::getOpaqueClientDataItemStr - index out of range");
- }
-
- DOMElement * c = findFirstElementChild(mp_opaqueClientDataElement);
- int i = 0;
-
- while (i < item) {
-
- c = findNextElementChild(c);
- if (c == NULL) {
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSMessageAbstractType::getOpaqueClientDataItemStr - index unexpectedly out of range");
- }
- ++i;
- }
-
- return findFirstChildOfType(c, DOMNode::TEXT_NODE)->getNodeValue();
-
-}
-
-void XKMSMessageAbstractTypeImpl::appendOpaqueClientDataItem(const XMLCh * item) {
-
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- if (mp_opaqueClientDataElement == NULL) {
-
- makeQName(str, prefix, XKMSConstants::s_tagOpaqueClientData);
-
- mp_opaqueClientDataElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
- mp_env->doPrettyPrint(mp_opaqueClientDataElement);
-
- /* Have to insert before anything else in the message */
- DOMElement * te;
- te = findFirstElementChild(mp_messageAbstractTypeElement);
- while (te != NULL &&
- strEquals(getXKMSLocalName(te), XKMSConstants::s_tagSignature))
- te = findNextElementChild(te);
-
- if (te == NULL) {
-
- mp_messageAbstractTypeElement->appendChild(mp_opaqueClientDataElement);
- mp_env->doPrettyPrint(mp_messageAbstractTypeElement);
- }
- else {
- mp_messageAbstractTypeElement->insertBefore(mp_opaqueClientDataElement, te);
- if (mp_env->getPrettyPrintFlag()) {
- mp_messageAbstractTypeElement->insertBefore(
- mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), te);
- }
- }
- }
-
- makeQName(str, prefix, XKMSConstants::s_tagOpaqueData);
- DOMElement * e = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
- e->appendChild(doc->createTextNode(item));
- mp_opaqueClientDataElement->appendChild(e);
- mp_env->doPrettyPrint(mp_opaqueClientDataElement);
-
- m_opaqueClientDataSize++;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.hpp b/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.hpp
deleted file mode 100644
index afab38c4..00000000
--- a/xsec/xkms/impl/XKMSMessageAbstractTypeImpl.hpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageAbstractTypeImpl := Implementation class for base XKMS messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSMESSAGEABSTRACTTYPEIMPL_INCLUDE
-#define XKMSMESSAGEABSTRACTTYPEIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSMessageAbstractType.hpp>
-#include <xsec/framework/XSECProvider.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECEnv;
-class DSIGSignature;
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-XSEC_DECLARE_XERCES_CLASS(DOMAttr);
-
-class XKMSMessageAbstractTypeImpl : public XKMSMessageAbstractType {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSMessageAbstractTypeImpl(
- const XSECEnv * env
- );
-
- XKMSMessageAbstractTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSMessageAbstractTypeImpl() ;
-
- // load
- void load(void);
-
- // Create from scratch - tag is the element name to create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankMessageAbstractType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id = NULL);
-
- /* Message Manipulation Methods */
-
- virtual XKMSMessageAbstractType::messageType getMessageType(void) {
- return XKMSMessageAbstractType::None;
- }
-
- /* Getter Interface Methods */
-
- virtual bool isSigned(void) const;
- virtual DSIGSignature * getSignature(void) const;
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const;
- virtual const XMLCh * getId(void) const;
- virtual const XMLCh * getService(void) const;
- virtual const XMLCh * getNonce(void) const;
-
- /* Setter interface methods */
-
- virtual void setId(const XMLCh * id);
- virtual void setService(const XMLCh * service);
- virtual void setNonce(const XMLCh * uri);
- virtual DSIGSignature * addSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm);
-
- /* Opaque Client Data interface */
- virtual int getOpaqueClientDataSize(void);
- virtual const XMLCh * getOpaqueClientDataItemStr(int item);
- virtual void appendOpaqueClientDataItem(const XMLCh * item);
-
-public:
-
- const XSECEnv * mp_env; // NOTE: Owned by the base message class
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_messageAbstractTypeElement;
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_idAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_serviceAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_nonceAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_signatureElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_opaqueClientDataElement;
-
- XSECProvider m_prov;
- DSIGSignature * mp_signature;
-
- int m_opaqueClientDataSize;
-
- // Unimplemented
- XKMSMessageAbstractTypeImpl(void);
- XKMSMessageAbstractTypeImpl(const XKMSMessageAbstractTypeImpl &);
- XKMSMessageAbstractTypeImpl & operator = (const XKMSMessageAbstractTypeImpl &);
-
-};
-
-#define XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS \
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * \
- getElement(void) const \
- {return m_msg.getElement();} \
- virtual bool isSigned(void) const \
- {return m_msg.isSigned();} \
- virtual DSIGSignature * getSignature(void) const \
- {return m_msg.getSignature();} \
- virtual const XMLCh * getId(void) const \
- {return m_msg.getId();} \
- virtual const XMLCh * getService(void) const \
- {return m_msg.getService();} \
- virtual const XMLCh * getNonce(void) const \
- {return m_msg.getNonce();} \
- virtual void setId(const XMLCh * id) \
- {m_msg.setId(id);} \
- virtual void setService(const XMLCh * service) \
- {m_msg.setService(service);} \
- virtual void setNonce(const XMLCh * uri) \
- {m_msg.setNonce(uri);} \
- virtual DSIGSignature * addSignature( \
- const XMLCh* c14nAlgorithm, \
- const XMLCh* signatureAlgorithm, \
- const XMLCh* hashAlgorithm) \
- {return m_msg.addSignature(c14nAlgorithm,signatureAlgorithm,hashAlgorithm);} \
- virtual int getOpaqueClientDataSize(void) \
- {return m_msg.getOpaqueClientDataSize();} \
- virtual const XMLCh * getOpaqueClientDataItemStr(int item) \
- {return m_msg.getOpaqueClientDataItemStr(item);} \
- virtual void appendOpaqueClientDataItem(const XMLCh * item) \
- {m_msg.appendOpaqueClientDataItem(item);}
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSMESSAGEABSTRACTTYPEIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSMessageFactoryImpl.cpp b/xsec/xkms/impl/XKMSMessageFactoryImpl.cpp
deleted file mode 100644
index 77fd4b90..00000000
--- a/xsec/xkms/impl/XKMSMessageFactoryImpl.cpp
+++ /dev/null
@@ -1,1236 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageFactoryImpl := Implementation of the XKMSMessageFactory class
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSCompoundRequestImpl.hpp"
-#include "XKMSCompoundResultImpl.hpp"
-#include "XKMSMessageFactoryImpl.hpp"
-#include "XKMSLocateRequestImpl.hpp"
-#include "XKMSLocateResultImpl.hpp"
-#include "XKMSStatusRequestImpl.hpp"
-#include "XKMSStatusResultImpl.hpp"
-#include "XKMSResultImpl.hpp"
-#include "XKMSValidateRequestImpl.hpp"
-#include "XKMSValidateResultImpl.hpp"
-#include "XKMSPendingRequestImpl.hpp"
-#include "XKMSRegisterRequestImpl.hpp"
-#include "XKMSRegisterResultImpl.hpp"
-#include "XKMSRevokeResultImpl.hpp"
-#include "XKMSRevokeRequestImpl.hpp"
-#include "XKMSRecoverResultImpl.hpp"
-#include "XKMSRecoverRequestImpl.hpp"
-#include "XKMSReissueResultImpl.hpp"
-#include "XKMSReissueRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/Janitor.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSMessageFactoryImpl::XKMSMessageFactoryImpl(void) {
-
- // Factory isn't tied to a particular document
-
- XSECnew(mp_env, XSECEnv(NULL));
- mp_env->setDSIGNSPrefix(MAKE_UNICODE_STRING("ds"));
-
-};
-
-XKMSMessageFactoryImpl::~XKMSMessageFactoryImpl(void) {
-
- delete mp_env;
-
-};
-
-// --------------------------------------------------------------------------------
-// Internal methods
-// --------------------------------------------------------------------------------
-
-void XKMSMessageFactoryImpl::copyRequestToResult(XKMSRequestAbstractType * req,
- XKMSResultType * res) {
-
-
- /* Set the requestId */
- res->setRequestId(req->getId());
-
- /* Copy any Opaque Data */
-
- int i;
- int sz = req->getOpaqueClientDataSize();
- for (i = 0; i < sz; ++i) {
- res->appendOpaqueClientDataItem(req->getOpaqueClientDataItemStr(i));
- }
-
- /* Set RequestSignatureValue data if necessary */
- sz = req->getResponseMechanismSize();
- for (i = 0; i < sz; ++i) {
- if (strEquals(req->getResponseMechanismItemStr(i), XKMSConstants::s_tagRequestSignatureValue)) {
- DSIGSignature *s = req->getSignature();
- if (s != NULL && res->getResultMinor() != XKMSResultType::NoAuthentication) {
-
- res->setRequestSignatureValue(s->getSignatureValue());
-
- }
-
- break;
- }
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Set/get the namespace prefix to be used when creating nodes
-// --------------------------------------------------------------------------------
-
-void XKMSMessageFactoryImpl::setDSIGNSPrefix(const XMLCh * prefix) {
-
- mp_env->setDSIGNSPrefix(prefix);
-
-}
-void XKMSMessageFactoryImpl::setECNSPrefix(const XMLCh * prefix) {
-
- mp_env->setECNSPrefix(prefix);
-
-}
-void XKMSMessageFactoryImpl::setXPFNSPrefix(const XMLCh * prefix) {
-
- mp_env->setXPFNSPrefix(prefix);
-
-}
-void XKMSMessageFactoryImpl::setXENCNSPrefix(const XMLCh * prefix) {
-
- mp_env->setXENCNSPrefix(prefix);
-
-}
-void XKMSMessageFactoryImpl::setXKMSNSPrefix(const XMLCh * prefix) {
-
- mp_env->setXKMSNSPrefix(prefix);
-
-}
-
-// --------------------------------------------------------------------------------
-// DOM Based construction
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType * XKMSMessageFactoryImpl::newMessageFromDOM(
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * elt) {
-
-
- XSECEnv * env;
- XSECnew(env, XSECEnv(*mp_env));
-
- env->setParentDocument(elt->getOwnerDocument());
-
- if (elt == NULL) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSMessageFactory::newMessageFromDOM - called on empty DOM");
-
- }
-
- // See if this is a known element
- const XMLCh * name = getXKMSLocalName(elt);
-
- if (strEquals(name, XKMSConstants::s_tagCompoundRequest)) {
-
- // This is a <CompoundRequest> message
- XKMSCompoundRequestImpl * ret;
- XSECnew(ret, XKMSCompoundRequestImpl(env, elt));
-
- ret->load();
-
- return (XKMSCompoundRequest*) ret;
-
- }
-
- if (strEquals(name, XKMSConstants::s_tagCompoundResult)) {
-
- // This is a <CompoundResult> message
- XKMSCompoundResultImpl * ret;
- XSECnew(ret, XKMSCompoundResultImpl(env, elt));
-
- ret->load();
-
- return (XKMSCompoundRequest*) ret;
-
- }
-
- if (strEquals(name, XKMSConstants::s_tagLocateRequest)) {
-
- // This is a <LocateRequest> message
- XKMSLocateRequestImpl * ret;
- XSECnew(ret, XKMSLocateRequestImpl(env, elt));
-
- ret->load();
-
- return (XKMSLocateRequest *) ret;
-
- }
-
- if (strEquals(name, XKMSConstants::s_tagValidateRequest)) {
-
- // This is a <ValidateRequest> message
- XKMSValidateRequestImpl * ret;
- XSECnew(ret, XKMSValidateRequestImpl(env, elt));
-
- ret->load();
-
- return (XKMSValidateRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagLocateResult)) {
-
- // This is a <LocateRequest> message
- XKMSLocateResultImpl * ret;
- XSECnew(ret, XKMSLocateResultImpl(env, elt));
- Janitor<XKMSLocateResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSLocateResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagValidateResult)) {
-
- // This is a <LocateRequest> message
- XKMSValidateResultImpl * ret;
- XSECnew(ret, XKMSValidateResultImpl(env, elt));
- Janitor<XKMSValidateResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSValidateResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagResult)) {
-
- // This is a <LocateRequest> message
- XKMSResultImpl * ret;
- XSECnew(ret, XKMSResultImpl(env, elt));
- Janitor<XKMSResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagPendingRequest)) {
-
- // This is a <PendingRequest> message
- XKMSPendingRequestImpl * ret;
- XSECnew(ret, XKMSPendingRequestImpl(env, elt));
- Janitor<XKMSPendingRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSPendingRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagStatusRequest)) {
-
- // This is a <StatusRequest> message
- XKMSStatusRequestImpl * ret;
- XSECnew(ret, XKMSStatusRequestImpl(env, elt));
- Janitor<XKMSStatusRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSStatusRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagStatusResult)) {
-
- // This is a <StatusRequest> message
- XKMSStatusResultImpl * ret;
- XSECnew(ret, XKMSStatusResultImpl(env, elt));
- Janitor<XKMSStatusResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSStatusResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagRegisterRequest)) {
-
- // This is a <PendingRequest> message
- XKMSRegisterRequestImpl * ret;
- XSECnew(ret, XKMSRegisterRequestImpl(env, elt));
- Janitor<XKMSRegisterRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRegisterRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagRegisterResult)) {
-
- // This is a <RegisterResult> message
- XKMSRegisterResultImpl * ret;
- XSECnew(ret, XKMSRegisterResultImpl(env, elt));
- Janitor<XKMSRegisterResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRegisterResult *) ret;
-
- }
- else if (strEquals(name, XKMSConstants::s_tagRevokeRequest)) {
-
- // This is a <RevokeRequest> message
- XKMSRevokeRequestImpl * ret;
- XSECnew(ret, XKMSRevokeRequestImpl(env, elt));
- Janitor<XKMSRevokeRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRevokeRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagRevokeResult)) {
-
- // This is a <RevokeResult> message
- XKMSRevokeResultImpl * ret;
- XSECnew(ret, XKMSRevokeResultImpl(env, elt));
- Janitor<XKMSRevokeResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRevokeResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagRecoverRequest)) {
-
- // This is a <RevokeRequest> message
- XKMSRecoverRequestImpl * ret;
- XSECnew(ret, XKMSRecoverRequestImpl(env, elt));
- Janitor<XKMSRecoverRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRecoverRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagRecoverResult)) {
-
- // This is a <RecoverResult> message
- XKMSRecoverResultImpl * ret;
- XSECnew(ret, XKMSRecoverResultImpl(env, elt));
- Janitor<XKMSRecoverResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSRecoverResult *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagReissueRequest)) {
-
- // This is a <ReissueRequest> message
- XKMSReissueRequestImpl * ret;
- XSECnew(ret, XKMSReissueRequestImpl(env, elt));
- Janitor<XKMSReissueRequestImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSReissueRequest *) ret;
-
- }
-
- else if (strEquals(name, XKMSConstants::s_tagReissueResult)) {
-
- // This is a <RevokeResult> message
- XKMSReissueResultImpl * ret;
- XSECnew(ret, XKMSReissueResultImpl(env, elt));
- Janitor<XKMSReissueResultImpl> j_ret(ret);
-
- ret->load();
-
- j_ret.release();
- return (XKMSReissueResult *) ret;
-
- }
-
- delete env;
- return NULL;
-
-}
-
-// --------------------------------------------------------------------------------
-// Construction from scratch
-// --------------------------------------------------------------------------------
-
-XKMSCompoundRequest * XKMSMessageFactoryImpl::createCompoundRequest(
- const XMLCh * service,
- DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSCompoundRequestImpl * cri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(cri, XKMSCompoundRequestImpl(tenv));
- cri->createBlankCompoundRequest(service, id);
-
- return cri;
-
-}
-
-XKMSCompoundRequest * XKMSMessageFactoryImpl::createCompoundRequest(
- const XMLCh * service,
- DOMDocument **doc,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSCompoundRequest * cri = createCompoundRequest(service, *doc, id);
- (*doc)->appendChild(cri->getElement());
-
- return cri;
-}
-
-XKMSLocateRequest * XKMSMessageFactoryImpl::createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSLocateRequestImpl * lri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(lri, XKMSLocateRequestImpl(tenv));
- lri->createBlankLocateRequest(service, id);
-
- return lri;
-
-}
-
-
-XKMSLocateRequest * XKMSMessageFactoryImpl::createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSLocateRequest * lri = createLocateRequest(service, *doc, id);
- (*doc)->appendChild(lri->getElement());
-
- return lri;
-}
-
-XKMSValidateRequest * XKMSMessageFactoryImpl::createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSValidateRequestImpl * vri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(vri, XKMSValidateRequestImpl(tenv));
- vri->createBlankValidateRequest(service, id);
-
- return vri;
-
-}
-
-
-XKMSValidateRequest * XKMSMessageFactoryImpl::createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSValidateRequest * vri = createValidateRequest(service, *doc, id);
- (*doc)->appendChild(vri->getElement());
-
- return vri;
-}
-
-XKMSPendingRequest * XKMSMessageFactoryImpl::createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSPendingRequestImpl * pri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(pri, XKMSPendingRequestImpl(tenv));
- pri->createBlankPendingRequest(service, id);
-
- return pri;
-
-}
-
-
-XKMSPendingRequest * XKMSMessageFactoryImpl::createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSPendingRequest * pri = createPendingRequest(service, *doc, id);
- (*doc)->appendChild(pri->getElement());
-
- return pri;
-}
-
-XKMSStatusRequest * XKMSMessageFactoryImpl::createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSStatusRequestImpl* sri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(sri, XKMSStatusRequestImpl(tenv));
- sri->createBlankStatusRequest(service, id);
-
- return sri;
-
-}
-
-XKMSStatusRequest * XKMSMessageFactoryImpl::createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSStatusRequest * sri = createStatusRequest(service, *doc, id);
- (*doc)->appendChild(sri->getElement());
-
- return sri;
-}
-
-XKMSRegisterRequest * XKMSMessageFactoryImpl::createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSRegisterRequestImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRegisterRequestImpl(tenv));
- rri->createBlankRegisterRequest(service, id);
-
- return rri;
-
-}
-
-
-XKMSRegisterRequest * XKMSMessageFactoryImpl::createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRegisterRequest * rri = createRegisterRequest(service, *doc, id);
- (*doc)->appendChild(rri->getElement());
-
- return rri;
-}
-
-XKMSRevokeRequest * XKMSMessageFactoryImpl::createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSRevokeRequestImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRevokeRequestImpl(tenv));
- rri->createBlankRevokeRequest(service, id);
-
- return rri;
-
-}
-
-
-XKMSRevokeRequest * XKMSMessageFactoryImpl::createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRevokeRequest * rri = createRevokeRequest(service, *doc, id);
- (*doc)->appendChild(rri->getElement());
-
- return rri;
-}
-
-XKMSRecoverRequest * XKMSMessageFactoryImpl::createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSRecoverRequestImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRecoverRequestImpl(tenv));
- rri->createBlankRecoverRequest(service, id);
-
- return rri;
-
-}
-
-
-XKMSRecoverRequest * XKMSMessageFactoryImpl::createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRecoverRequest * rri = createRecoverRequest(service, *doc, id);
- (*doc)->appendChild(rri->getElement());
-
- return rri;
-}
-
-XKMSReissueRequest * XKMSMessageFactoryImpl::createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id) {
-
- XKMSReissueRequestImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSReissueRequestImpl(tenv));
- rri->createBlankReissueRequest(service, id);
-
- return rri;
-
-}
-
-
-XKMSReissueRequest * XKMSMessageFactoryImpl::createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id) {
-
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSReissueRequest * rri = createReissueRequest(service, *doc, id);
- (*doc)->appendChild(rri->getElement());
-
- return rri;
-}
-
-// --------------------------------------------------------------------------------
-// Create a result based on a request
-// --------------------------------------------------------------------------------
-
-XKMSLocateResult * XKMSMessageFactoryImpl::createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSLocateResultImpl * lri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(lri, XKMSLocateResultImpl(tenv));
- lri->createBlankLocateResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) lri);
-
- return lri;
-
-}
-
-XKMSLocateResult * XKMSMessageFactoryImpl::createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSLocateResult * lr = createLocateResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(lr->getElement());
-
- return lr;
-}
-
-XKMSStatusResult * XKMSMessageFactoryImpl::createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSStatusResultImpl * sri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(sri, XKMSStatusResultImpl(tenv));
- sri->createBlankStatusResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) sri);
-
- return sri;
-
-}
-
-XKMSStatusResult * XKMSMessageFactoryImpl::createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSStatusResult * sr = createStatusResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(sr->getElement());
-
- return sr;
-}
-
-XKMSResult * XKMSMessageFactoryImpl::createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSResultImpl * ri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(ri, XKMSResultImpl(tenv));
- ri->createBlankResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) ri);
-
- return ri;
-
-}
-
-XKMSResult * XKMSMessageFactoryImpl::createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSResult * r = createResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(r->getElement());
-
- return r;
-}
-
-XKMSValidateResult * XKMSMessageFactoryImpl::createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSValidateResultImpl * vri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(vri, XKMSValidateResultImpl(tenv));
- vri->createBlankValidateResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) vri);
-
- return vri;
-
-}
-
-XKMSValidateResult * XKMSMessageFactoryImpl::createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSValidateResult * vr = createValidateResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(vr->getElement());
-
- return vr;
-}
-
-XKMSCompoundResult * XKMSMessageFactoryImpl::createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSCompoundResultImpl * cri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(cri, XKMSCompoundResultImpl(tenv));
- cri->createBlankCompoundResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) cri);
-
- return cri;
-
-}
-
-XKMSCompoundResult * XKMSMessageFactoryImpl::createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSCompoundResult * cr = createCompoundResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(cr->getElement());
-
- return cr;
-}
-
-XKMSRegisterResult * XKMSMessageFactoryImpl::createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRegisterResultImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRegisterResultImpl(tenv));
- rri->createBlankRegisterResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
-
- return rri;
-
-}
-
-XKMSRegisterResult * XKMSMessageFactoryImpl::createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRegisterResult * rr = createRegisterResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(rr->getElement());
-
- return rr;
-}
-
-
-XKMSRevokeResult * XKMSMessageFactoryImpl::createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRevokeResultImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRevokeResultImpl(tenv));
- rri->createBlankRevokeResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
-
- return rri;
-
-}
-
-
-XKMSRevokeResult * XKMSMessageFactoryImpl::createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRevokeResult * rr = createRevokeResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(rr->getElement());
-
- return rr;
-}
-
-XKMSReissueResult * XKMSMessageFactoryImpl::createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSReissueResultImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSReissueResultImpl(tenv));
- rri->createBlankReissueResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
-
- return rri;
-
-}
-
-XKMSReissueResult * XKMSMessageFactoryImpl::createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSReissueResult * rr = createReissueResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(rr->getElement());
-
- return rr;
-}
-
-XKMSRecoverResult * XKMSMessageFactoryImpl::createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- XKMSRecoverResultImpl * rri;
-
- XSECEnv * tenv;
- XSECnew(tenv, XSECEnv(*mp_env));
- tenv->setParentDocument(doc);
-
- XSECnew(rri, XKMSRecoverResultImpl(tenv));
- rri->createBlankRecoverResult(request->getService(), id, rmaj, rmin);
-
- copyRequestToResult(request, (XKMSResultTypeImpl*) rri);
-
- return rri;
-
-}
-
-XKMSRecoverResult * XKMSMessageFactoryImpl::createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin,
- const XMLCh * id) {
-
- // Create a document to put the element in
-
- XMLCh tempStr[100];
- XMLString::transcode("Core", tempStr, 99);
- DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
-
- *doc = impl->createDocument();
-
- // Embed the new structure in the document
- XKMSRecoverResult * rr = createRecoverResult(request, *doc, rmaj, rmin, id);
- (*doc)->appendChild(rr->getElement());
-
- return rr;
-}
-
-// --------------------------------------------------------------------------------
-// Message Conversions
-// --------------------------------------------------------------------------------
-
-
-XKMSRequestAbstractType * XKMSMessageFactoryImpl::toRequestAbstractType(XKMSMessageAbstractType *msg) {
-
-
- switch (msg->getMessageType()) {
-
- case XKMSMessageAbstractType::LocateRequest :
- case XKMSMessageAbstractType::ValidateRequest :
- case XKMSMessageAbstractType::CompoundRequest :
- case XKMSMessageAbstractType::PendingRequest :
- case XKMSMessageAbstractType::RegisterRequest :
- case XKMSMessageAbstractType::RevokeRequest :
- case XKMSMessageAbstractType::RecoverRequest :
- case XKMSMessageAbstractType::ReissueRequest :
- case XKMSMessageAbstractType::StatusRequest :
-
- return (XKMSRequestAbstractType *) msg;
-
- default:
-
- return NULL;
- }
-
- return NULL;
-
-}
-
-XKMSResultType * XKMSMessageFactoryImpl::toResultType(XKMSMessageAbstractType *msg) {
-
- switch (msg->getMessageType()) {
-
- case XKMSMessageAbstractType::LocateResult :
- case XKMSMessageAbstractType::ValidateResult :
- case XKMSMessageAbstractType::CompoundResult :
- case XKMSMessageAbstractType::RegisterResult :
- case XKMSMessageAbstractType::RevokeResult :
- case XKMSMessageAbstractType::RecoverResult :
- case XKMSMessageAbstractType::ReissueResult :
- case XKMSMessageAbstractType::StatusResult :
- case XKMSMessageAbstractType::Result :
-
- return (XKMSResultType *) msg;
-
- default:
- return NULL;
- }
- return NULL;
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSMessageFactoryImpl.hpp b/xsec/xkms/impl/XKMSMessageFactoryImpl.hpp
deleted file mode 100644
index 33d6c3bb..00000000
--- a/xsec/xkms/impl/XKMSMessageFactoryImpl.hpp
+++ /dev/null
@@ -1,286 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSMessageFactoryImpl := Implementation of the XKMSMessageFactory class
- *
- * $Id$
- *
- */
-
-#ifndef XKMSMESSAGEFACTORYIMPL_INCLUDE
-#define XKMSMESSAGEFACTORYIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSMessageFactory.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECProvider;
-class XKMSCompoundRequest;
-class XKMSCompoundResult;
-class XSECEnv;
-
-class XKMSMessageFactoryImpl : public XKMSMessageFactory {
-
-protected:
-
- XKMSMessageFactoryImpl(void);
-
-public:
-
- virtual ~XKMSMessageFactoryImpl();
-
- /* DOM based construction methods */
-
- virtual XKMSMessageAbstractType * newMessageFromDOM(
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * elt);
-
- /* Construction from scratch */
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSLocateRequest * createLocateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSValidateRequest * createValidateRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
- virtual XKMSCompoundRequest * createCompoundRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSCompoundRequest * createCompoundRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
- virtual XKMSPendingRequest * createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc,
- const XMLCh * id = NULL);
- virtual XKMSPendingRequest * createPendingRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
- virtual XKMSStatusRequest * createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSStatusRequest * createStatusRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
-
-
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSLocateResult * createLocateResult(
- XKMSLocateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSResult * createResult(
- XKMSRequestAbstractType * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSValidateResult * createValidateResult(
- XKMSValidateRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSCompoundResult * createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSCompoundResult * createCompoundResult(
- XKMSCompoundRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSStatusResult * createStatusResult(
- XKMSStatusRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
-
- /* X-KRSS Construction from Scratch */
-
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSRegisterRequest * createRegisterRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
-
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRegisterResult * createRegisterResult(
- XKMSRegisterRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
-
-
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSRevokeRequest * createRevokeRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
-
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRevokeResult * createRevokeResult(
- XKMSRevokeRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
-
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSRecoverRequest * createRecoverRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
-
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSRecoverResult * createRecoverResult(
- XKMSRecoverRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
-
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- const XMLCh * id = NULL);
- virtual XKMSReissueRequest * createReissueRequest(
- const XMLCh * service,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- const XMLCh * id = NULL);
-
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
- virtual XKMSReissueResult * createReissueResult(
- XKMSReissueRequest * request,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument **doc,
- XKMSResultType::ResultMajor rmaj,
- XKMSResultType::ResultMinor rmin = XKMSResultType::NoneMinor,
- const XMLCh * id = NULL);
-
- /* Conversions */
- virtual XKMSRequestAbstractType * toRequestAbstractType(XKMSMessageAbstractType *msg);
- virtual XKMSResultType * toResultType(XKMSMessageAbstractType *msg);
-
-
-
- /* Environment Manipulation */
- virtual void setDSIGNSPrefix(const XMLCh * prefix);
- virtual void setECNSPrefix(const XMLCh * prefix);
- virtual void setXPFNSPrefix(const XMLCh * prefix);
- virtual void setXENCNSPrefix(const XMLCh * prefix);
- virtual void setXKMSNSPrefix(const XMLCh * prefix);
-
-
- friend class XSECProvider;
- friend class XKMSCompoundRequestImpl;
- friend class XKMSCompoundResultImpl;
-
-private:
-
- // Internal methods
- void copyRequestToResult(XKMSRequestAbstractType * req, XKMSResultType * res);
- // Environment
- XSECEnv * mp_env;
-
- // Unimplemented
- XKMSMessageFactoryImpl(const XKMSMessageFactoryImpl &);
- XKMSMessageFactoryImpl & operator = (const XKMSMessageFactoryImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSMESSAGEFACTORYIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSNotBoundAuthentication.cpp b/xsec/xkms/impl/XKMSNotBoundAuthentication.cpp
deleted file mode 100644
index 6fc77a0a..00000000
--- a/xsec/xkms/impl/XKMSNotBoundAuthentication.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSNotBoundAuthenticationImpl := Implementation for NotBoundAuthentication elements
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSNotBoundAuthenticationImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSNotBoundAuthenticationImpl::XKMSNotBoundAuthenticationImpl(const XSECEnv * env) :
-mp_env(env),
-mp_notBoundAuthenticationElement(NULL),
-mp_protocolAttr(NULL),
-mp_valueAttr(NULL)
-{
-
-}
-
-XKMSNotBoundAuthenticationImpl::XKMSNotBoundAuthenticationImpl(const XSECEnv * env,
- DOMElement * node) :
-mp_env(env),
-mp_notBoundAuthenticationElement(node),
-mp_protocolAttr(NULL),
-mp_valueAttr(NULL)
-{
-
-}
-
-XKMSNotBoundAuthenticationImpl::~XKMSNotBoundAuthenticationImpl() {
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSNotBoundAuthenticationImpl::load(void) {
-
- if (mp_notBoundAuthenticationElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSNotBoundAuthenticationImpl::load - called on empty DOM");
- }
-
- mp_protocolAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagProtocol);
- mp_valueAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagValue);
-
- // Protocol and Value *must* be set
-
- if (mp_protocolAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSNotBoundAuthentication::load - Protocol attribute not found");
- }
- if (mp_valueAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSNotBoundAuthentication::load - Value attribute not found");
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSNotBoundAuthenticationImpl::createBlankNotBoundAuthentication(
- const XMLCh * protocol, const XMLCh * value) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagNotBoundAuthentication);
-
- mp_notBoundAuthenticationElement =
- doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
-
- // Set URI and value
- mp_notBoundAuthenticationElement->setAttributeNS(NULL,
- XKMSConstants::s_tagProtocol,
- protocol);
- mp_notBoundAuthenticationElement->setAttributeNS(NULL,
- XKMSConstants::s_tagValue,
- value);
-
- mp_env->doPrettyPrint(mp_notBoundAuthenticationElement);
-
- mp_protocolAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagProtocol);
- mp_valueAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagValue);
-
- return mp_notBoundAuthenticationElement;
-}
-
-// --------------------------------------------------------------------------------
-// Get interfaces
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSNotBoundAuthenticationImpl::getProtocol(void) const {
-
- if (mp_protocolAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSNotBoundAuthenticationImpl::getProtocol- called on empty DOM");
- }
-
- return mp_protocolAttr->getNodeValue();
-
-}
-
-
-const XMLCh * XKMSNotBoundAuthenticationImpl::getValue(void) const {
-
- if (mp_valueAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSNotBoundAuthenticationImpl::getValue- called on empty DOM");
- }
-
- return mp_valueAttr->getNodeValue();
-}
-// --------------------------------------------------------------------------------
-// Set Interfaces
-// --------------------------------------------------------------------------------
-
-void XKMSNotBoundAuthenticationImpl::setProtocol(const XMLCh * uri) {
-
- mp_notBoundAuthenticationElement->setAttributeNS(NULL,
- XKMSConstants::s_tagProtocol,
- uri);
- mp_protocolAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagProtocol);
-
-}
-
-void XKMSNotBoundAuthenticationImpl::setValue(const XMLCh * value) {
-
- mp_notBoundAuthenticationElement->setAttributeNS(NULL,
- XKMSConstants::s_tagValue,
- value);
- mp_valueAttr =
- mp_notBoundAuthenticationElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagValue);
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSNotBoundAuthenticationImpl.hpp b/xsec/xkms/impl/XKMSNotBoundAuthenticationImpl.hpp
deleted file mode 100644
index 8b1e3da1..00000000
--- a/xsec/xkms/impl/XKMSNotBoundAuthenticationImpl.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSNotBoundAuthenticationImpl := Interface for NotBoundAuthentication elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSNOTBOUNDAUTHENTICATIONIMPL_INCLUDE
-#define XKMSNOTBOUNDAUTHENTICATIONIMPL_INCLUDE
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#include <xsec/xkms/XKMSNotBoundAuthentication.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XKMSNotBoundAuthenticationImpl : public XKMSNotBoundAuthentication {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSNotBoundAuthenticationImpl(
- const XSECEnv * env
- );
-
- XKMSNotBoundAuthenticationImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSNotBoundAuthenticationImpl();
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankNotBoundAuthentication(const XMLCh * protocol, const XMLCh * value);
-
- // Get interfaces
-
- virtual const XMLCh * getProtocol(void) const;
- virtual const XMLCh * getValue(void) const;
-
- // Set Methods
-
- virtual void setProtocol(const XMLCh * uri);
- virtual void setValue(const XMLCh * value);
-
- //@}
-
-private:
-
- const XSECEnv * mp_env;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_notBoundAuthenticationElement;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_protocolAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_valueAttr;
-
- // Unimplemented
- XKMSNotBoundAuthenticationImpl(void);
- XKMSNotBoundAuthenticationImpl(const XKMSNotBoundAuthenticationImpl &);
- XKMSNotBoundAuthenticationImpl & operator = (const XKMSNotBoundAuthenticationImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSNOTBOUNDAUTHENTICATIONIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSPendingRequestImpl.cpp b/xsec/xkms/impl/XKMSPendingRequestImpl.cpp
deleted file mode 100644
index 9036feea..00000000
--- a/xsec/xkms/impl/XKMSPendingRequestImpl.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPendingRequestImpl := Implementation of PendingRequest Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSPendingRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSPendingRequestImpl::XKMSPendingRequestImpl(
- const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_responseIdAttr(NULL) {
-}
-
-XKMSPendingRequestImpl::XKMSPendingRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_responseIdAttr(NULL) {
-
-}
-
-XKMSPendingRequestImpl::~XKMSPendingRequestImpl() {
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSPendingRequestImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSPendingRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagPendingRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSPendingRequest::load - called incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for ResponseId attribute
- mp_responseIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
-
- if (mp_responseIdAttr == NULL) {
- // Attempt to load an empty element
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSPendingRequest::load - No ResponseId attribute found");
- }
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSPendingRequestImpl::createBlankPendingRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagPendingRequest, service, id);
-// return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
-// MAKE_UNICODE_STRING("ValidateRequest"), service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSPendingRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::PendingRequest;
-
-}
-
-
-const XMLCh * XKMSPendingRequestImpl::getResponseId(void) const {
-
- if (mp_responseIdAttr == NULL) {
-
- // Attempt read when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSPendingRequest::getResponseId - called on non-initialised structure");
-
- }
-
- return mp_responseIdAttr->getNodeValue();
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-void XKMSPendingRequestImpl::setResponseId(const XMLCh * responseId) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSPendingRequest::setResponseId - called on non-initialised structure");
-
- }
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagResponseId, responseId);
- mp_responseIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSPendingRequestImpl.hpp b/xsec/xkms/impl/XKMSPendingRequestImpl.hpp
deleted file mode 100644
index cd9eccef..00000000
--- a/xsec/xkms/impl/XKMSPendingRequestImpl.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPendingRequestImpl := Implementation of PendingRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSPENDINGREQUESTIMPL_INCLUDE
-#define XKMSPENDINGREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSPendingRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSPendingRequestImpl : public XKMSPendingRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSPendingRequestImpl(
- const XSECEnv * env
- );
-
- XKMSPendingRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSPendingRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankPendingRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual const XMLCh * getResponseId(void) const;
-
- /* Setter interface methods */
- virtual void setResponseId(const XMLCh * responseId);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_responseIdAttr;
-
- // Unimplemented
- XKMSPendingRequestImpl(const XKMSPendingRequestImpl &);
- XKMSPendingRequestImpl & operator = (const XKMSPendingRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSPENDINGREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.cpp
deleted file mode 100644
index 2184755c..00000000
--- a/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPrototypeKeyBindingImpl := Implementation of PrototypeKeyBinding elements
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSPrototypeKeyBindingImpl.hpp"
-#include "XKMSValidityIntervalImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSPrototypeKeyBindingImpl::XKMSPrototypeKeyBindingImpl(const XSECEnv * env) :
-XKMSKeyBindingAbstractTypeImpl(env),
-mp_validityInterval(NULL),
-mp_revocationCodeIdentifierElement(NULL) {
-
-}
-
-XKMSPrototypeKeyBindingImpl::XKMSPrototypeKeyBindingImpl(const XSECEnv * env, DOMElement * node) :
-XKMSKeyBindingAbstractTypeImpl(env, node),
-mp_validityInterval(NULL),
-mp_revocationCodeIdentifierElement(NULL) {
-
-}
-
-XKMSPrototypeKeyBindingImpl::~XKMSPrototypeKeyBindingImpl() {
-
- if (mp_validityInterval != NULL)
- delete mp_validityInterval;
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSPrototypeKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSPrototypeKeyBindingImpl::load - called on empty DOM");
- }
-
-
- DOMElement * tmpElt = findFirstElementChild(mp_keyBindingAbstractTypeElement);
-
- while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagValidityInterval) &&
- !strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagRevocationCodeIdentifier))
- tmpElt = findNextElementChild(tmpElt);
-
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagValidityInterval)) {
-
- XSECnew(mp_validityInterval, XKMSValidityIntervalImpl(mp_env, tmpElt));
- mp_validityInterval->load();
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagRevocationCodeIdentifier)) {
-
- mp_revocationCodeIdentifierElement = tmpElt;
-
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSPrototypeKeyBindingImpl::createBlankPrototypeKeyBinding(void) {
-
- DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagPrototypeKeyBinding);
-
- // Must have an Id
-
- XKMSKeyBindingAbstractTypeImpl::setId();
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get methods
-// --------------------------------------------------------------------------------
-
-XKMSValidityInterval * XKMSPrototypeKeyBindingImpl::getValidityInterval(void) const {
-
- return mp_validityInterval;
-
-}
-
-const XMLCh * XKMSPrototypeKeyBindingImpl::getRevocationCodeIdentifier(void) const {
-
- if (mp_revocationCodeIdentifierElement == NULL)
- return NULL;
-
- DOMNode * t = findFirstChildOfType(mp_revocationCodeIdentifierElement, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSPrototypeKeyBindingImpl::getRevocationCodeIdentifier - expected TEXT node");
- }
-
- return t->getNodeValue();
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-void XKMSPrototypeKeyBindingImpl::setValidityInterval(const XMLCh * notBefore, const XMLCh * notOnOrAfter) {
-
- XSECnew(mp_validityInterval, XKMSValidityIntervalImpl(mp_env));
- DOMElement * e = mp_validityInterval->createBlankValidityInterval(notBefore, notOnOrAfter);
-
- // Now insert
- if (mp_revocationCodeIdentifierElement != NULL) {
- mp_keyBindingAbstractTypeElement->insertBefore(e, mp_revocationCodeIdentifierElement);
- if (mp_env->getPrettyPrintFlag() == true) {
- mp_keyBindingAbstractTypeElement->insertBefore(
- mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- mp_revocationCodeIdentifierElement);
- }
- }
- else
- mp_keyBindingAbstractTypeElement->appendChild(e);
-
-}
-
-void XKMSPrototypeKeyBindingImpl::setRevocationCodeIdentifier(const XMLCh * identifier) {
-
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagRevocationCodeIdentifier);
-
- mp_revocationCodeIdentifierElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_keyBindingAbstractTypeElement->appendChild(mp_revocationCodeIdentifierElement);
- mp_env->doPrettyPrint(mp_keyBindingAbstractTypeElement);
-
- mp_revocationCodeIdentifierElement->appendChild(
- mp_env->getParentDocument()->createTextNode(identifier));
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.hpp
deleted file mode 100644
index b5981d0b..00000000
--- a/xsec/xkms/impl/XKMSPrototypeKeyBindingImpl.hpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSPrototypeKeyBindingImpl := Implementation of PrototypeKeyBinding elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSPROTOTYPEKEYBINDINGIMPL_INCLUDE
-#define XKMSPROTOTYPEKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSPrototypeKeyBinding.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSValidityIntervalImpl;
-
-class XKMSPrototypeKeyBindingImpl : public XKMSPrototypeKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSPrototypeKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSPrototypeKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSPrototypeKeyBindingImpl();
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankPrototypeKeyBinding(void);
-
- // Get methods
-
- virtual XKMSValidityInterval * getValidityInterval(void) const;
- virtual const XMLCh * getRevocationCodeIdentifier(void) const;
-
- // set methods
-
- virtual void setValidityInterval(const XMLCh * notBefore, const XMLCh * notOnOrAfter);
- virtual void setRevocationCodeIdentifier(const XMLCh * identifier);
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XKMSValidityIntervalImpl
- * mp_validityInterval;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_revocationCodeIdentifierElement;
-
- // Unimplemented
- XKMSPrototypeKeyBindingImpl(void);
- XKMSPrototypeKeyBindingImpl(const XKMSPrototypeKeyBindingImpl &);
- XKMSPrototypeKeyBindingImpl & operator = (const XKMSPrototypeKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSPROTOTYPEKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSQueryKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSQueryKeyBindingImpl.cpp
deleted file mode 100644
index 1d3edc61..00000000
--- a/xsec/xkms/impl/XKMSQueryKeyBindingImpl.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSQueryKeyBindingImpl := Implementation for QueryKeyBinding
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSQueryKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSQueryKeyBindingImpl::XKMSQueryKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
-
-}
-
-XKMSQueryKeyBindingImpl::XKMSQueryKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
-}
-
-XKMSQueryKeyBindingImpl::~XKMSQueryKeyBindingImpl() {}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSQueryKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSQueryKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSQueryKeyBindingImpl::createBlankQueryKeyBinding(void) {
-
- return XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagQueryKeyBinding);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSQueryKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSQueryKeyBindingImpl.hpp
deleted file mode 100644
index eb9d0d61..00000000
--- a/xsec/xkms/impl/XKMSQueryKeyBindingImpl.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSQueryKeyBindingImpl := Implementation for QueryKeyBinding
- *
- * $Id$
- *
- */
-
-#ifndef XKMSQUERYKEYBINDINGIMPL_INCLUDE
-#define XKMSQUERYKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSQueryKeyBinding.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSQueryKeyBindingImpl : public XKMSQueryKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSQueryKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSQueryKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSQueryKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankQueryKeyBinding(void);
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- // Unimplemented
- XKMSQueryKeyBindingImpl(void);
- XKMSQueryKeyBindingImpl(const XKMSQueryKeyBindingImpl &);
- XKMSQueryKeyBindingImpl & operator = (const XKMSQueryKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSQUERYKEYBINDING_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRSAKeyPairImpl.cpp b/xsec/xkms/impl/XKMSRSAKeyPairImpl.cpp
deleted file mode 100644
index 35c19bf2..00000000
--- a/xsec/xkms/impl/XKMSRSAKeyPairImpl.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRSAKeyPairImpl := Implementation class for RSAKeyPair elements
- *
- * $Id:$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRSAKeyPairImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-#define XKMS_GET_RSA_VAL(XVAL) e = (DOMElement *) findNextElementChild(e); \
- if (e == NULL || !strEquals(getXKMSLocalName(e), XKMSConstants::s_tag##XVAL) || \
- ((t = findFirstChildOfType(e, DOMNode::TEXT_NODE)) == NULL)) { \
- throw XSECException(XSECException::ExpectedXKMSChildNotFound, \
- "XKMSRSAKeyPair::load - Expected <XVAL> node"); \
- } \
- mp_##XVAL = t->getNodeValue();
-
-#define XKMS_SET_RSA_VAL(XVAL) makeQName(str, prefix, XKMSConstants::s_tag##XVAL); \
- e = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS, \
- str.rawXMLChBuffer());\
- e->appendChild(doc->createTextNode(XVAL));\
- mp_RSAKeyPairElement->appendChild(e);\
- mp_env->doPrettyPrint(mp_RSAKeyPairElement);
-
-#define XKMS_RET_RSA_VAL(XVAL) const XMLCh * XKMSRSAKeyPairImpl::get##XVAL (void) const {\
- return mp_##XVAL;}
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRSAKeyPairImpl::XKMSRSAKeyPairImpl(const XSECEnv * env) :
-mp_env(env),
-mp_RSAKeyPairElement(NULL),
-mp_Modulus(NULL),
-mp_Exponent(NULL),
-mp_P(NULL),
-mp_Q(NULL),
-mp_DP(NULL),
-mp_DQ(NULL),
-mp_InverseQ(NULL),
-mp_D(NULL) {}
-
-XKMSRSAKeyPairImpl::XKMSRSAKeyPairImpl(const XSECEnv * env, DOMElement * node) :
-mp_env(env),
-mp_RSAKeyPairElement(node),
-mp_Modulus(NULL),
-mp_Exponent(NULL),
-mp_P(NULL),
-mp_Q(NULL),
-mp_DP(NULL),
-mp_DQ(NULL),
-mp_InverseQ(NULL),
-mp_D(NULL) {}
-
-
-XKMSRSAKeyPairImpl::~XKMSRSAKeyPairImpl() {}
-
-// --------------------------------------------------------------------------------
-// load
-// --------------------------------------------------------------------------------
-
-void XKMSRSAKeyPairImpl::load(void) {
-
- if (mp_RSAKeyPairElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRSAKeyPair::load - called on empty DOM");
-
- }
-
- DOMElement * e;
- DOMNode * t;
- // Check for Modulus node
- e = (DOMElement *) findFirstElementChild(mp_RSAKeyPairElement);
- if (e == NULL || !strEquals(getXKMSLocalName(e), XKMSConstants::s_tagModulus) ||
- ((t = findFirstChildOfType(e, DOMNode::TEXT_NODE)) == NULL)) {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRSAKeyPair::load - Expected <Modulus> node");
-
- }
- mp_Modulus = t->getNodeValue();
-
- XKMS_GET_RSA_VAL(Exponent);
- XKMS_GET_RSA_VAL(P);
- XKMS_GET_RSA_VAL(Q);
- XKMS_GET_RSA_VAL(DP);
- XKMS_GET_RSA_VAL(DQ);
- XKMS_GET_RSA_VAL(InverseQ);
- XKMS_GET_RSA_VAL(D);
-
-}
-
-// --------------------------------------------------------------------------------
-// Build from Scratch
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRSAKeyPairImpl::createBlankXKMSRSAKeyPairImpl(
- const XMLCh * Modulus,
- const XMLCh * Exponent,
- const XMLCh * P,
- const XMLCh * Q,
- const XMLCh * DP,
- const XMLCh * DQ,
- const XMLCh * InverseQ,
- const XMLCh * D) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagRSAKeyPair);
-
- mp_RSAKeyPairElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(mp_RSAKeyPairElement);
-
- /* Now add the Values element */
- DOMElement * e;
- XKMS_SET_RSA_VAL(Modulus)
- XKMS_SET_RSA_VAL(Exponent)
- XKMS_SET_RSA_VAL(P)
- XKMS_SET_RSA_VAL(Q)
- XKMS_SET_RSA_VAL(DP)
- XKMS_SET_RSA_VAL(DQ)
- XKMS_SET_RSA_VAL(InverseQ)
- XKMS_SET_RSA_VAL(D)
-
- return mp_RSAKeyPairElement;
-
-}
-
-XKMS_RET_RSA_VAL(Modulus)
-XKMS_RET_RSA_VAL(Exponent)
-XKMS_RET_RSA_VAL(P)
-XKMS_RET_RSA_VAL(Q)
-XKMS_RET_RSA_VAL(DP)
-XKMS_RET_RSA_VAL(DQ)
-XKMS_RET_RSA_VAL(InverseQ)
-XKMS_RET_RSA_VAL(D)
-
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRSAKeyPairImpl.hpp b/xsec/xkms/impl/XKMSRSAKeyPairImpl.hpp
deleted file mode 100644
index a2fc3508..00000000
--- a/xsec/xkms/impl/XKMSRSAKeyPairImpl.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRSAKeyPairImpl := Implementation class for RSAKeyPair elements
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSRSAKEYPAIRIMPL_INCLUDE
-#define XKMSRSAKEYPAIRIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRSAKeyPair.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECEnv;
-
-class XKMSRSAKeyPairImpl : public XKMSRSAKeyPair {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSRSAKeyPairImpl(
- const XSECEnv * env
- );
-
- XKMSRSAKeyPairImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRSAKeyPairImpl() ;
-
- // load
- void load(void);
-
- // Create from scratch - tag is the element name to create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankXKMSRSAKeyPairImpl(
- const XMLCh * Modulus,
- const XMLCh * Exponent,
- const XMLCh * P,
- const XMLCh * Q,
- const XMLCh * DO,
- const XMLCh * DQ,
- const XMLCh * InverseQ,
- const XMLCh * D);
-
- // Interface methods
-
- virtual const XMLCh * getModulus(void) const;
- virtual const XMLCh * getExponent(void) const;
- virtual const XMLCh * getP(void) const;
- virtual const XMLCh * getQ(void) const;
- virtual const XMLCh * getDP(void) const;
- virtual const XMLCh * getDQ(void) const;
- virtual const XMLCh * getInverseQ(void) const;
- virtual const XMLCh * getD(void) const;
-
-private:
-
- const XSECEnv * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_RSAKeyPairElement;
-
- const XMLCh * mp_Modulus;
- const XMLCh * mp_Exponent;
- const XMLCh * mp_P;
- const XMLCh * mp_Q;
- const XMLCh * mp_DP;
- const XMLCh * mp_DQ;
- const XMLCh * mp_InverseQ;
- const XMLCh * mp_D;
-
- // Unimplemented
- XKMSRSAKeyPairImpl();
- XKMSRSAKeyPairImpl(const XKMSRSAKeyPairImpl &);
- XKMSRSAKeyPairImpl & operator = (const XKMSRSAKeyPairImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRSAKEYPAIRIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.cpp
deleted file mode 100644
index 3ffb53c5..00000000
--- a/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverKeyBindingImpl := Implementation for RecoverKeyBinding
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRecoverKeyBindingImpl.hpp"
-#include "XKMSStatusImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRecoverKeyBindingImpl::XKMSRecoverKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
- mp_status = NULL;
-}
-
-XKMSRecoverKeyBindingImpl::XKMSRecoverKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
- mp_status = NULL;
-}
-
-XKMSRecoverKeyBindingImpl::~XKMSRecoverKeyBindingImpl() {
-
- if (mp_status != NULL)
- delete mp_status;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSRecoverKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRecoverKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
- /* Find the status element */
- DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagStatus);
-
- if (nl == NULL || nl->getLength() != 1) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRecoverKeyBinding::load - Status value not found");
- }
-
- XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
- mp_status->load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRecoverKeyBindingImpl::createBlankRecoverKeyBinding(XKMSStatus::StatusValue status) {
-
- DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagRecoverKeyBinding);
-
- mp_env->doPrettyPrint(ret);
-
- // Create the status element
- XSECnew(mp_status, XKMSStatusImpl(mp_env));
- ret->appendChild(mp_status->createBlankStatus(status));
- mp_env->doPrettyPrint(ret);
-
- // Must have an Id
- XKMSKeyBindingAbstractTypeImpl::setId();
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Status handling
-// --------------------------------------------------------------------------------
-
-XKMSStatus * XKMSRecoverKeyBindingImpl::getStatus(void) const {
-
- return mp_status;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.hpp
deleted file mode 100644
index 7cf26780..00000000
--- a/xsec/xkms/impl/XKMSRecoverKeyBindingImpl.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverKeyBinding := Implementation for RecoverKeyBinding
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERKEYBINDINGIMPL_INCLUDE
-#define XKMSRECOVERKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRecoverKeyBinding.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSStatusImpl;
-
-class XKMSRecoverKeyBindingImpl : public XKMSRecoverKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSRecoverKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSRecoverKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRecoverKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRecoverKeyBinding(XKMSStatus::StatusValue status);
-
- // Interface
- virtual XKMSStatus * getStatus(void) const;
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XKMSStatusImpl * mp_status;
-
- // Unimplemented
- XKMSRecoverKeyBindingImpl(void);
- XKMSRecoverKeyBindingImpl(const XKMSRecoverKeyBindingImpl &);
- XKMSRecoverKeyBindingImpl & operator = (const XKMSRecoverKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRECOVERKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRecoverRequestImpl.cpp b/xsec/xkms/impl/XKMSRecoverRequestImpl.cpp
deleted file mode 100644
index 9df9f91a..00000000
--- a/xsec/xkms/impl/XKMSRecoverRequestImpl.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverRequestImpl := Implementation for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRecoverRequestImpl.hpp"
-#include "XKMSRecoverKeyBindingImpl.hpp"
-#include "XKMSAuthenticationImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRecoverRequestImpl::XKMSRecoverRequestImpl(const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_recoverKeyBinding(NULL) {
-}
-
-XKMSRecoverRequestImpl::XKMSRecoverRequestImpl(const XSECEnv * env, DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_recoverKeyBinding(NULL) {
-}
-
-XKMSRecoverRequestImpl::~XKMSRecoverRequestImpl() {
-
- if (mp_authentication != NULL)
- delete mp_authentication;
- if (mp_recoverKeyBinding != NULL)
- delete mp_recoverKeyBinding;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSRecoverRequestImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRecoverRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverRequest::load - called on incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any RecoverKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagRecoverKeyBinding)) {
- tmpElt = findNextElementChild(tmpElt);
- }
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_recoverKeyBinding, XKMSRecoverKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_recoverKeyBinding->load();
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRecoverRequest::load - Expected RecoverKeyBinding node");
-
- }
-
- // Authentication Element
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagAuthentication)) {
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env, tmpElt));
- mp_authentication->load(mp_recoverKeyBinding->getId());
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRecoverRequest::load - Expected Authentication node");
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRecoverRequestImpl::
- createBlankRecoverRequest(const XMLCh * service, const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagRecoverRequest, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// MessageType
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRecoverRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RecoverRequest;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Methods
-// --------------------------------------------------------------------------------
-
-XKMSRecoverKeyBinding * XKMSRecoverRequestImpl::getRecoverKeyBinding(void) const {
-
- return mp_recoverKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRecoverRequestImpl::getAuthentication (void) const {
-
- return mp_authentication;
-
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-XKMSRecoverKeyBinding * XKMSRecoverRequestImpl::addRecoverKeyBinding(XKMSStatus::StatusValue status) {
-
- if (mp_recoverKeyBinding != NULL)
- return mp_recoverKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_recoverKeyBinding, XKMSRecoverKeyBindingImpl(m_msg.mp_env));
- DOMElement * elt = mp_recoverKeyBinding->createBlankRecoverKeyBinding(status);
-
- // Insert
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagAuthentication) &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode)) {
- be = findNextElementChild(be);
- }
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_recoverKeyBinding;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_recoverKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRecoverRequestImpl::addAuthentication(void) {
-
- if (mp_authentication != NULL)
- return mp_authentication;
-
- if (mp_recoverKeyBinding == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverRequestImpl::addAuthentication - called prior to key infos being added");
- }
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env));
- DOMElement * e =
- mp_authentication->createBlankAuthentication(mp_recoverKeyBinding->getId());
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL && !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode))
- be = findNextElementChild(be);
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_authentication;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_authentication;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRecoverRequestImpl.hpp b/xsec/xkms/impl/XKMSRecoverRequestImpl.hpp
deleted file mode 100644
index 424db5ae..00000000
--- a/xsec/xkms/impl/XKMSRecoverRequestImpl.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverRequestImpl := Implementation for RecoverRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERREQUESTIMPL_INCLUDE
-#define XKMSRECOVERREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRecoverRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSAuthenticationImpl;
-class DSIGSignature;
-class XKMSRecoverKeyBindingImpl;
-
-class XKMSRecoverRequestImpl : public XKMSRecoverRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRecoverRequestImpl(
- const XSECEnv * env
- );
-
- XKMSRecoverRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRecoverRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRecoverRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual XKMSRecoverKeyBinding * getRecoverKeyBinding(void) const;
- virtual XKMSAuthentication * getAuthentication (void) const;
-
- /* Setter Interface Methods */
-
- virtual XKMSRecoverKeyBinding * addRecoverKeyBinding(XKMSStatus::StatusValue status);
- virtual XKMSAuthentication * addAuthentication(void);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-
-private:
-
- XKMSAuthenticationImpl * mp_authentication;
- XKMSRecoverKeyBindingImpl * mp_recoverKeyBinding;
-
- XSECProvider m_prov; // For creating the signature
-
- // Unimplemented
- XKMSRecoverRequestImpl(void);
- XKMSRecoverRequestImpl(const XKMSRecoverRequestImpl &);
- XKMSRecoverRequestImpl & operator = (const XKMSRecoverRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRECOVERREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRecoverResultImpl.cpp b/xsec/xkms/impl/XKMSRecoverResultImpl.cpp
deleted file mode 100644
index 9e27c838..00000000
--- a/xsec/xkms/impl/XKMSRecoverResultImpl.cpp
+++ /dev/null
@@ -1,380 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverResultImpl := Implementation of RecoverResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/XSECCryptoUtils.hpp>
-#include <xsec/enc/XSECCryptoKey.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECAlgorithmMapper.hpp>
-#include <xsec/framework/XSECAlgorithmHandler.hpp>
-#include <xsec/xenc/XENCEncryptedData.hpp>
-#include <xsec/xenc/XENCEncryptionMethod.hpp>
-#include <xsec/xenc/XENCCipher.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRecoverResultImpl.hpp"
-#include "XKMSKeyBindingImpl.hpp"
-#include "XKMSRSAKeyPairImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRecoverResultImpl::XKMSRecoverResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg),
-mp_RSAKeyPair(NULL),
-mp_privateKeyElement(NULL) {
-
-}
-
-XKMSRecoverResultImpl::XKMSRecoverResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg),
-mp_RSAKeyPair(NULL),
-mp_privateKeyElement(NULL) {
-
-}
-
-XKMSRecoverResultImpl::~XKMSRecoverResultImpl() {
-
- XKMSRecoverResultImpl::KeyBindingVectorType::iterator i;
-
- for (i = m_keyBindingList.begin() ; i != m_keyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
- if (mp_RSAKeyPair != NULL)
- delete mp_RSAKeyPair;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSRecoverResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRecoverResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagKeyBinding);
-
- if (nl != NULL) {
-
- XKMSKeyBindingImpl * kb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(kb, XKMSKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_keyBindingList.push_back(kb);
- kb->load();
-
- }
-
- }
-
- nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagPrivateKey);
-
- if (nl != NULL)
- mp_privateKeyElement = (DOMElement *) nl->item(0);
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSRecoverResultImpl::createBlankRecoverResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagRecoverResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRecoverResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RecoverResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSRecoverResultImpl::getKeyBindingSize(void) const {
-
- return (int) m_keyBindingList.size();
-
-}
-
-XKMSKeyBinding * XKMSRecoverResultImpl::getKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_keyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getKeyBindingItem - item out of range");
- }
-
- return m_keyBindingList[item];
-
-}
-
-XKMSKeyBinding * XKMSRecoverResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
-
- XKMSKeyBindingImpl * u;
-
- XSECnew(u, XKMSKeyBindingImpl(m_msg.mp_env));
-
- m_keyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankKeyBinding(status);
-
- // Append the element
- DOMElement * c = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (c != NULL) {
-
- if (strEquals(getXKMSLocalName(c), XKMSConstants::s_tagPrivateKey))
- break;
-
- }
-
- if (c != NULL) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, c);
- if (m_msg.mp_env->getPrettyPrintFlag()) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), c);
- }
- }
- else {
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
-
- return u;
-
-}
-
-// --------------------------------------------------------------------------------
-// RSAKeyPair handling
-// --------------------------------------------------------------------------------
-
-XKMSRSAKeyPair * XKMSRecoverResultImpl::getRSAKeyPair(const char * passPhrase) {
-
- // Already done?
- if (mp_RSAKeyPair != NULL)
- return mp_RSAKeyPair;
-
- // Nope - can we do it?
- if (mp_privateKeyElement == NULL)
- return NULL;
-
- // Yep! Load the key
- unsigned char kbuf[XSEC_MAX_HASH_SIZE];
- unsigned int len = CalculateXKMSKEK((unsigned char *) passPhrase, (int) strlen(passPhrase), kbuf, XSEC_MAX_HASH_SIZE);
-
- if (len == 0) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getRSAKeyPair - error deriving KEK");
- }
-
- XSECProvider prov;
- XENCCipher * cipher = prov.newCipher(m_msg.mp_env->getParentDocument());
-
- // Find the encrypted info
- DOMNode * n = findXENCNode(mp_privateKeyElement, "EncryptedData");
-
- // Load into the Cipher class
- XENCEncryptedData * xed = cipher->loadEncryptedData((DOMElement *) n);
- if (xed == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getRSAKeyPair - error loading encrypted data");
- }
-
- // Setup the appropriate key
- if (xed->getEncryptionMethod() == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getRSAKeyPair - no <EncryptionMethod> in EncryptedData");
- }
-
- // Now find if we can get an algorithm for this URI
- const XSECAlgorithmHandler *handler =
- XSECPlatformUtils::g_algorithmMapper->mapURIToHandler(
- xed->getEncryptionMethod()->getAlgorithm());
-
- if (handler == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getRSAKeyPair - unable to handle algorithm in EncryptedData");
- }
-
- XSECCryptoKey * sk = handler->createKeyForURI(
- xed->getEncryptionMethod()->getAlgorithm(),
- (XMLByte *) kbuf,
- len);
-
- memset(kbuf, 0, XSEC_MAX_HASH_SIZE);
-
- cipher->setKey(sk);
- cipher->decryptElement();
-
- // WooHoo - if we get this far things are looking good!
- DOMElement * kp = findFirstElementChild(mp_privateKeyElement);
- if (kp == NULL || !strEquals(getXKMSLocalName(kp), XKMSConstants::s_tagRSAKeyPair)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::getRSAKeyPair - private key did not decrypt to RSAKeyPair");
-
- }
-
- XSECnew(mp_RSAKeyPair, XKMSRSAKeyPairImpl(m_msg.mp_env, kp));
- mp_RSAKeyPair->load();
-
- return mp_RSAKeyPair;
-}
-
-XENCEncryptedData * XKMSRecoverResultImpl::setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI) {
-
- // Try to set up the key first - if this fails, don't want to have added the
- // XML
-
- // Find if we can get an algorithm for this URI
- const XSECAlgorithmHandler *handler =
- XSECPlatformUtils::g_algorithmMapper->mapURIToHandler(algorithmURI);
-
- if (handler == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::setRSAKeyPair - unable to handle algorithm");
- }
-
- unsigned char kbuf[XSEC_MAX_HASH_SIZE];
- unsigned int len = CalculateXKMSKEK((unsigned char *) passPhrase, (int) strlen(passPhrase), kbuf, XSEC_MAX_HASH_SIZE);
-
- if (len == 0) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRecoverResult::setRSAKeyPair - error deriving KEK");
- }
-
- XSECCryptoKey * sk = handler->createKeyForURI(
- algorithmURI,
- (XMLByte *) kbuf,
- len);
-
- memset(kbuf, 0, XSEC_MAX_HASH_SIZE);
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagPrivateKey);
-
- // Create a PrivateKey to add this to
- DOMElement * pk = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- m_msg.mp_env->doPrettyPrint(pk);
-
- // Add it to the request doc
- m_msg.mp_messageAbstractTypeElement->appendChild(pk);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- // Now create the RSA structure
- XKMSRSAKeyPairImpl * rsa;
- XSECnew(rsa, XKMSRSAKeyPairImpl(m_msg.mp_env));
-
- DOMElement * e =
- rsa->createBlankXKMSRSAKeyPairImpl(Modulus, Exponent, P, Q, DP, DQ, InverseQ, D);
-
- // Add it to the PrivateKey
- pk->appendChild(e);
- m_msg.mp_env->doPrettyPrint(pk);
-
- // Encrypt all of this for future use
- XENCCipher * cipher = m_prov.newCipher(m_msg.mp_env->getParentDocument());
- cipher->setKey(sk);
- cipher->encryptElementContent(pk, algorithmURI);
-
- // Now load the encrypted data back in
- return cipher->loadEncryptedData(findFirstElementChild(pk));
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRecoverResultImpl.hpp b/xsec/xkms/impl/XKMSRecoverResultImpl.hpp
deleted file mode 100644
index dc0a8d77..00000000
--- a/xsec/xkms/impl/XKMSRecoverResultImpl.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRecoverResultImpl := Implementation of RecoverResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRECOVERRESULTIMPL_INCLUDE
-#define XKMSRECOVERRESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRecoverResult.hpp>
-#include <xsec/framework/XSECProvider.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSKeyBindingImpl;
-class XKMSRSAKeyPairImpl;
-class XENCCipherImpl;
-
-class XKMSRecoverResultImpl : public XKMSRecoverResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRecoverResultImpl(
- const XSECEnv * env
- );
-
- XKMSRecoverResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRecoverResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRecoverResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getKeyBindingSize(void) const;
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
- virtual XKMSRSAKeyPair * getRSAKeyPair(const char * passPhrase);
- virtual XENCEncryptedData * setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI);
-
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#else
- typedef std::vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#endif
-
- KeyBindingVectorType m_keyBindingList;
- XKMSRSAKeyPairImpl * mp_RSAKeyPair;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_privateKeyElement;
-
- // To handle the cipher
- XSECProvider m_prov;
-
- // Unimplemented
- XKMSRecoverResultImpl(void);
- XKMSRecoverResultImpl(const XKMSRecoverResultImpl &);
- XKMSRecoverResultImpl & operator = (const XKMSRecoverResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRECOVERRESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRegisterRequestImpl.cpp b/xsec/xkms/impl/XKMSRegisterRequestImpl.cpp
deleted file mode 100644
index 340097a5..00000000
--- a/xsec/xkms/impl/XKMSRegisterRequestImpl.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterRequestImpl := Implementation for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRegisterRequestImpl.hpp"
-#include "XKMSAuthenticationImpl.hpp"
-#include "XKMSPrototypeKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRegisterRequestImpl::XKMSRegisterRequestImpl(const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_prototypeKeyBinding(NULL),
-mp_proofOfPossessionSignature(NULL) {
-}
-
-XKMSRegisterRequestImpl::XKMSRegisterRequestImpl(const XSECEnv * env, DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_prototypeKeyBinding(NULL),
-mp_proofOfPossessionSignature(NULL) {
-}
-
-XKMSRegisterRequestImpl::~XKMSRegisterRequestImpl() {
-
- if (mp_authentication != NULL)
- delete mp_authentication;
- if (mp_prototypeKeyBinding != NULL)
- delete mp_prototypeKeyBinding;
- // Provider will take care of the proofOfPossession signature
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSRegisterRequestImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRegisterRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterRequest::load - called on incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any PrototypeKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagPrototypeKeyBinding)) {
- tmpElt = findNextElementChild(tmpElt);
- }
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_prototypeKeyBinding, XKMSPrototypeKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_prototypeKeyBinding->load();
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRegisterRequest::load - Expected PrototypeKeyBinding node");
-
- }
-
- // Authentication Element
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagAuthentication)) {
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env, tmpElt));
- mp_authentication->load(mp_prototypeKeyBinding->getId());
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRegisterRequest::load - Expected Authentication node");
-
- }
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagProofOfPossession)) {
-
- // Find the signature
-
- DOMElement * sigElt = (DOMElement *) findFirstElementChild(tmpElt);
-
- if (sigElt == NULL || !strEquals(getDSIGLocalName(sigElt),
- XKMSConstants::s_tagSignature)) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRegisterRequest::load - Expected Signature child of ProofOfPossession");
-
- }
-
- // The provider will take care of cleaning this up later.
-
- mp_proofOfPossessionSignature = m_prov.newSignatureFromDOM(m_msg.mp_env->getParentDocument(),
- sigElt);
- mp_proofOfPossessionSignature->load();
-
- // Check the signature is across the correct input
-
- DSIGReferenceList * rl =
- mp_proofOfPossessionSignature->getReferenceList();
-
- if (rl->getSize() != 1) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterRequestImpl::load - ProofOfPossession Signature with incorrect number of references found (should be 1)");
- }
-
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_prototypeKeyBinding->getId());
-
- if (!strEquals(rl->item(0)->getURI(), sb.rawXMLChBuffer())) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterRequestImpl::load - ProofOfPossession Signature refers to incorrect Id (should be for PrototypeKeyBinding)");
- }
-
- // We don't actually check the signature as we have no key material to do so!
- }
-}
-
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRegisterRequestImpl::
- createBlankRegisterRequest(const XMLCh * service, const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagRegisterRequest, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// MessageType
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRegisterRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RegisterRequest;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Methods
-// --------------------------------------------------------------------------------
-
-XKMSPrototypeKeyBinding * XKMSRegisterRequestImpl::getPrototypeKeyBinding(void) const {
-
- return mp_prototypeKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRegisterRequestImpl::getAuthentication (void) const {
-
- return mp_authentication;
-
-}
-
-DSIGSignature * XKMSRegisterRequestImpl::getProofOfPossessionSignature(void) const {
-
- return mp_proofOfPossessionSignature;
-
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-XKMSPrototypeKeyBinding * XKMSRegisterRequestImpl::addPrototypeKeyBinding(void) {
-
- if (mp_prototypeKeyBinding != NULL)
- return mp_prototypeKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_prototypeKeyBinding, XKMSPrototypeKeyBindingImpl(m_msg.mp_env));
- DOMElement * elt = mp_prototypeKeyBinding->createBlankPrototypeKeyBinding();
-
- // Insert
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagAuthentication) &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagProofOfPossession)) {
- be = findNextElementChild(be);
- }
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_prototypeKeyBinding;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_prototypeKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRegisterRequestImpl::addAuthentication(void) {
-
- if (mp_authentication != NULL)
- return mp_authentication;
-
- if (mp_prototypeKeyBinding == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterRequestImpl::addAuthentication - called prior to key infos being added");
- }
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env));
- DOMElement * e =
- mp_authentication->createBlankAuthentication(mp_prototypeKeyBinding->getId());
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL && !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagProofOfPossession))
- be = findNextElementChild(be);
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_authentication;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_authentication;
-
-}
-
-DSIGSignature * XKMSRegisterRequestImpl::addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) {
-
- DSIGSignature * ret = m_prov.newSignature();
- DOMElement * elt = ret->createBlankSignature(m_msg.mp_env->getParentDocument(), c14nAlgorithm, signatureAlgorithm);
-
- /* Create the enveloping reference */
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_prototypeKeyBinding->getId());
-
- DSIGReference *ref = ret->createReference(sb.rawXMLChBuffer(), hashAlgorithm);
- ref->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
-
- /* Embed the signature in the document inside a KeyBindingAuthentication element */
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagProofOfPossession);
-
- DOMElement * t = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- m_msg.mp_env->doPrettyPrint(t);
- t->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(t);
-
- // Now append into the RegisterRequest
- m_msg.mp_messageAbstractTypeElement->appendChild(t);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return ret;
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRegisterRequestImpl.hpp b/xsec/xkms/impl/XKMSRegisterRequestImpl.hpp
deleted file mode 100644
index 42ad718d..00000000
--- a/xsec/xkms/impl/XKMSRegisterRequestImpl.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterRequestImpl := Implementation for RegisterRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREGISTERREQUESTIMPL_INCLUDE
-#define XKMSREGISTERREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRegisterRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSAuthenticationImpl;
-class XKMSPrototypeKeyBindingImpl;
-class DSIGSignature;
-
-class XKMSRegisterRequestImpl : public XKMSRegisterRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRegisterRequestImpl(
- const XSECEnv * env
- );
-
- XKMSRegisterRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRegisterRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRegisterRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual XKMSPrototypeKeyBinding * getPrototypeKeyBinding(void) const;
- virtual XKMSAuthentication * getAuthentication (void) const;
- virtual DSIGSignature * getProofOfPossessionSignature(void) const;
-
- /* Setter Interface Methods */
-
- virtual XKMSPrototypeKeyBinding * addPrototypeKeyBinding(void);
- virtual XKMSAuthentication * addAuthentication(void);
- virtual DSIGSignature * addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-
-private:
-
- XKMSAuthenticationImpl * mp_authentication;
- XKMSPrototypeKeyBindingImpl * mp_prototypeKeyBinding;
- DSIGSignature * mp_proofOfPossessionSignature;
-
- XSECProvider m_prov; // For creating the signature
-
- // Unimplemented
- XKMSRegisterRequestImpl(void);
- XKMSRegisterRequestImpl(const XKMSRegisterRequestImpl &);
- XKMSRegisterRequestImpl & operator = (const XKMSRegisterRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREGISTERREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRegisterResultImpl.cpp b/xsec/xkms/impl/XKMSRegisterResultImpl.cpp
deleted file mode 100644
index 3df8ac02..00000000
--- a/xsec/xkms/impl/XKMSRegisterResultImpl.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterResultImpl := Implementation of RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/enc/XSECCryptoUtils.hpp>
-#include <xsec/enc/XSECCryptoKey.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECAlgorithmMapper.hpp>
-#include <xsec/framework/XSECAlgorithmHandler.hpp>
-#include <xsec/xenc/XENCEncryptedData.hpp>
-#include <xsec/xenc/XENCEncryptionMethod.hpp>
-#include <xsec/xenc/XENCCipher.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRegisterResultImpl.hpp"
-#include "XKMSKeyBindingImpl.hpp"
-#include "XKMSRSAKeyPairImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRegisterResultImpl::XKMSRegisterResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg),
-mp_RSAKeyPair(NULL),
-mp_privateKeyElement(NULL) {
-
-}
-
-XKMSRegisterResultImpl::XKMSRegisterResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg),
-mp_RSAKeyPair(NULL),
-mp_privateKeyElement(NULL) {
-
-}
-
-XKMSRegisterResultImpl::~XKMSRegisterResultImpl() {
-
- XKMSRegisterResultImpl::KeyBindingVectorType::iterator i;
-
- for (i = m_keyBindingList.begin() ; i != m_keyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
- if (mp_RSAKeyPair != NULL)
- delete mp_RSAKeyPair;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSRegisterResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRegisterResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagKeyBinding);
-
- if (nl != NULL) {
-
- XKMSKeyBindingImpl * kb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(kb, XKMSKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_keyBindingList.push_back(kb);
- kb->load();
-
- }
-
- }
-
- nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagPrivateKey);
-
- if (nl != NULL)
- mp_privateKeyElement = (DOMElement *) nl->item(0);
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSRegisterResultImpl::createBlankRegisterResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagRegisterResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRegisterResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RegisterResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSRegisterResultImpl::getKeyBindingSize(void) const {
-
- return (int) m_keyBindingList.size();
-
-}
-
-XKMSKeyBinding * XKMSRegisterResultImpl::getKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_keyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getKeyBindingItem - item out of range");
- }
-
- return m_keyBindingList[item];
-
-}
-
-XKMSKeyBinding * XKMSRegisterResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
-
- XKMSKeyBindingImpl * u;
-
- XSECnew(u, XKMSKeyBindingImpl(m_msg.mp_env));
-
- m_keyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankKeyBinding(status);
-
- // Append the element
- DOMElement * c = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (c != NULL) {
-
- if (strEquals(getXKMSLocalName(c), XKMSConstants::s_tagPrivateKey))
- break;
-
- }
-
- if (c != NULL) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, c);
- if (m_msg.mp_env->getPrettyPrintFlag()) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), c);
- }
- }
- else {
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
-
- return u;
-
-}
-
-// --------------------------------------------------------------------------------
-// RSAKeyPair handling
-// --------------------------------------------------------------------------------
-
-XKMSRSAKeyPair * XKMSRegisterResultImpl::getRSAKeyPair(const char * passPhrase) {
-
- // Already done?
- if (mp_RSAKeyPair != NULL)
- return mp_RSAKeyPair;
-
- // Nope - can we do it?
- if (mp_privateKeyElement == NULL)
- return NULL;
-
- // Yep! Load the key
- unsigned char kbuf[XSEC_MAX_HASH_SIZE];
- unsigned int len = CalculateXKMSKEK((unsigned char *) passPhrase, (int) strlen(passPhrase), kbuf, XSEC_MAX_HASH_SIZE);
-
- if (len == 0) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getRSAKeyPair - error deriving KEK");
- }
-
- XSECProvider prov;
- XENCCipher * cipher = prov.newCipher(m_msg.mp_env->getParentDocument());
-
- // Find the encrypted info
- DOMNode * n = findXENCNode(mp_privateKeyElement, "EncryptedData");
-
- // Load into the Cipher class
- XENCEncryptedData * xed = cipher->loadEncryptedData((DOMElement *) n);
- if (xed == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getRSAKeyPair - error loading encrypted data");
- }
-
- // Setup the appropriate key
- if (xed->getEncryptionMethod() == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getRSAKeyPair - no <EncryptionMethod> in EncryptedData");
- }
-
- // Now find if we can get an algorithm for this URI
- const XSECAlgorithmHandler *handler =
- XSECPlatformUtils::g_algorithmMapper->mapURIToHandler(
- xed->getEncryptionMethod()->getAlgorithm());
-
- if (handler == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getRSAKeyPair - unable to handle algorithm in EncryptedData");
- }
-
- XSECCryptoKey * sk = handler->createKeyForURI(
- xed->getEncryptionMethod()->getAlgorithm(),
- (XMLByte *) kbuf,
- len);
-
- memset(kbuf, 0, XSEC_MAX_HASH_SIZE);
-
- cipher->setKey(sk);
- cipher->decryptElement();
-
- // WooHoo - if we get this far things are looking good!
- DOMElement * kp = findFirstElementChild(mp_privateKeyElement);
- if (kp == NULL || !strEquals(getXKMSLocalName(kp), XKMSConstants::s_tagRSAKeyPair)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::getRSAKeyPair - private key did not decrypt to RSAKeyPair");
-
- }
-
- XSECnew(mp_RSAKeyPair, XKMSRSAKeyPairImpl(m_msg.mp_env, kp));
- mp_RSAKeyPair->load();
-
- return mp_RSAKeyPair;
-}
-
-XENCEncryptedData * XKMSRegisterResultImpl::setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI) {
-
- // Try to set up the key first - if this fails, don't want to have added the
- // XML
-
- // Find if we can get an algorithm for this URI
- const XSECAlgorithmHandler *handler =
- XSECPlatformUtils::g_algorithmMapper->mapURIToHandler(
- algorithmURI);
-
- if (handler == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::setRSAKeyPair - unable to handle algorithm");
- }
-
- unsigned char kbuf[XSEC_MAX_HASH_SIZE];
- unsigned int len = CalculateXKMSKEK((unsigned char *) passPhrase, (int) strlen(passPhrase), kbuf, XSEC_MAX_HASH_SIZE);
-
- if (len == 0) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRegisterResult::setRSAKeyPair - error deriving KEK");
- }
-
-
- XSECCryptoKey * sk = handler->createKeyForURI(
- algorithmURI,
- (XMLByte *) kbuf,
- len);
-
- memset(kbuf, 0, XSEC_MAX_HASH_SIZE);
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagPrivateKey);
-
- // Create a PrivateKey to add this to
- DOMElement * pk = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- m_msg.mp_env->doPrettyPrint(pk);
-
- // Add it to the request doc
- m_msg.mp_messageAbstractTypeElement->appendChild(pk);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- // Now create the RSA structure
- XKMSRSAKeyPairImpl * rsa;
- XSECnew(rsa, XKMSRSAKeyPairImpl(m_msg.mp_env));
-
- DOMElement * e =
- rsa->createBlankXKMSRSAKeyPairImpl(Modulus, Exponent, P, Q, DP, DQ, InverseQ, D);
-
- // Add it to the PrivateKey
- pk->appendChild(e);
- m_msg.mp_env->doPrettyPrint(pk);
-
- // Encrypt all of this for future use
- XENCCipher * cipher = m_prov.newCipher(m_msg.mp_env->getParentDocument());
- cipher->setKey(sk);
- cipher->encryptElementContent(pk, algorithmURI);
-
- // Now load the encrypted data back in
- return cipher->loadEncryptedData(findFirstElementChild(pk));
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRegisterResultImpl.hpp b/xsec/xkms/impl/XKMSRegisterResultImpl.hpp
deleted file mode 100644
index 0f7af88b..00000000
--- a/xsec/xkms/impl/XKMSRegisterResultImpl.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRegisterResultImpl := Implementation of RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREGISTERRESULTIMPL_INCLUDE
-#define XKMSREGISTERRESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRegisterResult.hpp>
-#include <xsec/framework/XSECProvider.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSKeyBindingImpl;
-class XKMSRSAKeyPairImpl;
-class XENCCipherImpl;
-
-class XKMSRegisterResultImpl : public XKMSRegisterResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRegisterResultImpl(
- const XSECEnv * env
- );
-
- XKMSRegisterResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRegisterResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRegisterResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getKeyBindingSize(void) const;
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
- virtual XKMSRSAKeyPair * getRSAKeyPair(const char * passPhrase);
- virtual XENCEncryptedData * setRSAKeyPair(const char * passPhrase,
- XMLCh * Modulus,
- XMLCh * Exponent,
- XMLCh * P,
- XMLCh * Q,
- XMLCh * DP,
- XMLCh * DQ,
- XMLCh * InverseQ,
- XMLCh * D,
- const XMLCh * algorithmURI = NULL);
-
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#else
- typedef std::vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#endif
-
- KeyBindingVectorType m_keyBindingList;
- XKMSRSAKeyPairImpl * mp_RSAKeyPair;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_privateKeyElement;
-
- // To handle the cipher
- XSECProvider m_prov;
-
- // Unimplemented
- XKMSRegisterResultImpl(void);
- XKMSRegisterResultImpl(const XKMSRegisterResultImpl &);
- XKMSRegisterResultImpl & operator = (const XKMSRegisterResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREGISTERRESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSReissueKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSReissueKeyBindingImpl.cpp
deleted file mode 100644
index 44ee113c..00000000
--- a/xsec/xkms/impl/XKMSReissueKeyBindingImpl.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueKeyBindingImpl := Implementation for ReissueKeyBinding
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSReissueKeyBindingImpl.hpp"
-#include "XKMSStatusImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSReissueKeyBindingImpl::XKMSReissueKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
- mp_status = NULL;
-}
-
-XKMSReissueKeyBindingImpl::XKMSReissueKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
- mp_status = NULL;
-}
-
-XKMSReissueKeyBindingImpl::~XKMSReissueKeyBindingImpl() {
-
- if (mp_status != NULL)
- delete mp_status;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSReissueKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSReissueKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
- /* Find the status element */
- DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagStatus);
-
- if (nl == NULL || nl->getLength() != 1) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSReissueKeyBinding::load - Status value not found");
- }
-
- XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
- mp_status->load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSReissueKeyBindingImpl::createBlankReissueKeyBinding(XKMSStatus::StatusValue status) {
-
- DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagReissueKeyBinding);
-
- mp_env->doPrettyPrint(ret);
-
- // Create the status element
- XSECnew(mp_status, XKMSStatusImpl(mp_env));
- ret->appendChild(mp_status->createBlankStatus(status));
- mp_env->doPrettyPrint(ret);
-
- // Must have an Id
- XKMSKeyBindingAbstractTypeImpl::setId();
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Status handling
-// --------------------------------------------------------------------------------
-
-XKMSStatus * XKMSReissueKeyBindingImpl::getStatus(void) const {
-
- return mp_status;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSReissueKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSReissueKeyBindingImpl.hpp
deleted file mode 100644
index a2601307..00000000
--- a/xsec/xkms/impl/XKMSReissueKeyBindingImpl.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueKeyBinding := Implementation for ReissueKeyBinding
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUEKEYBINDINGIMPL_INCLUDE
-#define XKMSREISSUEKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSReissueKeyBinding.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSStatusImpl;
-
-class XKMSReissueKeyBindingImpl : public XKMSReissueKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSReissueKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSReissueKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSReissueKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankReissueKeyBinding(XKMSStatus::StatusValue status);
-
- // Interface
- virtual XKMSStatus * getStatus(void) const;
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XKMSStatusImpl * mp_status;
-
- // Unimplemented
- XKMSReissueKeyBindingImpl(void);
- XKMSReissueKeyBindingImpl(const XKMSReissueKeyBindingImpl &);
- XKMSReissueKeyBindingImpl & operator = (const XKMSReissueKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREISSUEKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSReissueRequestImpl.cpp b/xsec/xkms/impl/XKMSReissueRequestImpl.cpp
deleted file mode 100644
index d1f3c87c..00000000
--- a/xsec/xkms/impl/XKMSReissueRequestImpl.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueRequestImpl := Implementation for ReissueRequest Messages
- *
- * $Id: XKMSReissueRequestImpl.cpp 351366 2005-06-04 11:44:55Z blautenb $
- *
- */
-
-// XSEC Includes
-
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSReissueRequestImpl.hpp"
-#include "XKMSAuthenticationImpl.hpp"
-#include "XKMSReissueKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSReissueRequestImpl::XKMSReissueRequestImpl(const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_reissueKeyBinding(NULL),
-mp_proofOfPossessionSignature(NULL) {
-}
-
-XKMSReissueRequestImpl::XKMSReissueRequestImpl(const XSECEnv * env, DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_reissueKeyBinding(NULL),
-mp_proofOfPossessionSignature(NULL) {
-}
-
-XKMSReissueRequestImpl::~XKMSReissueRequestImpl() {
-
- if (mp_authentication != NULL)
- delete mp_authentication;
- if (mp_reissueKeyBinding != NULL)
- delete mp_reissueKeyBinding;
- // Provider will take care of the proofOfPossession signature
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSReissueRequestImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagReissueRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueRequest::load - called on incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any ReissueKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagReissueKeyBinding)) {
- tmpElt = findNextElementChild(tmpElt);
- }
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_reissueKeyBinding, XKMSReissueKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_reissueKeyBinding->load();
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSReissueRequest::load - Expected ReissueKeyBinding node");
-
- }
-
- // Authentication Element
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagAuthentication)) {
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env, tmpElt));
- mp_authentication->load(mp_reissueKeyBinding->getId());
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSReissueRequest::load - Expected Authentication node");
-
- }
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagProofOfPossession)) {
-
- // Find the signature
-
- DOMElement * sigElt = (DOMElement *) findFirstElementChild(tmpElt);
-
- if (sigElt == NULL || !strEquals(getDSIGLocalName(sigElt),
- XKMSConstants::s_tagSignature)) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSReissueRequest::load - Expected Signature child of ProofOfPossession");
-
- }
-
- // The provider will take care of cleaning this up later.
-
- mp_proofOfPossessionSignature = m_prov.newSignatureFromDOM(m_msg.mp_env->getParentDocument(),
- sigElt);
- mp_proofOfPossessionSignature->load();
-
- // Check the signature is across the correct input
-
- DSIGReferenceList * rl =
- mp_proofOfPossessionSignature->getReferenceList();
-
- if (rl->getSize() != 1) {
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueRequestImpl::load - ProofOfPossession Signature with incorrect number of references found (should be 1)");
- }
-
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_reissueKeyBinding->getId());
-
- if (!strEquals(rl->item(0)->getURI(), sb.rawXMLChBuffer())) {
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueRequestImpl::load - ProofOfPossession Signature refers to incorrect Id (should be for ReissueKeyBinding)");
- }
-
- // We don't actually check the signature as we have no key material to do so!
- }
-}
-
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSReissueRequestImpl::
- createBlankReissueRequest(const XMLCh * service, const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagReissueRequest, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// MessageType
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSReissueRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::ReissueRequest;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Methods
-// --------------------------------------------------------------------------------
-
-XKMSReissueKeyBinding * XKMSReissueRequestImpl::getReissueKeyBinding(void) const {
-
- return mp_reissueKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSReissueRequestImpl::getAuthentication (void) const {
-
- return mp_authentication;
-
-}
-
-DSIGSignature * XKMSReissueRequestImpl::getProofOfPossessionSignature(void) const {
-
- return mp_proofOfPossessionSignature;
-
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-XKMSReissueKeyBinding * XKMSReissueRequestImpl::addReissueKeyBinding(XKMSStatus::StatusValue status) {
-
- if (mp_reissueKeyBinding != NULL)
- return mp_reissueKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_reissueKeyBinding, XKMSReissueKeyBindingImpl(m_msg.mp_env));
- DOMElement * elt = mp_reissueKeyBinding->createBlankReissueKeyBinding(status);
-
- // Insert
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagAuthentication) &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagProofOfPossession)) {
- be = findNextElementChild(be);
- }
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_reissueKeyBinding;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_reissueKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSReissueRequestImpl::addAuthentication(void) {
-
- if (mp_authentication != NULL)
- return mp_authentication;
-
- if (mp_reissueKeyBinding == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueRequestImpl::addAuthentication - called prior to key infos being added");
- }
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env));
- DOMElement * e =
- mp_authentication->createBlankAuthentication(mp_reissueKeyBinding->getId());
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL && !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagProofOfPossession))
- be = findNextElementChild(be);
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_authentication;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_authentication;
-
-}
-
-DSIGSignature * XKMSReissueRequestImpl::addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm) {
-
- DSIGSignature * ret = m_prov.newSignature();
- DOMElement * elt = ret->createBlankSignature(m_msg.mp_env->getParentDocument(), c14nAlgorithm, signatureAlgorithm);
-
- /* Create the enveloping reference */
- safeBuffer sb;
- sb.sbXMLChIn(DSIGConstants::s_unicodeStrEmpty);
- sb.sbXMLChAppendCh(chPound);
- sb.sbXMLChCat(mp_reissueKeyBinding->getId());
-
- DSIGReference *ref = ret->createReference(sb.rawXMLChBuffer(), hashAlgorithm);
- ref->appendCanonicalizationTransform(DSIGConstants::s_unicodeStrURIEXC_C14N_COM);
-
- /* Embed the signature in the document inside a KeyBindingAuthentication element */
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagProofOfPossession);
-
- DOMElement * t = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- m_msg.mp_env->doPrettyPrint(t);
- t->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(t);
-
- // Now append into the ReissueRequest
- m_msg.mp_messageAbstractTypeElement->appendChild(t);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return ret;
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSReissueRequestImpl.hpp b/xsec/xkms/impl/XKMSReissueRequestImpl.hpp
deleted file mode 100644
index 98a0d3c8..00000000
--- a/xsec/xkms/impl/XKMSReissueRequestImpl.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueRequestImpl := Implementation for ReissueRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUEREQUESTIMPL_INCLUDE
-#define XKMSREISSUEREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSReissueRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSAuthenticationImpl;
-class XKMSReissueKeyBindingImpl;
-class DSIGSignature;
-
-class XKMSReissueRequestImpl : public XKMSReissueRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSReissueRequestImpl(
- const XSECEnv * env
- );
-
- XKMSReissueRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSReissueRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankReissueRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual XKMSReissueKeyBinding * getReissueKeyBinding(void) const;
- virtual XKMSAuthentication * getAuthentication (void) const;
- virtual DSIGSignature * getProofOfPossessionSignature(void) const;
-
- /* Setter Interface Methods */
-
- virtual XKMSReissueKeyBinding * addReissueKeyBinding(XKMSStatus::StatusValue status);
- virtual XKMSAuthentication * addAuthentication(void);
- virtual DSIGSignature * addProofOfPossessionSignature(
- const XMLCh* c14nAlgorithm,
- const XMLCh* signatureAlgorithm,
- const XMLCh* hashAlgorithm);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-
-private:
-
- XKMSAuthenticationImpl * mp_authentication;
- XKMSReissueKeyBindingImpl * mp_reissueKeyBinding;
- DSIGSignature * mp_proofOfPossessionSignature;
-
- XSECProvider m_prov; // For creating the signature
-
- // Unimplemented
- XKMSReissueRequestImpl(void);
- XKMSReissueRequestImpl(const XKMSReissueRequestImpl &);
- XKMSReissueRequestImpl & operator = (const XKMSReissueRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREISSUEREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSReissueResultImpl.cpp b/xsec/xkms/impl/XKMSReissueResultImpl.cpp
deleted file mode 100644
index b9048a42..00000000
--- a/xsec/xkms/impl/XKMSReissueResultImpl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueResultImpl := Implementation of RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSReissueResultImpl.hpp"
-#include "XKMSKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSReissueResultImpl::XKMSReissueResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSReissueResultImpl::XKMSReissueResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSReissueResultImpl::~XKMSReissueResultImpl() {
-
- XKMSReissueResultImpl::KeyBindingVectorType::iterator i;
-
- for (i = m_keyBindingList.begin() ; i != m_keyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSReissueResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagReissueResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagKeyBinding);
-
- if (nl != NULL) {
-
- XKMSKeyBindingImpl * kb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(kb, XKMSKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_keyBindingList.push_back(kb);
- kb->load();
-
- }
-
- }
-
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSReissueResultImpl::createBlankReissueResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagReissueResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSReissueResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::ReissueResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSReissueResultImpl::getKeyBindingSize(void) const {
-
- return (int) m_keyBindingList.size();
-
-}
-
-XKMSKeyBinding * XKMSReissueResultImpl::getKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_keyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSReissueResult::getKeyBindingItem - item out of range");
- }
-
- return m_keyBindingList[item];
-
-}
-
-XKMSKeyBinding * XKMSReissueResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
-
- XKMSKeyBindingImpl * u;
-
- XSECnew(u, XKMSKeyBindingImpl(m_msg.mp_env));
-
- m_keyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankKeyBinding(status);
-
- // Append the element
-
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return u;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSReissueResultImpl.hpp b/xsec/xkms/impl/XKMSReissueResultImpl.hpp
deleted file mode 100644
index 04ad20ef..00000000
--- a/xsec/xkms/impl/XKMSReissueResultImpl.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSReissueResultImpl := Implementation of RegisterResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREISSUERESULTIMPL_INCLUDE
-#define XKMSREISSUERESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSReissueResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSKeyBindingImpl;
-
-class XKMSReissueResultImpl : public XKMSReissueResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSReissueResultImpl(
- const XSECEnv * env
- );
-
- XKMSReissueResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSReissueResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankReissueResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getKeyBindingSize(void) const;
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#else
- typedef std::vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#endif
-
- KeyBindingVectorType m_keyBindingList;
-
- // Unimplemented
- XKMSReissueResultImpl(void);
- XKMSReissueResultImpl(const XKMSReissueResultImpl &);
- XKMSReissueResultImpl & operator = (const XKMSReissueResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREISSUERESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.cpp b/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.cpp
deleted file mode 100644
index 9b7391ec..00000000
--- a/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.cpp
+++ /dev/null
@@ -1,399 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRequestAbstractTypeImpl := Implementation class for XKMS Request messages
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-#include "XKMSRespondWithImpl.hpp"
-#include "XKMSResponseMechanismImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/dom/DOMNodeList.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRequestAbstractTypeImpl::XKMSRequestAbstractTypeImpl(
- const XSECEnv * env) :
-m_msg(env)
-{
- mp_originalRequestIdAttr = NULL;
- mp_responseLimitAttr = NULL;
-}
-
-XKMSRequestAbstractTypeImpl::XKMSRequestAbstractTypeImpl(
- const XSECEnv * env,
- DOMElement * node) :
-m_msg(env, node)
-{
- mp_originalRequestIdAttr = NULL;
- mp_responseLimitAttr = NULL;
-}
-
-XKMSRequestAbstractTypeImpl::~XKMSRequestAbstractTypeImpl() {
-
- RespondWithVectorType::iterator i;
-
- for (i = m_respondWithList.begin(); i != m_respondWithList.end(); ++i) {
- delete (*i);
- }
-
- ResponseMechanismVectorType::iterator j;
-
- for (j = m_responseMechanismList.begin(); j != m_responseMechanismList.end(); ++j) {
- delete (*j);
- }
-};
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSRequestAbstractTypeImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractType::load - called on empty DOM");
-
- }
-
- // Get any respond with elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagRespondWith);
-
- if (nl != NULL) {
-
- XKMSRespondWithImpl * rw;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(rw, XKMSRespondWithImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- rw->load();
- m_respondWithList.push_back(rw);
-
- }
-
- }
-
- // Get any ResponseMechanism elements
- nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagResponseMechanism);
-
- if (nl != NULL) {
-
- XKMSResponseMechanismImpl * rm;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(rm, XKMSResponseMechanismImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- rm->load();
- m_responseMechanismList.push_back(rm);
-
- }
-
- }
-
- mp_originalRequestIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagOriginalRequestId);
-
- mp_responseLimitAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseLimit);
-
-
- m_msg.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create from scratch
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRequestAbstractTypeImpl::createBlankRequestAbstractType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_msg.createBlankMessageAbstractType(tag, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get/Set interface methods
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSRequestAbstractTypeImpl::getOriginalRequestId(void) const {
-
- if (mp_originalRequestIdAttr != NULL)
- return mp_originalRequestIdAttr->getNodeValue();
-
- return NULL;
-}
-
-void XKMSRequestAbstractTypeImpl::setOriginalRequestId(const XMLCh * id) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSRequestAbstractType::setOriginalRequestId - called on non-initialised structure");
-
- }
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagOriginalRequestId, id);
- mp_originalRequestIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagOriginalRequestId);
-
-}
-
-unsigned int XKMSRequestAbstractTypeImpl::getResponseLimit(void) const {
-
- if (mp_responseLimitAttr == NULL)
- return 0;
-
- unsigned int ret;
-
- if (!XMLString::textToBin(mp_responseLimitAttr->getValue(), ret))
- return 0;
-
- return ret;
-}
-
-void XKMSRequestAbstractTypeImpl::setResponseLimit(unsigned int limit) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSRequestAbstractType::setResponseLimit - called on non-initialised structure");
-
- }
-
- /* Convert the number to a string */
- XMLCh limitStr[10];
- XMLString::binToText(limit, limitStr, 9, 10);
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagResponseLimit, limitStr);
- mp_responseLimitAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseLimit);
-
-}
-
-// --------------------------------------------------------------------------------
-// RespondWith handling
-// --------------------------------------------------------------------------------
-
-int XKMSRequestAbstractTypeImpl::getRespondWithSize(void) {
-
- return (int) m_respondWithList.size();
-
-}
-
-XKMSRespondWith * XKMSRequestAbstractTypeImpl::getRespondWithItem(int item) {
-
- if (item < 0 || item >= (int) m_respondWithList.size()) {
-
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractTypeImpl::getRespondWithItem - item out of range");
-
- }
-
- return m_respondWithList[item];
-
-}
-
-const XMLCh * XKMSRequestAbstractTypeImpl::getRespondWithItemStr(int item) {
-
- if (item < 0 || item >= (int) m_respondWithList.size()) {
-
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractTypeImpl::getRespondWithItem - item out of range");
-
- }
-
- return m_respondWithList[item]->getRespondWithString();
-
-}
-
-void XKMSRequestAbstractTypeImpl::appendRespondWithItem(XKMSRespondWith * item) {
-
-}
-
-void XKMSRequestAbstractTypeImpl::appendRespondWithItem(const XMLCh * item) {
-
- XKMSRespondWithImpl * rw;
- XSECnew(rw, XKMSRespondWithImpl(m_msg.mp_env));
-
- // Create the RespondWith object
- DOMElement * elt = rw->createBlankRespondWith(item);
-
- // Add to the item
- DOMElement * c = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (c != NULL) {
-
- if (!strEquals(getXKMSLocalName(c), XKMSConstants::s_tagResponseMechanism))
- break;
-
- }
-
- if (c != NULL) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, c);
- if (m_msg.mp_env->getPrettyPrintFlag()) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), c);
- }
- }
- else {
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
-
- // Add to the list
- m_respondWithList.push_back(rw);
-
-}
-
-
-// --------------------------------------------------------------------------------
-// ResponseMechanism handling
-// --------------------------------------------------------------------------------
-
-int XKMSRequestAbstractTypeImpl::getResponseMechanismSize(void) {
-
- return (int) m_responseMechanismList.size();
-
-}
-
-XKMSResponseMechanism * XKMSRequestAbstractTypeImpl::getResponseMechanismItem(int item) {
-
- if (item < 0 || item >= (int) m_responseMechanismList.size()) {
-
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractTypeImpl::getResponseMechanismItem - item out of range");
-
- }
-
- return m_responseMechanismList[item];
-
-}
-
-const XMLCh * XKMSRequestAbstractTypeImpl::getResponseMechanismItemStr(int item) {
-
- if (item < 0 || item >= (int) m_responseMechanismList.size()) {
-
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractTypeImpl::getResponseMechanismItem - item out of range");
-
- }
-
- return m_responseMechanismList[item]->getResponseMechanismString();
-
-}
-
-void XKMSRequestAbstractTypeImpl::appendResponseMechanismItem(XKMSResponseMechanism * item) {
-
-}
-
-void XKMSRequestAbstractTypeImpl::appendResponseMechanismItem(const XMLCh * item) {
-
- XKMSResponseMechanismImpl * rw;
- XSECnew(rw, XKMSResponseMechanismImpl(m_msg.mp_env));
-
- // Create the ResponseMechanism object
- DOMElement * elt = rw->createBlankResponseMechanism(item);
-
- // Add to the item
- DOMElement * c = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (c != NULL) {
-
- if (!strEquals(getXKMSLocalName(c), XKMSConstants::s_tagResponseMechanism))
- break;
-
- c = findNextElementChild(c);
-
- }
-
- if (c != NULL) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, c);
- if (m_msg.mp_env->getPrettyPrintFlag()) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), c);
- }
- }
- else {
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
-
- // Add to the list
- m_responseMechanismList.push_back(rw);
-
-}
-
-void XKMSRequestAbstractTypeImpl::removeResponseMechanismItem(int item) {
-
- if (item < 0 || item >= (int) m_responseMechanismList.size()) {
-
- throw XSECException(XSECException::RequestAbstractTypeError,
- "XKMSRequestAbstractTypeImpl::getResponseMechanismItem - item out of range");
-
- }
-
- XKMSResponseMechanism *rm = m_responseMechanismList[item];
- DOMNode * m = rm->getElement();
- m->getParentNode()->removeChild(m);
- m->release();
-
- // Now clean up our structure.
- ResponseMechanismVectorType::iterator i;
- int j = 0;
- i = m_responseMechanismList.begin();
- while (j < item) {
- j++;
- i++;
- }
- m_responseMechanismList.erase(i);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.hpp b/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.hpp
deleted file mode 100644
index d1586440..00000000
--- a/xsec/xkms/impl/XKMSRequestAbstractTypeImpl.hpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRequestAbstractTypeImpl := Implementation class for XKMS Request messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSREQUESTABSTRACTTYPEIMPL_INCLUDE
-#define XKMSREQUESTABSTRACTTYPEIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRequestAbstractType.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSMessageAbstractTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSRespondWithImpl;
-class XKMSResponseMechanismImpl;
-
-class XKMSRequestAbstractTypeImpl : public XKMSRequestAbstractType {
-
-public:
-
- XKMSMessageAbstractTypeImpl m_msg;
-
-public:
-
- /* Constructors and Destructors */
- XKMSRequestAbstractTypeImpl(
- const XSECEnv * env
- );
- XKMSRequestAbstractTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRequestAbstractTypeImpl();
-
- virtual void load(void);
-
- // Create from scratch - tag is the element name to create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRequestAbstractType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id = NULL);
-
- /* Getter Interface Methods */
-
- virtual const XMLCh * getOriginalRequestId(void) const;
- virtual void setOriginalRequestId(const XMLCh * id);
- virtual unsigned int getResponseLimit(void) const;
-
- /* Set interface methods */
- virtual void setResponseLimit(unsigned int limit);
-
- /* RespondWith handling */
-
- virtual int getRespondWithSize(void);
- virtual XKMSRespondWith * getRespondWithItem(int item);
- virtual const XMLCh * getRespondWithItemStr(int item);
- virtual void appendRespondWithItem(XKMSRespondWith * item);
- virtual void appendRespondWithItem(const XMLCh * item);
-
- /* ResponseMechanism handling */
- virtual int getResponseMechanismSize(void);
- virtual XKMSResponseMechanism * getResponseMechanismItem(int item);
- virtual const XMLCh * getResponseMechanismItemStr(int item);
- virtual void appendResponseMechanismItem(XKMSResponseMechanism * item);
- virtual void appendResponseMechanismItem(const XMLCh * item);
- virtual void removeResponseMechanismItem(int item);
-
-
- /* Inherited from XKMSMessageType */
- virtual messageType getMessageType(void) {return XKMSMessageAbstractType::None;}
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-#if 0
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const
- {return XKMSMessageAbstractTypeImpl::getElement();}
-
- virtual bool isSigned(void) const
- {return XKMSMessageAbstractTypeImpl::isSigned();}
- virtual DSIGSignature * getSignature(void) const
- {return XKMSMessageAbstractTypeImpl::getSignature();}
- virtual const XMLCh * getId(void) const
- {return XKMSMessageAbstractTypeImpl::getId();}
- virtual const XMLCh * getService(void) const
- {return XKMSMessageAbstractTypeImpl::getService();}
- virtual const XMLCh * getNonce(void) const
- {return XKMSMessageAbstractTypeImpl::getNonce();}
- virtual void setId(const XMLCh * id)
- {XKMSMessageAbstractTypeImpl::setId(id);}
- virtual void setService(const XMLCh * service)
- {XKMSMessageAbstractTypeImpl::setService(service);}
- virtual void setNonce(const XMLCh * uri)
- {XKMSMessageAbstractTypeImpl::setNonce(uri);}
-#endif
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSRespondWithImpl *> RespondWithVectorType;
-#else
- typedef std::vector<XKMSRespondWithImpl *> RespondWithVectorType;
-#endif
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSResponseMechanismImpl *> ResponseMechanismVectorType;
-#else
- typedef std::vector<XKMSResponseMechanismImpl *> ResponseMechanismVectorType;
-#endif
-
- RespondWithVectorType m_respondWithList; // List of m_respondWith elements
- ResponseMechanismVectorType m_responseMechanismList;// List of responseMechanism elements
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_originalRequestIdAttr;
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_responseLimitAttr;
-
- // Unimplemented
- XKMSRequestAbstractTypeImpl(void);
- XKMSRequestAbstractTypeImpl(const XKMSRequestAbstractTypeImpl &);
- XKMSRequestAbstractTypeImpl & operator = (const XKMSRequestAbstractTypeImpl &);
-
-};
-
-#define XKMS_REQUESTABSTRACTYPE_IMPL_METHODS \
- virtual const XMLCh * getOriginalRequestId(void) const \
- {return m_request.getOriginalRequestId();} \
- virtual void setOriginalRequestId(const XMLCh * id) \
- {m_request.setOriginalRequestId(id);} \
- virtual int getRespondWithSize(void) \
- {return m_request.getRespondWithSize();} \
- virtual XKMSRespondWith * getRespondWithItem(int item) \
- {return m_request.getRespondWithItem(item);} \
- virtual const XMLCh * getRespondWithItemStr(int item) \
- {return m_request.getRespondWithItemStr(item);} \
- virtual void appendRespondWithItem(XKMSRespondWith * item) \
- {m_request.appendRespondWithItem(item);} \
- virtual void appendRespondWithItem(const XMLCh * item) \
- {m_request.appendRespondWithItem(item);} \
- virtual int getResponseMechanismSize(void) \
- {return m_request.getResponseMechanismSize();} \
- virtual XKMSResponseMechanism * getResponseMechanismItem(int item) \
- {return m_request.getResponseMechanismItem(item);} \
- virtual const XMLCh * getResponseMechanismItemStr(int item) \
- {return m_request.getResponseMechanismItemStr(item);} \
- virtual void appendResponseMechanismItem(XKMSResponseMechanism * item) \
- {m_request.appendResponseMechanismItem(item);} \
- virtual void appendResponseMechanismItem(const XMLCh * item) \
- {m_request.appendResponseMechanismItem(item);} \
- virtual void removeResponseMechanismItem(int item) \
- {m_request.removeResponseMechanismItem(item);} \
- virtual unsigned int getResponseLimit(void) const \
- {return m_request.getResponseLimit();} \
- virtual void setResponseLimit(unsigned int limit) \
- {m_request.setResponseLimit(limit);}
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREQUESTABSTRACTTYPEIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRespondWithImpl.cpp b/xsec/xkms/impl/XKMSRespondWithImpl.cpp
deleted file mode 100644
index fcdc606a..00000000
--- a/xsec/xkms/impl/XKMSRespondWithImpl.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRespondWithImpl := Implementation of XKMSRespondWith
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRespondWithImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-
-XKMSRespondWithImpl::XKMSRespondWithImpl(const XSECEnv * env) :
-mp_env(env),
-mp_respondWithTextNode(NULL)
-{}
-
-XKMSRespondWithImpl::XKMSRespondWithImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-mp_env(env),
-mp_respondWithElement(node),
-mp_respondWithTextNode(NULL) {
-
-}
-
-XKMSRespondWithImpl::~XKMSRespondWithImpl() {}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSRespondWithImpl::load(void) {
-
- if (mp_respondWithElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRespondWith::load - called on empty DOM");
-
- }
-
- mp_respondWithTextNode = findFirstChildOfType(mp_respondWithElement, DOMNode::TEXT_NODE);
-
- if (mp_respondWithTextNode == NULL) {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRespondWith::load - Expected TEXT node beneath <RespondWith> element");
-
- }
-
-}
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRespondWithImpl::createBlankRespondWith(const XMLCh * item) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagRespondWith);
-
- mp_respondWithElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- // Create the RespondWith item
- str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- str.sbXMLChCat(item);
-
- mp_respondWithTextNode = doc->createTextNode(str.rawXMLChBuffer());
- mp_respondWithElement->appendChild(mp_respondWithTextNode);
-
- return mp_respondWithElement;
-}
-
-// --------------------------------------------------------------------------------
-// Get interface
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSRespondWithImpl::getRespondWithString(void) const {
-
- if (mp_respondWithTextNode == NULL) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRespondWith::getRespondWithString - Attempt to get prior to initialisation");
- }
- const XMLCh * r = mp_respondWithTextNode->getNodeValue();
-
- int index = XMLString::indexOf(r, chPound);
-
- if (index == -1 || XMLString::compareNString(r, XKMSConstants::s_unicodeStrURIXKMS, index)) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRespondWith::getRespondWithString - Item not in XKMS Name Space");
- }
-
- return &r[index+1];
-
-}
-
-// --------------------------------------------------------------------------------
-// Set interface
-// --------------------------------------------------------------------------------
-
-void XKMSRespondWithImpl::setRespondWithString(const XMLCh * str) {
-
- if (mp_respondWithTextNode == NULL) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRespondWith::setRespondWithString - Attempt to set prior to initialisation");
- }
-
- safeBuffer sb;
- sb.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- sb.sbXMLChCat(str);
-
- mp_respondWithTextNode->setNodeValue(sb.rawXMLChBuffer());
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRespondWithImpl.hpp b/xsec/xkms/impl/XKMSRespondWithImpl.hpp
deleted file mode 100644
index cc55ffad..00000000
--- a/xsec/xkms/impl/XKMSRespondWithImpl.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRespondWithImpl := Implementation of XKMSRespondWith
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESPONDWITHIMPL_INCLUDE
-#define XKMSRESPONDWITHIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRespondWith.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECEnv;
-
-class XKMSRespondWithImpl : public XKMSRespondWith {
-
-public:
-
- XKMSRespondWithImpl(const XSECEnv * env);
- XKMSRespondWithImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRespondWithImpl();
-
- // load
- void load(void);
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRespondWith(
- const XMLCh * item);
-
- /* Getter Interface Methods */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const {
- return mp_respondWithElement;
- }
-
- virtual const XMLCh * getRespondWithString(void) const;
-
- /* Setter interface methods */
-
- virtual void setRespondWithString(const XMLCh * str);
-
- //@}
-
-
-private:
-
- const XSECEnv * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_respondWithElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_respondWithTextNode;
-
- // Unimplemented
- XKMSRespondWithImpl(const XKMSRespondWithImpl &);
- XKMSRespondWithImpl & operator = (const XKMSRespondWithImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRESPONDWITHIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSResponseMechanismImpl.cpp b/xsec/xkms/impl/XKMSResponseMechanismImpl.cpp
deleted file mode 100644
index 0ee70e24..00000000
--- a/xsec/xkms/impl/XKMSResponseMechanismImpl.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResponseMechanismImpl := Implementation of XKMSResponseMechanism
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSResponseMechanismImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-
-XKMSResponseMechanismImpl::XKMSResponseMechanismImpl(const XSECEnv * env) :
-mp_env(env),
-mp_responseMechanismTextNode(NULL)
-{}
-
-XKMSResponseMechanismImpl::XKMSResponseMechanismImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-mp_env(env),
-mp_responseMechanismElement(node),
-mp_responseMechanismTextNode(NULL) {
-
-}
-
-XKMSResponseMechanismImpl::~XKMSResponseMechanismImpl() {}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSResponseMechanismImpl::load(void) {
-
- if (mp_responseMechanismElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSResponseMechanism::load - called on empty DOM");
-
- }
-
- mp_responseMechanismTextNode = findFirstChildOfType(mp_responseMechanismElement, DOMNode::TEXT_NODE);
-
- if (mp_responseMechanismTextNode == NULL) {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSResponseMechanism::load - Expected TEXT node beneath <ResponseMechanism> element");
-
- }
-
-}
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSResponseMechanismImpl::createBlankResponseMechanism(const XMLCh * item) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagResponseMechanism);
-
- mp_responseMechanismElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- // Create the ResponseMechanism item
- str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- str.sbXMLChCat(item);
- mp_responseMechanismTextNode = doc->createTextNode(str.rawXMLChBuffer());
- mp_responseMechanismElement->appendChild(mp_responseMechanismTextNode);
-
- return mp_responseMechanismElement;
-}
-
-// --------------------------------------------------------------------------------
-// Get interface
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSResponseMechanismImpl::getResponseMechanismString(void) const {
-
- if (mp_responseMechanismTextNode == NULL) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSResponseMechanism::getResponseMechanismString - Attempt to get prior to initialisation");
- }
- const XMLCh * r = mp_responseMechanismTextNode->getNodeValue();
-
- int index = XMLString::indexOf(r, chPound);
- if (index == -1 || XMLString::compareNString(r, XKMSConstants::s_unicodeStrURIXKMS, index)) {
- throw XSECException(XSECException::XKMSError,
- "XKMSResponseMechanism::getResponseMechanismString - Item not in XKMS Name Space");
- }
-
- return &r[index+1];
-
-}
-
-// --------------------------------------------------------------------------------
-// Set interface
-// --------------------------------------------------------------------------------
-
-void XKMSResponseMechanismImpl::setResponseMechanismString(const XMLCh * str) {
-
- if (mp_responseMechanismTextNode == NULL) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSResponseMechanism::setResponseMechanismString - Attempt to set prior to initialisation");
- }
-
- safeBuffer sb;
- sb.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- sb.sbXMLChCat(str);
-
- mp_responseMechanismTextNode->setNodeValue(sb.rawXMLChBuffer());
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSResponseMechanismImpl.hpp b/xsec/xkms/impl/XKMSResponseMechanismImpl.hpp
deleted file mode 100644
index 28adce8f..00000000
--- a/xsec/xkms/impl/XKMSResponseMechanismImpl.hpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResponseMechanismImpl := Implementation of XKMSResponseMechanism
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESPONSEMECHANISMIMPL_INCLUDE
-#define XKMSRESPONSEMECHANISMIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSResponseMechanism.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECEnv;
-
-class XKMSResponseMechanismImpl : public XKMSResponseMechanism {
-
-public:
-
- XKMSResponseMechanismImpl(const XSECEnv * env);
- XKMSResponseMechanismImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSResponseMechanismImpl();
-
- // load
- void load(void);
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankResponseMechanism(
- const XMLCh * item);
-
- /* Getter Interface Methods */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const {
- return mp_responseMechanismElement;
- }
-
- virtual const XMLCh * getResponseMechanismString(void) const;
-
- /* Setter interface methods */
-
- virtual void setResponseMechanismString(const XMLCh * str);
-
- //@}
-
-
-private:
-
- const XSECEnv * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_responseMechanismElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_responseMechanismTextNode;
-
- // Unimplemented
- XKMSResponseMechanismImpl(const XKMSResponseMechanismImpl &);
- XKMSResponseMechanismImpl & operator = (const XKMSResponseMechanismImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRESPONSEMECHANISMIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSResultImpl.cpp b/xsec/xkms/impl/XKMSResultImpl.cpp
deleted file mode 100644
index a926bc6d..00000000
--- a/xsec/xkms/impl/XKMSResultImpl.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResultImpl := Implementation of Result Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSResultImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSResultImpl::XKMSResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSResultImpl::XKMSResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSResultImpl::~XKMSResultImpl() {
-
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSResult::load - called incorrect node");
-
- }
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSResultImpl::createBlankResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::Result;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSResultImpl.hpp b/xsec/xkms/impl/XKMSResultImpl.hpp
deleted file mode 100644
index 90d81273..00000000
--- a/xsec/xkms/impl/XKMSResultImpl.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResultImpl := Implementation of Result Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESULTIMPL_INCLUDE
-#define XKMSRESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-class XKMSResultImpl : public XKMSResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSResultImpl(
- const XSECEnv * env
- );
-
- XKMSResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
- // Unimplemented
- XKMSResultImpl(const XKMSResultImpl &);
- XKMSResultImpl & operator = (const XKMSResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSResultTypeImpl.cpp b/xsec/xkms/impl/XKMSResultTypeImpl.cpp
deleted file mode 100644
index c2641a02..00000000
--- a/xsec/xkms/impl/XKMSResultTypeImpl.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResultTypeImpl := Implementation of base schema of XKMS Request messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECException.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Constructor Destructor
-// --------------------------------------------------------------------------------
-
-XKMSResultTypeImpl::XKMSResultTypeImpl(
- const XSECEnv * env) :
-m_msg(env),
-mp_resultMajorAttr(NULL),
-mp_resultMinorAttr(NULL),
-mp_requestSignatureValueElement(NULL)
-{
-
-}
-
-XKMSResultTypeImpl::XKMSResultTypeImpl(
- const XSECEnv * env,
- DOMElement * node) :
-m_msg(env, node),
-mp_requestSignatureValueElement(NULL)
-{
-
-}
-
-XKMSResultTypeImpl::~XKMSResultTypeImpl() {
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSResultTypeImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::ResultTypeError,
- "XKMSResultType::load - called on empty DOM");
-
- }
-
- m_msg.load();
-
- /* Now load the result attributes */
-
- mp_resultMajorAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResultMajor);
- mp_resultMinorAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResultMinor);
- mp_requestIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagRequestId);
-
- /* Decode responses */
- if (mp_resultMajorAttr == NULL) {
- // Attempt to load an empty element
- throw XSECException(XSECException::ResultTypeError,
- "XKMSResultType::load - No Major Response code found");
- }
-
- const XMLCh * res = mp_resultMajorAttr->getNodeValue();
-
- // Result types have now been updated, and are URIs with the XKMS namespace prepended
- // to the actual result value
-
- int res2 = XMLString::indexOf(res, chPound);
- if (res2 == -1 || XMLString::compareNString(res, XKMSConstants::s_unicodeStrURIXKMS, res2)) {
- throw XSECException(XSECException::ResultTypeError,
- "XKMSResultType::load - ResultType not in XKMS Name Space");
- }
-
- res = &res[res2+1];
- for (m_resultMajor = XKMSResultType::Pending;
- m_resultMajor > XKMSResultType::NoneMajor;
- m_resultMajor = (XKMSResultType::ResultMajor) (m_resultMajor-1)) {
-
- if (strEquals(XKMSConstants::s_tagResultMajorCodes[m_resultMajor], res))
- break;
-
- }
-
- if (mp_resultMinorAttr != NULL) {
-
- res = mp_resultMinorAttr->getNodeValue();
- int res2 = XMLString::indexOf(res, chPound);
- if (res2 == -1 ||
- XMLString::compareNString(res, XKMSConstants::s_unicodeStrURIXKMS, res2)) {
-
- throw XSECException(XSECException::ResultTypeError,
- "XKMSResultType::load - ResultType not in XKMS Name Space");
- }
-
- res = &res[res2+1];
-
- for (m_resultMinor = XKMSResultType::NotSynchronous;
- m_resultMinor > XKMSResultType::NoneMinor;
- m_resultMinor = (XKMSResultType::ResultMinor) (m_resultMinor-1)) {
-
- if (strEquals(XKMSConstants::s_tagResultMinorCodes[m_resultMinor], res))
- break;
-
- }
- }
-
- else
- m_resultMinor = XKMSResultType::NoneMinor;
-
- /* Check to see if there is a RequestSignatureValue node */
- mp_requestSignatureValueElement = (DOMElement *) findFirstChildOfType(m_msg.mp_messageAbstractTypeElement, DOMNode::ELEMENT_NODE);
- while (mp_requestSignatureValueElement != NULL &&
- !strEquals(getXKMSLocalName(mp_requestSignatureValueElement), XKMSConstants::s_tagRequestSignatureValue)) {
-
- mp_requestSignatureValueElement = findNextElementChild(mp_requestSignatureValueElement);
-
- }
-
- if (mp_requestSignatureValueElement != NULL) {
-
- if (findFirstChildOfType(mp_requestSignatureValueElement, DOMNode::TEXT_NODE) == NULL) {
- throw XSECException(XSECException::ResultTypeError,
- "XKMSResultType::load - RequestSignatureValue must have text node as child");
- }
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create from scratch
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSResultTypeImpl::createBlankResultType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- DOMElement * ret =
- m_msg.createBlankMessageAbstractType(tag, service, id);
-
- safeBuffer s;
-
- s.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- s.sbXMLChCat(XKMSConstants::s_tagResultMajorCodes[rmaj]);
-
- ret->setAttributeNS(NULL,
- XKMSConstants::s_tagResultMajor,
- s.rawXMLChBuffer());
-
- if (rmin != XKMSResultType::NoneMinor) {
-
- s.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- s.sbXMLChCat(XKMSConstants::s_tagResultMinorCodes[rmin]);
-
- ret->setAttributeNS(NULL,
- XKMSConstants::s_tagResultMinor,
- s.rawXMLChBuffer());
- }
-
- m_resultMajor = rmaj;
- m_resultMinor = rmin;
-
- mp_resultMajorAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResultMajor);
- mp_resultMinorAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResultMinor);
-
- return ret;
-}
-
-// --------------------------------------------------------------------------------
-// Getter interface
-// --------------------------------------------------------------------------------
-
-XKMSResultType::ResultMajor XKMSResultTypeImpl::getResultMajor(void) const {
-
- return m_resultMajor;
-
-}
-
-XKMSResultType::ResultMinor XKMSResultTypeImpl::getResultMinor(void) const {
-
- return m_resultMinor;
-
-}
-
-const XMLCh * XKMSResultTypeImpl::getRequestId(void) const {
-
- if (mp_requestIdAttr != NULL)
- return mp_requestIdAttr->getNodeValue();
-
- return NULL;
-
-}
-
-const XMLCh * XKMSResultTypeImpl::getRequestSignatureValue(void) const {
-
- if (mp_requestSignatureValueElement != NULL)
- return findFirstChildOfType(mp_requestSignatureValueElement,
- DOMNode::TEXT_NODE)->getNodeValue();
-
- return NULL;
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter interface
-// --------------------------------------------------------------------------------
-
-void XKMSResultTypeImpl::setResultMajor(ResultMajor) {}
-void XKMSResultTypeImpl::setResultMinor(ResultMinor) {}
-
-void XKMSResultTypeImpl::setRequestId(const XMLCh * id) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSResultType::setRequestId - called on non-initialised structure");
-
- }
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagRequestId, id);
- mp_requestIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagRequestId);
-
-}
-
-void XKMSResultTypeImpl::setRequestSignatureValue(const XMLCh * value) {
-
- if (mp_requestSignatureValueElement != NULL) {
- findFirstChildOfType(mp_requestSignatureValueElement, DOMNode::TEXT_NODE)->setNodeValue(value);
- return;
- }
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagRequestSignatureValue);
-
- mp_requestSignatureValueElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_requestSignatureValueElement->appendChild(doc->createTextNode(value));
-
- /* Find where this sits, and insert */
- DOMElement * c = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (c != NULL) {
-
- if (!(strEquals(getXKMSLocalName(c), XKMSConstants::s_tagMessageExtension) ||
- strEquals(getDSIGLocalName(c), XKMSConstants::s_tagSignature) ||
- strEquals(getXKMSLocalName(c), XKMSConstants::s_tagOpaqueClientData)))
-
- break;
-
- }
-
- if (c != NULL) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(mp_requestSignatureValueElement, c);
- if (m_msg.mp_env->getPrettyPrintFlag()) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL), c);
- }
- }
- else {
- m_msg.mp_messageAbstractTypeElement->appendChild(mp_requestSignatureValueElement);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSResultTypeImpl.hpp b/xsec/xkms/impl/XKMSResultTypeImpl.hpp
deleted file mode 100644
index 8332f60f..00000000
--- a/xsec/xkms/impl/XKMSResultTypeImpl.hpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSResultTypeImpl := Implementation of base schema of XKMS Request messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSRESULTTYPEIMPL_INCLUDE
-#define XKMSRESULTTYPEIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSResultType.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSMessageAbstractTypeImpl.hpp"
-
-XSEC_DECLARE_XERCES_CLASS(DOMElement);
-XSEC_DECLARE_XERCES_CLASS(DOMAttr);
-
-class XKMSResultTypeImpl : public XKMSResultType {
-
-public:
- XKMSMessageAbstractTypeImpl m_msg;
-public:
-
- XKMSResultTypeImpl(const XSECEnv * env);
- XKMSResultTypeImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node);
-
- virtual ~XKMSResultTypeImpl();
-
- // load
- void load(void);
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankResultType(
- const XMLCh * tag,
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
-
- /* Note yet implemented from MessageAbstractType */
- virtual messageType getMessageType(void) {return XKMSMessageAbstractType::None;}
-
- // Getter interface
-
- virtual ResultMajor getResultMajor(void) const;
- virtual ResultMinor getResultMinor(void) const;
- virtual const XMLCh * getRequestId(void) const;
- virtual const XMLCh * getRequestSignatureValue(void) const;
-
- // Setter interface
- virtual void setResultMajor(ResultMajor r);
- virtual void setResultMinor(ResultMinor r);
- virtual void setRequestId(const XMLCh * id);
- virtual void setRequestSignatureValue(const XMLCh * value);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_resultMajorAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_resultMinorAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_requestIdAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_requestSignatureValueElement;
-
- XKMSResultType::ResultMajor m_resultMajor;
- XKMSResultType::ResultMinor m_resultMinor;
-
- // Unimplemented
- XKMSResultTypeImpl();
- XKMSResultTypeImpl(const XKMSResultTypeImpl &);
- XKMSResultTypeImpl & operator = (const XKMSResultTypeImpl &);
-
-};
-
-#define XKMS_RESULTTYPE_IMPL_METHODS \
-virtual ResultMajor getResultMajor(void) const \
- {return m_result.getResultMajor();} \
-virtual ResultMinor getResultMinor(void) const \
- {return m_result.getResultMinor();} \
-virtual const XMLCh * getRequestId(void) const \
- {return m_result.getRequestId();} \
-virtual const XMLCh * getRequestSignatureValue(void) const \
- {return m_result.getRequestSignatureValue();} \
-virtual void setResultMajor(ResultMajor r) \
- {m_result.setResultMajor(r);} \
-virtual void setResultMinor(ResultMinor r) \
- {m_result.setResultMinor(r);} \
-virtual void setRequestId(const XMLCh * id) \
- {m_result.setRequestId(id);} \
-virtual void setRequestSignatureValue(const XMLCh * value) \
- {m_result.setRequestSignatureValue(value);}
-
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSRESULTTYPEIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.cpp
deleted file mode 100644
index d45f9dd1..00000000
--- a/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeKeyBindingImpl := Implementation for RevokeKeyBinding
- *
- * $Id:$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRevokeKeyBindingImpl.hpp"
-#include "XKMSStatusImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRevokeKeyBindingImpl::XKMSRevokeKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
- mp_status = NULL;
-}
-
-XKMSRevokeKeyBindingImpl::XKMSRevokeKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
- mp_status = NULL;
-}
-
-XKMSRevokeKeyBindingImpl::~XKMSRevokeKeyBindingImpl() {
-
- if (mp_status != NULL)
- delete mp_status;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSRevokeKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRevokeKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
- /* Find the status element */
- DOMNodeList * nl = mp_keyBindingAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagStatus);
-
- if (nl == NULL || nl->getLength() != 1) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRevokeKeyBinding::load - Status value not found");
- }
-
- XSECnew(mp_status, XKMSStatusImpl(mp_env, (DOMElement*) nl->item(0)));
- mp_status->load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRevokeKeyBindingImpl::createBlankRevokeKeyBinding(XKMSStatus::StatusValue status) {
-
- DOMElement * ret = XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagRevokeKeyBinding);
-
- mp_env->doPrettyPrint(ret);
-
- // Create the status element
- XSECnew(mp_status, XKMSStatusImpl(mp_env));
- ret->appendChild(mp_status->createBlankStatus(status));
- mp_env->doPrettyPrint(ret);
-
- // Must have an Id
- XKMSKeyBindingAbstractTypeImpl::setId();
-
- return ret;
-
-}
-
-// --------------------------------------------------------------------------------
-// Status handling
-// --------------------------------------------------------------------------------
-
-XKMSStatus * XKMSRevokeKeyBindingImpl::getStatus(void) const {
-
- return mp_status;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.hpp
deleted file mode 100644
index 1996f3a1..00000000
--- a/xsec/xkms/impl/XKMSRevokeKeyBindingImpl.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeKeyBinding := Implementation for RevokeKeyBinding
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSREVOKEKEYBINDINGIMPL_INCLUDE
-#define XKMSREVOKEKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRevokeKeyBinding.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSStatusImpl;
-
-class XKMSRevokeKeyBindingImpl : public XKMSRevokeKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSRevokeKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSRevokeKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRevokeKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRevokeKeyBinding(XKMSStatus::StatusValue status);
-
- // Interface
- virtual XKMSStatus * getStatus(void) const;
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XKMSStatusImpl * mp_status;
-
- // Unimplemented
- XKMSRevokeKeyBindingImpl(void);
- XKMSRevokeKeyBindingImpl(const XKMSRevokeKeyBindingImpl &);
- XKMSRevokeKeyBindingImpl & operator = (const XKMSRevokeKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREVOKEKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRevokeRequestImpl.cpp b/xsec/xkms/impl/XKMSRevokeRequestImpl.cpp
deleted file mode 100644
index 4722ed7e..00000000
--- a/xsec/xkms/impl/XKMSRevokeRequestImpl.cpp
+++ /dev/null
@@ -1,302 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeRequestImpl := Implementation for RegisterRequest Messages
- *
- * $Id:$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRevokeRequestImpl.hpp"
-#include "XKMSRevokeKeyBindingImpl.hpp"
-#include "XKMSAuthenticationImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRevokeRequestImpl::XKMSRevokeRequestImpl(const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_revokeKeyBinding(NULL),
-mp_revocationCodeElement(NULL) {
-}
-
-XKMSRevokeRequestImpl::XKMSRevokeRequestImpl(const XSECEnv * env, DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_authentication(NULL),
-mp_revokeKeyBinding(NULL),
-mp_revocationCodeElement(NULL) {
-}
-
-XKMSRevokeRequestImpl::~XKMSRevokeRequestImpl() {
-
- if (mp_authentication != NULL)
- delete mp_authentication;
- if (mp_revokeKeyBinding != NULL)
- delete mp_revokeKeyBinding;
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSRevokeRequestImpl::load(void) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRevokeRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeRequest::load - called on incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any RevokeKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL && !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagRevokeKeyBinding)) {
- tmpElt = findNextElementChild(tmpElt);
- }
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_revokeKeyBinding, XKMSRevokeKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_revokeKeyBinding->load();
-
- tmpElt = findNextElementChild(tmpElt);
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRevokeRequest::load - Expected RevokeKeyBinding node");
-
- }
-
- // Authentication Element | RevocationCode Element
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagAuthentication)) {
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env, tmpElt));
- mp_authentication->load(mp_revokeKeyBinding->getId());
-
- }
- else if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagRevocationCode)) {
-
- mp_revocationCodeElement = tmpElt;
-
- }
- else {
-
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRevokeRequest::load - Expected Authentication or RevocationCode nodes");
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSRevokeRequestImpl::
- createBlankRevokeRequest(const XMLCh * service, const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagRevokeRequest, service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// MessageType
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRevokeRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RevokeRequest;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get Methods
-// --------------------------------------------------------------------------------
-
-XKMSRevokeKeyBinding * XKMSRevokeRequestImpl::getRevokeKeyBinding(void) const {
-
- return mp_revokeKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRevokeRequestImpl::getAuthentication (void) const {
-
- return mp_authentication;
-
-}
-
-const XMLCh * XKMSRevokeRequestImpl::getRevocationCode(void) const {
-
- if (mp_revocationCodeElement == NULL)
- return NULL;
-
- DOMNode * t = findFirstChildOfType(mp_revocationCodeElement, DOMNode::TEXT_NODE);
-
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSRevokeRequestImpl::getRevocationCode - expected TEXT node");
- }
-
- return t->getNodeValue();
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-XKMSRevokeKeyBinding * XKMSRevokeRequestImpl::addRevokeKeyBinding(XKMSStatus::StatusValue status) {
-
- if (mp_revokeKeyBinding != NULL)
- return mp_revokeKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_revokeKeyBinding, XKMSRevokeKeyBindingImpl(m_msg.mp_env));
- DOMElement * elt = mp_revokeKeyBinding->createBlankRevokeKeyBinding(status);
-
- // Insert
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagAuthentication) &&
- !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode)) {
- be = findNextElementChild(be);
- }
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(elt);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_revokeKeyBinding;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(elt, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_revokeKeyBinding;
-
-}
-
-XKMSAuthentication * XKMSRevokeRequestImpl::addAuthentication(void) {
-
- if (mp_authentication != NULL)
- return mp_authentication;
-
- if (mp_revokeKeyBinding == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeRequestImpl::addAuthentication - called prior to key infos being added");
- }
-
- XSECnew(mp_authentication, XKMSAuthenticationImpl(m_msg.mp_env));
- DOMElement * e =
- mp_authentication->createBlankAuthentication(mp_revokeKeyBinding->getId());
-
- DOMElement * be = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
-
- while (be != NULL && !strEquals(getXKMSLocalName(be), XKMSConstants::s_tagRevocationCode))
- be = findNextElementChild(be);
-
- if (be == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- return mp_authentication;
- }
-
- m_msg.mp_messageAbstractTypeElement->insertBefore(e, be);
- if (m_msg.mp_env->getPrettyPrintFlag() == true) {
- m_msg.mp_messageAbstractTypeElement->insertBefore(
- m_msg.mp_env->getParentDocument()->createTextNode(DSIGConstants::s_unicodeStrNL),
- be);
- }
-
- return mp_authentication;
-
-}
-
-void XKMSRevokeRequestImpl::addRevocationCode(const XMLCh * code) {
-
- safeBuffer str;
- DOMDocument *doc = m_msg.mp_env->getParentDocument();
- const XMLCh * prefix = m_msg.mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagRevocationCode);
-
- mp_revocationCodeElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- m_msg.mp_messageAbstractTypeElement->appendChild(mp_revocationCodeElement);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- mp_revocationCodeElement->appendChild(
- m_msg.mp_env->getParentDocument()->createTextNode(code));
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRevokeRequestImpl.hpp b/xsec/xkms/impl/XKMSRevokeRequestImpl.hpp
deleted file mode 100644
index c2193f9d..00000000
--- a/xsec/xkms/impl/XKMSRevokeRequestImpl.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeRequestImpl := Implementation for RevokeRequest Messages
- *
- * $Id:$
- *
- */
-
-#ifndef XKMSREVOKEREQUESTIMPL_INCLUDE
-#define XKMSREVOKEREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRevokeRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSAuthenticationImpl;
-class DSIGSignature;
-class XKMSRevokeKeyBindingImpl;
-
-class XKMSRevokeRequestImpl : public XKMSRevokeRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRevokeRequestImpl(
- const XSECEnv * env
- );
-
- XKMSRevokeRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRevokeRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRevokeRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual XKMSRevokeKeyBinding * getRevokeKeyBinding(void) const;
- virtual XKMSAuthentication * getAuthentication (void) const;
- virtual const XMLCh * getRevocationCode(void) const;
-
- /* Setter Interface Methods */
-
- virtual XKMSRevokeKeyBinding * addRevokeKeyBinding(XKMSStatus::StatusValue status);
- virtual XKMSAuthentication * addAuthentication(void);
- virtual void addRevocationCode(const XMLCh * code);
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-
-private:
-
- XKMSAuthenticationImpl * mp_authentication;
- XKMSRevokeKeyBindingImpl * mp_revokeKeyBinding;
- XERCES_CPP_NAMESPACE_QUALIFIER
- DOMElement * mp_revocationCodeElement;
-
- XSECProvider m_prov; // For creating the signature
-
- // Unimplemented
- XKMSRevokeRequestImpl(void);
- XKMSRevokeRequestImpl(const XKMSRevokeRequestImpl &);
- XKMSRevokeRequestImpl & operator = (const XKMSRevokeRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREVOKEREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSRevokeResultImpl.cpp b/xsec/xkms/impl/XKMSRevokeResultImpl.cpp
deleted file mode 100644
index 7429cd51..00000000
--- a/xsec/xkms/impl/XKMSRevokeResultImpl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeResultImpl := Implementation of RegisterResult Messages
- *
- * $Id:$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSRevokeResultImpl.hpp"
-#include "XKMSKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSRevokeResultImpl::XKMSRevokeResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSRevokeResultImpl::XKMSRevokeResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSRevokeResultImpl::~XKMSRevokeResultImpl() {
-
- XKMSRevokeResultImpl::KeyBindingVectorType::iterator i;
-
- for (i = m_keyBindingList.begin() ; i != m_keyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSRevokeResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagRevokeResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagKeyBinding);
-
- if (nl != NULL) {
-
- XKMSKeyBindingImpl * kb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(kb, XKMSKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_keyBindingList.push_back(kb);
- kb->load();
-
- }
-
- }
-
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSRevokeResultImpl::createBlankRevokeResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagRevokeResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSRevokeResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::RevokeResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSRevokeResultImpl::getKeyBindingSize(void) const {
-
- return (int) m_keyBindingList.size();
-
-}
-
-XKMSKeyBinding * XKMSRevokeResultImpl::getKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_keyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSRevokeResult::getKeyBindingItem - item out of range");
- }
-
- return m_keyBindingList[item];
-
-}
-
-XKMSKeyBinding * XKMSRevokeResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
-
- XKMSKeyBindingImpl * u;
-
- XSECnew(u, XKMSKeyBindingImpl(m_msg.mp_env));
-
- m_keyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankKeyBinding(status);
-
- // Append the element
-
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return u;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSRevokeResultImpl.hpp b/xsec/xkms/impl/XKMSRevokeResultImpl.hpp
deleted file mode 100644
index 40acebf8..00000000
--- a/xsec/xkms/impl/XKMSRevokeResultImpl.hpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSRevokeResultImpl := Implementation of RegisterResult Messages
- *
- * $Id: XKMSRevokeResultImpl.hpp 351366 2005-06-04 11:44:55Z blautenb $
- *
- */
-
-#ifndef XKMSREVOKERESULTIMPL_INCLUDE
-#define XKMSREVOKERESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSRevokeResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSKeyBindingImpl;
-
-class XKMSRevokeResultImpl : public XKMSRevokeResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSRevokeResultImpl(
- const XSECEnv * env
- );
-
- XKMSRevokeResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSRevokeResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankRevokeResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getKeyBindingSize(void) const;
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#else
- typedef std::vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#endif
-
- KeyBindingVectorType m_keyBindingList;
-
- // Unimplemented
- XKMSRevokeResultImpl(void);
- XKMSRevokeResultImpl(const XKMSRevokeResultImpl &);
- XKMSRevokeResultImpl & operator = (const XKMSRevokeResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSREVOKERESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSStatusImpl.cpp b/xsec/xkms/impl/XKMSStatusImpl.cpp
deleted file mode 100644
index d799525b..00000000
--- a/xsec/xkms/impl/XKMSStatusImpl.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusImpl := Implementation for Status elements (in KeyBinding)
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSStatusImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-#include <xercesc/util/XMLUniDefs.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSStatusImpl::XKMSStatusImpl(
- const XSECEnv * env) :
-mp_env(env),
-mp_statusElement(NULL) {
-
- m_statusValue = XKMSStatus::StatusUndefined;
-
- StatusValue i;
- StatusReason j;
-
- /* Clean out status codes */
- for (i = Indeterminate ; i > StatusUndefined; i = (StatusValue)(i-1)) {
- for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined; j = (XKMSStatus::StatusReason) (j-1)) {
-
- m_statusReasons[i-1][j-1] = NULL;
-
- }
- }
-
-}
-
-XKMSStatusImpl::XKMSStatusImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-mp_env(env),
-mp_statusElement(node) {
-
- m_statusValue = XKMSStatus::StatusUndefined;
-
- StatusValue i;
- StatusReason j;
-
- /* Clean out status codes */
- for (i = Indeterminate ; i > StatusUndefined; i = (StatusValue)(i-1)) {
- for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined; j = (XKMSStatus::StatusReason) (j-1)) {
-
- m_statusReasons[i-1][j-1] = NULL;
-
- }
- }
-
-}
-
-XKMSStatusImpl::~XKMSStatusImpl() {
-
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSStatusImpl::load() {
-
- if (mp_statusElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - called on empty DOM");
-
- }
-
- /* Load the StatusValue attribute */
-
- mp_statusValueAttr =
- mp_statusElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagStatusValue);
-
- /* Decode as appropriate*/
- if (mp_statusValueAttr == NULL) {
- // Attempt to load an empty element
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - No StatusValue attribute found");
- }
-
- const XMLCh * res = mp_statusValueAttr->getNodeValue();
-
- // This is actually an QName, but we cheat and find the ':' character by hand
- // without actually checking the qualifier.
- // TODO - CHECK the qualifier.
-
- int res2 = XMLString::indexOf(res, chPound);
- if (res2 == -1 || XMLString::compareNString(res, XKMSConstants::s_unicodeStrURIXKMS, res2)) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - StatusValue not in XKMS Name Space");
- }
- res = &res[res2+1];
-
- for (m_statusValue = XKMSStatus::Indeterminate;
- m_statusValue > XKMSStatus::StatusUndefined;
- m_statusValue = (XKMSStatus::StatusValue) (m_statusValue-1)) {
-
- if (strEquals(XKMSConstants::s_tagStatusValueCodes[m_statusValue], res))
- break;
-
-
- }
-
- if (m_statusValue == XKMSStatus::StatusUndefined) {
-
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - Unknown StatusValue provided");
-
- }
-
- /* Now we need to run through the status values */
- DOMElement * e = findFirstElementChild(mp_statusElement);
- while (e != NULL) {
-
- const XMLCh * vs = getXKMSLocalName(e);
-
- StatusValue v;
-
- if (strEquals(vs, XKMSConstants::s_tagValidReason)) {
- v = Valid;
- }
- else if (strEquals(vs, XKMSConstants::s_tagInvalidReason)) {
- v = Invalid;
- }
- else if (strEquals(vs, XKMSConstants::s_tagIndeterminateReason)) {
- v = Indeterminate;
- }
- else {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - Unknown Reason element");
- }
-
- DOMNode *t = findFirstChildOfType(e, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - Expected text node child of reason element");
- }
-
- /* Strip out the URI prefix */
- const XMLCh * reason = t->getNodeValue();
-
- int res = XMLString::indexOf(reason, chPound);
- if (res == -1 || XMLString::compareNString(reason, XKMSConstants::s_unicodeStrURIXKMS, res)) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - StatusReason not in XKMS Name Space");
- }
- reason = &reason[res+1];
-
- /* Found out what we are! */
- XKMSStatus::StatusReason i;
- for (i = XKMSStatus::Signature; i != XKMSStatus::ReasonUndefined; i = (XKMSStatus::StatusReason) (i-1)) {
-
- if (strEquals(XKMSConstants::s_tagStatusReasonCodes[i], reason))
- break;
-
- }
-
- if (i == XKMSStatus::ReasonUndefined) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::load - Unknown StatusReason");
- }
-
- m_statusReasons[v-1][i-1] = e;
-
- e = findNextElementChild(e);
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create Blank Status
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSStatusImpl::createBlankStatus(StatusValue status) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagStatus);
-
- mp_statusElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(mp_statusElement);
-
- /* Now add the StatusValue element */
-
- str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- str.sbXMLChCat(XKMSConstants::s_tagStatusValueCodes[status]);
-
- mp_statusElement->setAttributeNS(NULL,
- XKMSConstants::s_tagStatusValue,
- str.rawXMLChBuffer());
-
- mp_statusValueAttr =
- mp_statusElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagStatusValue);
-
- m_statusValue = status;
-
- return mp_statusElement;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get methods
-// --------------------------------------------------------------------------------
-
- /* Getter Interface Methods */
-XKMSStatus::StatusValue XKMSStatusImpl::getStatusValue(void) const {
-
- return m_statusValue;
-
-}
-
-bool XKMSStatusImpl::getStatusReason(StatusValue status, StatusReason reason) const {
-
- if (status == StatusUndefined || reason == ReasonUndefined) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::getStatusReason - status or reason undefined");
- }
-
- return (m_statusReasons[status-1][reason-1] != NULL);
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Set methods
-// --------------------------------------------------------------------------------
-
-void XKMSStatusImpl::setStatusReason(StatusValue status, StatusReason reason, bool value) {
-
- if (status == StatusUndefined || reason == ReasonUndefined) {
- throw XSECException(XSECException::StatusError,
- "XKMSStatus::setStatusReason - status or reason undefined");
- }
-
- if ((m_statusReasons[status-1][reason-1] != NULL) == value)
- return;
-
- /* Delete if necessary */
- if (value == false) {
-
- DOMNode * c = m_statusReasons[status-1][reason-1];
- mp_statusElement->removeChild(c);
- c->release();
- m_statusReasons[status-1][reason-1] = NULL;
- return;
-
- }
-
-
- /* Find a previously found element to insert before*/
- DOMNode * found = NULL;
-
- m_statusValue = XKMSStatus::StatusUndefined;
-
- StatusValue i;
- StatusReason j = XKMSStatus::Signature;
-
- /* Clean out status codes */
- for (i = Indeterminate ; i > StatusUndefined && !(i == status && j == reason); i = (StatusValue)(i-1)) {
- for (j = XKMSStatus::Signature; j != XKMSStatus::ReasonUndefined && !(i == status && j == reason); j = (XKMSStatus::StatusReason) (j-1)) {
-
- if (m_statusReasons[i-1][j-1] != NULL)
- found = m_statusReasons[i-1][j-1];
-
- }
- }
-
- /* Now lets create our new element and its text child */
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- // str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- if (status == Valid) {
- makeQName(str, prefix, XKMSConstants::s_tagValidReason);
- }
- else if (status == Invalid) {
- makeQName(str, prefix, XKMSConstants::s_tagInvalidReason);
- }
- else {
- makeQName(str, prefix, XKMSConstants::s_tagIndeterminateReason);
- }
-
- DOMElement * e = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- /* Create the text node child */
- str.sbXMLChIn(XKMSConstants::s_unicodeStrURIXKMS);
- str.sbXMLChCat(XKMSConstants::s_tagStatusReasonCodes[reason]);
- e->appendChild(doc->createTextNode(str.rawXMLChBuffer()));
-
- /* Insert at correct place */
- if (found == NULL) {
-
- mp_statusElement->appendChild(e);
- mp_env->doPrettyPrint(mp_statusElement);
-
- }
- else {
-
- mp_statusElement->insertBefore(e, found);
- if (mp_env->getPrettyPrintFlag() == true)
- mp_statusElement->insertBefore(doc->createTextNode(DSIGConstants::s_unicodeStrNL), found);
-
- }
-
- m_statusReasons[status-1][reason-1] = e;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSStatusImpl.hpp b/xsec/xkms/impl/XKMSStatusImpl.hpp
deleted file mode 100644
index df5579f1..00000000
--- a/xsec/xkms/impl/XKMSStatusImpl.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusImpl := Implementation for Status elements (in KeyBinding)
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUSIMPL_INCLUDE
-#define XKMSSTATUSIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSStatus.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-
-class XKMSStatusImpl : public XKMSStatus {
-
-public:
-
- XKMSStatusImpl(
- const XSECEnv * env
- );
-
- XKMSStatusImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSStatusImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankStatus(StatusValue status);
-
- /* Getter Interface Methods */
- virtual StatusValue getStatusValue(void) const;
- virtual bool getStatusReason(StatusValue status, StatusReason reason) const;
-
- /* Setter Methods */
- virtual void setStatusReason(StatusValue status, StatusReason reason, bool value);
-
-private:
-
- const XSECEnv * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_statusElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_statusValueAttr;
-
- StatusValue m_statusValue;
-
- /* Record values of each status */
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * m_statusReasons[3][4];
-
-
- // Unimplemented
- XKMSStatusImpl(const XKMSStatusImpl &);
- XKMSStatusImpl & operator = (const XKMSStatusImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSSTATUSIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSStatusRequestImpl.cpp b/xsec/xkms/impl/XKMSStatusRequestImpl.cpp
deleted file mode 100644
index 789db2de..00000000
--- a/xsec/xkms/impl/XKMSStatusRequestImpl.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusRequestImpl := Implementation of StatusRequest Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSStatusRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSStatusRequestImpl::XKMSStatusRequestImpl(
- const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_responseIdAttr(NULL) {
-}
-
-XKMSStatusRequestImpl::XKMSStatusRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_responseIdAttr(NULL) {
-
-}
-
-XKMSStatusRequestImpl::~XKMSStatusRequestImpl() {
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSStatusRequestImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSStatusRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagStatusRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSStatusRequest::load - called incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for ResponseId attribute
- mp_responseIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
-
- if (mp_responseIdAttr == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSStatusRequest::load - responseId not found!");
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSStatusRequestImpl::createBlankStatusRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagStatusRequest, service, id);
-// return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
-// MAKE_UNICODE_STRING("ValidateRequest"), service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSStatusRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::StatusRequest;
-
-}
-
-
-const XMLCh * XKMSStatusRequestImpl::getResponseId(void) const {
-
- if (mp_responseIdAttr == NULL) {
-
- // Attempt read when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSStatusRequest::getResponseId - called on non-initialised structure");
-
- }
-
- return mp_responseIdAttr->getNodeValue();
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-void XKMSStatusRequestImpl::setResponseId(const XMLCh * responseId) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSStatusRequest::setResponseId - called on non-initialised structure");
-
- }
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagResponseId, responseId);
- mp_responseIdAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagResponseId);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSStatusRequestImpl.hpp b/xsec/xkms/impl/XKMSStatusRequestImpl.hpp
deleted file mode 100644
index 75a1c694..00000000
--- a/xsec/xkms/impl/XKMSStatusRequestImpl.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusRequestImpl := Implementation of StatusRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUSREQUESTIMPL_INCLUDE
-#define XKMSSTATUSREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSStatusRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-
-class XKMSStatusRequestImpl : public XKMSStatusRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSStatusRequestImpl(
- const XSECEnv * env
- );
-
- XKMSStatusRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSStatusRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankStatusRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
- virtual const XMLCh * getResponseId(void) const;
-
- /* Setter interface methods */
- virtual void setResponseId(const XMLCh * responseId);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_responseIdAttr;
-
- // Unimplemented
- XKMSStatusRequestImpl(const XKMSStatusRequestImpl &);
- XKMSStatusRequestImpl & operator = (const XKMSStatusRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSSTATUSREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSStatusResultImpl.cpp b/xsec/xkms/impl/XKMSStatusResultImpl.cpp
deleted file mode 100644
index 42d1fb61..00000000
--- a/xsec/xkms/impl/XKMSStatusResultImpl.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusResultImpl := Implementation of StatusResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSStatusResultImpl.hpp"
-#include "XKMSUnverifiedKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSStatusResultImpl::XKMSStatusResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
- mp_successAttr = NULL;
- mp_failureAttr = NULL;
- mp_pendingAttr = NULL;
-
-}
-
-XKMSStatusResultImpl::XKMSStatusResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
- mp_successAttr = NULL;
- mp_failureAttr = NULL;
- mp_pendingAttr = NULL;
-
-}
-
-XKMSStatusResultImpl::~XKMSStatusResultImpl() {
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSStatusResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSStatusResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagStatusResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSStatusResult::load - called incorrect node");
-
- }
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSStatusResultImpl::createBlankStatusResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagStatusResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSStatusResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::StatusResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// Result count handling
-// --------------------------------------------------------------------------------
-
-int XKMSStatusResultImpl::getSuccessCount(void) const {
-
- if (mp_successAttr == NULL)
- return 0;
-
- unsigned int val;
- XMLString::textToBin(mp_successAttr->getNodeValue(), val);
-
- return (int) val;
-
-}
-
-int XKMSStatusResultImpl::getFailureCount(void) const {
-
- if (mp_failureAttr == NULL)
- return 0;
-
- unsigned int val;
- XMLString::textToBin(mp_failureAttr->getNodeValue(), val);
-
- return (int) val;
-
-}
-
-int XKMSStatusResultImpl::getPendingCount(void) const {
-
- if (mp_pendingAttr == NULL)
- return 0;
-
- unsigned int val;
- XMLString::textToBin(mp_pendingAttr->getNodeValue(), val);
-
- return (int) val;
-
-}
-
-void XKMSStatusResultImpl::setSuccessCount(int count) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSStatusResult::setSuccessCount - called on non-initialised structure");
-
- }
-
- XMLCh val[16];
- XMLString::binToText(count, val, 16, 10);
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagSuccess, val);
- mp_successAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagSuccess);
-
-}
-
-void XKMSStatusResultImpl::setFailureCount(int count) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSStatusResult::setFailureCount - called on non-initialised structure");
-
- }
-
- XMLCh val[16];
- XMLString::binToText(count, val, 16, 10);
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagFailure, val);
- mp_failureAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagFailure);
-
-}
-
-void XKMSStatusResultImpl::setPendingCount(int count) {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt update when not initialised
- throw XSECException(XSECException::MessageAbstractTypeError,
- "XKMSStatusResult::setPendingCount - called on non-initialised structure");
-
- }
-
- XMLCh val[16];
- XMLString::binToText(count, val, 16, 10);
-
- m_msg.mp_messageAbstractTypeElement->setAttributeNS(NULL, XKMSConstants::s_tagPending, val);
- mp_pendingAttr =
- m_msg.mp_messageAbstractTypeElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagPending);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSStatusResultImpl.hpp b/xsec/xkms/impl/XKMSStatusResultImpl.hpp
deleted file mode 100644
index c438fb32..00000000
--- a/xsec/xkms/impl/XKMSStatusResultImpl.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSStatusResultImpl := Implementation of StatusResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSSTATUSRESULTIMPL_INCLUDE
-#define XKMSSTATUSRESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSStatusResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSUnverifiedKeyBindingImpl;
-
-
-class XKMSStatusResultImpl : public XKMSStatusResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSStatusResultImpl(
- const XSECEnv * env
- );
-
- XKMSStatusResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSStatusResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankStatusResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getSuccessCount(void) const;
- virtual int getFailureCount(void) const;
- virtual int getPendingCount(void) const;
- virtual void setSuccessCount(int count);
- virtual void setFailureCount(int count);
- virtual void setPendingCount(int count);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_successAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_failureAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMAttr
- * mp_pendingAttr;
-
- // Unimplemented
- XKMSStatusResultImpl(const XKMSStatusResultImpl &);
- XKMSStatusResultImpl & operator = (const XKMSStatusResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSSTATUSRESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.cpp b/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.cpp
deleted file mode 100644
index 688e31a9..00000000
--- a/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUnverifiedKeyBindingImpl := Implementation for UnverifiedKeyBinding
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSUnverifiedKeyBindingImpl.hpp"
-
-#include <xercesc/dom/DOM.hpp>
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSUnverifiedKeyBindingImpl::XKMSUnverifiedKeyBindingImpl(
- const XSECEnv * env
- ) :
-XKMSKeyBindingAbstractTypeImpl(env) {
-
-}
-
-XKMSUnverifiedKeyBindingImpl::XKMSUnverifiedKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- ) :
-XKMSKeyBindingAbstractTypeImpl(env, node) {
-
-}
-
-XKMSUnverifiedKeyBindingImpl::~XKMSUnverifiedKeyBindingImpl() {}
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-void XKMSUnverifiedKeyBindingImpl::load(void) {
-
- if (mp_keyBindingAbstractTypeElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSUnverifiedKeyBindingImpl::load - called on empty DOM");
- }
-
- XKMSKeyBindingAbstractTypeImpl::load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSUnverifiedKeyBindingImpl::createBlankUnverifiedKeyBinding(void) {
-
- return XKMSKeyBindingAbstractTypeImpl::
- createBlankKeyBindingAbstractType(XKMSConstants::s_tagUnverifiedKeyBinding);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.hpp b/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.hpp
deleted file mode 100644
index cb536be1..00000000
--- a/xsec/xkms/impl/XKMSUnverifiedKeyBindingImpl.hpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUnverifiedKeyBindingImpl := Implementation for UnverifiedKeyBinding
- *
- * $Id$
- *
- */
-
-#ifndef XKMSUNVERIFIEDKEYBINDINGIMPL_INCLUDE
-#define XKMSUNVERIFIEDKEYBINDINGIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSUnverifiedKeyBinding.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSKeyBindingAbstractTypeImpl.hpp"
-
-class XKMSUnverifiedKeyBindingImpl : public XKMSUnverifiedKeyBinding, public XKMSKeyBindingAbstractTypeImpl {
-
-public:
-
- XKMSUnverifiedKeyBindingImpl(
- const XSECEnv * env
- );
-
- XKMSUnverifiedKeyBindingImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSUnverifiedKeyBindingImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankUnverifiedKeyBinding(void);
-
- // Import methods from XKMSKeyBindingAbstractType
- XKMS_KEYBINDINGABSTRACTYPE_IMPL_METHODS
-
-private:
-
- // Unimplemented
- XKMSUnverifiedKeyBindingImpl(void);
- XKMSUnverifiedKeyBindingImpl(const XKMSUnverifiedKeyBindingImpl &);
- XKMSUnverifiedKeyBindingImpl & operator = (const XKMSUnverifiedKeyBindingImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSUNVERIFIEDKEYBINDINGIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSUseKeyWithImpl.cpp b/xsec/xkms/impl/XKMSUseKeyWithImpl.cpp
deleted file mode 100644
index 189a6bb0..00000000
--- a/xsec/xkms/impl/XKMSUseKeyWithImpl.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUseKeyWithImpl := Implementation of UseKeyWith Messages
- *
- * $Id$
- *
- */
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSUseKeyWithImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSUseKeyWithImpl::XKMSUseKeyWithImpl(const XSECEnv * env) {
-
- mp_env = env;
- mp_useKeyWithElement = NULL;
- mp_identifierAttr = NULL;
- mp_applicationAttr = NULL;
-
-}
-
-XKMSUseKeyWithImpl::XKMSUseKeyWithImpl(const XSECEnv * env, DOMElement * node) {
-
- mp_env = env;
- mp_useKeyWithElement = node;
- mp_identifierAttr = NULL;
- mp_applicationAttr = NULL;
-
-}
-
-XKMSUseKeyWithImpl::~XKMSUseKeyWithImpl(){
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-
-void XKMSUseKeyWithImpl::load(void) {
-
- if (mp_useKeyWithElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(mp_useKeyWithElement),
- XKMSConstants::s_tagUseKeyWith)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::load - called incorrect node");
-
- }
-
- // Identifier
- mp_identifierAttr =
- mp_useKeyWithElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagIdentifier);
- // Application
- mp_applicationAttr =
- mp_useKeyWithElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagApplication);
-
- // Identifier and Application MUST be set for a message to be OK
-
- if (mp_identifierAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSUseKeyWith::load - Identifier attribute not found");
- }
-
- if (mp_applicationAttr == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSUseKeyWith::load - Application attribute not found");
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSUseKeyWithImpl::createBlankUseKeyWith(const XMLCh * application,
- const XMLCh * identifier) {
-
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagUseKeyWith);
-
- mp_useKeyWithElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- // Setup the Application URI
- mp_useKeyWithElement->setAttributeNS(NULL,
- XKMSConstants::s_tagApplication,
- application);
- mp_applicationAttr =
- mp_useKeyWithElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagApplication);
-
- // Identifier
- mp_useKeyWithElement->setAttributeNS(NULL,
- XKMSConstants::s_tagIdentifier,
- identifier);
- mp_identifierAttr =
- mp_useKeyWithElement->getAttributeNodeNS(NULL, XKMSConstants::s_tagIdentifier);
-
- return mp_useKeyWithElement;
-
-}
-
-// --------------------------------------------------------------------------------
-// Get methods
-// --------------------------------------------------------------------------------
-
-
-DOMElement * XKMSUseKeyWithImpl::getElement(void) const {
-
- return mp_useKeyWithElement;
-
-}
-
-const XMLCh * XKMSUseKeyWithImpl::getApplication(void) const {
-
- if (mp_applicationAttr == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::getApplication - called on non-loaded construct");
- }
-
- return mp_applicationAttr->getNodeValue();
-
-}
-
-const XMLCh * XKMSUseKeyWithImpl::getIdentifier(void) const {
-
- if (mp_identifierAttr == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::getIdentifier - called on non-loaded construct");
- }
-
- return mp_identifierAttr->getNodeValue();
-
-}
-
-// --------------------------------------------------------------------------------
-// Set methods
-// --------------------------------------------------------------------------------
-
-void XKMSUseKeyWithImpl::setApplication(const XMLCh * uri) {
- if (mp_applicationAttr == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::setApplication - called on non-loaded construct");
- }
-
- mp_applicationAttr->setNodeValue(uri);
-
-}
-void XKMSUseKeyWithImpl::setIdentifier(const XMLCh * identifier) {
-
- if (mp_identifierAttr == NULL) {
- throw XSECException(XSECException::XKMSError,
- "XKMSUseKeyWith::setIdentifier - called on non-loaded construct");
- }
-
- mp_identifierAttr->setNodeValue(identifier);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSUseKeyWithImpl.hpp b/xsec/xkms/impl/XKMSUseKeyWithImpl.hpp
deleted file mode 100644
index 68d2dd26..00000000
--- a/xsec/xkms/impl/XKMSUseKeyWithImpl.hpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSUseKeyWithImpl := Implementation of UseKeyWith Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSUSEKEYWITHIMPL_INCLUDE
-#define XKMSUSEKEYWITHIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSUseKeyWith.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XKMSUseKeyWithImpl : public XKMSUseKeyWith {
-
-public:
-
- XKMSUseKeyWithImpl(
- const XSECEnv * env
- );
-
- XKMSUseKeyWithImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSUseKeyWithImpl() ;
-
- // Load
- void load(void);
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankUseKeyWith(
- const XMLCh * application,
- const XMLCh * identifier);
-
-
- // Interface methods
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * getElement(void) const;
- virtual const XMLCh * getApplication(void) const;
- virtual const XMLCh * getIdentifier(void) const;
- virtual void setApplication(const XMLCh * uri);
- virtual void setIdentifier(const XMLCh * identifier);
-
-protected:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_useKeyWithElement;
- const XSECEnv * mp_env;
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_applicationAttr;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_identifierAttr;
-
- // Unimplemented
- XKMSUseKeyWithImpl(const XKMSUseKeyWithImpl &);
- XKMSUseKeyWithImpl & operator = (const XKMSUseKeyWithImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSUSEKEYWITHIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSValidateRequestImpl.cpp b/xsec/xkms/impl/XKMSValidateRequestImpl.cpp
deleted file mode 100644
index eb520048..00000000
--- a/xsec/xkms/impl/XKMSValidateRequestImpl.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateRequestImpl := Implementation of ValidateRequest Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSValidateRequestImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSValidateRequestImpl::XKMSValidateRequestImpl(
- const XSECEnv * env) :
-m_request(env),
-m_msg(m_request.m_msg),
-mp_queryKeyBindingElement(NULL),
-mp_queryKeyBinding(NULL) {
-
-}
-
-XKMSValidateRequestImpl::XKMSValidateRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_request(env, node),
-m_msg(m_request.m_msg),
-mp_queryKeyBinding(NULL) {
-
-}
-
-XKMSValidateRequestImpl::~XKMSValidateRequestImpl() {
-
- if (mp_queryKeyBinding != NULL)
- delete mp_queryKeyBinding;
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSValidateRequestImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSValidateRequest::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagValidateRequest)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSValidateRequest::load - called incorrect node");
-
- }
-
- // Load the base message
- m_request.load();
-
- // Now check for any QueryKeyBinding elements
- DOMElement * tmpElt = findFirstElementChild(m_msg.mp_messageAbstractTypeElement);
- while (tmpElt != NULL &&
- !strEquals(getXKMSLocalName(tmpElt), XKMSConstants::s_tagQueryKeyBinding))
- tmpElt = findNextElementChild(tmpElt);
-
- if (tmpElt != NULL) {
-
- XSECnew(mp_queryKeyBinding, XKMSQueryKeyBindingImpl(m_msg.mp_env, tmpElt));
- mp_queryKeyBinding->load();
- mp_queryKeyBindingElement = tmpElt;
-
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSValidateRequestImpl::createBlankValidateRequest(
- const XMLCh * service,
- const XMLCh * id) {
-
- return m_request.createBlankRequestAbstractType(
- XKMSConstants::s_tagValidateRequest, service, id);
-// return XKMSRequestAbstractTypeImpl::createBlankMessageAbstractType(
-// MAKE_UNICODE_STRING("ValidateRequest"), service, id);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSValidateRequestImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::ValidateRequest;
-
-}
-
-
-XKMSQueryKeyBinding * XKMSValidateRequestImpl::getQueryKeyBinding(void) {
-
- return mp_queryKeyBinding;
-
-}
-
-// --------------------------------------------------------------------------------
-// Setter methods
-// --------------------------------------------------------------------------------
-
-XKMSQueryKeyBinding * XKMSValidateRequestImpl::addQueryKeyBinding(void) {
-
- if (mp_queryKeyBinding != NULL)
- return mp_queryKeyBinding;
-
-
- // OK - Nothing exists, so we need to create from scratch
-
- XSECnew(mp_queryKeyBinding, XKMSQueryKeyBindingImpl(m_msg.mp_env));
- mp_queryKeyBindingElement = mp_queryKeyBinding->createBlankQueryKeyBinding();
-
- if (m_msg.mp_messageAbstractTypeElement->getFirstChild() == NULL) {
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
- }
- m_msg.mp_messageAbstractTypeElement->appendChild(mp_queryKeyBindingElement);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return mp_queryKeyBinding;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSValidateRequestImpl.hpp b/xsec/xkms/impl/XKMSValidateRequestImpl.hpp
deleted file mode 100644
index b57cb6f9..00000000
--- a/xsec/xkms/impl/XKMSValidateRequestImpl.hpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateRequestImpl := Implementation of ValidateRequest Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDATEREQUESTIMPL_INCLUDE
-#define XKMSVALIDATEREQUESTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSValidateRequest.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSRequestAbstractTypeImpl.hpp"
-#include "XKMSQueryKeyBindingImpl.hpp"
-
-class XKMSQueryKeyRequestImpl;
-
-class XKMSValidateRequestImpl : public XKMSValidateRequest {
-
-public:
- XKMSRequestAbstractTypeImpl m_request;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSValidateRequestImpl(
- const XSECEnv * env
- );
-
- XKMSValidateRequestImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSValidateRequestImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankValidateRequest(
- const XMLCh * service,
- const XMLCh * id = NULL);
-
-
- /* Getter Interface Methods */
-
- virtual XKMSQueryKeyBinding * getQueryKeyBinding(void);
-
- /* Setter interface methods */
- virtual XKMSQueryKeyBinding * addQueryKeyBinding(void);
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from RequestAbstractType */
- XKMS_REQUESTABSTRACTYPE_IMPL_METHODS
-
-private:
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_queryKeyBindingElement;
- XKMSQueryKeyBindingImpl * mp_queryKeyBinding;
-
- // Unimplemented
- XKMSValidateRequestImpl(const XKMSValidateRequestImpl &);
- XKMSValidateRequestImpl & operator = (const XKMSValidateRequestImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSVALIDATEREQUESTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSValidateResultImpl.cpp b/xsec/xkms/impl/XKMSValidateResultImpl.cpp
deleted file mode 100644
index ce6135e4..00000000
--- a/xsec/xkms/impl/XKMSValidateResultImpl.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateResultImpl := Implementation of ValidateResult Messages
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECError.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSValidateResultImpl.hpp"
-#include "XKMSKeyBindingImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSValidateResultImpl::XKMSValidateResultImpl(
- const XSECEnv * env) :
-m_result(env),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSValidateResultImpl::XKMSValidateResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node) :
-m_result(env, node),
-m_msg(m_result.m_msg) {
-
-}
-
-XKMSValidateResultImpl::~XKMSValidateResultImpl() {
-
- XKMSValidateResultImpl::KeyBindingVectorType::iterator i;
-
- for (i = m_keyBindingList.begin() ; i != m_keyBindingList.end(); ++i) {
-
- delete (*i);
-
- }
-
-}
-
-
-// --------------------------------------------------------------------------------
-// Load from DOM
-// --------------------------------------------------------------------------------
-
-// Load elements
-void XKMSValidateResultImpl::load() {
-
- if (m_msg.mp_messageAbstractTypeElement == NULL) {
-
- // Attempt to load an empty element
- throw XSECException(XSECException::XKMSError,
- "XKMSValidateResult::load - called on empty DOM");
-
- }
-
- if (!strEquals(getXKMSLocalName(m_msg.mp_messageAbstractTypeElement),
- XKMSConstants::s_tagValidateResult)) {
-
- throw XSECException(XSECException::XKMSError,
- "XKMSValidateResult::load - called incorrect node");
-
- }
-
- // Get any UnverifiedKeyBinding elements
- DOMNodeList * nl = m_msg.mp_messageAbstractTypeElement->getElementsByTagNameNS(
- XKMSConstants::s_unicodeStrURIXKMS,
- XKMSConstants::s_tagKeyBinding);
-
- if (nl != NULL) {
-
- XKMSKeyBindingImpl * kb;
- for (unsigned int i = 0; i < nl->getLength() ; ++ i) {
-
- XSECnew(kb, XKMSKeyBindingImpl(m_msg.mp_env, (DOMElement *) nl->item(i)));
- m_keyBindingList.push_back(kb);
- kb->load();
-
- }
-
- }
-
-
- // Load the base message
- m_result.load();
-
-}
-
-// --------------------------------------------------------------------------------
-// Create a blank one
-// --------------------------------------------------------------------------------
-DOMElement * XKMSValidateResultImpl::createBlankValidateResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin) {
-
- return m_result.createBlankResultType(
- XKMSConstants::s_tagValidateResult, service, id, rmaj, rmin);
-
-}
-
-// --------------------------------------------------------------------------------
-// Get interface methods
-// --------------------------------------------------------------------------------
-
-XKMSMessageAbstractType::messageType XKMSValidateResultImpl::getMessageType(void) {
-
- return XKMSMessageAbstractTypeImpl::ValidateResult;
-
-}
-
-// --------------------------------------------------------------------------------
-// UnverifiedKeyBinding handling
-// --------------------------------------------------------------------------------
-
-
-int XKMSValidateResultImpl::getKeyBindingSize(void) const {
-
- return (int) m_keyBindingList.size();
-
-}
-
-XKMSKeyBinding * XKMSValidateResultImpl::getKeyBindingItem(int item) const {
-
- if (item < 0 || item >= (int) m_keyBindingList.size()) {
- throw XSECException(XSECException::XKMSError,
- "XKMSValidateResult::getKeyBindingItem - item out of range");
- }
-
- return m_keyBindingList[item];
-
-}
-
-XKMSKeyBinding * XKMSValidateResultImpl::appendKeyBindingItem(XKMSStatus::StatusValue status) {
-
- XKMSKeyBindingImpl * u;
-
- XSECnew(u, XKMSKeyBindingImpl(m_msg.mp_env));
-
- m_keyBindingList.push_back(u);
-
- DOMElement * e = u->createBlankKeyBinding(status);
-
- // Append the element
-
- m_msg.mp_messageAbstractTypeElement->appendChild(e);
- m_msg.mp_env->doPrettyPrint(m_msg.mp_messageAbstractTypeElement);
-
- return u;
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSValidateResultImpl.hpp b/xsec/xkms/impl/XKMSValidateResultImpl.hpp
deleted file mode 100644
index c62ff5cb..00000000
--- a/xsec/xkms/impl/XKMSValidateResultImpl.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidateResultImpl := Implementation of ValidateResult Messages
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDATERESULTIMPL_INCLUDE
-#define XKMSVALIDATERESULTIMPL_INCLUDE
-
-// XSEC Includes
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/xkms/XKMSValidateResult.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "XKMSResultTypeImpl.hpp"
-
-#include <vector>
-
-class XKMSKeyBindingImpl;
-
-class XKMSValidateResultImpl : public XKMSValidateResult {
-
-public:
- XKMSResultTypeImpl m_result;
- XKMSMessageAbstractTypeImpl &m_msg;
-public:
-
- XKMSValidateResultImpl(
- const XSECEnv * env
- );
-
- XKMSValidateResultImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSValidateResultImpl();
-
- // Load elements
- void load();
-
- // Creation
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankValidateResult(
- const XMLCh * service,
- const XMLCh * id,
- ResultMajor rmaj,
- ResultMinor rmin);
-
- // Interface methods
- virtual int getKeyBindingSize(void) const;
- virtual XKMSKeyBinding * getKeyBindingItem(int item) const;
- virtual XKMSKeyBinding * appendKeyBindingItem(XKMSStatus::StatusValue status);
-
-
- /* Implemented from MessageAbstractType */
- virtual messageType getMessageType(void);
-
- /* Forced inheritance from XKMSMessageAbstractTypeImpl */
- XKMS_MESSAGEABSTRACTYPE_IMPL_METHODS
-
- /* Forced inheritance from XKMSResultTypeImpl */
- XKMS_RESULTTYPE_IMPL_METHODS
-
-private:
-
-#if defined(XSEC_NO_NAMESPACES)
- typedef vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#else
- typedef std::vector<XKMSKeyBindingImpl *> KeyBindingVectorType;
-#endif
-
- KeyBindingVectorType m_keyBindingList;
-
- // Unimplemented
- XKMSValidateResultImpl(const XKMSValidateResultImpl &);
- XKMSValidateResultImpl & operator = (const XKMSValidateResultImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSVALIDATERESULTIMPL_INCLUDE */
diff --git a/xsec/xkms/impl/XKMSValidityIntervalImpl.cpp b/xsec/xkms/impl/XKMSValidityIntervalImpl.cpp
deleted file mode 100644
index e5b4faba..00000000
--- a/xsec/xkms/impl/XKMSValidityIntervalImpl.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidityInterval := Implementation for ValidityInterval elements
- *
- * $Id$
- *
- */
-
-#include <xsec/framework/XSECDefs.hpp>
-#include <xsec/framework/XSECEnv.hpp>
-#include <xsec/framework/XSECError.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-#include "../../utils/XSECDOMUtils.hpp"
-
-#include "XKMSValidityIntervalImpl.hpp"
-
-#include <xsec/xkms/XKMSConstants.hpp>
-
-#include <xercesc/dom/DOM.hpp>
-
-XERCES_CPP_NAMESPACE_USE
-
-// --------------------------------------------------------------------------------
-// Construct/Destruct
-// --------------------------------------------------------------------------------
-
-XKMSValidityIntervalImpl::XKMSValidityIntervalImpl(const XSECEnv * env) :
-mp_env(env),
-mp_validityIntervalElement(NULL),
-mp_notBeforeElement(NULL),
-mp_notOnOrAfterElement(NULL) {
-
-}
-
-
-XKMSValidityIntervalImpl::XKMSValidityIntervalImpl(const XSECEnv * env, DOMElement * node) :
-mp_env(env),
-mp_validityIntervalElement(node),
-mp_notBeforeElement(NULL),
-mp_notOnOrAfterElement(NULL) {
-
-}
-
-XKMSValidityIntervalImpl::~XKMSValidityIntervalImpl() {
-
-}
-
-// --------------------------------------------------------------------------------
-// Load
-// --------------------------------------------------------------------------------
-
-void XKMSValidityIntervalImpl::load(void) {
-
- if (mp_validityIntervalElement == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSValidityIntervalImpl::load - called on empty DOM");
- }
-
-
- DOMElement * tmpElt = findFirstElementChild(mp_validityIntervalElement);
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagNotBefore)) {
- mp_notBeforeElement = tmpElt;
- tmpElt = findNextElementChild(tmpElt);
- }
-
- if (tmpElt != NULL && strEquals(getXKMSLocalName(tmpElt),
- XKMSConstants::s_tagNotOnOrAfter)) {
- mp_notOnOrAfterElement = tmpElt;
- }
-
-}
-
-// --------------------------------------------------------------------------------
-// Create
-// --------------------------------------------------------------------------------
-
-DOMElement * XKMSValidityIntervalImpl::createBlankValidityInterval(const XMLCh * notBefore,
- const XMLCh * notOnOrAfter) {
-
- // Get some setup values
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagValidityInterval);
-
- mp_validityIntervalElement =
- doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_env->doPrettyPrint(mp_validityIntervalElement);
-
- if (notBefore != NULL) {
- makeQName(str, prefix, XKMSConstants::s_tagNotBefore);
- DOMElement * e =
- doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS, str.rawXMLChBuffer());
- mp_validityIntervalElement->appendChild(e);
- e->appendChild(doc->createTextNode(notBefore));
- mp_env->doPrettyPrint(mp_validityIntervalElement);
- }
- if (notOnOrAfter != NULL) {
- makeQName(str, prefix, XKMSConstants::s_tagNotOnOrAfter);
- DOMElement * e =
- doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS, str.rawXMLChBuffer());
- mp_validityIntervalElement->appendChild(e);
- e->appendChild(doc->createTextNode(notOnOrAfter));
- mp_env->doPrettyPrint(mp_validityIntervalElement);
- }
-
- return mp_validityIntervalElement;
-}
-
-// --------------------------------------------------------------------------------
-// Get Methods
-// --------------------------------------------------------------------------------
-
-const XMLCh * XKMSValidityIntervalImpl::getNotBefore(void) const {
-
- if (mp_notBeforeElement == NULL)
- return NULL;
-
- DOMNode * t = findFirstChildOfType(mp_notBeforeElement, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSValidityIntervalImpl::getNotBefore - expected TEXT node");
- }
-
- return t->getNodeValue();
-
-}
-
-const XMLCh * XKMSValidityIntervalImpl::getNotOnOrAfter(void) const {
-
- if (mp_notOnOrAfterElement == NULL)
- return NULL;
-
- DOMNode * t = findFirstChildOfType(mp_notOnOrAfterElement, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSValidityIntervalImpl::getNotOnOrAfter - expected TEXT node");
- }
-
- return t->getNodeValue();
-
-}
-
-// --------------------------------------------------------------------------------
-// Set Methods
-// --------------------------------------------------------------------------------
-
-
-void XKMSValidityIntervalImpl::setNotBefore(const XMLCh * val) {
-
- if (mp_notBeforeElement == NULL) {
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagNotBefore);
-
- mp_notBeforeElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_notBeforeElement->appendChild(doc->createTextNode(val));
-
- // Now insert appropriately
-
- if (mp_notOnOrAfterElement != NULL) {
- mp_validityIntervalElement->insertBefore(mp_notBeforeElement, mp_notOnOrAfterElement);
- if (mp_env->getPrettyPrintFlag() == true) {
- mp_validityIntervalElement->insertBefore(
- doc->createTextNode(DSIGConstants::s_unicodeStrNL),
- mp_notOnOrAfterElement);
-
- }
- }
- else {
- mp_validityIntervalElement->appendChild(mp_notBeforeElement);
- mp_env->doPrettyPrint(mp_validityIntervalElement);
- }
-
- return;
- }
-
- DOMNode * t = findFirstChildOfType(mp_notBeforeElement, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSValidityIntervalImpl::getNotBefore - expected TEXT node");
- }
-
- t->setNodeValue(val);
-
-}
-
-void XKMSValidityIntervalImpl::setNotOnOrAfter(const XMLCh * val) {
-
- if (mp_notOnOrAfterElement == NULL) {
- safeBuffer str;
- DOMDocument *doc = mp_env->getParentDocument();
- const XMLCh * prefix = mp_env->getXKMSNSPrefix();
-
- makeQName(str, prefix, XKMSConstants::s_tagNotOnOrAfter);
-
- mp_notOnOrAfterElement = doc->createElementNS(XKMSConstants::s_unicodeStrURIXKMS,
- str.rawXMLChBuffer());
-
- mp_notOnOrAfterElement->appendChild(doc->createTextNode(val));
-
- // Now insert appropriately
-
- mp_validityIntervalElement->appendChild(mp_notOnOrAfterElement);
- mp_env->doPrettyPrint(mp_validityIntervalElement);
-
- return;
- }
-
- DOMNode * t = findFirstChildOfType(mp_notOnOrAfterElement, DOMNode::TEXT_NODE);
- if (t == NULL) {
- throw XSECException(XSECException::ExpectedXKMSChildNotFound,
- "XKMSValidityIntervalImpl::getNotOnOrAfter - expected TEXT node");
- }
-
- t->setNodeValue(val);
-
-}
-
-#endif /* XSEC_XKMS_ENABLED */
diff --git a/xsec/xkms/impl/XKMSValidityIntervalImpl.hpp b/xsec/xkms/impl/XKMSValidityIntervalImpl.hpp
deleted file mode 100644
index 34076e30..00000000
--- a/xsec/xkms/impl/XKMSValidityIntervalImpl.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * XSEC
- *
- * XKMSValidityInterval := Implementation for ValidityInterval elements
- *
- * $Id$
- *
- */
-
-#ifndef XKMSVALIDITYINTERVALIMPL_HEADER
-#define XKMSVALIDITYINTERVALIMPL_HEADER
-
-#include <xsec/framework/XSECDefs.hpp>
-
-#include <xsec/xkms/XKMSValidityInterval.hpp>
-
-#ifdef XSEC_XKMS_ENABLED
-
-class XSECEnv;
-
-class XKMSValidityIntervalImpl : public XKMSValidityInterval {
-
-public:
-
- /* Constructors and Destructors */
-
- XKMSValidityIntervalImpl(
- const XSECEnv * env
- );
-
- XKMSValidityIntervalImpl(
- const XSECEnv * env,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * node
- );
-
- virtual ~XKMSValidityIntervalImpl() ;
-
- // Load
- void load();
-
- // Create
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankValidityInterval(const XMLCh * notBefore, const XMLCh * notOnOrAfter);
-
- // Get methods
-
- virtual const XMLCh * getNotBefore(void) const;
- virtual const XMLCh * getNotOnOrAfter(void) const;
-
- // Set
-
- virtual void setNotBefore(const XMLCh * val);
- virtual void setNotOnOrAfter(const XMLCh * val);
-
-private:
-
- const XSECEnv
- * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_validityIntervalElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_notBeforeElement;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement
- * mp_notOnOrAfterElement;
-
- // Unimplemented
- XKMSValidityIntervalImpl(void);
- XKMSValidityIntervalImpl(const XKMSValidityIntervalImpl &);
- XKMSValidityIntervalImpl & operator = (const XKMSValidityIntervalImpl &);
-
-};
-
-#endif /* XSEC_XKMS_ENABLED */
-#endif /* XKMSVALIDITYINTERVAL_INCLUDE */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list