diff -Nru libdigidoc-2.7.0/AUTHORS libdigidoc-3.7.0.875/AUTHORS --- libdigidoc-2.7.0/AUTHORS 2010-09-29 20:49:23.000000000 +0000 +++ libdigidoc-3.7.0.875/AUTHORS 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Veiko Sinivee - The main project leader and author of DigiDoc library. -Martin Paljak - Integrator, fixer, packaging maintainer. -Raul Metsma - Fixed a lot of bugs and crashes -Kalev Lember - Ported build system to CMake, fixed bugs -Antti Andreimann - Did something, can't remember exactly what ;) diff -Nru libdigidoc-2.7.0/CMakeLists.txt libdigidoc-3.7.0.875/CMakeLists.txt --- libdigidoc-2.7.0/CMakeLists.txt 2010-09-29 20:52:41.000000000 +0000 +++ libdigidoc-3.7.0.875/CMakeLists.txt 2012-12-13 22:05:47.000000000 +0000 @@ -1,57 +1,52 @@ -cmake_minimum_required( VERSION 2.6 ) +cmake_minimum_required( VERSION 2.8 ) project( libdigidoc ) -# Custom cmake modules set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" ) +set( CMAKE_FIND_ROOT_PATH ${CMAKE_OSX_SYSROOT} ) -include( InstallSettings ) +set( FRAMEWORK false CACHE BOOL "Build library as Mac OS X Framework" ) + +include( VersionInfo ) +include( GNUInstallDirs ) if( WIN32 ) - set( DIGIDOC_CONF_NAME "digidoc.ini" ) - set( PKCS11_MODULE "opensc-pkcs11.dll" ) -elseif( APPLE ) - set( DIGIDOC_CONF_NAME "digidoc.conf" ) - set( PKCS11_MODULE "/Library/OpenSC/lib/opensc-pkcs11.so" ) + set( DIGIDOC_CONF_NAME "digidoc.ini" ) + set( DIGIDOC_DATA_DIR "esteid") else() - set( DIGIDOC_CONF_NAME "digidoc.conf" ) - set( PKCS11_MODULE "opensc-pkcs11.so" ) + set( DIGIDOC_CONF_NAME "digidoc.conf" ) + set( DIGIDOC_DATA_DIR "${CMAKE_INSTALL_FULL_DATADIR}/esteid") +endif() +if( NOT DIGIDOC_CERT_LOCATION ) + set( DIGIDOC_CERT_LOCATION ${DIGIDOC_DATA_DIR} ) endif() - -set( DIGIDOC_DATA_DIR "${SHARE_INSTALL_PREFIX}/libdigidoc") -set( DIGIDOC_INCLUDE_DIR "${INCLUDE_INSTALL_DIR}/libdigidoc" ) -set( DIGIDOC_VERSION "2.7.0" ) find_package( LibXml2 REQUIRED ) find_package( OpenSSL REQUIRED ) -find_package( OpenSSLCrypto REQUIRED ) +find_package( PKCS11 ) find_package( ZLIB REQUIRED ) -find_package( Iconv REQUIRED ) -if(UNIX) - find_package( LibDL ) -endif(UNIX) - -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/libdigidoc.pc.cmake - ${CMAKE_CURRENT_BINARY_DIR}/libdigidoc.pc - @ONLY -) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libdigidoc.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig ) +find_package( Iconv ) +find_package( ICU ) +find_package( MFC ) + +include( CheckIncludeFiles ) +configure_file( config.h.cmake config.h ) include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${ICONV_INCLUDE_DIR} - ${LIBDL_INCLUDE_DIR} - ${LIBXML2_INCLUDE_DIR} - ${OPENSSLCRYPTO_INCLUDE_DIR} - ${OPENSSL_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${LIBXML2_INCLUDE_DIR} + ${OPENSSL_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} ) +if( ICU_FOUND ) + include_directories( ${ICU_INCLUDE_DIR} ) +endif() +if( ICONV_FOUND ) + include_directories( ${ICONV_INCLUDE_DIR} ) +endif() -if( APPLE ) - include_directories( /Library/OpenSC/include ) - include_directories( /usr/local/include/../include ) -endif( APPLE ) - -add_subdirectory( etc ) add_subdirectory( libdigidoc ) +if( MFC_FOUND ) + add_subdirectory( libdigidoccom ) + add_subdirectory( digidoccom ) +endif() diff -Nru libdigidoc-2.7.0/COPYING libdigidoc-3.7.0.875/COPYING --- libdigidoc-2.7.0/COPYING 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/COPYING 1970-01-01 00:00:00.000000000 +0000 @@ -1,510 +0,0 @@ - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations -below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it -becomes a de-facto standard. To achieve this, non-free programs must -be allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control -compilation and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at least - three years, to give the same user the materials specified in - Subsection 6a, above, for a charge no more than the cost of - performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply, and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License -may add an explicit geographical distribution limitation excluding those -countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms -of the ordinary General Public License). - - To apply these terms, attach the following notices to the library. -It is safest to attach them to the start of each source file to most -effectively convey the exclusion of warranty; and each file should -have at least the "copyright" line and a pointer to where the full -notice is found. - - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or -your school, if any, to sign a "copyright disclaimer" for the library, -if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James - Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff -Nru libdigidoc-2.7.0/ChangeLog libdigidoc-3.7.0.875/ChangeLog --- libdigidoc-2.7.0/ChangeLog 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/ChangeLog 2012-12-13 22:05:47.000000000 +0000 @@ -1,19 +1,3 @@ -Version 2.5.33 -(Veiko Sinivee ) -* using of verifyOCSPResponse to verify OCSP response status if CA certs not -found. Additional error handling - -(Priit Randla ) -* OCSP revoked cert response verification fix - -Version 2.5.32 -(Veiko Sinivee ) -* fixed adding signature from file and enabled saving digidoc-s without signature value - -Version 2.5.31 -(Veiko Sinivee ) -* mobile signing functionality added - Version 2.4.3 (Veiko Sinivee ) * more buffer overflow and security fixes diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocDds.c libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocDds.c --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocDds.c 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocDds.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,2199 +0,0 @@ -//================================================== -// FILE: DigiDocDds.c -// PROJECT: Digi Doc -// DESCRIPTION: Digi Doc functions for DigiDocService client -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 07.01.2006 Veiko Sinivee -// Creation -//================================================== - -#include "DigiDocDds.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "DigiDocService.nsmap" -#include "ddsH.h" -#include "ddsStub.h" - -// global flag to mark SSL init status -int g_nSslInited = 0; - -//-------------------------------------------------- -// Locates client PEM file containing client private -// key and cert for service access. -// szClientPem - buffer for found file name -// nLen - length of buffer -// returns ERR_OK on success -//-------------------------------------------------- -int ddocLocateClientKeyAndCert(char* szClientPem, int nLen) -{ - int err = ERR_OK; - X509* pCert = 0; - EVP_PKEY *pkey = 0; - char *pkcs12file = 0, *pkcs12passwd = 0, *p; - - // init return buffer - memset(szClientPem, 0, nLen); - pkcs12file = (char*)ConfigItem_lookup("DIGIDOC_PKCS_FILE"); - pkcs12passwd = (char*)ConfigItem_lookup("DIGIDOC_PKCS_PASSWD"); - ddocDebug(3, "ddocLocateClientKeyAndCert", "PKCS12: %s passwd: \'%s\'", - (pkcs12file ? pkcs12file : "NULL"), (pkcs12passwd ? pkcs12passwd : "NONE")); - if(pkcs12file) { - // compose default pem file location - strncpy(szClientPem, pkcs12file, nLen); - szClientPem[nLen] = 0; - p = strrchr(szClientPem, '.'); - if(p) *p = 0; - strncat(szClientPem, ".pem", nLen - strlen(szClientPem)); - szClientPem[nLen] = 0; - // check if pem exists there - err = checkFileExists(szClientPem); - ddocDebug(3, "ddocLocateClientKeyAndCert", "Check PEM: %s exists: %d", szClientPem, err); - // if it doesn't exist then attempt to create - if(!err) { - err = ReadCertificateByPKCS12(&pCert, pkcs12file, pkcs12passwd, &pkey); - ddocDebug(3, "ddocLocateClientKeyAndCert", "Read p12: %s key: %s cert: %s", - (pkcs12file ? pkcs12file : "NULL"), (pkey ? "OK" : "NO"), (pCert ? "OK" : "NO")); - if(!err && pCert && pkey) { - err = ddocWriteKeyAndCertPem(pkey, pCert, szClientPem, pkcs12passwd); - ddocDebug(3, "ddocLocateClientKeyAndCert", "Write pem: %s - %d", szClientPem, err); - } - // if no permission to write then try temp file - if(err) { - szClientPem[0] = 0; // no luck - if(pCert && pkey) { - err = getTempFileName(szClientPem, nLen); - if(!err) { - err = ddocWriteKeyAndCertPem(pkey, pCert, szClientPem, pkcs12passwd); - ddocDebug(3, "ddocLocateClientKeyAndCert", "Write pem: %s - %d", szClientPem, err); - } - if(err) szClientPem[0] = 0; // no luck - } - } - } // else pem exists - else - err = 0; - } - if(pCert) - X509_free(pCert); - if(pkey) - EVP_PKEY_free(pkey); - - return err; -} - -//-------------------------------------------------- -// Initializes DDS connection -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsConnect(DDS** ppDds) -{ - int err = ERR_OK, e2; - char buf1[250], buf2[250]; - - RETURN_IF_NULL_PARAM(ppDds); - // alloc new object only if there is none - if(!*ppDds) { - // allocate new DDS context object - *ppDds = (DDS*)malloc(sizeof(DDS)); - RETURN_IF_BAD_ALLOC(*ppDds); - memset(*ppDds, 0, sizeof(DDS)); - } - ddocDebug(3, "ddocDdsConnect", "Connecting to: %s", (char*)ConfigItem_lookup("DIGIDOC_DDS_ENDPOINT")); - (*ppDds)->endpoint = (char*)ConfigItem_lookup("DIGIDOC_DDS_ENDPOINT"); - if((char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST")) - ddocDebug(3, "ddocDdsConnect", "Using proxy: %s:%s", - (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"), - (char*)ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - (*ppDds)->soap.proxy_host = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); - if(ConfigItem_lookup("DIGIDOC_PROXY_PORT")) - (*ppDds)->soap.proxy_port = atoi(ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - //soap_init(&((*ppDds)->soap)); - soap_init2(&((*ppDds)->soap), SOAP_IO_KEEPALIVE | SOAP_IO_CHUNK | SOAP_C_UTFSTRING, - SOAP_IO_KEEPALIVE | SOAP_C_UTFSTRING); - (*ppDds)->soap.namespaces = namespaces; - // if using HTTPS connection -#ifdef WIN32 - if((*ppDds)->endpoint && !_strnicmp((*ppDds)->endpoint, "https", 5)) { -#else - if((*ppDds)->endpoint && !strncasecmp((*ppDds)->endpoint, "https", 5)) { -#endif - // set client authentication - err = ddocLocateClientKeyAndCert(buf2, sizeof(buf2)); - // compose DDS GW server cert path - buf1[0] = 0; - if(ConfigItem_lookup("DIGIDOC_DDS_CERT")) { - strncpy(buf1, (char*)ConfigItem_lookup("CA_CERT_PATH"), sizeof(buf1)); - if(buf1[0]) { -#ifdef WIN32 - strcat(buf1, "\\"); -#else - strcat(buf1, "/"); -#endif - } - strncat(buf1, (char*)ConfigItem_lookup("DIGIDOC_DDS_CERT"), sizeof(buf1)-strlen(buf1)-1); - } - ddocDebug(3, "ddocDdsConnect", "Server cert: %s client-pem: %s", buf1, buf2); - // init SSL if necessary - if(!g_nSslInited) { - soap_ssl_init(); - g_nSslInited = 1; - } - if((e2 = soap_ssl_client_context(&((*ppDds)->soap), - // SOAP_SSL_NO_AUTHENTICATION, NULL, NULL, NULL, - (ConfigItem_lookup("DIGIDOC_DDS_CERT") ? SOAP_SSL_DEFAULT : SOAP_SSL_NO_AUTHENTICATION), - (strlen(buf2) ? buf2 : NULL), // client auth pem - (strlen(buf2) ? (char*)ConfigItem_lookup("DIGIDOC_PKCS_PASSWD") : NULL), // client key passwd - (ConfigItem_lookup("DIGIDOC_DDS_CERT") ? buf1 : NULL), // server ca - NULL, // optional capath - NULL // no randfile - ))) { - if(e2 == SOAP_SSL_ERROR) - err = ERR_WPKI_UNTRUSTED_SRVICE; - else - err = ERR_GENERIC_SOAP_ERR; - soap_print_fault(&((*ppDds)->soap), stderr); - return err; // ??? - } - } - - return err; -} - -//-------------------------------------------------- -// Cleanup Certificate info -// pInfo - cert info pointer -//-------------------------------------------------- -void ddocDdsCleanupCertificateInfo(struct d__CertificateInfo *pInfo) -{ - int i; - if(pInfo) { - if(pInfo->Issuer) - free(pInfo->Issuer); - if(pInfo->Subject) - free(pInfo->Subject); - if(pInfo->ValidFrom) - free(pInfo->ValidFrom); - if(pInfo->ValidTo) - free(pInfo->ValidTo); - if(pInfo->IssuerSerial) - free(pInfo->IssuerSerial); - if(pInfo->__ptrPolicies && pInfo->__sizePolicies > 0) { - for(i = 0; i < pInfo->__sizePolicies; i++) { - if(pInfo->__ptrPolicies[i].OID) - free(pInfo->__ptrPolicies[i].OID); - if(pInfo->__ptrPolicies[i].URL) - free(pInfo->__ptrPolicies[i].URL); - if(pInfo->__ptrPolicies[i].Description) - free(pInfo->__ptrPolicies[i].Description); - } - free(pInfo->__ptrPolicies); - } - free(pInfo); - } -} - -//-------------------------------------------------- -// Cleanup DDS connection error & fault info -// pDds - pointer to DDS context structure -//-------------------------------------------------- -int ddocDdsCleanupStatusAndFault(DDS* pDds) -{ - RETURN_IF_NULL_PARAM(pDds); - pDds->err = ERR_OK; - if(pDds->szStatus) { - free(pDds->szStatus); - pDds->szStatus = 0; - } - if(pDds->szStatusCode) { - free(pDds->szStatusCode); - pDds->szStatusCode = 0; - } - if(pDds->szSoapFaultCode) { - free(pDds->szSoapFaultCode); - pDds->szSoapFaultCode = 0; - } - if(pDds->szSoapFaultString) { - free(pDds->szSoapFaultString); - pDds->szSoapFaultString = 0; - } - if(pDds->szSoapFaultDetail) { - free(pDds->szSoapFaultDetail); - pDds->szSoapFaultDetail = 0; - } - return ERR_OK; -} - -//-------------------------------------------------- -// Cleanup DDS connection status & signed doc info -// pDds - pointer to DDS context structure -//-------------------------------------------------- -EXP_OPTION int ddocDdsCleanupInfo(DDS* pDds) -{ - int err = ERR_OK, i, j; - - RETURN_IF_NULL_PARAM(pDds); - // cleanup signed doc info - if(pDds->pSigDocInfo) { - // format - if(pDds->pSigDocInfo->Format) - free(pDds->pSigDocInfo->Format); - // version - if(pDds->pSigDocInfo->Version) - free(pDds->pSigDocInfo->Version); - // data files - if(pDds->pSigDocInfo->__ptrDataFileInfo && - pDds->pSigDocInfo->__sizeOfDataFileInfos > 0) { - for(i = 0; i < pDds->pSigDocInfo->__sizeOfDataFileInfos; i++) { - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].Id) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].Id); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].Filename) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].Filename); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].MimeType) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].MimeType); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].ContentType) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].ContentType); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestType) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestType); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestValue) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestValue); - // data file atributes - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes && - pDds->pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes > 0) { - for(j = 0; j < pDds->pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes; j++) { - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Name) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Name); - if(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Value) - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Value); - } - free(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes); - } - } - free(pDds->pSigDocInfo->__ptrDataFileInfo); - } // data files - // signatures - if(pDds->pSigDocInfo->__ptrSignatureInfo && - pDds->pSigDocInfo->__sizeOfSignatureInfos > 0) { - for(i = 0; i < pDds->pSigDocInfo->__sizeOfSignatureInfos; i++) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Id) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Id); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Status) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Status); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SigningTime) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SigningTime); - // signature error - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Category) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Category); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Description) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Description); - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error); - } - // roles - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole && - pDds->pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles) { - for(j = 0; j < pDds->pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles; j++) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Role) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Role); - } - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole); - } - // signature production place - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->City) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->City); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->StateOrProvince) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->StateOrProvince); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->PostalCode) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->PostalCode); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->CountryName) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->CountryName); - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace); - } - // Signer - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->CommonName) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->CommonName); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->IDCode) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->IDCode); - // Signers cert - ddocDdsCleanupCertificateInfo(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->Certificate); - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer); - } // Signer - // Confirmation - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation) { - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderID) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderID); - if(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ProducedAt) - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ProducedAt); - // Notarys cert - ddocDdsCleanupCertificateInfo(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderCertificate); - free(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation); - } // Confirmation - } // for signatures - free(pDds->pSigDocInfo->__ptrSignatureInfo); - } // signatures - // set pointer to 0 - pDds->pSigDocInfo = 0; - } - return err; -} - -//-------------------------------------------------- -// Cleanup DDS connection but don't disconnect -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsCleanup(DDS* pDds) -{ - int err = ERR_OK; - ddocDebug(3, "ddocDdsCleanup", "cleanup"); - if(pDds) { - ddocDebug(3, "ddocDdsCleanup", "cleanup: %s", (pDds->endpoint ? pDds->endpoint : "")); - soap_destroy(&(pDds->soap)); - soap_end(&(pDds->soap)); - soap_done(&(pDds->soap)); - } - //pDds->endpoint = 0; // mark disconnected - return err; -} - -//-------------------------------------------------- -// Cleanup DDS connection -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsDisconnect(DDS* pDds) -{ - int err = ERR_OK; - // cleanup cached info - if(pDds) - ddocDdsCleanupInfo(pDds); - ddocDebug(3, "ddocDdsDisconnect", "Disconnecting"); - if(pDds && pDds->endpoint) { - ddocDebug(3, "ddocDdsDisconnect", "Disconnecting from: %s", pDds->endpoint); - soap_destroy(&(pDds->soap)); - soap_end(&(pDds->soap)); - soap_done(&(pDds->soap)); - pDds->endpoint = 0; // mark disconnected - } - if(pDds) - free(pDds); - return err; -} - - -//-------------------------------------------------- -// Copies Certificate info from soap response -// ppDest - address of place for new pointer -// pSrc - cert info in soap response -// return error code or ERR_OK; -//-------------------------------------------------- -int ddocDdsCopyCertificateInfo(struct d__CertificateInfo **ppDest, struct d__CertificateInfo* pSrc) -{ - int err = ERR_OK, i; - RETURN_IF_NULL_PARAM(ppDest); - if(pSrc) { - *ppDest = (struct d__CertificateInfo*)malloc(sizeof(struct d__CertificateInfo)); - RETURN_IF_BAD_ALLOC(*ppDest); - memset(*ppDest, 0, sizeof(struct d__CertificateInfo)); - if(pSrc->Issuer) - (*ppDest)->Issuer = strdup(pSrc->Issuer); - if(pSrc->Subject) - (*ppDest)->Subject = strdup(pSrc->Subject); - if(pSrc->ValidFrom) - (*ppDest)->ValidFrom = strdup(pSrc->ValidFrom); - if(pSrc->ValidTo) - (*ppDest)->ValidTo = strdup(pSrc->ValidTo); - if(pSrc->IssuerSerial) - (*ppDest)->IssuerSerial = strdup(pSrc->IssuerSerial); - if(pSrc->__ptrPolicies && pSrc->__sizePolicies > 0) { - (*ppDest)->__ptrPolicies = (struct d__CertificatePolicy*) - malloc(sizeof(struct d__CertificatePolicy) * pSrc->__sizePolicies); - RETURN_IF_BAD_ALLOC((*ppDest)->__ptrPolicies); - memset((*ppDest)->__ptrPolicies, 0, sizeof(struct d__CertificatePolicy) * pSrc->__sizePolicies); - (*ppDest)->__sizePolicies = pSrc->__sizePolicies; - for(i = 0; i < pSrc->__sizePolicies; i++) { - if(pSrc->__ptrPolicies[i].OID) - (*ppDest)->__ptrPolicies[i].OID = strdup(pSrc->__ptrPolicies[i].OID); - if(pSrc->__ptrPolicies[i].URL) - (*ppDest)->__ptrPolicies[i].URL = strdup(pSrc->__ptrPolicies[i].URL); - if(pSrc->__ptrPolicies[i].Description) - (*ppDest)->__ptrPolicies[i].Description = strdup(pSrc->__ptrPolicies[i].Description); - } - } - } - return err; -} - -//-------------------------------------------------- -// Retrieves SOAP fault string -// pDds - pointer to DDS context structure -// returns SOAP fault string or NULL -//-------------------------------------------------- -char* ddocDdsGetSoapFaultString(DDS* pDds) -{ - char *s = NULL, **p = NULL; - if(pDds && pDds->soap.error) { - ddocDebug(4, "ddocDdsGetSoapFaultString", "Get fault for err: %d", pDds->soap); - p = (char**)soap_faultstring(&(pDds->soap)); - ddocDebug(4, "ddocDdsGetSoapFaultString", "p: %s, s: %s", - (p ? "OK" : "NULL"), ((p && *p) ? *p : "NULL")); - if(p && *p) - s = (char*)*p; - } - return s; -} - -//-------------------------------------------------- -// Retrieves SOAP fault code -// pDds - pointer to DDS context structure -// returns SOAP fault code or NULL -//-------------------------------------------------- -char* ddocDdsGetSoapFaultCode(DDS* pDds) -{ - char *s = NULL, **d = NULL; - if(pDds && pDds->soap.error) { - d = (char**)soap_faultcode(&(pDds->soap)); - if(d && *d) - s = *d; - } - return s; -} - -//-------------------------------------------------- -// Retrieves SOAP fault detail -// pDds - pointer to DDS context structure -// returns SOAP fault detail or NULL -//-------------------------------------------------- -char* ddocDdsGetSoapFaultDetail(DDS* pDds) -{ - char *s = NULL, **d = NULL; - if(pDds && pDds->soap.error) { - d = (char**)soap_faultdetail(&(pDds->soap)); - if(d && *d) - s = *d; - } - return s; -} - -//-------------------------------------------------- -// Copy response status, error code and soap fault data -// pDds - pointer to DDS context structure -// szStatus - response status as returned by service -// err - error code returned by service -//-------------------------------------------------- -int ddocDdsCopyStatusAndFault(DDS* pDds, char* szStatus, char* szStatusCode, int err) -{ - char *s; - RETURN_IF_NULL_PARAM(pDds); - // cleanup old info - ddocDdsCleanupStatusAndFault(pDds); - // copy status - if(szStatus) - pDds->szStatus = strdup(szStatus); - if(szStatusCode) - pDds->szStatusCode = strdup(szStatusCode); - // error - pDds->err = err; - // soap fault info - if(err) { - s = ddocDdsGetSoapFaultCode(pDds); - if(s) - pDds->szSoapFaultCode = strdup(s); - s = ddocDdsGetSoapFaultString(pDds); - if(s) - pDds->szSoapFaultString = strdup(s); - s = ddocDdsGetSoapFaultDetail(pDds); - if(s) - pDds->szSoapFaultDetail = strdup(s); - } - return ERR_OK; -} - - -//-------------------------------------------------- -// Copies SignedDoc Info from soap response to -// DDS structure so it can be further examined -// in client application. Internal function. -// pDds - pointer to DDS context structure -// pSigDocInfo - signed doc info from soap -// return error code or ERR_OK; -//-------------------------------------------------- -int ddocDdsCopySoapRespInfo(DDS* pDds, struct d__SignedDocInfo* pSigDocInfo) -{ - int err = ERR_OK, i, j; - - RETURN_IF_NULL_PARAM(pDds); - // cleanup old info - ddocDdsCleanupInfo(pDds); - // copy signed doc info - if(pSigDocInfo) { - pDds->pSigDocInfo = (struct d__SignedDocInfo*)malloc(sizeof(struct d__SignedDocInfo)); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo); - memset(pDds->pSigDocInfo, 0, sizeof(struct d__SignedDocInfo)); - // format - if(pSigDocInfo->Format) - pDds->pSigDocInfo->Format = strdup(pSigDocInfo->Format); - // version - if(pSigDocInfo->Version) - pDds->pSigDocInfo->Version = strdup(pSigDocInfo->Version); - // data files - if(pSigDocInfo->__ptrDataFileInfo && pSigDocInfo->__sizeOfDataFileInfos > 0) { - pDds->pSigDocInfo->__ptrDataFileInfo = (struct d__DataFileInfo*) - malloc(sizeof(struct d__DataFileInfo) * pSigDocInfo->__sizeOfDataFileInfos); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrDataFileInfo); - memset(pDds->pSigDocInfo->__ptrDataFileInfo, 0, - sizeof(struct d__DataFileInfo) * pSigDocInfo->__sizeOfDataFileInfos); - pDds->pSigDocInfo->__sizeOfDataFileInfos = pSigDocInfo->__sizeOfDataFileInfos; - for(i = 0; i < pSigDocInfo->__sizeOfDataFileInfos; i++) { - if(pSigDocInfo->__ptrDataFileInfo[i].Id) - pDds->pSigDocInfo->__ptrDataFileInfo[i].Id = strdup(pSigDocInfo->__ptrDataFileInfo[i].Id); - if(pSigDocInfo->__ptrDataFileInfo[i].Filename) - pDds->pSigDocInfo->__ptrDataFileInfo[i].Filename = strdup(pSigDocInfo->__ptrDataFileInfo[i].Filename); - if(pSigDocInfo->__ptrDataFileInfo[i].MimeType) - pDds->pSigDocInfo->__ptrDataFileInfo[i].MimeType = strdup(pSigDocInfo->__ptrDataFileInfo[i].MimeType); - if(pSigDocInfo->__ptrDataFileInfo[i].ContentType) - pDds->pSigDocInfo->__ptrDataFileInfo[i].ContentType = strdup(pSigDocInfo->__ptrDataFileInfo[i].ContentType); - if(pSigDocInfo->__ptrDataFileInfo[i].DigestType) - pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestType = strdup(pSigDocInfo->__ptrDataFileInfo[i].DigestType); - if(pSigDocInfo->__ptrDataFileInfo[i].DigestValue) - pDds->pSigDocInfo->__ptrDataFileInfo[i].DigestValue = strdup(pSigDocInfo->__ptrDataFileInfo[i].DigestValue); - pDds->pSigDocInfo->__ptrDataFileInfo[i].Size = pSigDocInfo->__ptrDataFileInfo[i].Size; - // data file atributes - if(pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes && - pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes > 0) { - pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes = (struct d__DataFileAttribute*) - malloc(sizeof(struct d__DataFileAttribute) * pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes); - memset(pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes, 0, - sizeof(struct d__DataFileAttribute) * pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes); - pDds->pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes = - pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes; - for(j = 0; j < pSigDocInfo->__ptrDataFileInfo[i].__sizeOfAttributes; j++) { - if(pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Name) - pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Name = - strdup(pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Name); - if(pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Value) - pDds->pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Value = - strdup(pSigDocInfo->__ptrDataFileInfo[i].__ptrAttributes[j].Value); - } - } - } - } // data files - // signatures - if(pSigDocInfo->__ptrSignatureInfo && pSigDocInfo->__sizeOfSignatureInfos > 0) { - pDds->pSigDocInfo->__ptrSignatureInfo = (struct d__SignatureInfo*) - malloc(sizeof(struct d__SignatureInfo) * pSigDocInfo->__sizeOfSignatureInfos); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo); - memset(pDds->pSigDocInfo->__ptrSignatureInfo, 0, - sizeof(struct d__SignatureInfo) * pSigDocInfo->__sizeOfSignatureInfos); - pDds->pSigDocInfo->__sizeOfSignatureInfos = pSigDocInfo->__sizeOfSignatureInfos; - // signatures - for(i = 0; i < pSigDocInfo->__sizeOfSignatureInfos; i++) { - if(pSigDocInfo->__ptrSignatureInfo[i].Id) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Id = strdup(pSigDocInfo->__ptrSignatureInfo[i].Id); - if(pSigDocInfo->__ptrSignatureInfo[i].Status) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Status = strdup(pSigDocInfo->__ptrSignatureInfo[i].Status); - if(pSigDocInfo->__ptrSignatureInfo[i].SigningTime) - pDds->pSigDocInfo->__ptrSignatureInfo[i].SigningTime = strdup(pSigDocInfo->__ptrSignatureInfo[i].SigningTime); - // signature error - if(pSigDocInfo->__ptrSignatureInfo[i].Error) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].Error = (struct d__Error*)malloc(sizeof(struct d__Error)); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error); - memset(pDds->pSigDocInfo->__ptrSignatureInfo[i].Error, 0, sizeof(struct d__Error)); - if(pSigDocInfo->__ptrSignatureInfo[i].Error->Category) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Category = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Error->Category); - if(pSigDocInfo->__ptrSignatureInfo[i].Error->Description) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Description = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Error->Description); - pDds->pSigDocInfo->__ptrSignatureInfo[i].Error->Code = - pSigDocInfo->__ptrSignatureInfo[i].Error->Code; - } - // roles - if(pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole && - pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole = (struct d__SignerRole*) - malloc(sizeof(struct d__SignerRole) * pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole); - memset(pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole, 0, - sizeof(struct d__SignerRole) * pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles); - pDds->pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles = - pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles; - for(j = 0; j < pSigDocInfo->__ptrSignatureInfo[i].__sizeRoles; j++) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Certified = - pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Certified; - if(pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Role) - pDds->pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Role = - strdup(pSigDocInfo->__ptrSignatureInfo[i].__ptrSignerRole[j].Role); - } - } - // signature production place - if(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace = (struct d__SignatureProductionPlace*) - malloc(sizeof(struct d__SignatureProductionPlace)); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace); - memset(pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace, 0, sizeof(struct d__SignatureProductionPlace)); - if(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->City) - pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->City = - strdup(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->City); - if(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->StateOrProvince) - pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->StateOrProvince = - strdup(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->StateOrProvince); - if(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->PostalCode) - pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->PostalCode = - strdup(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->PostalCode); - if(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->CountryName) - pDds->pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->CountryName = - strdup(pSigDocInfo->__ptrSignatureInfo[i].SignatureProductionPlace->CountryName); - } - // Signer - if(pSigDocInfo->__ptrSignatureInfo[i].Signer) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer = (struct d__SignerInfo*) - malloc(sizeof(struct d__SignerInfo)); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer); - memset(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer, 0, sizeof(struct d__SignerInfo)); - if(pSigDocInfo->__ptrSignatureInfo[i].Signer->CommonName) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->CommonName = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Signer->CommonName); - if(pSigDocInfo->__ptrSignatureInfo[i].Signer->IDCode) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->IDCode = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Signer->IDCode); - // Signers cert - ddocDdsCopyCertificateInfo(&(pDds->pSigDocInfo->__ptrSignatureInfo[i].Signer->Certificate), - pSigDocInfo->__ptrSignatureInfo[i].Signer->Certificate); - } // Signer - // Confirmation - if(pSigDocInfo->__ptrSignatureInfo[i].Confirmation) { - pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation = (struct d__ConfirmationInfo*) - malloc(sizeof(struct d__ConfirmationInfo)); - RETURN_IF_BAD_ALLOC(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation); - memset(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation, 0, sizeof(struct d__ConfirmationInfo)); - if(pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderID) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderID = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderID); - if(pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ProducedAt) - pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ProducedAt = - strdup(pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ProducedAt); - // Notarys cert - ddocDdsCopyCertificateInfo(&(pDds->pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderCertificate), - pSigDocInfo->__ptrSignatureInfo[i].Confirmation->ResponderCertificate); - } // Confirmation - } // for signatures - } // signatures - } - // err = ddocDdsCopySigDocInfo(pDds, pSigDocInfo); - return err; -} - - -//-------------------------------------------------- -// Internal function. Initializes a DataFileData structure -// with new data file data -// sFileName - full path and filename of any new data file -// szMimeType - mime type of new data file -// szContentType - content type of new data file -// returns error code or SOAP_OK -//-------------------------------------------------- -int initDataFileWithFile(struct d__DataFileData* pDf, const char* szFileName, - const char* szMimeType, const char* szContentType) -{ - int err = SOAP_OK, l1, l2; - long lFileSize; - DigiDocMemBuf mbuf1; - char *p1 = 0, buf1[30]; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - ddocDebug(3, "initDataFileWithFile", - "df-file: %s df-mime: %s df-content: %s", - (szFileName ? szFileName : "NULL"), (szMimeType ? szMimeType : "NULL"), - (szContentType ? szContentType : "NULL")); - RETURN_IF_NULL_PARAM(pDf); - RETURN_IF_NULL_PARAM(szFileName); - RETURN_IF_NULL_PARAM(szMimeType); - RETURN_IF_NULL_PARAM(szContentType); - // init output struct - memset(pDf, 0, sizeof(struct d__DataFileData)); - // check for existence of file and calculate it's size - err = calculateFileSize(szFileName, &lFileSize); - pDf->Size = lFileSize; - pDf->MimeType = (char*)szMimeType; - pDf->ContentType = (char*)szContentType; - pDf->Filename = (char*)getSimpleFileName(szFileName); - // for embedded cases read in file contents - if(!strcmp(szContentType, CONTENT_EMBEDDED) || - !strcmp(szContentType, CONTENT_EMBEDDED_BASE64)) { - err = ddocReadFile(szFileName, &mbuf1); - if(!strcmp(szContentType, CONTENT_EMBEDDED)) { - pDf->DfData = (char*)mbuf1.pMem; // caller must free this! - mbuf1.pMem = 0; - mbuf1.nLen = 0; // release ownership of this mem-block - } - if(!strcmp(szContentType, CONTENT_EMBEDDED_BASE64)) { - l1 = mbuf1.nLen * 2; - p1 = (char*)malloc(l1); - if(p1) { - memset(p1, 0, l1); - encode((const byte*)mbuf1.pMem, mbuf1.nLen, (byte*)p1, &l1); - pDf->DfData = (char*)p1; // caller must free this - } - } - } - if(!strcmp(szContentType, CONTENT_DETATCHED)) { - // this is a static string, don't free - pDf->DigestType = DIGEST_SHA1_NAME; - l1 = sizeof(buf1); - err = calculateFileDigest(szFileName, DIGEST_SHA1, - (byte*)buf1, &l1, &lFileSize); - l2 = l1 * 2; - pDf->DigestValue = (char*)malloc(l2); - if(pDf->DigestValue) { - memset(pDf->DigestValue, 0, l2); - encode((const byte*)buf1, l1, (byte*)pDf->DigestValue, &l2); - } - } - // cleanup - ddocMemBuf_free(&mbuf1); - return err; -} - -//-------------------------------------------------- -// Cleanup DataFileData struct -// pDf - pointer to struct -// return error code or ERR_OK -//-------------------------------------------------- -int cleanupDataFileData(struct d__DataFileData* pDf) -{ - int err = ERR_OK; - - RETURN_IF_NULL_PARAM(pDf); - if(pDf->DigestValue) - free(pDf->DigestValue); - if(pDf->DfData) - free(pDf->DfData); - // the rest is static strings - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to start a new session -// Optionally loads an existing digidoc file or -// just any other file and creates digidoc based on it. -// pDds - pointer to DDS context structure -// bHoldSession - 1=hold session, 0=terminate after this call -// szSigningProfile - signing profile URL -// szDigiDocFile - full path and filename of digidoc document -// szDataFile - full path and filename of any new data file -// szDfMimeType - mime type of new data file -// szDfContentType - content type of new data file -// pMBufDdoc - memory buffer with digidoc xml data to send (optional) -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsStartSession(DDS* pDds, int bHoldSession, - const char* szSigningProfile, - const char* szDigiDocFile, const char* szDataFile, - const char* szDfMimeType, const char* szDfContentType, - DigiDocMemBuf* pMBufDdoc) -{ - int err = SOAP_OK; - struct d__DataFileData df; - struct d__StartSessionResponse resp; - DigiDocMemBuf mbuf1; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - RETURN_IF_NULL_PARAM(pDds); - memset(&df, 0, sizeof(struct d__DataFileData)); - memset(&resp, 0, sizeof(struct d__StartSessionResponse)); - ddocDebug(3, "ddocDdsStartSession", - "Hold sess: %d digidoc: %s, mbuf: %s, df: %s df-mime: %s df-content: %s", - bHoldSession, (szDigiDocFile ? szDigiDocFile : "NULL"), (pMBufDdoc ? "OK" : "NULL"), - (szDataFile ? szDataFile : "NULL"), (szDfMimeType ? szDfMimeType : "NULL"), - (szDfContentType ? szDfContentType : "NULL")); - // cleanup old info if applicable - //ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // init parameters - if(szDigiDocFile && !pMBufDdoc) { - err = ddocReadFile(szDigiDocFile, &mbuf1); - } else if(szDataFile) { - err = initDataFileWithFile(&df, szDataFile, szDfMimeType, szDfContentType); - } - // send DDS request - ddocDebug(3, "ddocDdsStartSession", "Sending request, err: %d!", err); - if(!err) - err = soap_call_d__StartSession(&(pDds->soap), - (const char*)pDds->endpoint, "", - (char*)szSigningProfile, - (pMBufDdoc ? (char*)pMBufDdoc->pMem : ((szDigiDocFile ? (char*)mbuf1.pMem : 0))), - bHoldSession, - ((!szDigiDocFile && szDataFile) ? &df : 0), &resp); - if(err == SOAP_OK) { - err = ERR_OK; - } else if(err == SOAP_TCP_ERROR) { - err = ERR_CONNECTION_FAILURE; - SET_LAST_ERROR(ERR_CONNECTION_FAILURE); - } else - err = ERR_GENERIC_SOAP_ERR; - // report error or success - ddocDebug(3, "ddocDdsStartSession", "status: %s", resp.Status); - // copy response data for client to use it before releasing soap call data - pDds->lDdsSesscode = (unsigned long)resp.Sesscode; - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup - cleanupDataFileData(&df); - ddocMemBuf_free(&mbuf1); - ddocDdsCleanup(pDds); - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to close a session -// pDds - pointer to DDS context structure -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCloseSession(DDS* pDds) -{ - int err = SOAP_OK; - struct d__CloseSessionResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - memset(&resp, 0, sizeof(struct d__CloseSessionResponse)); - ddocDebug(3, "ddocDdsCloseSession", "sesscode: %ld", pDds->lDdsSesscode); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsCloseSession", "Sending request!"); - err = soap_call_d__CloseSession(&(pDds->soap), - (const char*)pDds->endpoint, "", - pDds->lDdsSesscode, &resp); - if(err == SOAP_OK) { - err = ERR_OK; - } else if(err == SOAP_TCP_ERROR) { - err = ERR_CONNECTION_FAILURE; - SET_LAST_ERROR(ERR_CONNECTION_FAILURE); - } else - err = ERR_GENERIC_SOAP_ERR; - // report error or success - ddocDebug(3, "ddocDdsCloseSession", "status: %s", resp.Status); - // reset sesscode for next session - pDds->lDdsSesscode = 0; - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // cleanup - ddocDdsCleanup(pDds); - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to create a new empty digidoc -// pDds - pointer to DDS context structure -// szFormat - digidoc format -// szVersion - digidoc format version -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCreateSignedDoc(DDS* pDds, const char* szFormat, const char* szVersion) -{ - int err = SOAP_OK; - struct d__CreateSignedDocResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - memset(&resp, 0, sizeof(struct d__CreateSignedDocResponse)); - ddocDebug(3, "ddocDdsCreateSignedDoc", "sesscode: %ld format: %s version: %s", - pDds->lDdsSesscode, (szFormat ? szFormat : "NULL"), - (szVersion ? szVersion : "NULL")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsCreateSignedDoc", "Sending request!"); - err = soap_call_d__CreateSignedDoc(&(pDds->soap), - (const char*)pDds->endpoint, "", - pDds->lDdsSesscode, (char*)szFormat, (char*)szVersion, &resp); - // report error or success - ddocDebug(3, "ddocDdsCreateSignedDoc", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to add a new data file -// pDds - pointer to DDS context structure -// szFileName - filename and path -// szMimeType - mime type -// szContentType - content type -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsAddDataFile(DDS* pDds, const char* szFileName, - const char* szMimeType, const char* szContentType) -{ - int err = SOAP_OK; - struct d__DataFileData df; - struct d__AddDataFileResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szFileName); - RETURN_IF_NULL_PARAM(szMimeType); - RETURN_IF_NULL_PARAM(szContentType); - memset(&df, 0, sizeof(struct d__DataFileData)); - memset(&resp, 0, sizeof(struct d__AddDataFileResponse)); - ddocDebug(3, "ddocDdsAddDataFile", "sesscode: %ld file: %s mime: %s, content: %s", - pDds->lDdsSesscode, (szFileName ? szFileName : "NULL"), - (szMimeType ? szMimeType : "NULL"), (szContentType ? szContentType : "NULL")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // init parameters - err = initDataFileWithFile(&df, szFileName, szMimeType, szContentType); - // send DDS request - ddocDebug(3, "ddocDdsAddDataFile", "Sending request, err: %d", err); - if(!err) - err = soap_call_d__AddDataFile(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - df.Filename, df.MimeType, df.ContentType, - df.Size, df.DigestType, df.DigestValue, - df.DfData, &resp); - // report error or success - ddocDebug(3, "ddocDdsAddDataFile", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - cleanupDataFileData(&df); - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to remove a data file -// pDds - pointer to DDS context structure -// szId - data file id -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsRemoveDataFile(DDS* pDds, const char* szId) -{ - int err = SOAP_OK; - struct d__RemoveDataFileResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - memset(&resp, 0, sizeof(struct d__RemoveDataFileResponse)); - ddocDebug(3, "ddocDdsRemoveDataFile", "sesscode: %ld id: %s", - pDds->lDdsSesscode, (szId ? szId : "NULL")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsRemoveDataFile", "Sending request!"); - err = soap_call_d__RemoveDataFile(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsRemoveDataFile", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to retrieve current -// digidoc data and stores in in the given file -// pDds - pointer to DDS context structure -// szFileName - filename to store the digidoc -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetSignedDoc(DDS* pDds, const char* szFileName) -{ - int err = SOAP_OK; - struct d__GetSignedDocResponse resp; - FILE* hFile; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szFileName); - memset(&resp, 0, sizeof(struct d__GetSignedDocResponse)); - ddocDebug(3, "ddocDdsGetSignedDoc", "sesscode: %ld file: %s", - pDds->lDdsSesscode, (szFileName ? szFileName : "NULL")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetSignedDoc", "Sending request!"); - err = soap_call_d__GetSignedDoc(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetSignedDoc", "status: %s, data: %d", - resp.Status, strlen(resp.SignedDocData)); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - if(!err && resp.SignedDocData) { - if((hFile = fopen(szFileName, "wb")) != NULL) { - fputs(resp.SignedDocData, hFile); - fclose(hFile); - ddocDebug(3, "ddocDdsGetSignedDoc", "stored: %d bytes in: %s", - strlen(resp.SignedDocData), szFileName); - } - } - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to retrieve current -// digidoc info. -// pDds - pointer to DDS context structure -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetSignedDocInfo(DDS* pDds) -{ - int err = SOAP_OK; - struct d__GetSignedDocInfoResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - memset(&resp, 0, sizeof(struct d__GetSignedDocInfoResponse)); - ddocDebug(3, "ddocDdsGetSignedDocInfo", "sesscode: %ld", pDds->lDdsSesscode); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetSignedDocInfo", "Sending request!"); - err = soap_call_d__GetSignedDocInfo(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetSignedDocInfo", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data file info and store it in a file. -// pDds - pointer to DDS context structure -// szId - data file id [mandatory] -// szFileName - file to store data in. Use NULL to use -// original data file name (but current directory!) -// Use directory name (ending with / or \ ) to -// use original data file name but in a directory -// of your choice. -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetDataFile(DDS* pDds, const char* szId, const char* szFileName) -{ - int err = SOAP_OK, l1, l2; - struct d__GetDataFileResponse resp; - FILE* hFile; - char *pFileName = 0, *pContent = 0; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - memset(&resp, 0, sizeof(struct d__GetDataFileResponse)); - ddocDebug(3, "ddocDdsGetDataFile", "sesscode: %ld", pDds->lDdsSesscode); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetDataFile", "Sending request!"); - err = soap_call_d__GetDataFile(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetDataFile", "err: %d status: %s, data-len: %d content: %s", - err, resp.Status, (resp.DataFileData ? resp.DataFileData->Size : 0), - (resp.DataFileData ? resp.DataFileData->ContentType : "?")); - // store data in a file - if(!err && resp.DataFileData) { - // chek filename param - if(szFileName) { - l1 = strlen(szFileName); - if(szFileName[l1-1] == '\\' || szFileName[l1-1] == '/') { - pFileName = (char*)malloc(l1 + strlen(resp.DataFileData->Filename) + 1); - if(pFileName) { - strcpy(pFileName, szFileName); - strcat(pFileName, resp.DataFileData->Filename); - } - } else - pFileName = (char*)szFileName; - } else { - pFileName = resp.DataFileData->Filename; - } - // default content is data file content - if(!strcmp(resp.DataFileData->ContentType, CONTENT_EMBEDDED)) - pContent = resp.DataFileData->DfData; - if(!strcmp(resp.DataFileData->ContentType, CONTENT_EMBEDDED_BASE64)) { - l1 = l2 = strlen(resp.DataFileData->DfData); - pContent = (char*)malloc(l1); - if(pContent) - decode((const byte*)resp.DataFileData->DfData, l1, (byte*)pContent, &l2); - } - // store in file - ddocDebug(3, "ddocDdsGetDataFile", "content: %s file: %s", - (pContent ? "OK" : "NULL"), pFileName); - if(pContent && pFileName) { - if((hFile = fopen(pFileName, "wb")) != NULL) { - l1 = fwrite(pContent, 1, l2, hFile); - ddocDebug(3, "ddocDdsGetDataFile", "wrote: %d bytes in: %s", l2, pFileName); - fclose(hFile); - } - } - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup - if(pFileName && pFileName != szFileName && - resp.DataFileData && pFileName != resp.DataFileData->Filename) - free(pFileName); - if(pContent && resp.DataFileData && pContent != resp.DataFileData->DfData) - free(pContent); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -char* g_szCertPemHeader = "-----BEGIN CERTIFICATE-----\r\n"; -char* g_szCertPemTrailer = "\n-----END CERTIFICATE-----"; - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures signers certificate -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetSignersCertificate(DDS* pDds, const char* szId, const char* szFileName) -{ - int err = SOAP_OK; - struct d__GetSignersCertificateResponse resp; - FILE* hFile; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - RETURN_IF_NULL_PARAM(szFileName); - memset(&resp, 0, sizeof(struct d__GetSignersCertificateResponse)); - ddocDebug(3, "ddocDdsGetSignersCertificate", "sesscode: %ld, id: %s file: %s", - pDds->lDdsSesscode, szId, szFileName); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetSignersCertificate", "Sending request!"); - err = soap_call_d__GetSignersCertificate(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetSignersCertificate", "status: %s", resp.Status); - // store data in a file - if(!err && resp.CertificateData) { - if((hFile = fopen(szFileName, "wb")) != NULL) { - fputs(g_szCertPemHeader, hFile); - fputs(resp.CertificateData, hFile); - fputs(g_szCertPemTrailer, hFile); - ddocDebug(3, "ddocDdsGetSignersCertificate", "wrote cert in file: %s", szFileName); - fclose(hFile); - } - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures notarys (responders) certificate -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetNotarysCertificate(DDS* pDds, const char* szId, const char* szFileName) -{ - int err = SOAP_OK; - struct d__GetNotarysCertificateResponse resp; - FILE* hFile; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - RETURN_IF_NULL_PARAM(szFileName); - memset(&resp, 0, sizeof(struct d__GetNotarysCertificateResponse)); - ddocDebug(3, "ddocDdsGetNotarysCertificate", "sesscode: %ld, id: %s file: %s", - pDds->lDdsSesscode, szId, szFileName); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetNotarysCertificate", "Sending request!"); - err = soap_call_d__GetNotarysCertificate(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetNotarysCertificate", "status: %s", resp.Status); - // store data in a file - if(!err && resp.CertificateData) { - if((hFile = fopen(szFileName, "wb")) != NULL) { - fputs(g_szCertPemHeader, hFile); - fputs(resp.CertificateData, hFile); - fputs(g_szCertPemTrailer, hFile); - ddocDebug(3, "ddocDdsGetNotarysCertificate", "wrote cert in file: %s", szFileName); - fclose(hFile); - } - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -char* g_szOcspPemHeader = "-----BEGIN OCSP RESPONSE-----\n"; -char* g_szOcspPemTrailer = "\n-----END OCSP RESPONSE-----"; - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures OCSP response data -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetNotary(DDS* pDds, const char* szId, const char* szFileName) -{ - int err = SOAP_OK; - struct d__GetNotaryResponse resp; - FILE* hFile; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - RETURN_IF_NULL_PARAM(szFileName); - memset(&resp, 0, sizeof(struct d__GetNotaryResponse)); - ddocDebug(3, "ddocDdsGetNotary", "sesscode: %ld, id: %s file: %s", - pDds->lDdsSesscode, szId, szFileName); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetNotary", "Sending request!"); - err = soap_call_d__GetNotary(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetNotary", "status: %s", resp.Status); - // store data in a file - if(!err && resp.OcspData) { - if((hFile = fopen(szFileName, "wb")) != NULL) { - fputs(g_szOcspPemHeader, hFile); - fputs(resp.OcspData, hFile); - fputs(g_szOcspPemTrailer, hFile); - ddocDebug(3, "ddocDdsGetNotary", "wrote OCSP in file: %s", szFileName); - fclose(hFile); - } - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to retrieve fixed PKI -// signature modules for the given platform, phase -// and type -// pDds - pointer to DDS context structure -// szPlatform - LINUX-MOZILLA, WIN32-MOZILLA, WIN32-IE -// szPhase - PREPARE or FINALIZE -// szType - DYNAMIC or STATIC or ALL -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetSignatureModules(DDS* pDds, const char* szPlatform, - const char* szPhase, const char* szType) -{ - int err = SOAP_OK; - struct d__GetSignatureModulesResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szPlatform); - RETURN_IF_NULL_PARAM(szPhase); - RETURN_IF_NULL_PARAM(szType); - memset(&resp, 0, sizeof(struct d__GetSignatureModulesResponse)); - ddocDebug(3, "ddocDdsGetSignatureModules", "sesscode: %ld, platform: %s phase: %s type: %s", - pDds->lDdsSesscode, szPlatform, szPhase, szType); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetSignatureModules", "Sending request!"); - err = soap_call_d__GetSignatureModules(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - (char*)szPlatform, (char*)szPhase, (char*)szType, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetSignatureModules", "status: %s", resp.Status); - // store data in a file - if(!err && resp.Modules ) { - // what should I do here? - not usefull for C apps! - - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to prepare a new signature -// pDds - pointer to DDS context structure -// pCert - direct X509 cert [must rpovide cert or cert filename] -// szCertFile - cert PEM filename -// szTokenId - -// szRole - signers role [optional] -// szCity - signers address, city [optional] -// szState - signers address, state [optional] -// szPostalCode - signers address, postal code [optional] -// szCountry - signers address, country [optional] -// szSigId - buffer for new signature id [mandatory] -// szHash - buffer for new hash code to be signed [mandatory] -// pHashLen - pointer to length (int) of hash code [mandatory] -// szSigningProfile - signing profile URL -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsPrepareSignature(DDS* pDds, const char* szSigningProfile, - const X509* pCert, const char* szCertFile, - const char* szTokenId, const char* szRole, const char* szCity, - const char* szState, const char* szPostalCode, const char* szCountry, - char* szSigId, char* szHash, int *pHashLen) -{ - int err = SOAP_OK, l1, l2; - struct d__PrepareSignatureResponse resp; - X509* pCert2 = 0; - char *p1 = 0, *p2 = 0; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(pCert || szCertFile); - RETURN_IF_NULL_PARAM(szTokenId); - RETURN_IF_NULL_PARAM(szSigId); - RETURN_IF_NULL_PARAM(szHash); - RETURN_IF_NULL_PARAM(pHashLen); - memset(&resp, 0, sizeof(struct d__PrepareSignatureResponse)); - ddocDebug(3, "ddocDdsPrepareSignature", "sesscode: %ld, cert: %s token: %s role: %s city: %s state: %s zip: %s country: %s", - pDds->lDdsSesscode, (pCert ? "CERT" : szCertFile), szTokenId, - (szRole ? szRole : ""), (szCity ? szCity : ""), - (szState ? szState : ""), (szPostalCode ? szPostalCode : ""), - (szCountry ? szCountry : "")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // prepare cert - pCert2 = (X509*)pCert; - if(!pCert) - err = ReadCertificate(&pCert2, szCertFile); - if(err || !pCert) - return err; - l1 = i2d_X509(pCert2, NULL); - p1 = (char*)malloc(l1+10); - RETURN_IF_BAD_ALLOC(p1); - p2 = p1; - i2d_X509(pCert2, (unsigned char**)&p2); - l2 = l1 * 2 + 10; - p2 = (char*)malloc(l2); - if(!p2) { - free(p1); - RETURN_IF_BAD_ALLOC(p2); - } - bin2hex((const byte*)p1, l1, (char*)p2, &l2); - // send DDS request - ddocDebug(3, "ddocDdsPrepareSignature", "Sending request!"); - err = soap_call_d__PrepareSignature(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - p2, (char*)szTokenId, (char*)szRole, (char*)szCity, - (char*)szState, (char*)szPostalCode, (char*)szCountry, - (char*)szSigningProfile, &resp); - // report error or success - ddocDebug(3, "ddocDdsPrepareSignature", "status: %s signatur: %s, hash: %s", - resp.Status, (resp.SignatureId ? resp.SignatureId : "NULL"), - (resp.SignedInfoDigest ? resp.SignedInfoDigest : "NULL")); - // return data - if(!err && resp.SignatureId && resp.SignedInfoDigest) { - strcpy(szSigId, resp.SignatureId); - hex2bin((const char*)resp.SignedInfoDigest, (byte*)szHash, pHashLen); - } - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup - if(p1) - free(p1); - if(p2) - free(p2); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to finalize a new signature -// pDds - pointer to DDS context structure -// szId - siganture id [mandatory] -// szSigValHEX - signature value in hex [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsFinalizeSignature(DDS* pDds, const char* szId, const char* szSigValHEX) -{ - int err = SOAP_OK; - struct d__FinalizeSignatureResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - RETURN_IF_NULL_PARAM(szSigValHEX); - memset(&resp, 0, sizeof(struct d__FinalizeSignatureResponse)); - ddocDebug(3, "ddocDdsFinalizeSignature", "sesscode: %ld, sig-id: %s signature: %s", - pDds->lDdsSesscode, szId, szSigValHEX); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsFinalizeSignature", "Sending request!"); - err = soap_call_d__FinalizeSignature(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - (char*)szId, (char*)szSigValHEX, &resp); - // report error or success - ddocDebug(3, "ddocDdsFinalizeSignature", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to remove a signature -// pDds - pointer to DDS context structure -// szId - siganture id [mandatory] -// szSigValHEX - signature value in hex [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsRemoveSignature(DDS* pDds, const char* szId) -{ - int err = SOAP_OK; - struct d__RemoveSignatureResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szId); - memset(&resp, 0, sizeof(struct d__RemoveSignatureResponse)); - ddocDebug(3, "ddocDdsRemoveSignature", "sesscode: %ld, sig-id: %s", - pDds->lDdsSesscode, szId); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsRemoveSignature", "Sending request!"); - err = soap_call_d__RemoveSignature(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - (char*)szId, &resp); - // report error or success - ddocDebug(3, "ddocDdsRemoveSignature", "status: %s", resp.Status); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, 0, err); - // copy response signed doc info - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to remove a signature -// pDds - pointer to DDS context structure -// szName - buffer for service name [mandatory] -// szVersion - buffer for service version [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsGetVersion(DDS* pDds, char* szName, char* szVersion) -{ - int err = SOAP_OK; - struct d__GetVersionResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(szName); - RETURN_IF_NULL_PARAM(szVersion); - memset(&resp, 0, sizeof(struct d__GetVersionResponse)); - ddocDebug(3, "ddocDdsGetVersion", "sesscode: %ld", pDds->lDdsSesscode); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetVersion", "Sending request!"); - err = soap_call_d__GetVersion(&(pDds->soap), - (const char*)pDds->endpoint, "", /*0,*/ &resp); - // report error or success - ddocDebug(3, "ddocDdsGetVersion", "name: %s version: %s", resp.Name, resp.Version); - // copy response status & err & faults - //ddocDdsCopyStatusAndFault(pDds, resp.status, 0, err); - // return data - if(!err && resp.Name && resp.Version) { - strcpy(szName, resp.Name); - strcpy(szVersion, resp.Version); - } - // copy response signed doc info - //ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// MSSP gateway and mobile signing -// pDds - pointer to DDS context structure -// szSigningProfile - signing profile URL -// szCountryCode - signers country code (2 chars) -// szSignerIdCode - signers personal id code [mnadatory] -// szSignerPhoneNo - signers phone number [mandatory] -// szDataToBeDisplayed - data to be displayed [optional] -// szLang - laguage -// szRole - signers role/manifest [optional] -// szCity - signers address, city [optional] -// szState - signers address, state [optional] -// szPostalCode - signers address, postal code [optional] -// szCountry - signers address, country [optional] -// szMsgMode - "asynchClientServer" -// szNotifURL - notification URL. Not used yet. Send NULL -// szCertURL - certificate url. [optional] -// bReturnDocInfo - 1/0 send digidoc info or not -// bReturnDocData - 1/0 send digidic data or not -// pMbChallengeId - buffer for challenge id [OUT] -// pMbChallenge - buffer for challenge [OUT] -// szSigningProfile - signing profile URL -// szFileName - filename to store the digidoc -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsMobileSign(DDS* pDds, const char* szSigningProfile, - const char* szSignerIdCode, const char* szCountryCode, - const char* szSignerPhoneNo, const char* szDataToBeDisplayed, - const char* szLang, const char* szRole, const char* szCity, - const char* szState, const char* szPostalCode, - const char* szCountry, const char* szMsgMode, - //const char* szNotifURL, const char* szCertURL, - //int bReturnDocInfo, int bReturnDocData, - DigiDocMemBuf *pMbChallengeId, DigiDocMemBuf *pMbChallenge, - const char* szDigiDocFileName) -{ - int err = SOAP_OK; - struct d__MobileSignResponse resp; - //FILE* hFile; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(((szSignerIdCode && szCountryCode) || szSignerPhoneNo)); - RETURN_IF_NULL_PARAM(szDataToBeDisplayed || szRole); - //RETURN_IF_NULL_PARAM(szDigiDocFileName); - //RETURN_IF_NULL_PARAM(szMsgMode); - memset(&resp, 0, sizeof(struct d__MobileSignResponse)); - ddocDebug(3, "ddocDdsMobileSign", "sesscode: %ld signer-id: %s cntr-cd: %s phone-no: %s data-to-be-displayed: \'%s\' lang: %s, role: %s city: %s state: %s zip: %s country: %s msg-mode: %s ddoc-name: %s", - pDds->lDdsSesscode, (szSignerIdCode ? szSignerIdCode : ""), - (szCountryCode ? szCountryCode : ""), (szSignerPhoneNo ? szSignerPhoneNo : ""), - (szDataToBeDisplayed ? szDataToBeDisplayed : ""), - (szLang ? szLang : ""), (szRole ? szRole : ""), (szCity ? szCity : ""), - (szState ? szState : ""), (szPostalCode ? szPostalCode : ""), - (szCountry ? szCountry : ""), (szMsgMode ? szMsgMode : ""), - //(szNotifURL ? szNotifURL : ""), (szCertURL ? szCertURL : ""), - //bReturnDocInfo, bReturnDocData, - (szDigiDocFileName ? szDigiDocFileName : "")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - //if(bReturnDocInfo) - // ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsMobileSign", "Sending request!"); - err = soap_call_d__MobileSign(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - (char*)szSignerIdCode, (char*)szCountryCode, - (char*) szSignerPhoneNo, "DigiDoc Client", (char*)szDataToBeDisplayed, - (szLang ? (char*)szLang : "ENG"), (char*)szRole, (char*)szCity, - (char*)szState, (char*)szPostalCode, (char*)szCountry, - (char*)szSigningProfile, - (szMsgMode ? (char*)szMsgMode : "asynchClientServer"), - 0 /*AsyncConfiguration*/, - //(char*)szNotifURL, (char*)szCertURL, - 0, 0, /*bReturnDocInfo, bReturnDocData,*/ &resp); - // report error or success - ddocDebug(3, "ddocDdsMobileSign", "status: %s, status-code: %s challenge-id: %s", - resp.Status, resp.StatusCode, resp.ChallengeID /*(resp.SignedDocData ? strlen(resp.SignedDocData) : 0)*/); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, resp.StatusCode, err); - // get real error code - if(pDds && pDds->szSoapFaultString && isdigit(pDds->szSoapFaultString[0])) - err = atoi(pDds->szSoapFaultString); - else - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - /*if(!err && resp.SignedDocData && szDigiDocFileName) { - if((hFile = fopen(szDigiDocFileName, "wb")) != NULL) { - fputs(resp.SignedDocData, hFile); - fclose(hFile); - ddocDebug(3, "ddocDdsMobileSign", "stored: %d bytes in: %s", - strlen(resp.SignedDocData), szDigiDocFileName); - } - }*/ - // copy response signed doc info - //if(bReturnDocInfo) - // ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - if(pMbChallengeId && resp.ChallengeID) - ddocMemAssignData(pMbChallengeId, resp.ChallengeID, -1); - //if(pMbChallenge && resp.Challenge) - // ddocMemAssignData(pMbChallenge, resp.Challenge, -1); - // cleanup soap data - ddocDdsCleanup(pDds); - - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// MSSP gateway and mobile signing -// lSesscode - DDS sessioncode -// bReturnDocInfo - 1/0 send digidoc info or not -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetStatusInfo(long lSesscode, int bReturnDocInfo, char* pszStartusStr, int nStatusLen) -{ - int err = SOAP_OK; - struct d__GetStatusInfoResponse resp; - DDS* pDds = 0; - - memset(&resp, 0, sizeof(struct d__GetStatusInfoResponse)); - ddocDebug(3, "ddocDdsGetStatusInfo", "sesscode: %ld return-ddoc-info: %d", - lSesscode, bReturnDocInfo); - // connect - err = ddocDdsConnect(&pDds); - pDds->lDdsSesscode = lSesscode; - if(err) return err; - // cleanup old info if applicable - //ddocDdsCleanupStatusAndFault(pDds); - //if(bReturnDocInfo) - // ddocDdsCleanupInfo(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetStatusInfo", "Sending request!"); - err = soap_call_d__GetStatusInfo(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, - bReturnDocInfo, 0, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetStatusInfo", "status: %s, status-code: %s", - resp.Status, resp.StatusCode); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, resp.StatusCode, err); - // copy response signed doc info - if(pszStartusStr) { - strncpy(pszStartusStr, pDds->szStatusCode, nStatusLen); - pszStartusStr[nStatusLen-1] = 0; - } - if(bReturnDocInfo) - ddocDdsCopySoapRespInfo(pDds, resp.SignedDocInfo); - // cleanup soap data - //ddocDdsCleanup(pDds); - ddocDdsDisconnect(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to authenticate a person through -// MSSP gateway and mobile signing -// pDds - pointer to DDS context structure -// szIdCode - authenticators personal id code -// szCountryCode - signers country code (2 chars) -// szPhoneNo - authenticators phone number -// [mandatory] - either szIdCode and szCountryCode or szPhoneNo -// szLang - laguage [optional] default is ENG -// szMessageToDisplay - message to be displayed [optional] -// szSpcChallenge - AP challenge [optional] -// szCertUrl - certificate URL [optional] -// szMsgMode - "asynchClientServer" -// szNotifURL - notification URL. Not used yet. Send NULL -// bReturnCertData - 1/0 send cert data or not -// bReturnRevocationData - 1/0 send revocation data or not -// pMbUserIDCode - buffer for user id code [OUT] -// pMbUserGivenname - buffer for user givenname [OUT] -// pMbUserSurname - buffer for user surname [OUT] -// pMbUserCountry - buffer for user country [OUT] -// pMbUserCN - buffer for user CN [OUT] -// pMbCertData - buffer for user certificate data [OUT] -// pMbChallengeId - buffer for challenge id [OUT] -// pMbChallenge - buffer for challenge [OUT] -// pMbRevocationData - buffer for revocation data [OUT] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsMobileAuthenticate(DDS* pDds, const char* szIdCode, - const char* szCountryCode, - const char* szPhoneNo, const char* szLang, - const char* szMessageToDisplay, - const char* szSpcChallenge, const char* szCertUrl, - const char* szMsgMode, const char* szNotifURL, - int bReturnCertData, int bReturnRevocationData, - const char* szServiceName, - DigiDocMemBuf *pMbUserIDCode, DigiDocMemBuf *pMbUserGivenname, - DigiDocMemBuf *pMbUserSurname, DigiDocMemBuf *pMbUserCountry, - DigiDocMemBuf *pMbUserCN, DigiDocMemBuf *pMbCertData, - DigiDocMemBuf *pMbChallengeId, DigiDocMemBuf *pMbChallenge, - DigiDocMemBuf *pMbRevocationData) -{ - int err = SOAP_OK; - struct d__MobileAuthenticateResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - RETURN_IF_NULL_PARAM(((szIdCode && szCountryCode) || szPhoneNo)); - RETURN_IF_NULL_PARAM(szMessageToDisplay); - RETURN_IF_NULL_PARAM(szMsgMode); - memset(&resp, 0, sizeof(struct d__MobileSignResponse)); - ddocDebug(3, "ddocDdsMobileAuthenticate", "id: %s cntr-cd: %s, phone-no: %s msg-to-display: \'%s\' lang: %s, spc-challenge: %s cert-url: %s msg-mode: %s notif-url: %s return-cert-data: %d return-revoc-data: %d service: %s", - (szIdCode ? szIdCode : ""), (szCountryCode ? szCountryCode : ""), - (szPhoneNo ? szPhoneNo : ""), szMessageToDisplay, - (szLang ? szLang : ""), (szSpcChallenge ? szSpcChallenge : ""), - (szCertUrl ? szCertUrl : ""), szMsgMode, (szNotifURL ? szNotifURL : ""), - bReturnCertData, bReturnRevocationData, (szServiceName ? szServiceName : "")); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - // send DDS request - ddocDebug(3, "ddocDdsMobileAuthenticate", "Sending request!"); - err = soap_call_d__MobileAuthenticate(&(pDds->soap), - (const char*)pDds->endpoint, "", (char*)szIdCode, - (char*)szCountryCode, (char*)szPhoneNo, - (szLang ? (char*)szLang : "ENG"), - (char*)szServiceName, (char*)szMessageToDisplay, - (char*)szSpcChallenge, //(char*)szCertUrl, - (szMsgMode ? (char*)szMsgMode : "asynchClientServer"), 0, 0, 0, - //(char*)szNotifURL, bReturnCertData, bReturnRevocationData, - &resp); - // report error or success - ddocDebug(3, "ddocDdsMobileAuthenticate", "status: %s, sesscode: %ld", - resp.Status, resp.Sesscode); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, NULL, err); - // get real error code - if(pDds && pDds->szSoapFaultString && isdigit(pDds->szSoapFaultString[0])) - err = atoi(pDds->szSoapFaultString); - else - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - // copy response data - if(resp.Status && !strcmp(resp.Status, "OK")) { - pDds->lDdsSesscode = resp.Sesscode; - if(pMbUserIDCode && resp.UserIDCode) - ddocMemAssignData(pMbUserIDCode, resp.UserIDCode, -1); - if(pMbUserGivenname && resp.UserGivenname) - ddocMemAssignData(pMbUserGivenname, resp.UserGivenname, -1); - if(pMbUserSurname && resp.UserSurname) - ddocMemAssignData(pMbUserSurname, resp.UserSurname, -1); - if(pMbUserCountry && resp.UserCountry) - ddocMemAssignData(pMbUserCountry, resp.UserCountry, -1); - if(pMbUserCN && resp.UserCN) - ddocMemAssignData(pMbUserCN, resp.UserCN, -1); - if(pMbCertData && resp.CertificateData) - ddocMemAssignData(pMbCertData, resp.CertificateData, -1); - if(pMbChallengeId && resp.ChallengeID) - ddocMemAssignData(pMbChallengeId, resp.ChallengeID, -1); - if(pMbChallenge && resp.Challenge) - ddocMemAssignData(pMbChallenge, resp.Challenge, -1); - if(pMbRevocationData && resp.RevocationData) - ddocMemAssignData(pMbRevocationData, resp.RevocationData, -1); - } - // cleanup soap data - ddocDdsCleanup(pDds); - return err; -} - -//-------------------------------------------------- -// Sends an DDS request to get authentication status -// pDds - pointer to DDS context structure -// pMbSignature - buffer for signature value [OUT] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetMobileAuthenticateStatus(DDS* pDds, int bWaitSignature, - DigiDocMemBuf *pMbSignature) -{ - int err = SOAP_OK, l1; - struct d__GetMobileAuthenticateStatusResponse resp; - - RETURN_IF_NULL_PARAM(pDds); - memset(&resp, 0, sizeof(struct d__GetStatusInfoResponse)); - ddocDebug(3, "ddocDdsGetMobileAuthenticateStatus", "sesscode: %ld wait: %d", - pDds->lDdsSesscode, bWaitSignature); - // cleanup old info if applicable - ddocDdsCleanupStatusAndFault(pDds); - // send DDS request - ddocDebug(3, "ddocDdsGetMobileAuthenticateStatus", "Sending request!"); - err = soap_call_d__GetMobileAuthenticateStatus(&(pDds->soap), - (const char*)pDds->endpoint, "", - pDds->lDdsSesscode, bWaitSignature, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetMobileAuthenticateStatus", "status: %s, signature: %s", - resp.Status, (resp.Signature ? "OK" : "NULL")); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, NULL, err); - // copy response signed doc info - if(pMbSignature && resp.Signature) { - l1 = strlen(resp.Signature); - ddocMemSetLength(pMbSignature, l1); - hex2bin((const char*)resp.Signature, (byte*)pMbSignature->pMem, &l1); - pMbSignature->nLen = l1; - } - // cleanup soap data - ddocDdsCleanup(pDds); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -//-------------------------------------------------- -// Translates error codes and strings returned by service -// to libdigidoc error codes -// pDds - pointer to DDS context structure -// nErr - direct numeric error code returned by soap -// libdigidoc error code -//-------------------------------------------------- -int findServiceErrCode(DDS* pDds, int nErr) -{ - int err = ERR_OK; - // get real error code - // ddocDebug(3, "findServiceErrCode err: %d - %s", nErr, (pDds ? pDds->szSoapFaultString : 0)); - if(pDds && pDds->szSoapFaultString && isdigit(pDds->szSoapFaultString[0])) - err = atoi(pDds->szSoapFaultString); - else { - if(nErr == SOAP_TCP_ERROR) { - err = ERR_CONNECTION_FAILURE; - } else if(nErr != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - } - // errors in string form - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "EXPIRED_TRANSACTION")) - err = ERR_WPKI_TIMEOUT; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "USER_CANCEL")) - err = ERR_WPKI_CANCELLED; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "MID_NOT_READY")) - err = ERR_WPKI_MID_NOT_READY; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "PHONE_ABSENT")) - err = ERR_WPKI_PHONE_NOT_REACHABLE; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "SENDING_ERROR")) - err = ERR_WPKI_SENDING_ERROR; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "SIM_ERROR")) - err = ERR_WPKI_SIM_ERROR; - if(pDds && pDds->szStatusCode && !strcmp(pDds->szStatusCode, "INTERNAL_ERROR")) - err = ERR_WPKI_SERVICE_ERR; - // numeric code switch - switch(err) { - case 100: err = ERR_GENERIC_SOAP_ERR; break; - //case 101: err = ERR_BAD_PARAM; break; - case 102: err = ERR_NULL_PARAM; break; - case 103: err = ERR_WPKI_UNTRUSTED_USER; break; - //case 101: - case 104: // id-code doesn't match phone number - err = ERR_WPKI_INVALID_PHONE_NO; - break; - case 200: err = ERR_WPKI_SERVICE_ERR; break; - case 300: err = ERR_WPKI_UNUSABLE_PHONE; break; - case 301: err = ERR_WPKI_UNKNOWN_USER; break; - case 302: err = ERR_OCSP_CERT_REVOKED; break; - case 101: err = ERR_OCSP_CERT_REVOKED; break; - case 303: err = ERR_OCSP_CERT_UNKNOWN; break; - } - return err; -} - - -//-------------------------------------------------- -// Signs the document using DigiDocService. -// Digidoc file must have been saved before -// to calculate correct hashes. -// plSesscode - pointer to buffer for session code -// pSigDoc - signed document object -// szSigningProfile - signing profile -// szServiceName - service name -// szIdCode - signers id-code -// szCountryCode - signers country code -// szPhoneNo - users phone number -// szMessageToDisplay - message to display -// manifest - manifest or role -// city - signers address , city -// state - signers address , state or province -// zip - signers address , postal code -// country - signers address , country name -// szLang - language code -// pMbChallengeId - buffer for challenge id [OUT] -// return returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCreateMobileSignature(long* plSesscode, const SignedDoc *pSigDoc, - const char* szSigningProfile, const char* szServiceName, - const char* szIdCode, const char* szCountryCode, - const char* szPhoneNo, const char* szMessageToDisplay, - const char* manifest, const char* city, - const char* state, const char* zip, - const char* country, const char* szLang, - DigiDocMemBuf *pMbChallengeId) -{ - int err = ERR_OK, i, n, l; - struct d__MobileCreateSignatureResponse resp; - struct d__DataFileDigestList dflst; - SignatureInfo* pSigInfo = 0; - DataFile* pDf = 0; - DigiDocMemBuf *pMbuf = 0; - DDS* pDds = 0; - char id[10]; - - ddocDebug(3, "ddocDdsMobileCreateSignature", - "Creating DDS signature for id: %s country: %s phone: %s msg: %s role: %s city: %s state: %s zip: %s country-name: %s lang: %s", - (szIdCode ? szIdCode : "NULL"), (szCountryCode ? szCountryCode : "NULL"), - (szPhoneNo ? szPhoneNo : "NULL"), (szMessageToDisplay ? szMessageToDisplay : "NULL"), - (manifest ? manifest : "NULL"), (city ? city : "NULL"), - (state ? state : "NULL"), (zip ? zip : "NULL"), - (country ? country : "NULL"), (szLang ? szLang : "NULL")); - RETURN_IF_NULL_PARAM(plSesscode); - RETURN_IF_NULL_PARAM(pSigDoc); - RETURN_IF_NULL_PARAM(((szIdCode && szCountryCode) || szPhoneNo)); - //RETURN_IF_NULL_PARAM(szMessageToDisplay || manifest); - // connect - *plSesscode = 0; - err = ddocDdsConnect(&pDds); - if(err) return err; - // set old DF & SIG info - n = getCountOfDataFiles(pSigDoc); - memset(&resp, 0, sizeof(struct d__MobileCreateSignatureResponse)); - memset(&dflst, 0, sizeof(struct d__DataFileDigestList)); - if(n > 0) { - dflst.__ptrDataFileDigest = (struct d__DataFileDigest*)malloc(sizeof(struct d__DataFileDigest) * n); - RETURN_IF_BAD_ALLOC(dflst.__ptrDataFileDigest); - dflst.__sizeOfDataFileDigests = n; - for(i = 0; i < n; i++) { - pDf = getDataFile(pSigDoc, i); - pMbuf = ddocDataFile_GetDigestValue(pDf); - dflst.__ptrDataFileDigest[i].Id = pDf->szId; - dflst.__ptrDataFileDigest[i].DigestType = DIGEST_SHA1_NAME; - l = DIGEST_LEN * 2; - dflst.__ptrDataFileDigest[i].DigestValue = (char*)malloc(l); - RETURN_IF_BAD_ALLOC(dflst.__ptrDataFileDigest[i].DigestValue); - memset(dflst.__ptrDataFileDigest[i].DigestValue, 0, l); - encode((const byte*)pMbuf->pMem, pMbuf->nLen, - (byte*)dflst.__ptrDataFileDigest[i].DigestValue, &l); - ddocDebug(3, "ddocDdsMobileCreateSignature", - "Sending DF: %s hash: %s", pDf->szId, (char*)dflst.__ptrDataFileDigest[i].DigestValue); - } - } - pSigInfo = ddocGetLastSignature(pSigDoc); - snprintf(id, sizeof(id), "S%d", getNextSignatureId(pSigDoc)); - - // send DDS request - ddocDebug(3, "ddocDdsMobileCreateSignature", "Sending request!"); - err = soap_call_d__MobileCreateSignature(&(pDds->soap), (const char*)pDds->endpoint, "", - (char*)szIdCode, (szCountryCode ? (char*)szCountryCode : " "), - (char*)szPhoneNo, (char*)(szLang ? szLang : "ENG"), - (char*)szServiceName, (char*)szMessageToDisplay, - (char*)manifest, (char*)city, (char*)state, (char*)zip, - (char*)country, (char*)szSigningProfile, &dflst, - (char*)pSigDoc->szFormat, (char*)pSigDoc->szFormatVer, - (char*)id, (char*)"asynchClientServer", 0, &resp); - - ddocDebug(3, "ddocDdsMobileCreateSignature", "RC: %d session: %ld status: %s challenge-id: %s", - err, resp.Sesscode, (resp.Status ? (char*)resp.Status : "NULL"), - (resp.ChallengeID ? (char*)resp.ChallengeID : "NULL")); - // copy response status & err & faults - pDds->lDdsSesscode = *plSesscode = resp.Sesscode; - ddocDdsCopyStatusAndFault(pDds, resp.Status, NULL, err); - // try to find real error number - err = findServiceErrCode(pDds, err); - // copy response signed doc info - if(pMbChallengeId && resp.ChallengeID) - ddocMemAssignData(pMbChallengeId, resp.ChallengeID, -1); - // cleanup soap data - ddocDdsCleanup(pDds); - // report on success - ddocDebug(3, "ddocDdsMobileCreateSignature", "SignatureReq: %d sess: %ld status: %s code: %s", - err, pDds->lDdsSesscode, (pDds->szStatus ? pDds->szStatus : ""), - (pDds->szStatusCode ? pDds->szStatusCode : ""), - (pDds->szSoapFaultCode ? pDds->szSoapFaultCode : ""), - (pDds->szSoapFaultString ? pDds->szSoapFaultString : ""), - (pDds->szSoapFaultDetail ? pDds->szSoapFaultDetail : "")); - ddocDdsDisconnect(pDds); - return err; -} - - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// MSSP gateway and mobile signing -// lSesscode - DDS sessioncode -// bWaitSig - 1=wait synchronously for signature -// pMbStatus - buffer for status -// szTempDdocFile - temporary digidoc file name -// ppSigDoc - address of SignedDoc object -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetCreateSignatureStatusInfo(long lSesscode, int bWaitSig, - DigiDocMemBuf *pMbStatus, - const char* szTempDdocFile, - SignedDoc** ppSigDoc) -{ - int err = SOAP_OK, l1; - struct d__GetMobileCreateSignatureStatusResponse resp; - DDS* pDds = 0; - FILE* hFile = 0; - char* buf1[110], *p1; - long lSize, lPos; - - RETURN_IF_NULL_PARAM(pMbStatus); - RETURN_IF_NULL_PARAM(szTempDdocFile); - RETURN_IF_NULL_PARAM(ppSigDoc); - memset(&resp, 0, sizeof(struct d__GetMobileCreateSignatureStatusResponse)); - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "sesscode: %ld wait-sig: %d temp-file: %s", - lSesscode, bWaitSig, (szTempDdocFile ? szTempDdocFile : "NULL")); - // connect - err = ddocDdsConnect(&pDds); - if(err) return err; - pDds->lDdsSesscode = lSesscode; - // send DDS request - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "Sending request!"); - err = soap_call_d__GetMobileCreateSignatureStatus(&(pDds->soap), - (const char*)pDds->endpoint, "", pDds->lDdsSesscode, bWaitSig, &resp); - // report error or success - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "status: %s, signature: %s", - resp.Status, resp.Signature); - // copy response status & err & faults - ddocDdsCopyStatusAndFault(pDds, resp.Status, NULL, err); - // try to find real error number - err = findServiceErrCode(pDds, err); - // copy response signed doc info - if(pMbStatus && resp.Status) - ddocMemAssignData(pMbStatus, resp.Status, -1); - // if we got a new signature then add it to temp file ans reread it in - if(resp.Status && !strcmp(resp.Status, "SIGNATURE") && - resp.Signature) { - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "appending signature to: %s", szTempDdocFile); - //calculateFileSize(szTempDdocFile, &lSize); - if((hFile = fopen(szTempDdocFile, "r+b")) != NULL) { - memset(buf1, 0, sizeof(buf1)); - fseek(hFile, 0, SEEK_END); - lSize = ftell(hFile); - // seek back max 300 bytes - fseek(hFile, ((lSize > 100) ? (lSize - 100) : 0), SEEK_SET); - lPos = ftell(hFile); - l1 = fread(buf1, 1, ((lSize > 100) ? 100 : lSize), hFile); - p1 = strstr((const char*)buf1, ""); - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", - "pos: %ld go: %ld", lPos, (long)((long)p1 - (long)buf1 - l1)); - fseek(hFile, (long)((long)p1 - (long)buf1 - l1) , SEEK_CUR); - lPos = ftell(hFile); - // now write new signature - fputs((const char*)resp.Signature, hFile); - fputs("", hFile); - fclose(hFile); - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "signature appended"); - // release old digidoc if necessary - if(*ppSigDoc) { - SignedDoc_free(*ppSigDoc); - *ppSigDoc = 0; - } - err = ddocSaxReadSignedDocFromFile(ppSigDoc, szTempDdocFile, 0, 0); - ddocDebug(3, "ddocDdsGetCreateSignatureStatusInfo", "read file: %d", err); - - } - else - err = ERR_FILE_WRITE; - } - // cleanup soap data - //ddocDdsCleanup(pDds); - ddocDdsDisconnect(pDds); - return err; -} - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocDds.h libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocDds.h --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocDds.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocDds.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,391 +0,0 @@ -#ifndef __DIGIDOC_DDS_H__ -#define __DIGIDOC_DDS_H__ -//================================================== -// FILE: DigiDocDds.h -// PROJECT: Digi Doc -// DESCRIPTION: Digi Doc functions for DigiDocService client -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 07.01.2006 Veiko Sinivee -// Creation -//================================================== - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct DDS_st -{ - struct soap soap; - const char *endpoint; - unsigned long lDdsSesscode; - char* szStatus; - char* szStatusCode; - int err; - char* szSoapFaultCode; - char* szSoapFaultString; - char* szSoapFaultDetail; - struct d__SignedDocInfo* pSigDocInfo; -} DDS; - -//-------------------------------------------------- -// Initializes DDS connection -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsConnect(DDS** pDds); - -//-------------------------------------------------- -// Cleanup DDS connection. Free memory -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsDisconnect(DDS* pDds); - -//-------------------------------------------------- -// Cleanup DDS connection but don't disconnect -// pDds - pointer to DDS context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocDdsCleanup(DDS* pDds); - -//-------------------------------------------------- -// Sends an DDS request to start a new session -// Optionally loads an existing digidoc file or -// just any other file and creates digidoc based on it. -// pDds - pointer to DDS context structure -// bHoldSession - 1=hold session, 0=terminate after this call -// szSigningProfile - signing profile URL -// szDigiDocFile - full path and filename of digidoc document -// szDataFile - full path and filename of any new data file -// szDfMimeType - mime type of new data file -// szDfContentType - content type of new data file -// pMBufDdoc - memory buffer with digidoc xml data to send (optional) -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsStartSession(DDS* pDds, int bHoldSession, - const char* szSigningProfile, - const char* szDigiDocFile, const char* szDataFile, - const char* szDfMimeType, const char* szDfContentType, - DigiDocMemBuf* pMBufDdoc); - -//-------------------------------------------------- -// Sends an DDS request to close a session -// pDds - pointer to DDS context structure -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCloseSession(DDS* pDds); - -//-------------------------------------------------- -// Sends an DDS request to create a new empty digidoc -// pDds - pointer to DDS context structure -// szFormat - digidoc format -// szVersion - digidoc format version -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCreateSignedDoc(DDS* pDds, const char* szFormat, const char* szVersion); - -//-------------------------------------------------- -// Sends an DDS request to add a new data file -// pDds - pointer to DDS context structure -// szFileName - filename and path -// szMimeType - mime type -// szContentType - content type -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsAddDataFile(DDS* pDds, const char* szFileName, - const char* szMimeType, const char* szContentType); - -//-------------------------------------------------- -// Sends an DDS request to remove a data file -// pDds - pointer to DDS context structure -// szId - data file id -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsRemoveDataFile(DDS* pDds, const char* szId); - -//-------------------------------------------------- -// Sends an DDS request to retrieve current -// digidoc data and stores in in the given file -// pDds - pointer to DDS context structure -// szFileName - filename to store the digidoc -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetSignedDoc(DDS* pDds, const char* szFileName); - -//-------------------------------------------------- -// Sends an DDS request to retrieve current -// digidoc info. -// pDds - pointer to DDS context structure -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetSignedDocInfo(DDS* pDds); - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data file info and store it in a file. -// pDds - pointer to DDS context structure -// szId - data file id [mandatory] -// szFileName - file to store data in. Use NULL to use -// original data file name (but current directory!) -// Use directory name (ending with / or \ ) to -// use original data file name but in a directory -// of your choice. -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetDataFile(DDS* pDds, const char* szId, const char* szFileName); - - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures signers certificate -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetSignersCertificate(DDS* pDds, const char* szId, const char* szFileName); - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures notarys (responders) certificate -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetNotarysCertificate(DDS* pDds, const char* szId, const char* szFileName); - -//-------------------------------------------------- -// Sends an DDS request to retrieve the given -// data signatures OCSP response data -// pDds - pointer to DDS context structure -// szId - signature id [mandatory] -// szFileName - file to store data in. [mandatory] -// Data will be in PEM format! -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetNotary(DDS* pDds, const char* szId, const char* szFileName); - -//-------------------------------------------------- -// Sends an DDS request to prepare a new signature -// pDds - pointer to DDS context structure -// pCert - direct X509 cert [must rpovide cert or cert filename] -// szCertFile - cert PEM filename -// szTokenId - -// szRole - signers role [optional] -// szCity - signers address, city [optional] -// szState - signers address, state [optional] -// szPostalCode - signers address, postal code [optional] -// szCountry - signers address, country [optional] -// szSigId - buffer for new signature id [mandatory] -// szHash - buffer for new hash code to be signed [mandatory] -// pHashLen - pointer to length (int) of hash code [mandatory] -// szSigningProfile - signing profile URL [optional] -// returns error code or SOAP_OK -//-------------------------------------------------- - EXP_OPTION int ddocDdsPrepareSignature(DDS* pDds, - const char* szSigningProfile, - const X509* pCert, const char* szCertFile, - const char* szTokenId, const char* szRole, const char* szCity, - const char* szState, const char* szPostalCode, const char* szCountry, - char* szSigId, char* szHash, int *pHashLen); - -//-------------------------------------------------- -// Sends an DDS request to finalize a new signature -// pDds - pointer to DDS context structure -// szId - siganture id [mandatory] -// szSigValHEX - signature value in hex [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsFinalizeSignature(DDS* pDds, const char* szId, const char* szSigValHEX); - -//-------------------------------------------------- -// Sends an DDS request to remove a signature -// pDds - pointer to DDS context structure -// szId - siganture id [mandatory] -// szSigValHEX - signature value in hex [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsRemoveSignature(DDS* pDds, const char* szId); - -//-------------------------------------------------- -// Sends an DDS request to remove a signature -// pDds - pointer to DDS context structure -// szName - buffer for service name [mandatory] -// szVersion - buffer for service version [mandatory] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetVersion(DDS* pDds, char* szName, char* szVersion); - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// DigiDocService and mobile signing -// pDds - pointer to DDS context structure -// szSigningProfile - signing profile URL -// szCountryCode - signers country code (2 chars) -// szSignerIdCode - signers personal id code -// szSignerPhoneNo - signers phone number -// [mandatory] - either szIdCode and szCountryCode or szPhoneNo -// szDataToBeDisplayed - data to be displayed [optional] -// szLang - laguage -// szRole - signers role/manifest [optional] -// szCity - signers address, city [optional] -// szState - signers address, state [optional] -// szPostalCode - signers address, postal code [optional] -// szCountry - signers address, country [optional] -// szMsgMode - "asynchClientServer" -// szNotifURL - notification URL. Not used yet. Send NULL -// szCertURL - certificate url. [optional] -// bReturnDocInfo - 1/0 send digidoc info or not -// bReturnDocData - 1/0 send digidic data or not -// pMbChallengeId - buffer for challenge id [OUT] -// pMbChallenge - buffer for challenge [OUT] -// szSigningProfile - signing profile URL -// szFileName - filename to store the digidoc -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsMobileSign(DDS* pDds, const char* szSigningProfile, - const char* szSignerIdCode, const char* szCountryCode, - const char* szSignerPhoneNo, const char* szDataToBeDisplayed, - const char* szLang, const char* szRole, const char* szCity, - const char* szState, const char* szPostalCode, - const char* szCountry, const char* szMsgMode, - //const char* szNotifURL, const char* szCertURL, - //int bReturnDocInfo, int bReturnDocData, - DigiDocMemBuf *pMbChallengeId, DigiDocMemBuf *pMbChallenge, - const char* szDigiDocFileName); - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// MSSP gateway and mobile signing -// lSesscode - DDS sessioncode -// bReturnDocInfo - 1/0 send digidoc info or not -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetStatusInfo(long lSesscode, int bReturnDocInfo, - char* pszStartusStr, int nStatusLen); - -//-------------------------------------------------- -// Sends an DDS request to authenticate a person through -// MSSP gateway and mobile signing -// pDds - pointer to DDS context structure -// szIdCode - authenticators personal id code -// szCountryCode - signers country code (2 chars) -// szPhoneNo - authenticators phone number -// [mandatory] - either szIdCode and szCountryCode or szPhoneNo -// szLang - laguage [optional] default is ENG -// szMessageToDisplay - message to be displayed [optional] -// szSpcChallenge - AP challenge [optional] -// szCertUrl - certificate URL [optional] -// szMsgMode - "asynchClientServer" -// szNotifURL - notification URL. Not used yet. Send NULL -// bReturnCertData - 1/0 send cert data or not -// bReturnRevocationData - 1/0 send revocation data or not -// pMbUserIDCode - buffer for user id code [OUT] -// pMbUserGivenname - buffer for user givenname [OUT] -// pMbUserSurname - buffer for user surname [OUT] -// pMbUserCountry - buffer for user country [OUT] -// pMbUserCN - buffer for user CN [OUT] -// pMbCertData - buffer for user certificate data [OUT] -// pMbChallengeId - buffer for challenge id [OUT] -// pMbChallenge - buffer for challenge [OUT] -// pMbRevocationData - buffer for revocation data [OUT] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsMobileAuthenticate(DDS* pDds, const char* szIdCode, - const char* szCountryCode, - const char* szPhoneNo, const char* szLang, - const char* szMessageToDisplay, - const char* szSpcChallenge, const char* szCertUrl, - const char* szMsgMode, const char* szNotifURL, - int bReturnCertData, int bReturnRevocationData, - const char* ServiceName, - DigiDocMemBuf *pMbUserIDCode, DigiDocMemBuf *pMbUserGivenname, - DigiDocMemBuf *pMbUserSurname, DigiDocMemBuf *pMbUserCountry, - DigiDocMemBuf *pMbUserCN, DigiDocMemBuf *pMbCertData, - DigiDocMemBuf *pMbChallengeId, DigiDocMemBuf *pMbChallenge, - DigiDocMemBuf *pMbRevocationData); - -//-------------------------------------------------- -// Sends an DDS request to get authentication status -// pDds - pointer to DDS context structure -// bWaitSignature - 1=wait until signature or err, 0=return immediately -// pMbSignature - buffer for signature value [OUT] -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetMobileAuthenticateStatus(DDS* pDds, int bWaitSignature, - DigiDocMemBuf *pMbSignature); - -//-------------------------------------------------- -// Signs the document using DigiDocService. -// Digidoc file must have been saved before -// to calculate correct hashes. -// plSesscode - pointer to buffer for session code -// pSigDoc - signed document object -// szSigningProfile - signing profile -// szServiceName - service name -// szIdCode - signers id-code -// szCountryCode - signers country code -// szPhoneNo - users phone number -// szMessageToDisplay - message to display -// manifest - manifest or role -// city - signers address , city -// state - signers address , state or province -// zip - signers address , postal code -// country - signers address , country name -// szLang - language code -// pMbChallengeId - buffer for challenge id [OUT] -// return returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsCreateMobileSignature(long* plSesscode, const SignedDoc *pSigDoc, - const char* szSigningProfile, const char* szServiceName, - const char* szIdCode, const char* szCountryCode, - const char* szPhoneNo, const char* szMessageToDisplay, - const char* manifest, const char* city, - const char* state, const char* zip, - const char* country, const char* szLang, - DigiDocMemBuf *pMbChallengeId); - -//-------------------------------------------------- -// Sends an DDS request to create a new signature via -// MSSP gateway and mobile signing -// lSesscode - DDS sessioncode -// bWaitSig - 1=wait synchronously for signature -// pMbStatus - buffer for status -// szTempDdocFile - temporary digidoc file name -// ppSigDoc - address of SignedDoc object -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocDdsGetCreateSignatureStatusInfo(long lSesscode, int bWaitSig, - DigiDocMemBuf *pMbStatus, - const char* szTempDdocFile, - SignedDoc** ppSigDoc); - - -#ifdef __cplusplus -} -#endif - -#endif // __DIGIDOC_DDS_H__ - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService-old.h libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService-old.h --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService-old.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService-old.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,493 +0,0 @@ -//gsoap d service name: DigiDocService -//gsoap d service style: rpc -//gsoap d service encoding: encoded -//gsoap d schema elementForm: unqualified -//gsoap d schema attributeForm: qualified -//gsoap d service location: https://www.sk.ee:8094/DigiDocService -//gsoap d schema namespace: https://www.sk.ee:8094/DigiDocService/DigiDocService.wsdl -//gsoap d service method-action: add "" -//gsoap d service documentation: Digital signature service - -typedef char *xsd__string; // encode xsd string value as the xsd:string schema type -typedef char *xsd__anyURI; // encode xsd anyURI value as the xsd:anyURI schema type -typedef float xsd__float; // encode xsd float value as the xsd:float schema type -typedef long xsd__int; // encode xsd int value as the xsd:int schema type -typedef bool xsd__boolean; // encode xsd boolean value as the xsd:boolean schema type -typedef unsigned long long xsd__positiveInteger; // encode xsd positiveInteger value as the xsd:positiveInteger schema type -typedef char* XML; -typedef char* xsd__dateTime; - -//enum xsd__boolean { false_, true_ }; - -struct xsd__hexBinary -{ - public: - unsigned char *__ptr; - int __size; -}; - -struct d__DataFileAtribute -{ - xsd__string name; - xsd__string value; -}; - - -struct d__DataFileInfo -{ - xsd__string Id; - xsd__string Filename; - xsd__string MimeType; - xsd__string ContentType; - xsd__int Size; - xsd__string DigestType; - xsd__string DigestValue; - // optional atributes - int __sizeOfAtributes; - struct d__DataFileAtribute* __ptrAtributes; -}; - -struct d__SignerRole -{ - xsd__int certified; - xsd__string Role; -}; - -struct d__SignatureProductionPlace -{ - xsd__string City; - xsd__string StateOrProvince; - xsd__string PostalCode; - xsd__string CountryName; -}; - -struct d__CertificatePolicy -{ - xsd__string OID; - xsd__string URL; - xsd__string Description; -}; - -struct d__CertificateInfo -{ - xsd__string Issuer; - xsd__string Subject; - xsd__dateTime ValidFrom; - xsd__dateTime ValidTo; - xsd__string IssuerSerial; - int __sizePolicies; - struct d__CertificatePolicy* __ptrPolicies; -}; - -struct d__SignerInfo -{ - xsd__string CommonName; - xsd__string IDCode; - struct d__CertificateInfo* Certificate; -}; - -struct d__ConfirmationInfo -{ - xsd__string ResponderID; - xsd__string ProducedAt; - struct d__CertificateInfo* ResponderCertificate; -}; - -struct d__TstInfo -{ - xsd__string Id; - xsd__string Type; - xsd__string SerialNumber; - xsd__dateTime CreationTime; - xsd__string Policy; - xsd__string ErrorBound; - xsd__boolean Ordered; - xsd__string TSA; - struct d__CertificateInfo* Certificate; -}; - -struct d__RevokedInfo -{ - xsd__positiveInteger Sequence; - xsd__string SerialNumber; - xsd__dateTime RevocationDate; -}; - -struct d__CRLInfo -{ - xsd__string Issuer; - xsd__dateTime LastUpdate; - xsd__dateTime NextUpdate; - // optional atributes - int __sizeOfRevocations; - struct d__RevokedInfo* __ptrRevocations; -}; - - -struct d__Error -{ - xsd__int code; - xsd__string category; - xsd__string description; -}; - -struct d__SignatureInfo -{ - xsd__string Id; - xsd__string Status; - // optional error - struct d__Error* Error; - xsd__dateTime SigningTime; - // roles - int __sizeRoles; - struct d__SignerRole* __ptrSignerRole; - // address - struct d__SignatureProductionPlace* SignatureProductionPlace; - // signer info - struct d__SignerInfo* Signer; - // confirmation info - struct d__ConfirmationInfo* Confirmation; - // timestamps - int __sizeTimestamps; - struct d__TstInfo* __ptrTimestamps; - // CRL info - struct d__CRLInfo* CRLInfo; -}; - -struct d__SignedDocInfo -{ - xsd__string format; - xsd__string version; - // DataFile -s - int __sizeOfDataFileInfos; - struct d__DataFileInfo* __ptrDataFileInfo; - // SignatureInfos - int __sizeOfSignatureInfos; - struct d__SignatureInfo* __ptrSignatureInfo; -}; - - -struct d__DataFileData -{ - xsd__string Id; - xsd__string Filename; - xsd__string MimeType; - xsd__string ContentType; - xsd__string DigestType; - xsd__string DigestValue; - xsd__int Size; - int __sizeOfAtributes; - struct d__DataFileAtribute* __ptrAtributes; - xsd__string DfData; -}; - - -struct d__StartSessionResponse { - xsd__string status; - xsd__int sesscode; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__StartSession This method starts a new session -//gsoap d service method-output-header-part: d__StartSession d__SessionCode -int d__StartSession(xsd__string SigningProfile, xsd__string SigDocXML, xsd__boolean bHoldSession, - struct d__DataFileData* datafile, struct d__StartSessionResponse* result); - -struct d__CloseSessionResponse { - xsd__string status; -}; - -//gsoap d service method-documentation: d__CloseSession This method close an existing session -//gsoap d service method-header-part: d__CloseSession d__SessionCode -int d__CloseSession(xsd__int sesscode, struct d__CloseSessionResponse* result); - - -struct d__CreateSignedDocResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__CreateSignedDoc This method creates a new digidoc container and deletes old one if it had existed in this session -//gsoap d service method-header-part: d__CreateSignedDoc d__SessionCode -int d__CreateSignedDoc(xsd__int sesscode, xsd__string format, xsd__string version, - struct d__CreateSignedDocResponse* result); - - -struct d__AddDataFileResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__AddDataFile This method adds a new DataFile -//gsoap d service method-header-part: d__AddDataFile d__SessionCode -int d__AddDataFile(xsd__int sesscode, xsd__string FileName, xsd__string MimeType, - xsd__string ContentType, xsd__int Size, - xsd__string DigestType, xsd__string DigestValue, - xsd__string content, struct d__AddDataFileResponse* result); - -struct d__RemoveDataFileResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__RemoveDataFile This method removes an existing DataFile -//gsoap d service method-header-part: d__RemoveDataFile d__SessionCode -int d__RemoveDataFile(xsd__int sesscode, xsd__string DataFileId, - struct d__RemoveDataFileResponse* result); - - -struct d__GetSignedDocResponse { - xsd__string status; - xsd__string SignedDocData; -}; - -//gsoap d service method-documentation: d__GetSignedDoc This method returns the digidoc document -//gsoap d service method-header-part: d__GetSignedDoc d__SessionCode -int d__GetSignedDoc(xsd__int sesscode, - struct d__GetSignedDocResponse* result); - - -struct d__GetSignedDocInfoResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__GetSignedDocInfo This method returns the digidoc info -//gsoap d service method-header-part: d__GetSignedDocInfo d__SessionCode -int d__GetSignedDocInfo(xsd__int sesscode, - struct d__GetSignedDocInfoResponse* result); - - -struct d__GetDataFileResponse { - xsd__string status; - struct d__DataFileData* DataFileData; -}; - -//gsoap d service method-documentation: d__GetDataFile This method return existing DataFile info and data -//gsoap d service method-header-part: d__GetDataFile d__SessionCode -int d__GetDataFile(xsd__int sesscode, xsd__string DataFileId, - struct d__GetDataFileResponse* result); - - -struct d__GetSignersCertificateResponse { - xsd__string status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetSignersCertificate This method returns signers certificate in PEM form -//gsoap d service method-header-part: d__GetSignersCertificate d__SessionCode -int d__GetSignersCertificate(xsd__int sesscode, xsd__string SignatureId, - struct d__GetSignersCertificateResponse* result); - -struct d__GetNotarysCertificateResponse { - xsd__string status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetNotarysCertificate This method returns notarys certificate in PEM form -//gsoap d service method-header-part: d__GetNotarysCertificate d__SessionCode -int d__GetNotarysCertificate(xsd__int sesscode, xsd__string SignatureId, - struct d__GetNotarysCertificateResponse* result); - -struct d__GetNotaryResponse { - xsd__string status; - xsd__string OcspData; -}; - -//gsoap d service method-documentation: d__GetNotary This method returns notarys certificate OCSP responsein PEM form -int d__GetNotary(xsd__int sesscode, xsd__string SignatureId, - struct d__GetNotaryResponse* result); - - -struct d__GetTSACertificateResponse { - xsd__string status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetTSACertificate This method returns TSA certificate in PEM form -int d__GetTSACertificate(xsd__int sesscode, xsd__string TimestampId, - struct d__GetTSACertificateResponse* result); - -struct d__GetTimestampResponse { - xsd__string status; - xsd__string TimestampData; -}; - -//gsoap d service method-documentation: d__GetNotary This method returns notarys certificate OCSP responsein PEM form -int d__GetTimestamp(xsd__int sesscode, xsd__string TimestampId, - struct d__GetTimestampResponse* result); - - -struct d__GetCRLResponse { - xsd__string status; - xsd__string CRLData; -}; - -//gsoap d service method-documentation: d__GetCRL This method returns CRL in PEM form -int d__GetCRL(xsd__int sesscode, xsd__string SignatureId, - struct d__GetCRLResponse* result); - - - -struct d__SignatureModule { - xsd__string name; // name of the file or nothing for HTML or input element name/id - xsd__string type; // type: FILE, HTML, HTML-INPUT - xsd__string location; // DOCROOT, HTML-HEAD, HTML-BODY, HTML-FORM-BEGIN, HTML-FORM-END - xsd__string contentType; // HTML, BASE64 - xsd__string content; // files content in base64 or plain HTML text -}; - - -struct d__SignatureModulesArray { - int __sizeOfModules; - struct d__SignatureModule* __ptrModules; -}; - -struct d__GetSignatureModulesResponse { - xsd__string status; - struct d__SignatureModulesArray* modules; -}; - -//gsoap d service method-documentation: d__GetSignatureModules This method returns signature modules and HTML page content for signing pages -//gsoap d service method-header-part: d__GetSignatureModules d__SessionCode -int d__GetSignatureModules(xsd__int sesscode, - xsd__string platform, // LINUX-MOZILLA, WIN32-MOZILLA, WIN32-IE - xsd__string phase, // PREPARE or FINALIZE - xsd__string type, // DYNAMIC or STATIC or ALL - struct d__GetSignatureModulesResponse* result); - - -struct d__PrepareSignatureResponse { - xsd__string status; - xsd__string SignatureId; - xsd__string SignedInfoDigest; -}; - -//gsoap d service method-documentation: d__PrepareSignature This method prepares a new signature -//gsoap d service method-header-part: d__PrepareSignature d__SessionCode -int d__PrepareSignature(xsd__int sesscode, - xsd__string SignersCertificate, - xsd__string SignersTokenId, - xsd__string Role, - xsd__string City, - xsd__string State, - xsd__string PostalCode, - xsd__string Country, - xsd__string SigningProfile, - struct d__PrepareSignatureResponse* result); - - -struct d__FinalizeSignatureResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__FinalizeSignature This method finalizes a new signature -//gsoap d service method-header-part: d__FinalizeSignature d__SessionCode -int d__FinalizeSignature(xsd__int sesscode, - xsd__string SignatureId, xsd__string SignatureValue, - struct d__FinalizeSignatureResponse* result); - - -struct d__RemoveSignatureResponse { - xsd__string status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__RemoveSignature This method removes an existing signature -//gsoap d service method-header-part: d__RemoveSignature d__SessionCode -int d__RemoveSignature(xsd__int sesscode, xsd__string SignatureId, - struct d__RemoveSignatureResponse* result); - - -struct d__GetVersionResponse { - xsd__string name; - xsd__string version; -}; - -//gsoap d service method-documentation: d__GetVersion This method returns the name and version of service -int d__GetVersion(struct d__GetVersionResponse* result); - -struct d__MobileSignResponse { - xsd__string status; - xsd__string statusCode; - xsd__string ChallengeID; - xsd__string Challenge; - xsd__string SignedDocData; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__MobileSignRequest sends a request for mobile signing -int d__MobileSign(xsd__int sesscode, xsd__string SignerIDCode, - xsd__string CountryCode, xsd__string SignerPhoneNo, - xsd__string AdditionalDataToBeDisplayed, xsd__string Language, - xsd__string Role, xsd__string City, xsd__string StateOrProvince, - xsd__string PostalCode, xsd__string CountryName, - xsd__string SigningProfile, - xsd__string MessagingMode, xsd__string NotificationURL, - xsd__string CertificateURL, xsd__boolean ReturnDocInfo, - xsd__boolean ReturnDocData, struct d__MobileSignResponse* result); - -struct d__GetStatusInfoResponse { - xsd__string LastAction; - xsd__string status; - xsd__string statusCode; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__GetStatusInfoRequest sends mobile signing status info request -int d__GetStatusInfo(xsd__int sesscode, xsd__boolean ReturnDocInfo, - struct d__GetStatusInfoResponse* result); - - -struct d__MobileAuthenticateResponse { - xsd__int Sesscode; - xsd__string Status; - xsd__string UserIDCode; - xsd__string UserGivenname; - xsd__string UserSurname; - xsd__string UserCountry; - xsd__string UserCN; - xsd__string CertificateData; - xsd__string ChallengeID; - xsd__string Challenge; - xsd__string RevocationData; -}; - -//gsoap d service method-documentation: d__MobileAuthenticateRequest sends a request for mobile authentication -int d__MobileAuthenticate(xsd__string IDCode, xsd__string CountryCode, - xsd__string PhoneNo, xsd__string Language, - xsd__string MessageToDisplay, xsd__string SPChallenge, - xsd__string CertificateURL, xsd__string MessagingMode, - xsd__string NotificationURL, xsd__boolean ReturnCertData, - xsd__boolean ReturnRevocationData, xsd__string ServiceName, - struct d__MobileAuthenticateResponse* result); - - -struct d__GetMobileAuthenticateStatusResponse { - xsd__string Status; - xsd__string Signature; // pkcs#1 konteiner base64 kujul - -}; - -//gsoap d service method-documentation: d__GetMobileAuthenticateStatus sends mobile authenticate status info request -int d__GetMobileAuthenticateStatus(xsd__int sesscode, xsd__boolean WaitSignature, - struct d__GetMobileAuthenticateStatusResponse* result); - - -struct mss_DummyResp { - xsd__string str; -}; - -//gsoap mss service name: MSSP_GW -//gsoap mss service style: rpc -//gsoap mss service encoding: literal -//gsoap mss schema elementForm: qualified -//gsoap mss schema attributeForm: qualified -//gsoap mss service location: http://www.sk.ee/MSSP_GW -//gsoap mss schema namespace: http://www.sk.ee/MSSP_GW/MSSP_GW.wsdl -//gsoap mss service method-action: add "" -//gsoap mss service documentation: MSSP Gateway Service - -//gsoap mss service method-documentation: mss__MSS_SignatureDummy This method request a mobile signature -int mss__MSS_USCORESignatureDummy(struct mss_DummyResp* resp); diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.h libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.h --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,565 +0,0 @@ -//gsoap d service name: DigiDocService -//gsoap d service style: rpc -//gsoap d service encoding: encoded -//gsoap d schema elementForm: unqualified -//gsoap d schema attributeForm: qualified -//gsoap d service location: http://www.sk.ee:8095/DigiDocService -//gsoap d schema namespace: http://www.sk.ee/DigiDocService/DigiDocService_2_3.wsdl -//gsoap d service method-action: add "" -//gsoap d service documentation: Digital signature service - -typedef char *xsd__string; // encode xsd string value as the xsd:string schema type -typedef char *xsd__anyURI; // encode xsd anyURI value as the xsd:anyURI schema type -typedef float xsd__float; // encode xsd float value as the xsd:float schema type -typedef long xsd__int; // encode xsd int value as the xsd:int schema type -typedef bool xsd__boolean; // encode xsd boolean value as the xsd:boolean schema type -typedef unsigned long long xsd__positiveInteger; // encode xsd positiveInteger value as the xsd:positiveInteger schema type -typedef char* XML; -typedef char* xsd__dateTime; - -//enum xsd__boolean { false_, true_ }; - -struct xsd__hexBinary -{ - public: - unsigned char *__ptr; - int __size; -}; - -struct d__DataFileAttribute -{ - xsd__string Name; - xsd__string Value; -}; - - -struct d__DataFileInfo -{ - xsd__string Id; - xsd__string Filename; - xsd__string MimeType; - xsd__string ContentType; - xsd__int Size; - xsd__string DigestType; - xsd__string DigestValue; - // optional atributes - int __sizeOfAttributes; - struct d__DataFileAttribute* __ptrAttributes; -}; - -struct d__SignerRole -{ - xsd__int Certified; - xsd__string Role; -}; - -struct d__SignatureProductionPlace -{ - xsd__string City; - xsd__string StateOrProvince; - xsd__string PostalCode; - xsd__string CountryName; -}; - -struct d__CertificatePolicy -{ - xsd__string OID; - xsd__string URL; - xsd__string Description; -}; - -struct d__CertificateInfo -{ - xsd__string Issuer; - xsd__string Subject; - xsd__dateTime ValidFrom; - xsd__dateTime ValidTo; - xsd__string IssuerSerial; - int __sizePolicies; - struct d__CertificatePolicy* __ptrPolicies; -}; - -struct d__SignerInfo -{ - xsd__string CommonName; - xsd__string IDCode; - struct d__CertificateInfo* Certificate; -}; - -struct d__ConfirmationInfo -{ - xsd__string ResponderID; - xsd__string ProducedAt; - struct d__CertificateInfo* ResponderCertificate; -}; - -struct d__TstInfo -{ - xsd__string Id; - xsd__string Type; - xsd__string SerialNumber; - xsd__dateTime CreationTime; - xsd__string Policy; - xsd__string ErrorBound; - xsd__boolean Ordered; - xsd__string TSA; - struct d__CertificateInfo* Certificate; -}; - -struct d__RevokedInfo -{ - xsd__positiveInteger Sequence; - xsd__string SerialNumber; - xsd__dateTime RevocationDate; -}; - -struct d__CRLInfo -{ - xsd__string Issuer; - xsd__dateTime LastUpdate; - xsd__dateTime NextUpdate; - // optional atributes - int __sizeOfRevocations; - struct d__RevokedInfo* __ptrRevocations; -}; - - -struct d__Error -{ - xsd__int Code; - xsd__string Category; - xsd__string Description; -}; - -struct d__SignatureInfo -{ - xsd__string Id; - xsd__string Status; - // optional error - struct d__Error* Error; - xsd__dateTime SigningTime; - // roles - int __sizeRoles; - struct d__SignerRole* __ptrSignerRole; - // address - struct d__SignatureProductionPlace* SignatureProductionPlace; - // signer info - struct d__SignerInfo* Signer; - // confirmation info - struct d__ConfirmationInfo* Confirmation; - // timestamps - int __sizeTimestamps; - struct d__TstInfo* __ptrTimestamps; - // CRL info - struct d__CRLInfo* CRLInfo; -}; - -struct d__SignedDocInfo -{ - xsd__string Format; - xsd__string Version; - // DataFile -s - int __sizeOfDataFileInfos; - struct d__DataFileInfo* __ptrDataFileInfo; - // SignatureInfos - int __sizeOfSignatureInfos; - struct d__SignatureInfo* __ptrSignatureInfo; -}; - - -struct d__DataFileData -{ - xsd__string Id; - xsd__string Filename; - xsd__string MimeType; - xsd__string ContentType; - xsd__string DigestType; - xsd__string DigestValue; - xsd__int Size; - int __sizeOfAttributes; - struct d__DataFileAttribute* __ptrAttributes; - xsd__string DfData; -}; - - -struct d__StartSessionResponse { - xsd__string Status; - xsd__int Sesscode; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__StartSession This method starts a new session -//gsoap d service method-output-header-part: d__StartSession d__SessionCode -int d__StartSession(xsd__string SigningProfile, xsd__string SigDocXML, xsd__boolean bHoldSession, - struct d__DataFileData* datafile, struct d__StartSessionResponse* result); - -struct d__CloseSessionResponse { - xsd__string Status; -}; - -//gsoap d service method-documentation: d__CloseSession This method close an existing session -//gsoap d service method-header-part: d__CloseSession d__SessionCode -int d__CloseSession(xsd__int Sesscode, struct d__CloseSessionResponse* result); - - -struct d__CreateSignedDocResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__CreateSignedDoc This method creates a new digidoc container and deletes old one if it had existed in this session -//gsoap d service method-header-part: d__CreateSignedDoc d__SessionCode -int d__CreateSignedDoc(xsd__int Sesscode, xsd__string Format, xsd__string Version, - struct d__CreateSignedDocResponse* result); - - -struct d__AddDataFileResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__AddDataFile This method adds a new DataFile -//gsoap d service method-header-part: d__AddDataFile d__SessionCode -int d__AddDataFile(xsd__int Sesscode, xsd__string FileName, xsd__string MimeType, - xsd__string ContentType, xsd__int Size, - xsd__string DigestType, xsd__string DigestValue, - xsd__string Content, struct d__AddDataFileResponse* result); - -struct d__RemoveDataFileResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__RemoveDataFile This method removes an existing DataFile -//gsoap d service method-header-part: d__RemoveDataFile d__SessionCode -int d__RemoveDataFile(xsd__int Sesscode, xsd__string DataFileId, - struct d__RemoveDataFileResponse* result); - - -struct d__GetSignedDocResponse { - xsd__string Status; - xsd__string SignedDocData; -}; - -//gsoap d service method-documentation: d__GetSignedDoc This method returns the digidoc document -//gsoap d service method-header-part: d__GetSignedDoc d__SessionCode -int d__GetSignedDoc(xsd__int Sesscode, - struct d__GetSignedDocResponse* result); - - -struct d__GetSignedDocInfoResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__GetSignedDocInfo This method returns the digidoc info -//gsoap d service method-header-part: d__GetSignedDocInfo d__SessionCode -int d__GetSignedDocInfo(xsd__int Sesscode, - struct d__GetSignedDocInfoResponse* result); - - -struct d__GetDataFileResponse { - xsd__string Status; - struct d__DataFileData* DataFileData; -}; - -//gsoap d service method-documentation: d__GetDataFile This method return existing DataFile info and data -//gsoap d service method-header-part: d__GetDataFile d__SessionCode -int d__GetDataFile(xsd__int Sesscode, xsd__string DataFileId, - struct d__GetDataFileResponse* result); - - -struct d__GetSignersCertificateResponse { - xsd__string Status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetSignersCertificate This method returns signers certificate in PEM form -//gsoap d service method-header-part: d__GetSignersCertificate d__SessionCode -int d__GetSignersCertificate(xsd__int Sesscode, xsd__string SignatureId, - struct d__GetSignersCertificateResponse* result); - -struct d__GetNotarysCertificateResponse { - xsd__string Status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetNotarysCertificate This method returns notarys certificate in PEM form -//gsoap d service method-header-part: d__GetNotarysCertificate d__SessionCode -int d__GetNotarysCertificate(xsd__int Sesscode, xsd__string SignatureId, - struct d__GetNotarysCertificateResponse* result); - -struct d__GetNotaryResponse { - xsd__string Status; - xsd__string OcspData; -}; - -//gsoap d service method-documentation: d__GetNotary This method returns notarys certificate OCSP responsein PEM form -int d__GetNotary(xsd__int Sesscode, xsd__string SignatureId, - struct d__GetNotaryResponse* result); - - -struct d__GetTSACertificateResponse { - xsd__string Status; - xsd__string CertificateData; -}; - -//gsoap d service method-documentation: d__GetTSACertificate This method returns TSA certificate in PEM form -int d__GetTSACertificate(xsd__int Sesscode, xsd__string TimestampId, - struct d__GetTSACertificateResponse* result); - -struct d__GetTimestampResponse { - xsd__string Status; - xsd__string TimestampData; -}; - -//gsoap d service method-documentation: d__GetNotary This method returns notarys certificate OCSP responsein PEM form -int d__GetTimestamp(xsd__int Sesscode, xsd__string TimestampId, - struct d__GetTimestampResponse* result); - - -struct d__GetCRLResponse { - xsd__string Status; - xsd__string CRLData; -}; - -//gsoap d service method-documentation: d__GetCRL This method returns CRL in PEM form -int d__GetCRL(xsd__int Sesscode, xsd__string SignatureId, - struct d__GetCRLResponse* result); - - - -struct d__SignatureModule { - xsd__string Name; // name of the file or nothing for HTML or input element name/id - xsd__string Type; // type: FILE, HTML, HTML-INPUT - xsd__string Location; // DOCROOT, HTML-HEAD, HTML-BODY, HTML-FORM-BEGIN, HTML-FORM-END - xsd__string ContentType; // HTML, BASE64 - xsd__string Content; // files content in base64 or plain HTML text -}; - - -struct d__SignatureModulesArray { - int __sizeOfModules; - struct d__SignatureModule* __ptrModules; -}; - -struct d__GetSignatureModulesResponse { - xsd__string Status; - struct d__SignatureModulesArray* Modules; -}; - -//gsoap d service method-documentation: d__GetSignatureModules This method returns signature modules and HTML page content for signing pages -//gsoap d service method-header-part: d__GetSignatureModules d__SessionCode -int d__GetSignatureModules(xsd__int Sesscode, - xsd__string Platform, // LINUX-MOZILLA, WIN32-MOZILLA, WIN32-IE - xsd__string Phase, // PREPARE or FINALIZE - xsd__string Type, // DYNAMIC or STATIC or ALL - struct d__GetSignatureModulesResponse* result); - - -struct d__PrepareSignatureResponse { - xsd__string Status; - xsd__string SignatureId; - xsd__string SignedInfoDigest; -}; - -//gsoap d service method-documentation: d__PrepareSignature This method prepares a new signature -//gsoap d service method-header-part: d__PrepareSignature d__SessionCode -int d__PrepareSignature(xsd__int Sesscode, - xsd__string SignersCertificate, - xsd__string SignersTokenId, - xsd__string Role, - xsd__string City, - xsd__string State, - xsd__string PostalCode, - xsd__string Country, - xsd__string SigningProfile, - struct d__PrepareSignatureResponse* result); - - -struct d__FinalizeSignatureResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__FinalizeSignature This method finalizes a new signature -//gsoap d service method-header-part: d__FinalizeSignature d__SessionCode -int d__FinalizeSignature(xsd__int Sesscode, - xsd__string SignatureId, xsd__string SignatureValue, - struct d__FinalizeSignatureResponse* result); - - -struct d__RemoveSignatureResponse { - xsd__string Status; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__RemoveSignature This method removes an existing signature -//gsoap d service method-header-part: d__RemoveSignature d__SessionCode -int d__RemoveSignature(xsd__int Sesscode, xsd__string SignatureId, - struct d__RemoveSignatureResponse* result); - - -struct d__GetVersionResponse { - xsd__string Name; - xsd__string Version; -}; - -//gsoap d service method-documentation: d__GetVersion This method returns the name and version of service -int d__GetVersion(struct d__GetVersionResponse* result); - -struct d__MobileSignResponse { - xsd__string Status; - xsd__string StatusCode; - xsd__string ChallengeID; -}; - -//gsoap d service method-documentation: d__MobileSignRequest sends a request for mobile signing -int d__MobileSign(xsd__int Sesscode, - xsd__string SignerIDCode, - xsd__string SignersCountry, - xsd__string SignerPhoneNo, - xsd__string ServiceName, - xsd__string AdditionalDataToBeDisplayed, - xsd__string Language, - xsd__string Role, - xsd__string City, - xsd__string StateOrProvince, - xsd__string PostalCode, - xsd__string CountryName, - xsd__string SigningProfile, - xsd__string MessagingMode, - xsd__int AsyncConfiguration, - xsd__boolean ReturnDocInfo, - xsd__boolean ReturnDocData, - struct d__MobileSignResponse* result); - -struct d__GetStatusInfoResponse { - xsd__string Status; - xsd__string StatusCode; - struct d__SignedDocInfo* SignedDocInfo; -}; - -//gsoap d service method-documentation: d__GetStatusInfoRequest sends mobile signing status info request -int d__GetStatusInfo(xsd__int Sesscode, - xsd__boolean ReturnDocInfo, - xsd__boolean WaitSignature, - struct d__GetStatusInfoResponse* result); - - -struct d__MobileAuthenticateResponse -{ - xsd__int Sesscode; - xsd__string Status; - xsd__string UserIDCode; - xsd__string UserGivenname; - xsd__string UserSurname; - xsd__string UserCountry; - xsd__string UserCN; - xsd__string CertificateData; - xsd__string ChallengeID; - xsd__string Challenge; - xsd__string RevocationData; -}; - -//gsoap d service method-documentation: d__MobileAuthenticateRequest sends a request for mobile authentication -int d__MobileAuthenticate(xsd__string IDCode, - xsd__string CountryCode, - xsd__string PhoneNo, - xsd__string Language, - xsd__string ServiceName, - xsd__string MessageToDisplay, - xsd__string SPChallenge, - xsd__string MessagingMode, - xsd__int AsyncConfiguration, - xsd__boolean ReturnCertData, - xsd__boolean ReturnRevocationData, - struct d__MobileAuthenticateResponse* result); - - -struct d__GetMobileAuthenticateStatusResponse -{ - xsd__string Status; - xsd__string Signature; // pkcs#1 konteiner base64 kujul -}; - -//gsoap d service method-documentation: d__GetMobileAuthenticateStatus sends mobile authenticate status info request -int d__GetMobileAuthenticateStatus(xsd__int Sesscode, - xsd__boolean WaitSignature, - struct d__GetMobileAuthenticateStatusResponse* result); - -struct d__DataFileDigest -{ - xsd__string Id; - xsd__string DigestType; - xsd__string DigestValue; -}; - -struct d__DataFileDigestList -{ - int __sizeOfDataFileDigests; - struct d__DataFileDigest* __ptrDataFileDigest; -}; - -struct d__MobileCreateSignatureResponse -{ - xsd__int Sesscode; - xsd__string ChallengeID; - xsd__string Status; -}; - -//gsoap g service method-documentation: d_MobileCreateSignature sends a request to sign external digidoc by a mobile -int d__MobileCreateSignature(xsd__string IDCode, - xsd__string SignersCountry, - xsd__string PhoneNo, - xsd__string Language, - xsd__string ServiceName, - xsd__string MessageToDisplay, - xsd__string Role, - xsd__string City, - xsd__string StateOrProvince, - xsd__string PostalCode, - xsd__string CountryName, - xsd__string SigningProfile, - struct d__DataFileDigestList* DataFiles, - xsd__string Format, - xsd__string Version, - xsd__string SignatureID, - xsd__string MessagingMode, - xsd__int AsyncConfiguration, - struct d__MobileCreateSignatureResponse* result); - - -struct d__GetMobileCreateSignatureStatusResponse -{ - xsd__int Sesscode; - xsd__string Status; - xsd__string Signature; -}; - -//gsoap d service method-documentation: d__GetMobileCreateSignatureStatus sends mobile signature status info request -int d__GetMobileCreateSignatureStatus(xsd__int Sesscode, - xsd__boolean WaitSignature, - struct d__GetMobileCreateSignatureStatusResponse* result); - - - -struct mss_DummyResp { - xsd__string str; -}; - -//gsoap mss service name: MSSP_GW -//gsoap mss service style: rpc -//gsoap mss service encoding: literal -//gsoap mss schema elementForm: qualified -//gsoap mss schema attributeForm: qualified -//gsoap mss service location: http://www.sk.ee:8096/MSSP_GW -//gsoap mss schema namespace: http://www.sk.ee:8096/MSSP_GW/MSSP_GW.wsdl -//gsoap mss service method-action: add "" -//gsoap mss service documentation: MSSP Gateway Service - -//gsoap mss service method-documentation: mss__MSS_SignatureDummy This method request a mobile signature -int mss__MSS_USCORESignatureDummy(struct mss_DummyResp* resp); - - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.nsmap libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.nsmap --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.nsmap 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.nsmap 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - -#include "ddsH.h" -SOAP_NMAC struct Namespace namespaces[] = -{ - {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL}, - {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL}, - {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, - {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, - {"d", "http://www.sk.ee/DigiDocService/DigiDocService_2_3.wsdl", NULL, NULL}, - {"mss", "http://www.sk.ee:8096/MSSP_GW/MSSP_GW.wsdl", NULL, NULL}, - {NULL, NULL, NULL, NULL} -}; diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.wsdl libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.wsdl --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocService.wsdl 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocService.wsdl 1970-01-01 00:00:00.000000000 +0000 @@ -1,889 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Service definition of function d__StartSession - - - - - Service definition of function d__CloseSession - - - - - Service definition of function d__CreateSignedDoc - - - - - Service definition of function d__AddDataFile - - - - - Service definition of function d__RemoveDataFile - - - - - Service definition of function d__GetSignedDoc - - - - - Service definition of function d__GetSignedDocInfo - - - - - Service definition of function d__GetDataFile - - - - - Service definition of function d__GetSignersCertificate - - - - - Service definition of function d__GetNotarysCertificate - - - - - Service definition of function d__GetNotary - - - - - Service definition of function d__GetTSACertificate - - - - - Service definition of function d__GetTimestamp - - - - - Service definition of function d__GetCRL - - - - - Service definition of function d__GetSignatureModules - - - - - Service definition of function d__PrepareSignature - - - - - Service definition of function d__FinalizeSignature - - - - - Service definition of function d__RemoveSignature - - - - - Service definition of function d__GetVersion - - - - - Service definition of function d__MobileSign - - - - - Service definition of function d__GetStatusInfo - - - - - Service definition of function d__MobileAuthenticate - - - - - Service definition of function d__GetMobileAuthenticateStatus - - - - - Service definition of function d__MobileCreateSignature - - - - - Service definition of function d__GetMobileCreateSignatureStatus - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Digital signature service - - - - - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.dsp libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.dsp --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.dsp 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.dsp 1970-01-01 00:00:00.000000000 +0000 @@ -1,127 +0,0 @@ -# Microsoft Developer Studio Project File - Name="DigiDocServiceClient" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=DigiDocServiceClient - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "DigiDocServiceClient.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "DigiDocServiceClient.mak" CFG="DigiDocServiceClient - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "DigiDocServiceClient - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "DigiDocServiceClient - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "DigiDocServiceClient - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DIGIDOCSERVICECLIENT_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DIGIDOCSERVICECLIENT_EXPORTS" /D "WITH_SOAPDEFS_H" /D "WITH_NONAMESPACES" /D "BUILDINGDLL" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x425 /d "NDEBUG" -# ADD RSC /l 0x425 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib libeay32.lib ssleay32.lib DigiDocLib.lib stdsoap2.lib libxml2.lib /nologo /dll /incremental:yes /machine:I386 - -!ELSEIF "$(CFG)" == "DigiDocServiceClient - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DIGIDOCSERVICECLIENT_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DIGIDOCSERVICECLIENT_EXPORTS" /D "BUILDINGDLL" /D "WITH_SOAPDEFS_H" /D "WITH_NONAMESPACES" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x425 /d "_DEBUG" -# ADD RSC /l 0x425 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib libeay32.lib ssleay32.lib DigiDocLib.lib stdsoap2.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "DigiDocServiceClient - Win32 Release" -# Name "DigiDocServiceClient - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\ddsC.c -# End Source File -# Begin Source File - -SOURCE=.\ddsClient.c -# End Source File -# Begin Source File - -SOURCE=.\DigiDocDds.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\DigiDocDds.h -# End Source File -# Begin Source File - -SOURCE=.\DigiDocService.h -# End Source File -# Begin Source File - -SOURCE=.\soapdefs.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.dsw libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.dsw --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.dsw 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.dsw 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "DigiDocServiceClient"=.\DigiDocServiceClient.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.ncb and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.ncb differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.opt and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.opt differ diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.plg libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.plg --- libdigidoc-2.7.0/DigiDocServiceClient/DigiDocServiceClient.plg 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/DigiDocServiceClient.plg 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ - - -
-

Build Log

-

---------------------Configuration: DigiDocServiceClient - Win32 Debug-------------------- -

-

Command Lines

-Creating temporary file "C:\DOCUME~1\Veiko\LOCALS~1\Temp\RSP6F.tmp" with contents -[ -/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "DIGIDOCSERVICECLIENT_EXPORTS" /D "BUILDINGDLL" /D "WITH_SOAPDEFS_H" /D "WITH_NONAMESPACES" /Fp"Debug/DigiDocServiceClient.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c" -] -Creating command line "cl.exe @C:\DOCUME~1\Veiko\LOCALS~1\Temp\RSP6F.tmp" -Creating temporary file "C:\DOCUME~1\Veiko\LOCALS~1\Temp\RSP70.tmp" with contents -[ -kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib libeay32.lib ssleay32.lib DigiDocLib.lib stdsoap2.lib /nologo /dll /incremental:yes /pdb:"Debug/DigiDocServiceClient.pdb" /debug /machine:I386 /out:"Debug/DigiDocServiceClient.dll" /implib:"Debug/DigiDocServiceClient.lib" /pdbtype:sept -.\Debug\ddsC.obj -.\Debug\ddsClient.obj -.\Debug\DigiDocDds.obj -] -Creating command line "link.exe @C:\DOCUME~1\Veiko\LOCALS~1\Temp\RSP70.tmp" -

Output Window

-Compiling... -DigiDocDds.c -C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c(170) : warning C4761: integral size mismatch in argument; conversion supplied -C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c(853) : warning C4761: integral size mismatch in argument; conversion supplied -C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c(1771) : warning C4761: integral size mismatch in argument; conversion supplied -C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c(1920) : warning C4761: integral size mismatch in argument; conversion supplied -C:\veiko\libdigidoc\DigiDocServiceClient\DigiDocDds.c(2147) : warning C4761: integral size mismatch in argument; conversion supplied -Linking... - - - -

Results

-DigiDocServiceClient.dll - 0 error(s), 5 warning(s) -
- - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/MSSP_GW.nsmap libdigidoc-3.7.0.875/DigiDocServiceClient/MSSP_GW.nsmap --- libdigidoc-2.7.0/DigiDocServiceClient/MSSP_GW.nsmap 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/MSSP_GW.nsmap 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - -#include "ddsH.h" -SOAP_NMAC struct Namespace namespaces[] = -{ - {"SOAP-ENV", "http://schemas.xmlsoap.org/soap/envelope/", "http://www.w3.org/*/soap-envelope", NULL}, - {"SOAP-ENC", "http://schemas.xmlsoap.org/soap/encoding/", "http://www.w3.org/*/soap-encoding", NULL}, - {"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, - {"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, - {"d", "http://www.sk.ee/DigiDocService/DigiDocService_2_3.wsdl", NULL, NULL}, - {"mss", "http://www.sk.ee:8096/MSSP_GW/MSSP_GW.wsdl", NULL, NULL}, - {NULL, NULL, NULL, NULL} -}; diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/MSSP_GW.wsdl libdigidoc-3.7.0.875/DigiDocServiceClient/MSSP_GW.wsdl --- libdigidoc-2.7.0/DigiDocServiceClient/MSSP_GW.wsdl 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/MSSP_GW.wsdl 1970-01-01 00:00:00.000000000 +0000 @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Service definition of function mss__MSS_USCORESignatureDummy - - - - - - - - - - - - - - - - - - - - MSSP Gateway Service - - - - - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/d.xsd libdigidoc-3.7.0.875/DigiDocServiceClient/d.xsd --- libdigidoc-2.7.0/DigiDocServiceClient/d.xsd 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/d.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/ddsC.c libdigidoc-3.7.0.875/DigiDocServiceClient/ddsC.c --- libdigidoc-2.7.0/DigiDocServiceClient/ddsC.c 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/ddsC.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,12047 +0,0 @@ -/* ddsC.c - Generated by gSOAP 2.7.9 from DigiDocService.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. - This part of the software is released under one of the following licenses: - GPL, the gSOAP public license, or Genivia's license for commercial use. -*/ - -#include "ddsH.h" -#ifdef __cplusplus -extern "C" { -#endif - -SOAP_SOURCE_STAMP("@(#) ddsC.c ver 2.7.9 2007-03-12 16:55:20 GMT") - - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serializeheader(struct soap *soap) -{ - if (soap->header) - soap_serialize_SOAP_ENV__Header(soap, soap->header); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_putheader(struct soap *soap) -{ - if (soap->header) - { soap->part = SOAP_IN_HEADER; - soap_out_SOAP_ENV__Header(soap, "SOAP-ENV:Header", 0, soap->header, NULL); - soap->part = SOAP_END_HEADER; - } - return SOAP_OK; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_getheader(struct soap *soap) -{ - soap->part = SOAP_IN_HEADER; - soap->header = soap_in_SOAP_ENV__Header(soap, "SOAP-ENV:Header", NULL, NULL); - soap->part = SOAP_END_HEADER; - return soap->header == NULL; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap) -{ - if (!soap->fault) - { soap->fault = (struct SOAP_ENV__Fault*)soap_malloc(soap, sizeof(struct SOAP_ENV__Fault)); - soap_default_SOAP_ENV__Fault(soap, soap->fault); - } - if (soap->version == 2 && !soap->fault->SOAP_ENV__Code) - { soap->fault->SOAP_ENV__Code = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); - soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code); - } - if (soap->version == 2 && !soap->fault->SOAP_ENV__Reason) - { soap->fault->SOAP_ENV__Reason = (struct SOAP_ENV__Reason*)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason)); - soap_default_SOAP_ENV__Reason(soap, soap->fault->SOAP_ENV__Reason); - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serializefault(struct soap *soap) -{ - if (soap->fault) - soap_serialize_SOAP_ENV__Fault(soap, soap->fault); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_putfault(struct soap *soap) -{ - if (soap->fault) - return soap_put_SOAP_ENV__Fault(soap, soap->fault, "SOAP-ENV:Fault", NULL); - return SOAP_OK; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_getfault(struct soap *soap) -{ - return (soap->fault = soap_get_SOAP_ENV__Fault(soap, NULL, "SOAP-ENV:Fault", NULL)) == NULL; -} - -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultcode(struct soap *soap) -{ - soap_fault(soap); - if (soap->version == 2) - return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Value; - return (const char**)&soap->fault->faultcode; -} - -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultsubcode(struct soap *soap) -{ - soap_fault(soap); - if (soap->version == 2) - { if (!soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode) - { soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code)); - soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode); - } - return (const char**)&soap->fault->SOAP_ENV__Code->SOAP_ENV__Subcode->SOAP_ENV__Value; - } - return (const char**)&soap->fault->faultcode; -} - -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultstring(struct soap *soap) -{ - soap_fault(soap); - if (soap->version == 2) - return (const char**)&soap->fault->SOAP_ENV__Reason->SOAP_ENV__Text; - return (const char**)&soap->fault->faultstring; -} - -SOAP_FMAC3 const char ** SOAP_FMAC4 soap_faultdetail(struct soap *soap) -{ - soap_fault(soap); - if (soap->version == 1) - { if (!soap->fault->detail) - { soap->fault->detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); - soap_default_SOAP_ENV__Detail(soap, soap->fault->detail); - } - return (const char**)&soap->fault->detail->__any; - } - if (!soap->fault->SOAP_ENV__Detail) - { soap->fault->SOAP_ENV__Detail = (struct SOAP_ENV__Detail*)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail)); - soap_default_SOAP_ENV__Detail(soap, soap->fault->SOAP_ENV__Detail); - } - return (const char**)&soap->fault->SOAP_ENV__Detail->__any; -} - -#endif - -#ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap *soap) -{ - int t; - for (;;) - if (!soap_getelement(soap, &t)) - if (soap->error || soap_ignore_element(soap)) - break; - if (soap->error == SOAP_NO_TAG || soap->error == SOAP_EOF) - soap->error = SOAP_OK; - return soap->error; -} -#endif - -#ifndef WITH_NOIDREF -SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap *soap, int *type) -{ - if (soap_peek_element(soap)) - return NULL; - if (!*soap->id || !(*type = soap_lookup_type(soap, soap->id))) - *type = soap_lookup_type(soap, soap->href); - switch (*type) - { - case SOAP_TYPE_byte: - return soap_in_byte(soap, NULL, NULL, "xsd:byte"); - case SOAP_TYPE_int: - return soap_in_int(soap, NULL, NULL, "xsd:int"); - case SOAP_TYPE_xsd__int: - return soap_in_xsd__int(soap, NULL, NULL, "xsd:int"); - case SOAP_TYPE_long: - return soap_in_long(soap, NULL, NULL, "xsd:long"); - case SOAP_TYPE_LONG64: - return soap_in_LONG64(soap, NULL, NULL, "xsd:long"); - case SOAP_TYPE_xsd__float: - return soap_in_xsd__float(soap, NULL, NULL, "xsd:float"); - case SOAP_TYPE_float: - return soap_in_float(soap, NULL, NULL, "xsd:float"); - case SOAP_TYPE_unsignedByte: - return soap_in_unsignedByte(soap, NULL, NULL, "xsd:unsignedByte"); - case SOAP_TYPE_unsignedInt: - return soap_in_unsignedInt(soap, NULL, NULL, "xsd:unsignedInt"); - case SOAP_TYPE_xsd__positiveInteger: - return soap_in_xsd__positiveInteger(soap, NULL, NULL, "xsd:positiveInteger"); - case SOAP_TYPE_unsignedLONG64: - return soap_in_unsignedLONG64(soap, NULL, NULL, "xsd:unsignedLong"); - case SOAP_TYPE_xsd__boolean: - return soap_in_xsd__boolean(soap, NULL, NULL, "xsd:boolean"); - case SOAP_TYPE_bool: - return soap_in_bool(soap, NULL, NULL, "xsd:boolean"); - case SOAP_TYPE_mss__MSS_USCORESignatureDummy: - return soap_in_mss__MSS_USCORESignatureDummy(soap, NULL, NULL, "mss:MSS_SignatureDummy"); - case SOAP_TYPE_mss_DummyResp: - return soap_in_mss_DummyResp(soap, NULL, NULL, "mss-DummyResp"); - case SOAP_TYPE_d__GetMobileCreateSignatureStatus: - return soap_in_d__GetMobileCreateSignatureStatus(soap, NULL, NULL, "d:GetMobileCreateSignatureStatus"); - case SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse: - return soap_in_d__GetMobileCreateSignatureStatusResponse(soap, NULL, NULL, "d:GetMobileCreateSignatureStatusResponse"); - case SOAP_TYPE_d__MobileCreateSignature: - return soap_in_d__MobileCreateSignature(soap, NULL, NULL, "d:MobileCreateSignature"); - case SOAP_TYPE_d__MobileCreateSignatureResponse: - return soap_in_d__MobileCreateSignatureResponse(soap, NULL, NULL, "d:MobileCreateSignatureResponse"); - case SOAP_TYPE_d__DataFileDigestList: - return soap_in_d__DataFileDigestList(soap, NULL, NULL, "d:DataFileDigestList"); - case SOAP_TYPE_d__DataFileDigest: - return soap_in_d__DataFileDigest(soap, NULL, NULL, "d:DataFileDigest"); - case SOAP_TYPE_d__GetMobileAuthenticateStatus: - return soap_in_d__GetMobileAuthenticateStatus(soap, NULL, NULL, "d:GetMobileAuthenticateStatus"); - case SOAP_TYPE_d__GetMobileAuthenticateStatusResponse: - return soap_in_d__GetMobileAuthenticateStatusResponse(soap, NULL, NULL, "d:GetMobileAuthenticateStatusResponse"); - case SOAP_TYPE_d__MobileAuthenticate: - return soap_in_d__MobileAuthenticate(soap, NULL, NULL, "d:MobileAuthenticate"); - case SOAP_TYPE_d__MobileAuthenticateResponse: - return soap_in_d__MobileAuthenticateResponse(soap, NULL, NULL, "d:MobileAuthenticateResponse"); - case SOAP_TYPE_d__GetStatusInfo: - return soap_in_d__GetStatusInfo(soap, NULL, NULL, "d:GetStatusInfo"); - case SOAP_TYPE_d__GetStatusInfoResponse: - return soap_in_d__GetStatusInfoResponse(soap, NULL, NULL, "d:GetStatusInfoResponse"); - case SOAP_TYPE_d__MobileSign: - return soap_in_d__MobileSign(soap, NULL, NULL, "d:MobileSign"); - case SOAP_TYPE_d__MobileSignResponse: - return soap_in_d__MobileSignResponse(soap, NULL, NULL, "d:MobileSignResponse"); - case SOAP_TYPE_d__GetVersion: - return soap_in_d__GetVersion(soap, NULL, NULL, "d:GetVersion"); - case SOAP_TYPE_d__GetVersionResponse: - return soap_in_d__GetVersionResponse(soap, NULL, NULL, "d:GetVersionResponse"); - case SOAP_TYPE_d__RemoveSignature: - return soap_in_d__RemoveSignature(soap, NULL, NULL, "d:RemoveSignature"); - case SOAP_TYPE_d__RemoveSignatureResponse: - return soap_in_d__RemoveSignatureResponse(soap, NULL, NULL, "d:RemoveSignatureResponse"); - case SOAP_TYPE_d__FinalizeSignature: - return soap_in_d__FinalizeSignature(soap, NULL, NULL, "d:FinalizeSignature"); - case SOAP_TYPE_d__FinalizeSignatureResponse: - return soap_in_d__FinalizeSignatureResponse(soap, NULL, NULL, "d:FinalizeSignatureResponse"); - case SOAP_TYPE_d__PrepareSignature: - return soap_in_d__PrepareSignature(soap, NULL, NULL, "d:PrepareSignature"); - case SOAP_TYPE_d__PrepareSignatureResponse: - return soap_in_d__PrepareSignatureResponse(soap, NULL, NULL, "d:PrepareSignatureResponse"); - case SOAP_TYPE_d__GetSignatureModules: - return soap_in_d__GetSignatureModules(soap, NULL, NULL, "d:GetSignatureModules"); - case SOAP_TYPE_d__GetSignatureModulesResponse: - return soap_in_d__GetSignatureModulesResponse(soap, NULL, NULL, "d:GetSignatureModulesResponse"); - case SOAP_TYPE_d__SignatureModulesArray: - return soap_in_d__SignatureModulesArray(soap, NULL, NULL, "d:SignatureModulesArray"); - case SOAP_TYPE_d__SignatureModule: - return soap_in_d__SignatureModule(soap, NULL, NULL, "d:SignatureModule"); - case SOAP_TYPE_d__GetCRL: - return soap_in_d__GetCRL(soap, NULL, NULL, "d:GetCRL"); - case SOAP_TYPE_d__GetCRLResponse: - return soap_in_d__GetCRLResponse(soap, NULL, NULL, "d:GetCRLResponse"); - case SOAP_TYPE_d__GetTimestamp: - return soap_in_d__GetTimestamp(soap, NULL, NULL, "d:GetTimestamp"); - case SOAP_TYPE_d__GetTimestampResponse: - return soap_in_d__GetTimestampResponse(soap, NULL, NULL, "d:GetTimestampResponse"); - case SOAP_TYPE_d__GetTSACertificate: - return soap_in_d__GetTSACertificate(soap, NULL, NULL, "d:GetTSACertificate"); - case SOAP_TYPE_d__GetTSACertificateResponse: - return soap_in_d__GetTSACertificateResponse(soap, NULL, NULL, "d:GetTSACertificateResponse"); - case SOAP_TYPE_d__GetNotary: - return soap_in_d__GetNotary(soap, NULL, NULL, "d:GetNotary"); - case SOAP_TYPE_d__GetNotaryResponse: - return soap_in_d__GetNotaryResponse(soap, NULL, NULL, "d:GetNotaryResponse"); - case SOAP_TYPE_d__GetNotarysCertificate: - return soap_in_d__GetNotarysCertificate(soap, NULL, NULL, "d:GetNotarysCertificate"); - case SOAP_TYPE_d__GetNotarysCertificateResponse: - return soap_in_d__GetNotarysCertificateResponse(soap, NULL, NULL, "d:GetNotarysCertificateResponse"); - case SOAP_TYPE_d__GetSignersCertificate: - return soap_in_d__GetSignersCertificate(soap, NULL, NULL, "d:GetSignersCertificate"); - case SOAP_TYPE_d__GetSignersCertificateResponse: - return soap_in_d__GetSignersCertificateResponse(soap, NULL, NULL, "d:GetSignersCertificateResponse"); - case SOAP_TYPE_d__GetDataFile: - return soap_in_d__GetDataFile(soap, NULL, NULL, "d:GetDataFile"); - case SOAP_TYPE_d__GetDataFileResponse: - return soap_in_d__GetDataFileResponse(soap, NULL, NULL, "d:GetDataFileResponse"); - case SOAP_TYPE_d__GetSignedDocInfo: - return soap_in_d__GetSignedDocInfo(soap, NULL, NULL, "d:GetSignedDocInfo"); - case SOAP_TYPE_d__GetSignedDocInfoResponse: - return soap_in_d__GetSignedDocInfoResponse(soap, NULL, NULL, "d:GetSignedDocInfoResponse"); - case SOAP_TYPE_d__GetSignedDoc: - return soap_in_d__GetSignedDoc(soap, NULL, NULL, "d:GetSignedDoc"); - case SOAP_TYPE_d__GetSignedDocResponse: - return soap_in_d__GetSignedDocResponse(soap, NULL, NULL, "d:GetSignedDocResponse"); - case SOAP_TYPE_d__RemoveDataFile: - return soap_in_d__RemoveDataFile(soap, NULL, NULL, "d:RemoveDataFile"); - case SOAP_TYPE_d__RemoveDataFileResponse: - return soap_in_d__RemoveDataFileResponse(soap, NULL, NULL, "d:RemoveDataFileResponse"); - case SOAP_TYPE_d__AddDataFile: - return soap_in_d__AddDataFile(soap, NULL, NULL, "d:AddDataFile"); - case SOAP_TYPE_d__AddDataFileResponse: - return soap_in_d__AddDataFileResponse(soap, NULL, NULL, "d:AddDataFileResponse"); - case SOAP_TYPE_d__CreateSignedDoc: - return soap_in_d__CreateSignedDoc(soap, NULL, NULL, "d:CreateSignedDoc"); - case SOAP_TYPE_d__CreateSignedDocResponse: - return soap_in_d__CreateSignedDocResponse(soap, NULL, NULL, "d:CreateSignedDocResponse"); - case SOAP_TYPE_d__CloseSession: - return soap_in_d__CloseSession(soap, NULL, NULL, "d:CloseSession"); - case SOAP_TYPE_d__CloseSessionResponse: - return soap_in_d__CloseSessionResponse(soap, NULL, NULL, "d:CloseSessionResponse"); - case SOAP_TYPE_d__StartSession: - return soap_in_d__StartSession(soap, NULL, NULL, "d:StartSession"); - case SOAP_TYPE_d__StartSessionResponse: - return soap_in_d__StartSessionResponse(soap, NULL, NULL, "d:StartSessionResponse"); - case SOAP_TYPE_d__DataFileData: - return soap_in_d__DataFileData(soap, NULL, NULL, "d:DataFileData"); - case SOAP_TYPE_d__SignedDocInfo: - return soap_in_d__SignedDocInfo(soap, NULL, NULL, "d:SignedDocInfo"); - case SOAP_TYPE_d__SignatureInfo: - return soap_in_d__SignatureInfo(soap, NULL, NULL, "d:SignatureInfo"); - case SOAP_TYPE_d__Error: - return soap_in_d__Error(soap, NULL, NULL, "d:Error"); - case SOAP_TYPE_d__CRLInfo: - return soap_in_d__CRLInfo(soap, NULL, NULL, "d:CRLInfo"); - case SOAP_TYPE_d__RevokedInfo: - return soap_in_d__RevokedInfo(soap, NULL, NULL, "d:RevokedInfo"); - case SOAP_TYPE_d__TstInfo: - return soap_in_d__TstInfo(soap, NULL, NULL, "d:TstInfo"); - case SOAP_TYPE_d__ConfirmationInfo: - return soap_in_d__ConfirmationInfo(soap, NULL, NULL, "d:ConfirmationInfo"); - case SOAP_TYPE_d__SignerInfo: - return soap_in_d__SignerInfo(soap, NULL, NULL, "d:SignerInfo"); - case SOAP_TYPE_d__CertificateInfo: - return soap_in_d__CertificateInfo(soap, NULL, NULL, "d:CertificateInfo"); - case SOAP_TYPE_d__CertificatePolicy: - return soap_in_d__CertificatePolicy(soap, NULL, NULL, "d:CertificatePolicy"); - case SOAP_TYPE_d__SignatureProductionPlace: - return soap_in_d__SignatureProductionPlace(soap, NULL, NULL, "d:SignatureProductionPlace"); - case SOAP_TYPE_d__SignerRole: - return soap_in_d__SignerRole(soap, NULL, NULL, "d:SignerRole"); - case SOAP_TYPE_d__DataFileInfo: - return soap_in_d__DataFileInfo(soap, NULL, NULL, "d:DataFileInfo"); - case SOAP_TYPE_d__DataFileAttribute: - return soap_in_d__DataFileAttribute(soap, NULL, NULL, "d:DataFileAttribute"); - case SOAP_TYPE_xsd__hexBinary: - return soap_in_xsd__hexBinary(soap, NULL, NULL, "xsd:hexBinary"); - case SOAP_TYPE_PointerTomss_DummyResp: - return soap_in_PointerTomss_DummyResp(soap, NULL, NULL, "mss-DummyResp"); - case SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse: - return soap_in_PointerTod__GetMobileCreateSignatureStatusResponse(soap, NULL, NULL, "d:GetMobileCreateSignatureStatusResponse"); - case SOAP_TYPE_PointerTod__MobileCreateSignatureResponse: - return soap_in_PointerTod__MobileCreateSignatureResponse(soap, NULL, NULL, "d:MobileCreateSignatureResponse"); - case SOAP_TYPE_PointerTod__DataFileDigestList: - return soap_in_PointerTod__DataFileDigestList(soap, NULL, NULL, "d:DataFileDigestList"); - case SOAP_TYPE_PointerTod__DataFileDigest: - return soap_in_PointerTod__DataFileDigest(soap, NULL, NULL, "d:DataFileDigest"); - case SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse: - return soap_in_PointerTod__GetMobileAuthenticateStatusResponse(soap, NULL, NULL, "d:GetMobileAuthenticateStatusResponse"); - case SOAP_TYPE_PointerTod__MobileAuthenticateResponse: - return soap_in_PointerTod__MobileAuthenticateResponse(soap, NULL, NULL, "d:MobileAuthenticateResponse"); - case SOAP_TYPE_PointerTod__GetStatusInfoResponse: - return soap_in_PointerTod__GetStatusInfoResponse(soap, NULL, NULL, "d:GetStatusInfoResponse"); - case SOAP_TYPE_PointerTod__MobileSignResponse: - return soap_in_PointerTod__MobileSignResponse(soap, NULL, NULL, "d:MobileSignResponse"); - case SOAP_TYPE_PointerTod__GetVersionResponse: - return soap_in_PointerTod__GetVersionResponse(soap, NULL, NULL, "d:GetVersionResponse"); - case SOAP_TYPE_PointerTod__RemoveSignatureResponse: - return soap_in_PointerTod__RemoveSignatureResponse(soap, NULL, NULL, "d:RemoveSignatureResponse"); - case SOAP_TYPE_PointerTod__FinalizeSignatureResponse: - return soap_in_PointerTod__FinalizeSignatureResponse(soap, NULL, NULL, "d:FinalizeSignatureResponse"); - case SOAP_TYPE_PointerTod__PrepareSignatureResponse: - return soap_in_PointerTod__PrepareSignatureResponse(soap, NULL, NULL, "d:PrepareSignatureResponse"); - case SOAP_TYPE_PointerTod__GetSignatureModulesResponse: - return soap_in_PointerTod__GetSignatureModulesResponse(soap, NULL, NULL, "d:GetSignatureModulesResponse"); - case SOAP_TYPE_PointerTod__SignatureModulesArray: - return soap_in_PointerTod__SignatureModulesArray(soap, NULL, NULL, "d:SignatureModulesArray"); - case SOAP_TYPE_PointerTod__SignatureModule: - return soap_in_PointerTod__SignatureModule(soap, NULL, NULL, "d:SignatureModule"); - case SOAP_TYPE_PointerTod__GetCRLResponse: - return soap_in_PointerTod__GetCRLResponse(soap, NULL, NULL, "d:GetCRLResponse"); - case SOAP_TYPE_PointerTod__GetTimestampResponse: - return soap_in_PointerTod__GetTimestampResponse(soap, NULL, NULL, "d:GetTimestampResponse"); - case SOAP_TYPE_PointerTod__GetTSACertificateResponse: - return soap_in_PointerTod__GetTSACertificateResponse(soap, NULL, NULL, "d:GetTSACertificateResponse"); - case SOAP_TYPE_PointerTod__GetNotaryResponse: - return soap_in_PointerTod__GetNotaryResponse(soap, NULL, NULL, "d:GetNotaryResponse"); - case SOAP_TYPE_PointerTod__GetNotarysCertificateResponse: - return soap_in_PointerTod__GetNotarysCertificateResponse(soap, NULL, NULL, "d:GetNotarysCertificateResponse"); - case SOAP_TYPE_PointerTod__GetSignersCertificateResponse: - return soap_in_PointerTod__GetSignersCertificateResponse(soap, NULL, NULL, "d:GetSignersCertificateResponse"); - case SOAP_TYPE_PointerTod__GetDataFileResponse: - return soap_in_PointerTod__GetDataFileResponse(soap, NULL, NULL, "d:GetDataFileResponse"); - case SOAP_TYPE_PointerTod__GetSignedDocInfoResponse: - return soap_in_PointerTod__GetSignedDocInfoResponse(soap, NULL, NULL, "d:GetSignedDocInfoResponse"); - case SOAP_TYPE_PointerTod__GetSignedDocResponse: - return soap_in_PointerTod__GetSignedDocResponse(soap, NULL, NULL, "d:GetSignedDocResponse"); - case SOAP_TYPE_PointerTod__RemoveDataFileResponse: - return soap_in_PointerTod__RemoveDataFileResponse(soap, NULL, NULL, "d:RemoveDataFileResponse"); - case SOAP_TYPE_PointerTod__AddDataFileResponse: - return soap_in_PointerTod__AddDataFileResponse(soap, NULL, NULL, "d:AddDataFileResponse"); - case SOAP_TYPE_PointerTod__CreateSignedDocResponse: - return soap_in_PointerTod__CreateSignedDocResponse(soap, NULL, NULL, "d:CreateSignedDocResponse"); - case SOAP_TYPE_PointerTod__CloseSessionResponse: - return soap_in_PointerTod__CloseSessionResponse(soap, NULL, NULL, "d:CloseSessionResponse"); - case SOAP_TYPE_PointerTod__StartSessionResponse: - return soap_in_PointerTod__StartSessionResponse(soap, NULL, NULL, "d:StartSessionResponse"); - case SOAP_TYPE_PointerTod__DataFileData: - return soap_in_PointerTod__DataFileData(soap, NULL, NULL, "d:DataFileData"); - case SOAP_TYPE_PointerTod__SignedDocInfo: - return soap_in_PointerTod__SignedDocInfo(soap, NULL, NULL, "d:SignedDocInfo"); - case SOAP_TYPE_PointerTod__SignatureInfo: - return soap_in_PointerTod__SignatureInfo(soap, NULL, NULL, "d:SignatureInfo"); - case SOAP_TYPE_PointerTod__DataFileInfo: - return soap_in_PointerTod__DataFileInfo(soap, NULL, NULL, "d:DataFileInfo"); - case SOAP_TYPE_PointerTod__CRLInfo: - return soap_in_PointerTod__CRLInfo(soap, NULL, NULL, "d:CRLInfo"); - case SOAP_TYPE_PointerTod__TstInfo: - return soap_in_PointerTod__TstInfo(soap, NULL, NULL, "d:TstInfo"); - case SOAP_TYPE_PointerTod__ConfirmationInfo: - return soap_in_PointerTod__ConfirmationInfo(soap, NULL, NULL, "d:ConfirmationInfo"); - case SOAP_TYPE_PointerTod__SignerInfo: - return soap_in_PointerTod__SignerInfo(soap, NULL, NULL, "d:SignerInfo"); - case SOAP_TYPE_PointerTod__SignatureProductionPlace: - return soap_in_PointerTod__SignatureProductionPlace(soap, NULL, NULL, "d:SignatureProductionPlace"); - case SOAP_TYPE_PointerTod__SignerRole: - return soap_in_PointerTod__SignerRole(soap, NULL, NULL, "d:SignerRole"); - case SOAP_TYPE_PointerTod__Error: - return soap_in_PointerTod__Error(soap, NULL, NULL, "d:Error"); - case SOAP_TYPE_PointerTod__RevokedInfo: - return soap_in_PointerTod__RevokedInfo(soap, NULL, NULL, "d:RevokedInfo"); - case SOAP_TYPE_PointerTod__CertificateInfo: - return soap_in_PointerTod__CertificateInfo(soap, NULL, NULL, "d:CertificateInfo"); - case SOAP_TYPE_PointerTod__CertificatePolicy: - return soap_in_PointerTod__CertificatePolicy(soap, NULL, NULL, "d:CertificatePolicy"); - case SOAP_TYPE_PointerTod__DataFileAttribute: - return soap_in_PointerTod__DataFileAttribute(soap, NULL, NULL, "d:DataFileAttribute"); - case SOAP_TYPE_PointerTounsignedByte: - return soap_in_PointerTounsignedByte(soap, NULL, NULL, "xsd:unsignedByte"); - case SOAP_TYPE_xsd__dateTime: - { char **s; - s = soap_in_xsd__dateTime(soap, NULL, NULL, "xsd:dateTime"); - return s ? *s : NULL; - } - case SOAP_TYPE_xsd__anyURI: - { char **s; - s = soap_in_xsd__anyURI(soap, NULL, NULL, "xsd:anyURI"); - return s ? *s : NULL; - } - case SOAP_TYPE_xsd__string: - { char **s; - s = soap_in_xsd__string(soap, NULL, NULL, "xsd:string"); - return s ? *s : NULL; - } - case SOAP_TYPE_string: - { char **s; - s = soap_in_string(soap, NULL, NULL, "xsd:string"); - return s ? *s : NULL; - } - default: - { const char *t = soap->type; - if (!*t) - t = soap->tag; - if (!soap_match_tag(soap, t, "xsd:byte")) - { *type = SOAP_TYPE_byte; - return soap_in_byte(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:int")) - { *type = SOAP_TYPE_int; - return soap_in_int(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:int")) - { *type = SOAP_TYPE_xsd__int; - return soap_in_xsd__int(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:long")) - { *type = SOAP_TYPE_long; - return soap_in_long(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:long")) - { *type = SOAP_TYPE_LONG64; - return soap_in_LONG64(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:float")) - { *type = SOAP_TYPE_xsd__float; - return soap_in_xsd__float(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:float")) - { *type = SOAP_TYPE_float; - return soap_in_float(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:unsignedByte")) - { *type = SOAP_TYPE_unsignedByte; - return soap_in_unsignedByte(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:unsignedInt")) - { *type = SOAP_TYPE_unsignedInt; - return soap_in_unsignedInt(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:positiveInteger")) - { *type = SOAP_TYPE_xsd__positiveInteger; - return soap_in_xsd__positiveInteger(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:unsignedLong")) - { *type = SOAP_TYPE_unsignedLONG64; - return soap_in_unsignedLONG64(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:boolean")) - { *type = SOAP_TYPE_xsd__boolean; - return soap_in_xsd__boolean(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:boolean")) - { *type = SOAP_TYPE_bool; - return soap_in_bool(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "mss:MSS_SignatureDummy")) - { *type = SOAP_TYPE_mss__MSS_USCORESignatureDummy; - return soap_in_mss__MSS_USCORESignatureDummy(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "mss-DummyResp")) - { *type = SOAP_TYPE_mss_DummyResp; - return soap_in_mss_DummyResp(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetMobileCreateSignatureStatus")) - { *type = SOAP_TYPE_d__GetMobileCreateSignatureStatus; - return soap_in_d__GetMobileCreateSignatureStatus(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetMobileCreateSignatureStatusResponse")) - { *type = SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse; - return soap_in_d__GetMobileCreateSignatureStatusResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileCreateSignature")) - { *type = SOAP_TYPE_d__MobileCreateSignature; - return soap_in_d__MobileCreateSignature(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileCreateSignatureResponse")) - { *type = SOAP_TYPE_d__MobileCreateSignatureResponse; - return soap_in_d__MobileCreateSignatureResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:DataFileDigestList")) - { *type = SOAP_TYPE_d__DataFileDigestList; - return soap_in_d__DataFileDigestList(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:DataFileDigest")) - { *type = SOAP_TYPE_d__DataFileDigest; - return soap_in_d__DataFileDigest(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetMobileAuthenticateStatus")) - { *type = SOAP_TYPE_d__GetMobileAuthenticateStatus; - return soap_in_d__GetMobileAuthenticateStatus(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetMobileAuthenticateStatusResponse")) - { *type = SOAP_TYPE_d__GetMobileAuthenticateStatusResponse; - return soap_in_d__GetMobileAuthenticateStatusResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileAuthenticate")) - { *type = SOAP_TYPE_d__MobileAuthenticate; - return soap_in_d__MobileAuthenticate(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileAuthenticateResponse")) - { *type = SOAP_TYPE_d__MobileAuthenticateResponse; - return soap_in_d__MobileAuthenticateResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetStatusInfo")) - { *type = SOAP_TYPE_d__GetStatusInfo; - return soap_in_d__GetStatusInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetStatusInfoResponse")) - { *type = SOAP_TYPE_d__GetStatusInfoResponse; - return soap_in_d__GetStatusInfoResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileSign")) - { *type = SOAP_TYPE_d__MobileSign; - return soap_in_d__MobileSign(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:MobileSignResponse")) - { *type = SOAP_TYPE_d__MobileSignResponse; - return soap_in_d__MobileSignResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetVersion")) - { *type = SOAP_TYPE_d__GetVersion; - return soap_in_d__GetVersion(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetVersionResponse")) - { *type = SOAP_TYPE_d__GetVersionResponse; - return soap_in_d__GetVersionResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:RemoveSignature")) - { *type = SOAP_TYPE_d__RemoveSignature; - return soap_in_d__RemoveSignature(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:RemoveSignatureResponse")) - { *type = SOAP_TYPE_d__RemoveSignatureResponse; - return soap_in_d__RemoveSignatureResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:FinalizeSignature")) - { *type = SOAP_TYPE_d__FinalizeSignature; - return soap_in_d__FinalizeSignature(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:FinalizeSignatureResponse")) - { *type = SOAP_TYPE_d__FinalizeSignatureResponse; - return soap_in_d__FinalizeSignatureResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:PrepareSignature")) - { *type = SOAP_TYPE_d__PrepareSignature; - return soap_in_d__PrepareSignature(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:PrepareSignatureResponse")) - { *type = SOAP_TYPE_d__PrepareSignatureResponse; - return soap_in_d__PrepareSignatureResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignatureModules")) - { *type = SOAP_TYPE_d__GetSignatureModules; - return soap_in_d__GetSignatureModules(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignatureModulesResponse")) - { *type = SOAP_TYPE_d__GetSignatureModulesResponse; - return soap_in_d__GetSignatureModulesResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignatureModulesArray")) - { *type = SOAP_TYPE_d__SignatureModulesArray; - return soap_in_d__SignatureModulesArray(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignatureModule")) - { *type = SOAP_TYPE_d__SignatureModule; - return soap_in_d__SignatureModule(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetCRL")) - { *type = SOAP_TYPE_d__GetCRL; - return soap_in_d__GetCRL(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetCRLResponse")) - { *type = SOAP_TYPE_d__GetCRLResponse; - return soap_in_d__GetCRLResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetTimestamp")) - { *type = SOAP_TYPE_d__GetTimestamp; - return soap_in_d__GetTimestamp(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetTimestampResponse")) - { *type = SOAP_TYPE_d__GetTimestampResponse; - return soap_in_d__GetTimestampResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetTSACertificate")) - { *type = SOAP_TYPE_d__GetTSACertificate; - return soap_in_d__GetTSACertificate(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetTSACertificateResponse")) - { *type = SOAP_TYPE_d__GetTSACertificateResponse; - return soap_in_d__GetTSACertificateResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetNotary")) - { *type = SOAP_TYPE_d__GetNotary; - return soap_in_d__GetNotary(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetNotaryResponse")) - { *type = SOAP_TYPE_d__GetNotaryResponse; - return soap_in_d__GetNotaryResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetNotarysCertificate")) - { *type = SOAP_TYPE_d__GetNotarysCertificate; - return soap_in_d__GetNotarysCertificate(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetNotarysCertificateResponse")) - { *type = SOAP_TYPE_d__GetNotarysCertificateResponse; - return soap_in_d__GetNotarysCertificateResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignersCertificate")) - { *type = SOAP_TYPE_d__GetSignersCertificate; - return soap_in_d__GetSignersCertificate(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignersCertificateResponse")) - { *type = SOAP_TYPE_d__GetSignersCertificateResponse; - return soap_in_d__GetSignersCertificateResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetDataFile")) - { *type = SOAP_TYPE_d__GetDataFile; - return soap_in_d__GetDataFile(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetDataFileResponse")) - { *type = SOAP_TYPE_d__GetDataFileResponse; - return soap_in_d__GetDataFileResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignedDocInfo")) - { *type = SOAP_TYPE_d__GetSignedDocInfo; - return soap_in_d__GetSignedDocInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignedDocInfoResponse")) - { *type = SOAP_TYPE_d__GetSignedDocInfoResponse; - return soap_in_d__GetSignedDocInfoResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignedDoc")) - { *type = SOAP_TYPE_d__GetSignedDoc; - return soap_in_d__GetSignedDoc(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:GetSignedDocResponse")) - { *type = SOAP_TYPE_d__GetSignedDocResponse; - return soap_in_d__GetSignedDocResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:RemoveDataFile")) - { *type = SOAP_TYPE_d__RemoveDataFile; - return soap_in_d__RemoveDataFile(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:RemoveDataFileResponse")) - { *type = SOAP_TYPE_d__RemoveDataFileResponse; - return soap_in_d__RemoveDataFileResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:AddDataFile")) - { *type = SOAP_TYPE_d__AddDataFile; - return soap_in_d__AddDataFile(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:AddDataFileResponse")) - { *type = SOAP_TYPE_d__AddDataFileResponse; - return soap_in_d__AddDataFileResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CreateSignedDoc")) - { *type = SOAP_TYPE_d__CreateSignedDoc; - return soap_in_d__CreateSignedDoc(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CreateSignedDocResponse")) - { *type = SOAP_TYPE_d__CreateSignedDocResponse; - return soap_in_d__CreateSignedDocResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CloseSession")) - { *type = SOAP_TYPE_d__CloseSession; - return soap_in_d__CloseSession(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CloseSessionResponse")) - { *type = SOAP_TYPE_d__CloseSessionResponse; - return soap_in_d__CloseSessionResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:StartSession")) - { *type = SOAP_TYPE_d__StartSession; - return soap_in_d__StartSession(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:StartSessionResponse")) - { *type = SOAP_TYPE_d__StartSessionResponse; - return soap_in_d__StartSessionResponse(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:DataFileData")) - { *type = SOAP_TYPE_d__DataFileData; - return soap_in_d__DataFileData(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignedDocInfo")) - { *type = SOAP_TYPE_d__SignedDocInfo; - return soap_in_d__SignedDocInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignatureInfo")) - { *type = SOAP_TYPE_d__SignatureInfo; - return soap_in_d__SignatureInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:Error")) - { *type = SOAP_TYPE_d__Error; - return soap_in_d__Error(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CRLInfo")) - { *type = SOAP_TYPE_d__CRLInfo; - return soap_in_d__CRLInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:RevokedInfo")) - { *type = SOAP_TYPE_d__RevokedInfo; - return soap_in_d__RevokedInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:TstInfo")) - { *type = SOAP_TYPE_d__TstInfo; - return soap_in_d__TstInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:ConfirmationInfo")) - { *type = SOAP_TYPE_d__ConfirmationInfo; - return soap_in_d__ConfirmationInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignerInfo")) - { *type = SOAP_TYPE_d__SignerInfo; - return soap_in_d__SignerInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CertificateInfo")) - { *type = SOAP_TYPE_d__CertificateInfo; - return soap_in_d__CertificateInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:CertificatePolicy")) - { *type = SOAP_TYPE_d__CertificatePolicy; - return soap_in_d__CertificatePolicy(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignatureProductionPlace")) - { *type = SOAP_TYPE_d__SignatureProductionPlace; - return soap_in_d__SignatureProductionPlace(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:SignerRole")) - { *type = SOAP_TYPE_d__SignerRole; - return soap_in_d__SignerRole(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:DataFileInfo")) - { *type = SOAP_TYPE_d__DataFileInfo; - return soap_in_d__DataFileInfo(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "d:DataFileAttribute")) - { *type = SOAP_TYPE_d__DataFileAttribute; - return soap_in_d__DataFileAttribute(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:hexBinary")) - { *type = SOAP_TYPE_xsd__hexBinary; - return soap_in_xsd__hexBinary(soap, NULL, NULL, NULL); - } - if (!soap_match_tag(soap, t, "xsd:dateTime")) - { char **s; - *type = SOAP_TYPE_xsd__dateTime; - s = soap_in_xsd__dateTime(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - if (!soap_match_tag(soap, t, "xsd:anyURI")) - { char **s; - *type = SOAP_TYPE_xsd__anyURI; - s = soap_in_xsd__anyURI(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - if (!soap_match_tag(soap, t, "xsd:string")) - { char **s; - *type = SOAP_TYPE_xsd__string; - s = soap_in_xsd__string(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - if (!soap_match_tag(soap, t, "xsd:string")) - { char **s; - *type = SOAP_TYPE_string; - s = soap_in_string(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - t = soap->tag; - if (!soap_match_tag(soap, t, "xsd:QName")) - { char **s; - *type = SOAP_TYPE__QName; - s = soap_in__QName(soap, NULL, NULL, NULL); - return s ? *s : NULL; - } - } - } - soap->error = SOAP_TAG_MISMATCH; - return NULL; -} -#endif - -SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap *soap) -{ - if (!soap_peek_element(soap)) - { int t; - if (soap->mustUnderstand && !soap->other) - return soap->error = SOAP_MUSTUNDERSTAND; - if (((soap->mode & SOAP_XML_STRICT) && soap->part != SOAP_IN_HEADER) || !soap_match_tag(soap, soap->tag, "SOAP-ENV:")) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "REJECTING element '%s'\n", soap->tag)); - return soap->error = SOAP_TAG_MISMATCH; - } - if (!*soap->id || !soap_getelement(soap, &t)) - { soap->peeked = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unknown element '%s' (level=%u, %d)\n", soap->tag, soap->level, soap->body)); - if (soap->fignore) - soap->error = soap->fignore(soap, soap->tag); - else - soap->error = SOAP_OK; - DBGLOG(TEST, if (!soap->error) SOAP_MESSAGE(fdebug, "IGNORING element '%s'\n", soap->tag)); - if (!soap->error && soap->body) - { soap->level++; - while (!soap_ignore_element(soap)) - ; - if (soap->error == SOAP_NO_TAG) - soap->error = soap_element_end_in(soap, NULL); - } - } - } - return soap->error; -} - -#ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap *soap) -{ - int i; - struct soap_plist *pp; - if (soap->version == 1 && soap->encodingStyle && !(soap->mode & (SOAP_XML_TREE | SOAP_XML_GRAPH))) - for (i = 0; i < SOAP_PTRHASH; i++) - for (pp = soap->pht[i]; pp; pp = pp->next) - if (pp->mark1 == 2 || pp->mark2 == 2) - if (soap_putelement(soap, pp->ptr, "id", pp->id, pp->type)) - return soap->error; - return SOAP_OK; -} -#endif - -#ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap *soap, const void *ptr, const char *tag, int id, int type) -{ - switch (type) - { - case SOAP_TYPE_byte: - return soap_out_byte(soap, tag, id, (const char *)ptr, "xsd:byte"); - case SOAP_TYPE_int: - return soap_out_int(soap, tag, id, (const int *)ptr, "xsd:int"); - case SOAP_TYPE_xsd__int: - return soap_out_xsd__int(soap, tag, id, (const long *)ptr, "xsd:int"); - case SOAP_TYPE_long: - return soap_out_long(soap, tag, id, (const long *)ptr, "xsd:long"); - case SOAP_TYPE_LONG64: - return soap_out_LONG64(soap, tag, id, (const LONG64 *)ptr, "xsd:long"); - case SOAP_TYPE_xsd__float: - return soap_out_xsd__float(soap, tag, id, (const float *)ptr, "xsd:float"); - case SOAP_TYPE_float: - return soap_out_float(soap, tag, id, (const float *)ptr, "xsd:float"); - case SOAP_TYPE_unsignedByte: - return soap_out_unsignedByte(soap, tag, id, (const unsigned char *)ptr, "xsd:unsignedByte"); - case SOAP_TYPE_unsignedInt: - return soap_out_unsignedInt(soap, tag, id, (const unsigned int *)ptr, "xsd:unsignedInt"); - case SOAP_TYPE_xsd__positiveInteger: - return soap_out_xsd__positiveInteger(soap, tag, id, (const ULONG64 *)ptr, "xsd:positiveInteger"); - case SOAP_TYPE_unsignedLONG64: - return soap_out_unsignedLONG64(soap, tag, id, (const ULONG64 *)ptr, "xsd:unsignedLong"); - case SOAP_TYPE_xsd__boolean: - return soap_out_xsd__boolean(soap, tag, id, (const bool *)ptr, "xsd:boolean"); - case SOAP_TYPE_bool: - return soap_out_bool(soap, tag, id, (const bool *)ptr, "xsd:boolean"); - case SOAP_TYPE_mss__MSS_USCORESignatureDummy: - return soap_out_mss__MSS_USCORESignatureDummy(soap, tag, id, (const struct mss__MSS_USCORESignatureDummy *)ptr, "mss:MSS_SignatureDummy"); - case SOAP_TYPE_mss_DummyResp: - return soap_out_mss_DummyResp(soap, tag, id, (const struct mss_DummyResp *)ptr, "mss-DummyResp"); - case SOAP_TYPE_d__GetMobileCreateSignatureStatus: - return soap_out_d__GetMobileCreateSignatureStatus(soap, tag, id, (const struct d__GetMobileCreateSignatureStatus *)ptr, "d:GetMobileCreateSignatureStatus"); - case SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse: - return soap_out_d__GetMobileCreateSignatureStatusResponse(soap, tag, id, (const struct d__GetMobileCreateSignatureStatusResponse *)ptr, "d:GetMobileCreateSignatureStatusResponse"); - case SOAP_TYPE_d__MobileCreateSignature: - return soap_out_d__MobileCreateSignature(soap, tag, id, (const struct d__MobileCreateSignature *)ptr, "d:MobileCreateSignature"); - case SOAP_TYPE_d__MobileCreateSignatureResponse: - return soap_out_d__MobileCreateSignatureResponse(soap, tag, id, (const struct d__MobileCreateSignatureResponse *)ptr, "d:MobileCreateSignatureResponse"); - case SOAP_TYPE_d__DataFileDigestList: - return soap_out_d__DataFileDigestList(soap, tag, id, (const struct d__DataFileDigestList *)ptr, "d:DataFileDigestList"); - case SOAP_TYPE_d__DataFileDigest: - return soap_out_d__DataFileDigest(soap, tag, id, (const struct d__DataFileDigest *)ptr, "d:DataFileDigest"); - case SOAP_TYPE_d__GetMobileAuthenticateStatus: - return soap_out_d__GetMobileAuthenticateStatus(soap, tag, id, (const struct d__GetMobileAuthenticateStatus *)ptr, "d:GetMobileAuthenticateStatus"); - case SOAP_TYPE_d__GetMobileAuthenticateStatusResponse: - return soap_out_d__GetMobileAuthenticateStatusResponse(soap, tag, id, (const struct d__GetMobileAuthenticateStatusResponse *)ptr, "d:GetMobileAuthenticateStatusResponse"); - case SOAP_TYPE_d__MobileAuthenticate: - return soap_out_d__MobileAuthenticate(soap, tag, id, (const struct d__MobileAuthenticate *)ptr, "d:MobileAuthenticate"); - case SOAP_TYPE_d__MobileAuthenticateResponse: - return soap_out_d__MobileAuthenticateResponse(soap, tag, id, (const struct d__MobileAuthenticateResponse *)ptr, "d:MobileAuthenticateResponse"); - case SOAP_TYPE_d__GetStatusInfo: - return soap_out_d__GetStatusInfo(soap, tag, id, (const struct d__GetStatusInfo *)ptr, "d:GetStatusInfo"); - case SOAP_TYPE_d__GetStatusInfoResponse: - return soap_out_d__GetStatusInfoResponse(soap, tag, id, (const struct d__GetStatusInfoResponse *)ptr, "d:GetStatusInfoResponse"); - case SOAP_TYPE_d__MobileSign: - return soap_out_d__MobileSign(soap, tag, id, (const struct d__MobileSign *)ptr, "d:MobileSign"); - case SOAP_TYPE_d__MobileSignResponse: - return soap_out_d__MobileSignResponse(soap, tag, id, (const struct d__MobileSignResponse *)ptr, "d:MobileSignResponse"); - case SOAP_TYPE_d__GetVersion: - return soap_out_d__GetVersion(soap, tag, id, (const struct d__GetVersion *)ptr, "d:GetVersion"); - case SOAP_TYPE_d__GetVersionResponse: - return soap_out_d__GetVersionResponse(soap, tag, id, (const struct d__GetVersionResponse *)ptr, "d:GetVersionResponse"); - case SOAP_TYPE_d__RemoveSignature: - return soap_out_d__RemoveSignature(soap, tag, id, (const struct d__RemoveSignature *)ptr, "d:RemoveSignature"); - case SOAP_TYPE_d__RemoveSignatureResponse: - return soap_out_d__RemoveSignatureResponse(soap, tag, id, (const struct d__RemoveSignatureResponse *)ptr, "d:RemoveSignatureResponse"); - case SOAP_TYPE_d__FinalizeSignature: - return soap_out_d__FinalizeSignature(soap, tag, id, (const struct d__FinalizeSignature *)ptr, "d:FinalizeSignature"); - case SOAP_TYPE_d__FinalizeSignatureResponse: - return soap_out_d__FinalizeSignatureResponse(soap, tag, id, (const struct d__FinalizeSignatureResponse *)ptr, "d:FinalizeSignatureResponse"); - case SOAP_TYPE_d__PrepareSignature: - return soap_out_d__PrepareSignature(soap, tag, id, (const struct d__PrepareSignature *)ptr, "d:PrepareSignature"); - case SOAP_TYPE_d__PrepareSignatureResponse: - return soap_out_d__PrepareSignatureResponse(soap, tag, id, (const struct d__PrepareSignatureResponse *)ptr, "d:PrepareSignatureResponse"); - case SOAP_TYPE_d__GetSignatureModules: - return soap_out_d__GetSignatureModules(soap, tag, id, (const struct d__GetSignatureModules *)ptr, "d:GetSignatureModules"); - case SOAP_TYPE_d__GetSignatureModulesResponse: - return soap_out_d__GetSignatureModulesResponse(soap, tag, id, (const struct d__GetSignatureModulesResponse *)ptr, "d:GetSignatureModulesResponse"); - case SOAP_TYPE_d__SignatureModulesArray: - return soap_out_d__SignatureModulesArray(soap, tag, id, (const struct d__SignatureModulesArray *)ptr, "d:SignatureModulesArray"); - case SOAP_TYPE_d__SignatureModule: - return soap_out_d__SignatureModule(soap, tag, id, (const struct d__SignatureModule *)ptr, "d:SignatureModule"); - case SOAP_TYPE_d__GetCRL: - return soap_out_d__GetCRL(soap, tag, id, (const struct d__GetCRL *)ptr, "d:GetCRL"); - case SOAP_TYPE_d__GetCRLResponse: - return soap_out_d__GetCRLResponse(soap, tag, id, (const struct d__GetCRLResponse *)ptr, "d:GetCRLResponse"); - case SOAP_TYPE_d__GetTimestamp: - return soap_out_d__GetTimestamp(soap, tag, id, (const struct d__GetTimestamp *)ptr, "d:GetTimestamp"); - case SOAP_TYPE_d__GetTimestampResponse: - return soap_out_d__GetTimestampResponse(soap, tag, id, (const struct d__GetTimestampResponse *)ptr, "d:GetTimestampResponse"); - case SOAP_TYPE_d__GetTSACertificate: - return soap_out_d__GetTSACertificate(soap, tag, id, (const struct d__GetTSACertificate *)ptr, "d:GetTSACertificate"); - case SOAP_TYPE_d__GetTSACertificateResponse: - return soap_out_d__GetTSACertificateResponse(soap, tag, id, (const struct d__GetTSACertificateResponse *)ptr, "d:GetTSACertificateResponse"); - case SOAP_TYPE_d__GetNotary: - return soap_out_d__GetNotary(soap, tag, id, (const struct d__GetNotary *)ptr, "d:GetNotary"); - case SOAP_TYPE_d__GetNotaryResponse: - return soap_out_d__GetNotaryResponse(soap, tag, id, (const struct d__GetNotaryResponse *)ptr, "d:GetNotaryResponse"); - case SOAP_TYPE_d__GetNotarysCertificate: - return soap_out_d__GetNotarysCertificate(soap, tag, id, (const struct d__GetNotarysCertificate *)ptr, "d:GetNotarysCertificate"); - case SOAP_TYPE_d__GetNotarysCertificateResponse: - return soap_out_d__GetNotarysCertificateResponse(soap, tag, id, (const struct d__GetNotarysCertificateResponse *)ptr, "d:GetNotarysCertificateResponse"); - case SOAP_TYPE_d__GetSignersCertificate: - return soap_out_d__GetSignersCertificate(soap, tag, id, (const struct d__GetSignersCertificate *)ptr, "d:GetSignersCertificate"); - case SOAP_TYPE_d__GetSignersCertificateResponse: - return soap_out_d__GetSignersCertificateResponse(soap, tag, id, (const struct d__GetSignersCertificateResponse *)ptr, "d:GetSignersCertificateResponse"); - case SOAP_TYPE_d__GetDataFile: - return soap_out_d__GetDataFile(soap, tag, id, (const struct d__GetDataFile *)ptr, "d:GetDataFile"); - case SOAP_TYPE_d__GetDataFileResponse: - return soap_out_d__GetDataFileResponse(soap, tag, id, (const struct d__GetDataFileResponse *)ptr, "d:GetDataFileResponse"); - case SOAP_TYPE_d__GetSignedDocInfo: - return soap_out_d__GetSignedDocInfo(soap, tag, id, (const struct d__GetSignedDocInfo *)ptr, "d:GetSignedDocInfo"); - case SOAP_TYPE_d__GetSignedDocInfoResponse: - return soap_out_d__GetSignedDocInfoResponse(soap, tag, id, (const struct d__GetSignedDocInfoResponse *)ptr, "d:GetSignedDocInfoResponse"); - case SOAP_TYPE_d__GetSignedDoc: - return soap_out_d__GetSignedDoc(soap, tag, id, (const struct d__GetSignedDoc *)ptr, "d:GetSignedDoc"); - case SOAP_TYPE_d__GetSignedDocResponse: - return soap_out_d__GetSignedDocResponse(soap, tag, id, (const struct d__GetSignedDocResponse *)ptr, "d:GetSignedDocResponse"); - case SOAP_TYPE_d__RemoveDataFile: - return soap_out_d__RemoveDataFile(soap, tag, id, (const struct d__RemoveDataFile *)ptr, "d:RemoveDataFile"); - case SOAP_TYPE_d__RemoveDataFileResponse: - return soap_out_d__RemoveDataFileResponse(soap, tag, id, (const struct d__RemoveDataFileResponse *)ptr, "d:RemoveDataFileResponse"); - case SOAP_TYPE_d__AddDataFile: - return soap_out_d__AddDataFile(soap, tag, id, (const struct d__AddDataFile *)ptr, "d:AddDataFile"); - case SOAP_TYPE_d__AddDataFileResponse: - return soap_out_d__AddDataFileResponse(soap, tag, id, (const struct d__AddDataFileResponse *)ptr, "d:AddDataFileResponse"); - case SOAP_TYPE_d__CreateSignedDoc: - return soap_out_d__CreateSignedDoc(soap, tag, id, (const struct d__CreateSignedDoc *)ptr, "d:CreateSignedDoc"); - case SOAP_TYPE_d__CreateSignedDocResponse: - return soap_out_d__CreateSignedDocResponse(soap, tag, id, (const struct d__CreateSignedDocResponse *)ptr, "d:CreateSignedDocResponse"); - case SOAP_TYPE_d__CloseSession: - return soap_out_d__CloseSession(soap, tag, id, (const struct d__CloseSession *)ptr, "d:CloseSession"); - case SOAP_TYPE_d__CloseSessionResponse: - return soap_out_d__CloseSessionResponse(soap, tag, id, (const struct d__CloseSessionResponse *)ptr, "d:CloseSessionResponse"); - case SOAP_TYPE_d__StartSession: - return soap_out_d__StartSession(soap, tag, id, (const struct d__StartSession *)ptr, "d:StartSession"); - case SOAP_TYPE_d__StartSessionResponse: - return soap_out_d__StartSessionResponse(soap, tag, id, (const struct d__StartSessionResponse *)ptr, "d:StartSessionResponse"); - case SOAP_TYPE_d__DataFileData: - return soap_out_d__DataFileData(soap, tag, id, (const struct d__DataFileData *)ptr, "d:DataFileData"); - case SOAP_TYPE_d__SignedDocInfo: - return soap_out_d__SignedDocInfo(soap, tag, id, (const struct d__SignedDocInfo *)ptr, "d:SignedDocInfo"); - case SOAP_TYPE_d__SignatureInfo: - return soap_out_d__SignatureInfo(soap, tag, id, (const struct d__SignatureInfo *)ptr, "d:SignatureInfo"); - case SOAP_TYPE_d__Error: - return soap_out_d__Error(soap, tag, id, (const struct d__Error *)ptr, "d:Error"); - case SOAP_TYPE_d__CRLInfo: - return soap_out_d__CRLInfo(soap, tag, id, (const struct d__CRLInfo *)ptr, "d:CRLInfo"); - case SOAP_TYPE_d__RevokedInfo: - return soap_out_d__RevokedInfo(soap, tag, id, (const struct d__RevokedInfo *)ptr, "d:RevokedInfo"); - case SOAP_TYPE_d__TstInfo: - return soap_out_d__TstInfo(soap, tag, id, (const struct d__TstInfo *)ptr, "d:TstInfo"); - case SOAP_TYPE_d__ConfirmationInfo: - return soap_out_d__ConfirmationInfo(soap, tag, id, (const struct d__ConfirmationInfo *)ptr, "d:ConfirmationInfo"); - case SOAP_TYPE_d__SignerInfo: - return soap_out_d__SignerInfo(soap, tag, id, (const struct d__SignerInfo *)ptr, "d:SignerInfo"); - case SOAP_TYPE_d__CertificateInfo: - return soap_out_d__CertificateInfo(soap, tag, id, (const struct d__CertificateInfo *)ptr, "d:CertificateInfo"); - case SOAP_TYPE_d__CertificatePolicy: - return soap_out_d__CertificatePolicy(soap, tag, id, (const struct d__CertificatePolicy *)ptr, "d:CertificatePolicy"); - case SOAP_TYPE_d__SignatureProductionPlace: - return soap_out_d__SignatureProductionPlace(soap, tag, id, (const struct d__SignatureProductionPlace *)ptr, "d:SignatureProductionPlace"); - case SOAP_TYPE_d__SignerRole: - return soap_out_d__SignerRole(soap, tag, id, (const struct d__SignerRole *)ptr, "d:SignerRole"); - case SOAP_TYPE_d__DataFileInfo: - return soap_out_d__DataFileInfo(soap, tag, id, (const struct d__DataFileInfo *)ptr, "d:DataFileInfo"); - case SOAP_TYPE_d__DataFileAttribute: - return soap_out_d__DataFileAttribute(soap, tag, id, (const struct d__DataFileAttribute *)ptr, "d:DataFileAttribute"); - case SOAP_TYPE_xsd__hexBinary: - return soap_out_xsd__hexBinary(soap, tag, id, (const struct xsd__hexBinary *)ptr, "xsd:hexBinary"); - case SOAP_TYPE_PointerTomss_DummyResp: - return soap_out_PointerTomss_DummyResp(soap, tag, id, (struct mss_DummyResp *const*)ptr, "mss-DummyResp"); - case SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse: - return soap_out_PointerTod__GetMobileCreateSignatureStatusResponse(soap, tag, id, (struct d__GetMobileCreateSignatureStatusResponse *const*)ptr, "d:GetMobileCreateSignatureStatusResponse"); - case SOAP_TYPE_PointerTod__MobileCreateSignatureResponse: - return soap_out_PointerTod__MobileCreateSignatureResponse(soap, tag, id, (struct d__MobileCreateSignatureResponse *const*)ptr, "d:MobileCreateSignatureResponse"); - case SOAP_TYPE_PointerTod__DataFileDigestList: - return soap_out_PointerTod__DataFileDigestList(soap, tag, id, (struct d__DataFileDigestList *const*)ptr, "d:DataFileDigestList"); - case SOAP_TYPE_PointerTod__DataFileDigest: - return soap_out_PointerTod__DataFileDigest(soap, tag, id, (struct d__DataFileDigest *const*)ptr, "d:DataFileDigest"); - case SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse: - return soap_out_PointerTod__GetMobileAuthenticateStatusResponse(soap, tag, id, (struct d__GetMobileAuthenticateStatusResponse *const*)ptr, "d:GetMobileAuthenticateStatusResponse"); - case SOAP_TYPE_PointerTod__MobileAuthenticateResponse: - return soap_out_PointerTod__MobileAuthenticateResponse(soap, tag, id, (struct d__MobileAuthenticateResponse *const*)ptr, "d:MobileAuthenticateResponse"); - case SOAP_TYPE_PointerTod__GetStatusInfoResponse: - return soap_out_PointerTod__GetStatusInfoResponse(soap, tag, id, (struct d__GetStatusInfoResponse *const*)ptr, "d:GetStatusInfoResponse"); - case SOAP_TYPE_PointerTod__MobileSignResponse: - return soap_out_PointerTod__MobileSignResponse(soap, tag, id, (struct d__MobileSignResponse *const*)ptr, "d:MobileSignResponse"); - case SOAP_TYPE_PointerTod__GetVersionResponse: - return soap_out_PointerTod__GetVersionResponse(soap, tag, id, (struct d__GetVersionResponse *const*)ptr, "d:GetVersionResponse"); - case SOAP_TYPE_PointerTod__RemoveSignatureResponse: - return soap_out_PointerTod__RemoveSignatureResponse(soap, tag, id, (struct d__RemoveSignatureResponse *const*)ptr, "d:RemoveSignatureResponse"); - case SOAP_TYPE_PointerTod__FinalizeSignatureResponse: - return soap_out_PointerTod__FinalizeSignatureResponse(soap, tag, id, (struct d__FinalizeSignatureResponse *const*)ptr, "d:FinalizeSignatureResponse"); - case SOAP_TYPE_PointerTod__PrepareSignatureResponse: - return soap_out_PointerTod__PrepareSignatureResponse(soap, tag, id, (struct d__PrepareSignatureResponse *const*)ptr, "d:PrepareSignatureResponse"); - case SOAP_TYPE_PointerTod__GetSignatureModulesResponse: - return soap_out_PointerTod__GetSignatureModulesResponse(soap, tag, id, (struct d__GetSignatureModulesResponse *const*)ptr, "d:GetSignatureModulesResponse"); - case SOAP_TYPE_PointerTod__SignatureModulesArray: - return soap_out_PointerTod__SignatureModulesArray(soap, tag, id, (struct d__SignatureModulesArray *const*)ptr, "d:SignatureModulesArray"); - case SOAP_TYPE_PointerTod__SignatureModule: - return soap_out_PointerTod__SignatureModule(soap, tag, id, (struct d__SignatureModule *const*)ptr, "d:SignatureModule"); - case SOAP_TYPE_PointerTod__GetCRLResponse: - return soap_out_PointerTod__GetCRLResponse(soap, tag, id, (struct d__GetCRLResponse *const*)ptr, "d:GetCRLResponse"); - case SOAP_TYPE_PointerTod__GetTimestampResponse: - return soap_out_PointerTod__GetTimestampResponse(soap, tag, id, (struct d__GetTimestampResponse *const*)ptr, "d:GetTimestampResponse"); - case SOAP_TYPE_PointerTod__GetTSACertificateResponse: - return soap_out_PointerTod__GetTSACertificateResponse(soap, tag, id, (struct d__GetTSACertificateResponse *const*)ptr, "d:GetTSACertificateResponse"); - case SOAP_TYPE_PointerTod__GetNotaryResponse: - return soap_out_PointerTod__GetNotaryResponse(soap, tag, id, (struct d__GetNotaryResponse *const*)ptr, "d:GetNotaryResponse"); - case SOAP_TYPE_PointerTod__GetNotarysCertificateResponse: - return soap_out_PointerTod__GetNotarysCertificateResponse(soap, tag, id, (struct d__GetNotarysCertificateResponse *const*)ptr, "d:GetNotarysCertificateResponse"); - case SOAP_TYPE_PointerTod__GetSignersCertificateResponse: - return soap_out_PointerTod__GetSignersCertificateResponse(soap, tag, id, (struct d__GetSignersCertificateResponse *const*)ptr, "d:GetSignersCertificateResponse"); - case SOAP_TYPE_PointerTod__GetDataFileResponse: - return soap_out_PointerTod__GetDataFileResponse(soap, tag, id, (struct d__GetDataFileResponse *const*)ptr, "d:GetDataFileResponse"); - case SOAP_TYPE_PointerTod__GetSignedDocInfoResponse: - return soap_out_PointerTod__GetSignedDocInfoResponse(soap, tag, id, (struct d__GetSignedDocInfoResponse *const*)ptr, "d:GetSignedDocInfoResponse"); - case SOAP_TYPE_PointerTod__GetSignedDocResponse: - return soap_out_PointerTod__GetSignedDocResponse(soap, tag, id, (struct d__GetSignedDocResponse *const*)ptr, "d:GetSignedDocResponse"); - case SOAP_TYPE_PointerTod__RemoveDataFileResponse: - return soap_out_PointerTod__RemoveDataFileResponse(soap, tag, id, (struct d__RemoveDataFileResponse *const*)ptr, "d:RemoveDataFileResponse"); - case SOAP_TYPE_PointerTod__AddDataFileResponse: - return soap_out_PointerTod__AddDataFileResponse(soap, tag, id, (struct d__AddDataFileResponse *const*)ptr, "d:AddDataFileResponse"); - case SOAP_TYPE_PointerTod__CreateSignedDocResponse: - return soap_out_PointerTod__CreateSignedDocResponse(soap, tag, id, (struct d__CreateSignedDocResponse *const*)ptr, "d:CreateSignedDocResponse"); - case SOAP_TYPE_PointerTod__CloseSessionResponse: - return soap_out_PointerTod__CloseSessionResponse(soap, tag, id, (struct d__CloseSessionResponse *const*)ptr, "d:CloseSessionResponse"); - case SOAP_TYPE_PointerTod__StartSessionResponse: - return soap_out_PointerTod__StartSessionResponse(soap, tag, id, (struct d__StartSessionResponse *const*)ptr, "d:StartSessionResponse"); - case SOAP_TYPE_PointerTod__DataFileData: - return soap_out_PointerTod__DataFileData(soap, tag, id, (struct d__DataFileData *const*)ptr, "d:DataFileData"); - case SOAP_TYPE_PointerTod__SignedDocInfo: - return soap_out_PointerTod__SignedDocInfo(soap, tag, id, (struct d__SignedDocInfo *const*)ptr, "d:SignedDocInfo"); - case SOAP_TYPE_PointerTod__SignatureInfo: - return soap_out_PointerTod__SignatureInfo(soap, tag, id, (struct d__SignatureInfo *const*)ptr, "d:SignatureInfo"); - case SOAP_TYPE_PointerTod__DataFileInfo: - return soap_out_PointerTod__DataFileInfo(soap, tag, id, (struct d__DataFileInfo *const*)ptr, "d:DataFileInfo"); - case SOAP_TYPE_PointerTod__CRLInfo: - return soap_out_PointerTod__CRLInfo(soap, tag, id, (struct d__CRLInfo *const*)ptr, "d:CRLInfo"); - case SOAP_TYPE_PointerTod__TstInfo: - return soap_out_PointerTod__TstInfo(soap, tag, id, (struct d__TstInfo *const*)ptr, "d:TstInfo"); - case SOAP_TYPE_PointerTod__ConfirmationInfo: - return soap_out_PointerTod__ConfirmationInfo(soap, tag, id, (struct d__ConfirmationInfo *const*)ptr, "d:ConfirmationInfo"); - case SOAP_TYPE_PointerTod__SignerInfo: - return soap_out_PointerTod__SignerInfo(soap, tag, id, (struct d__SignerInfo *const*)ptr, "d:SignerInfo"); - case SOAP_TYPE_PointerTod__SignatureProductionPlace: - return soap_out_PointerTod__SignatureProductionPlace(soap, tag, id, (struct d__SignatureProductionPlace *const*)ptr, "d:SignatureProductionPlace"); - case SOAP_TYPE_PointerTod__SignerRole: - return soap_out_PointerTod__SignerRole(soap, tag, id, (struct d__SignerRole *const*)ptr, "d:SignerRole"); - case SOAP_TYPE_PointerTod__Error: - return soap_out_PointerTod__Error(soap, tag, id, (struct d__Error *const*)ptr, "d:Error"); - case SOAP_TYPE_PointerTod__RevokedInfo: - return soap_out_PointerTod__RevokedInfo(soap, tag, id, (struct d__RevokedInfo *const*)ptr, "d:RevokedInfo"); - case SOAP_TYPE_PointerTod__CertificateInfo: - return soap_out_PointerTod__CertificateInfo(soap, tag, id, (struct d__CertificateInfo *const*)ptr, "d:CertificateInfo"); - case SOAP_TYPE_PointerTod__CertificatePolicy: - return soap_out_PointerTod__CertificatePolicy(soap, tag, id, (struct d__CertificatePolicy *const*)ptr, "d:CertificatePolicy"); - case SOAP_TYPE_PointerTod__DataFileAttribute: - return soap_out_PointerTod__DataFileAttribute(soap, tag, id, (struct d__DataFileAttribute *const*)ptr, "d:DataFileAttribute"); - case SOAP_TYPE_PointerTounsignedByte: - return soap_out_PointerTounsignedByte(soap, tag, id, (unsigned char *const*)ptr, "xsd:unsignedByte"); - case SOAP_TYPE_xsd__dateTime: - return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:dateTime"); - case SOAP_TYPE_xsd__anyURI: - return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:anyURI"); - case SOAP_TYPE_xsd__string: - return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:string"); - case SOAP_TYPE__QName: - return soap_out_string(soap, "xsd:QName", id, (char**)&ptr, NULL); - case SOAP_TYPE_string: - return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:string"); - } - return SOAP_OK; -} -#endif - -#ifndef WITH_NOIDREF -SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap *soap, const void *ptr, int type) -{ - (void)soap; (void)ptr; (void)type; /* appease -Wall -Werror */ - switch (type) - { - case SOAP_TYPE_mss__MSS_USCORESignatureDummy: - soap_serialize_mss__MSS_USCORESignatureDummy(soap, (const struct mss__MSS_USCORESignatureDummy *)ptr); - break; - case SOAP_TYPE_mss_DummyResp: - soap_serialize_mss_DummyResp(soap, (const struct mss_DummyResp *)ptr); - break; - case SOAP_TYPE_d__GetMobileCreateSignatureStatus: - soap_serialize_d__GetMobileCreateSignatureStatus(soap, (const struct d__GetMobileCreateSignatureStatus *)ptr); - break; - case SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse: - soap_serialize_d__GetMobileCreateSignatureStatusResponse(soap, (const struct d__GetMobileCreateSignatureStatusResponse *)ptr); - break; - case SOAP_TYPE_d__MobileCreateSignature: - soap_serialize_d__MobileCreateSignature(soap, (const struct d__MobileCreateSignature *)ptr); - break; - case SOAP_TYPE_d__MobileCreateSignatureResponse: - soap_serialize_d__MobileCreateSignatureResponse(soap, (const struct d__MobileCreateSignatureResponse *)ptr); - break; - case SOAP_TYPE_d__DataFileDigestList: - soap_serialize_d__DataFileDigestList(soap, (const struct d__DataFileDigestList *)ptr); - break; - case SOAP_TYPE_d__DataFileDigest: - soap_serialize_d__DataFileDigest(soap, (const struct d__DataFileDigest *)ptr); - break; - case SOAP_TYPE_d__GetMobileAuthenticateStatus: - soap_serialize_d__GetMobileAuthenticateStatus(soap, (const struct d__GetMobileAuthenticateStatus *)ptr); - break; - case SOAP_TYPE_d__GetMobileAuthenticateStatusResponse: - soap_serialize_d__GetMobileAuthenticateStatusResponse(soap, (const struct d__GetMobileAuthenticateStatusResponse *)ptr); - break; - case SOAP_TYPE_d__MobileAuthenticate: - soap_serialize_d__MobileAuthenticate(soap, (const struct d__MobileAuthenticate *)ptr); - break; - case SOAP_TYPE_d__MobileAuthenticateResponse: - soap_serialize_d__MobileAuthenticateResponse(soap, (const struct d__MobileAuthenticateResponse *)ptr); - break; - case SOAP_TYPE_d__GetStatusInfo: - soap_serialize_d__GetStatusInfo(soap, (const struct d__GetStatusInfo *)ptr); - break; - case SOAP_TYPE_d__GetStatusInfoResponse: - soap_serialize_d__GetStatusInfoResponse(soap, (const struct d__GetStatusInfoResponse *)ptr); - break; - case SOAP_TYPE_d__MobileSign: - soap_serialize_d__MobileSign(soap, (const struct d__MobileSign *)ptr); - break; - case SOAP_TYPE_d__MobileSignResponse: - soap_serialize_d__MobileSignResponse(soap, (const struct d__MobileSignResponse *)ptr); - break; - case SOAP_TYPE_d__GetVersion: - soap_serialize_d__GetVersion(soap, (const struct d__GetVersion *)ptr); - break; - case SOAP_TYPE_d__GetVersionResponse: - soap_serialize_d__GetVersionResponse(soap, (const struct d__GetVersionResponse *)ptr); - break; - case SOAP_TYPE_d__RemoveSignature: - soap_serialize_d__RemoveSignature(soap, (const struct d__RemoveSignature *)ptr); - break; - case SOAP_TYPE_d__RemoveSignatureResponse: - soap_serialize_d__RemoveSignatureResponse(soap, (const struct d__RemoveSignatureResponse *)ptr); - break; - case SOAP_TYPE_d__FinalizeSignature: - soap_serialize_d__FinalizeSignature(soap, (const struct d__FinalizeSignature *)ptr); - break; - case SOAP_TYPE_d__FinalizeSignatureResponse: - soap_serialize_d__FinalizeSignatureResponse(soap, (const struct d__FinalizeSignatureResponse *)ptr); - break; - case SOAP_TYPE_d__PrepareSignature: - soap_serialize_d__PrepareSignature(soap, (const struct d__PrepareSignature *)ptr); - break; - case SOAP_TYPE_d__PrepareSignatureResponse: - soap_serialize_d__PrepareSignatureResponse(soap, (const struct d__PrepareSignatureResponse *)ptr); - break; - case SOAP_TYPE_d__GetSignatureModules: - soap_serialize_d__GetSignatureModules(soap, (const struct d__GetSignatureModules *)ptr); - break; - case SOAP_TYPE_d__GetSignatureModulesResponse: - soap_serialize_d__GetSignatureModulesResponse(soap, (const struct d__GetSignatureModulesResponse *)ptr); - break; - case SOAP_TYPE_d__SignatureModulesArray: - soap_serialize_d__SignatureModulesArray(soap, (const struct d__SignatureModulesArray *)ptr); - break; - case SOAP_TYPE_d__SignatureModule: - soap_serialize_d__SignatureModule(soap, (const struct d__SignatureModule *)ptr); - break; - case SOAP_TYPE_d__GetCRL: - soap_serialize_d__GetCRL(soap, (const struct d__GetCRL *)ptr); - break; - case SOAP_TYPE_d__GetCRLResponse: - soap_serialize_d__GetCRLResponse(soap, (const struct d__GetCRLResponse *)ptr); - break; - case SOAP_TYPE_d__GetTimestamp: - soap_serialize_d__GetTimestamp(soap, (const struct d__GetTimestamp *)ptr); - break; - case SOAP_TYPE_d__GetTimestampResponse: - soap_serialize_d__GetTimestampResponse(soap, (const struct d__GetTimestampResponse *)ptr); - break; - case SOAP_TYPE_d__GetTSACertificate: - soap_serialize_d__GetTSACertificate(soap, (const struct d__GetTSACertificate *)ptr); - break; - case SOAP_TYPE_d__GetTSACertificateResponse: - soap_serialize_d__GetTSACertificateResponse(soap, (const struct d__GetTSACertificateResponse *)ptr); - break; - case SOAP_TYPE_d__GetNotary: - soap_serialize_d__GetNotary(soap, (const struct d__GetNotary *)ptr); - break; - case SOAP_TYPE_d__GetNotaryResponse: - soap_serialize_d__GetNotaryResponse(soap, (const struct d__GetNotaryResponse *)ptr); - break; - case SOAP_TYPE_d__GetNotarysCertificate: - soap_serialize_d__GetNotarysCertificate(soap, (const struct d__GetNotarysCertificate *)ptr); - break; - case SOAP_TYPE_d__GetNotarysCertificateResponse: - soap_serialize_d__GetNotarysCertificateResponse(soap, (const struct d__GetNotarysCertificateResponse *)ptr); - break; - case SOAP_TYPE_d__GetSignersCertificate: - soap_serialize_d__GetSignersCertificate(soap, (const struct d__GetSignersCertificate *)ptr); - break; - case SOAP_TYPE_d__GetSignersCertificateResponse: - soap_serialize_d__GetSignersCertificateResponse(soap, (const struct d__GetSignersCertificateResponse *)ptr); - break; - case SOAP_TYPE_d__GetDataFile: - soap_serialize_d__GetDataFile(soap, (const struct d__GetDataFile *)ptr); - break; - case SOAP_TYPE_d__GetDataFileResponse: - soap_serialize_d__GetDataFileResponse(soap, (const struct d__GetDataFileResponse *)ptr); - break; - case SOAP_TYPE_d__GetSignedDocInfo: - soap_serialize_d__GetSignedDocInfo(soap, (const struct d__GetSignedDocInfo *)ptr); - break; - case SOAP_TYPE_d__GetSignedDocInfoResponse: - soap_serialize_d__GetSignedDocInfoResponse(soap, (const struct d__GetSignedDocInfoResponse *)ptr); - break; - case SOAP_TYPE_d__GetSignedDoc: - soap_serialize_d__GetSignedDoc(soap, (const struct d__GetSignedDoc *)ptr); - break; - case SOAP_TYPE_d__GetSignedDocResponse: - soap_serialize_d__GetSignedDocResponse(soap, (const struct d__GetSignedDocResponse *)ptr); - break; - case SOAP_TYPE_d__RemoveDataFile: - soap_serialize_d__RemoveDataFile(soap, (const struct d__RemoveDataFile *)ptr); - break; - case SOAP_TYPE_d__RemoveDataFileResponse: - soap_serialize_d__RemoveDataFileResponse(soap, (const struct d__RemoveDataFileResponse *)ptr); - break; - case SOAP_TYPE_d__AddDataFile: - soap_serialize_d__AddDataFile(soap, (const struct d__AddDataFile *)ptr); - break; - case SOAP_TYPE_d__AddDataFileResponse: - soap_serialize_d__AddDataFileResponse(soap, (const struct d__AddDataFileResponse *)ptr); - break; - case SOAP_TYPE_d__CreateSignedDoc: - soap_serialize_d__CreateSignedDoc(soap, (const struct d__CreateSignedDoc *)ptr); - break; - case SOAP_TYPE_d__CreateSignedDocResponse: - soap_serialize_d__CreateSignedDocResponse(soap, (const struct d__CreateSignedDocResponse *)ptr); - break; - case SOAP_TYPE_d__CloseSession: - soap_serialize_d__CloseSession(soap, (const struct d__CloseSession *)ptr); - break; - case SOAP_TYPE_d__CloseSessionResponse: - soap_serialize_d__CloseSessionResponse(soap, (const struct d__CloseSessionResponse *)ptr); - break; - case SOAP_TYPE_d__StartSession: - soap_serialize_d__StartSession(soap, (const struct d__StartSession *)ptr); - break; - case SOAP_TYPE_d__StartSessionResponse: - soap_serialize_d__StartSessionResponse(soap, (const struct d__StartSessionResponse *)ptr); - break; - case SOAP_TYPE_d__DataFileData: - soap_serialize_d__DataFileData(soap, (const struct d__DataFileData *)ptr); - break; - case SOAP_TYPE_d__SignedDocInfo: - soap_serialize_d__SignedDocInfo(soap, (const struct d__SignedDocInfo *)ptr); - break; - case SOAP_TYPE_d__SignatureInfo: - soap_serialize_d__SignatureInfo(soap, (const struct d__SignatureInfo *)ptr); - break; - case SOAP_TYPE_d__Error: - soap_serialize_d__Error(soap, (const struct d__Error *)ptr); - break; - case SOAP_TYPE_d__CRLInfo: - soap_serialize_d__CRLInfo(soap, (const struct d__CRLInfo *)ptr); - break; - case SOAP_TYPE_d__RevokedInfo: - soap_serialize_d__RevokedInfo(soap, (const struct d__RevokedInfo *)ptr); - break; - case SOAP_TYPE_d__TstInfo: - soap_serialize_d__TstInfo(soap, (const struct d__TstInfo *)ptr); - break; - case SOAP_TYPE_d__ConfirmationInfo: - soap_serialize_d__ConfirmationInfo(soap, (const struct d__ConfirmationInfo *)ptr); - break; - case SOAP_TYPE_d__SignerInfo: - soap_serialize_d__SignerInfo(soap, (const struct d__SignerInfo *)ptr); - break; - case SOAP_TYPE_d__CertificateInfo: - soap_serialize_d__CertificateInfo(soap, (const struct d__CertificateInfo *)ptr); - break; - case SOAP_TYPE_d__CertificatePolicy: - soap_serialize_d__CertificatePolicy(soap, (const struct d__CertificatePolicy *)ptr); - break; - case SOAP_TYPE_d__SignatureProductionPlace: - soap_serialize_d__SignatureProductionPlace(soap, (const struct d__SignatureProductionPlace *)ptr); - break; - case SOAP_TYPE_d__SignerRole: - soap_serialize_d__SignerRole(soap, (const struct d__SignerRole *)ptr); - break; - case SOAP_TYPE_d__DataFileInfo: - soap_serialize_d__DataFileInfo(soap, (const struct d__DataFileInfo *)ptr); - break; - case SOAP_TYPE_d__DataFileAttribute: - soap_serialize_d__DataFileAttribute(soap, (const struct d__DataFileAttribute *)ptr); - break; - case SOAP_TYPE_xsd__hexBinary: - soap_serialize_xsd__hexBinary(soap, (const struct xsd__hexBinary *)ptr); - break; - case SOAP_TYPE_PointerTomss_DummyResp: - soap_serialize_PointerTomss_DummyResp(soap, (struct mss_DummyResp *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse: - soap_serialize_PointerTod__GetMobileCreateSignatureStatusResponse(soap, (struct d__GetMobileCreateSignatureStatusResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__MobileCreateSignatureResponse: - soap_serialize_PointerTod__MobileCreateSignatureResponse(soap, (struct d__MobileCreateSignatureResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__DataFileDigestList: - soap_serialize_PointerTod__DataFileDigestList(soap, (struct d__DataFileDigestList *const*)ptr); - break; - case SOAP_TYPE_PointerTod__DataFileDigest: - soap_serialize_PointerTod__DataFileDigest(soap, (struct d__DataFileDigest *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse: - soap_serialize_PointerTod__GetMobileAuthenticateStatusResponse(soap, (struct d__GetMobileAuthenticateStatusResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__MobileAuthenticateResponse: - soap_serialize_PointerTod__MobileAuthenticateResponse(soap, (struct d__MobileAuthenticateResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetStatusInfoResponse: - soap_serialize_PointerTod__GetStatusInfoResponse(soap, (struct d__GetStatusInfoResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__MobileSignResponse: - soap_serialize_PointerTod__MobileSignResponse(soap, (struct d__MobileSignResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetVersionResponse: - soap_serialize_PointerTod__GetVersionResponse(soap, (struct d__GetVersionResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__RemoveSignatureResponse: - soap_serialize_PointerTod__RemoveSignatureResponse(soap, (struct d__RemoveSignatureResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__FinalizeSignatureResponse: - soap_serialize_PointerTod__FinalizeSignatureResponse(soap, (struct d__FinalizeSignatureResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__PrepareSignatureResponse: - soap_serialize_PointerTod__PrepareSignatureResponse(soap, (struct d__PrepareSignatureResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetSignatureModulesResponse: - soap_serialize_PointerTod__GetSignatureModulesResponse(soap, (struct d__GetSignatureModulesResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignatureModulesArray: - soap_serialize_PointerTod__SignatureModulesArray(soap, (struct d__SignatureModulesArray *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignatureModule: - soap_serialize_PointerTod__SignatureModule(soap, (struct d__SignatureModule *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetCRLResponse: - soap_serialize_PointerTod__GetCRLResponse(soap, (struct d__GetCRLResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetTimestampResponse: - soap_serialize_PointerTod__GetTimestampResponse(soap, (struct d__GetTimestampResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetTSACertificateResponse: - soap_serialize_PointerTod__GetTSACertificateResponse(soap, (struct d__GetTSACertificateResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetNotaryResponse: - soap_serialize_PointerTod__GetNotaryResponse(soap, (struct d__GetNotaryResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetNotarysCertificateResponse: - soap_serialize_PointerTod__GetNotarysCertificateResponse(soap, (struct d__GetNotarysCertificateResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetSignersCertificateResponse: - soap_serialize_PointerTod__GetSignersCertificateResponse(soap, (struct d__GetSignersCertificateResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetDataFileResponse: - soap_serialize_PointerTod__GetDataFileResponse(soap, (struct d__GetDataFileResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetSignedDocInfoResponse: - soap_serialize_PointerTod__GetSignedDocInfoResponse(soap, (struct d__GetSignedDocInfoResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__GetSignedDocResponse: - soap_serialize_PointerTod__GetSignedDocResponse(soap, (struct d__GetSignedDocResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__RemoveDataFileResponse: - soap_serialize_PointerTod__RemoveDataFileResponse(soap, (struct d__RemoveDataFileResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__AddDataFileResponse: - soap_serialize_PointerTod__AddDataFileResponse(soap, (struct d__AddDataFileResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__CreateSignedDocResponse: - soap_serialize_PointerTod__CreateSignedDocResponse(soap, (struct d__CreateSignedDocResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__CloseSessionResponse: - soap_serialize_PointerTod__CloseSessionResponse(soap, (struct d__CloseSessionResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__StartSessionResponse: - soap_serialize_PointerTod__StartSessionResponse(soap, (struct d__StartSessionResponse *const*)ptr); - break; - case SOAP_TYPE_PointerTod__DataFileData: - soap_serialize_PointerTod__DataFileData(soap, (struct d__DataFileData *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignedDocInfo: - soap_serialize_PointerTod__SignedDocInfo(soap, (struct d__SignedDocInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignatureInfo: - soap_serialize_PointerTod__SignatureInfo(soap, (struct d__SignatureInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__DataFileInfo: - soap_serialize_PointerTod__DataFileInfo(soap, (struct d__DataFileInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__CRLInfo: - soap_serialize_PointerTod__CRLInfo(soap, (struct d__CRLInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__TstInfo: - soap_serialize_PointerTod__TstInfo(soap, (struct d__TstInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__ConfirmationInfo: - soap_serialize_PointerTod__ConfirmationInfo(soap, (struct d__ConfirmationInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignerInfo: - soap_serialize_PointerTod__SignerInfo(soap, (struct d__SignerInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignatureProductionPlace: - soap_serialize_PointerTod__SignatureProductionPlace(soap, (struct d__SignatureProductionPlace *const*)ptr); - break; - case SOAP_TYPE_PointerTod__SignerRole: - soap_serialize_PointerTod__SignerRole(soap, (struct d__SignerRole *const*)ptr); - break; - case SOAP_TYPE_PointerTod__Error: - soap_serialize_PointerTod__Error(soap, (struct d__Error *const*)ptr); - break; - case SOAP_TYPE_PointerTod__RevokedInfo: - soap_serialize_PointerTod__RevokedInfo(soap, (struct d__RevokedInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__CertificateInfo: - soap_serialize_PointerTod__CertificateInfo(soap, (struct d__CertificateInfo *const*)ptr); - break; - case SOAP_TYPE_PointerTod__CertificatePolicy: - soap_serialize_PointerTod__CertificatePolicy(soap, (struct d__CertificatePolicy *const*)ptr); - break; - case SOAP_TYPE_PointerTod__DataFileAttribute: - soap_serialize_PointerTod__DataFileAttribute(soap, (struct d__DataFileAttribute *const*)ptr); - break; - case SOAP_TYPE_PointerTounsignedByte: - soap_serialize_PointerTounsignedByte(soap, (unsigned char *const*)ptr); - break; - case SOAP_TYPE_xsd__dateTime: - soap_serialize_string(soap, (char**)&ptr); - break; - case SOAP_TYPE_xsd__anyURI: - soap_serialize_string(soap, (char**)&ptr); - break; - case SOAP_TYPE_xsd__string: - soap_serialize_string(soap, (char**)&ptr); - break; - case SOAP_TYPE__QName: - soap_serialize_string(soap, (char**)&ptr); - break; - case SOAP_TYPE_string: - soap_serialize_string(soap, (char**)&ptr); - break; - } -} -#endif - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap *soap, char *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_byte - *a = SOAP_DEFAULT_byte; -#else - *a = (char)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap *soap, const char *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_byte); - if (soap_out_byte(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap *soap, const char *tag, int id, const char *a, const char *type) -{ - return soap_outbyte(soap, tag, id, a, type, SOAP_TYPE_byte); -} - -SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap *soap, char *p, const char *tag, const char *type) -{ - if ((p = soap_in_byte(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap *soap, const char *tag, char *a, const char *type) -{ - return soap_inbyte(soap, tag, a, type, SOAP_TYPE_byte); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap *soap, int *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_int - *a = SOAP_DEFAULT_int; -#else - *a = (int)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap *soap, const int *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_int); - if (soap_out_int(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap *soap, const char *tag, int id, const int *a, const char *type) -{ - return soap_outint(soap, tag, id, a, type, SOAP_TYPE_int); -} - -SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap *soap, int *p, const char *tag, const char *type) -{ - if ((p = soap_in_int(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap *soap, const char *tag, int *a, const char *type) -{ - return soap_inint(soap, tag, a, type, SOAP_TYPE_int); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__int(struct soap *soap, long *a) -{ soap_default_long(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__int(struct soap *soap, const long *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__int); - if (soap_out_xsd__int(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__int(struct soap *soap, const char *tag, int id, const long *a, const char *type) -{ - return soap_outlong(soap, tag, id, a, type, SOAP_TYPE_xsd__int); -} - -SOAP_FMAC3 long * SOAP_FMAC4 soap_get_xsd__int(struct soap *soap, long *p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__int(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 long * SOAP_FMAC4 soap_in_xsd__int(struct soap *soap, const char *tag, long *a, const char *type) -{ - return soap_inlong(soap, tag, a, type, SOAP_TYPE_xsd__int); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_long(struct soap *soap, long *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_long - *a = SOAP_DEFAULT_long; -#else - *a = (long)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_long(struct soap *soap, const long *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_long); - if (soap_out_long(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_long(struct soap *soap, const char *tag, int id, const long *a, const char *type) -{ - return soap_outlong(soap, tag, id, a, type, SOAP_TYPE_long); -} - -SOAP_FMAC3 long * SOAP_FMAC4 soap_get_long(struct soap *soap, long *p, const char *tag, const char *type) -{ - if ((p = soap_in_long(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 long * SOAP_FMAC4 soap_in_long(struct soap *soap, const char *tag, long *a, const char *type) -{ - return soap_inlong(soap, tag, a, type, SOAP_TYPE_long); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_LONG64(struct soap *soap, LONG64 *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_LONG64 - *a = SOAP_DEFAULT_LONG64; -#else - *a = (LONG64)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_LONG64(struct soap *soap, const LONG64 *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_LONG64); - if (soap_out_LONG64(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_LONG64(struct soap *soap, const char *tag, int id, const LONG64 *a, const char *type) -{ - return soap_outLONG64(soap, tag, id, a, type, SOAP_TYPE_LONG64); -} - -SOAP_FMAC3 LONG64 * SOAP_FMAC4 soap_get_LONG64(struct soap *soap, LONG64 *p, const char *tag, const char *type) -{ - if ((p = soap_in_LONG64(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 LONG64 * SOAP_FMAC4 soap_in_LONG64(struct soap *soap, const char *tag, LONG64 *a, const char *type) -{ - return soap_inLONG64(soap, tag, a, type, SOAP_TYPE_LONG64); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__float(struct soap *soap, float *a) -{ soap_default_float(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__float(struct soap *soap, const float *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__float); - if (soap_out_xsd__float(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__float(struct soap *soap, const char *tag, int id, const float *a, const char *type) -{ - return soap_outfloat(soap, tag, id, a, type, SOAP_TYPE_xsd__float); -} - -SOAP_FMAC3 float * SOAP_FMAC4 soap_get_xsd__float(struct soap *soap, float *p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__float(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 float * SOAP_FMAC4 soap_in_xsd__float(struct soap *soap, const char *tag, float *a, const char *type) -{ - return soap_infloat(soap, tag, a, type, SOAP_TYPE_xsd__float); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_float(struct soap *soap, float *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_float - *a = SOAP_DEFAULT_float; -#else - *a = (float)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_float(struct soap *soap, const float *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_float); - if (soap_out_float(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_float(struct soap *soap, const char *tag, int id, const float *a, const char *type) -{ - return soap_outfloat(soap, tag, id, a, type, SOAP_TYPE_float); -} - -SOAP_FMAC3 float * SOAP_FMAC4 soap_get_float(struct soap *soap, float *p, const char *tag, const char *type) -{ - if ((p = soap_in_float(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 float * SOAP_FMAC4 soap_in_float(struct soap *soap, const char *tag, float *a, const char *type) -{ - return soap_infloat(soap, tag, a, type, SOAP_TYPE_float); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedByte(struct soap *soap, unsigned char *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_unsignedByte - *a = SOAP_DEFAULT_unsignedByte; -#else - *a = (unsigned char)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedByte(struct soap *soap, const unsigned char *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_unsignedByte); - if (soap_out_unsignedByte(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedByte(struct soap *soap, const char *tag, int id, const unsigned char *a, const char *type) -{ - return soap_outunsignedByte(soap, tag, id, a, type, SOAP_TYPE_unsignedByte); -} - -SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_get_unsignedByte(struct soap *soap, unsigned char *p, const char *tag, const char *type) -{ - if ((p = soap_in_unsignedByte(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_in_unsignedByte(struct soap *soap, const char *tag, unsigned char *a, const char *type) -{ - return soap_inunsignedByte(soap, tag, a, type, SOAP_TYPE_unsignedByte); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedInt(struct soap *soap, unsigned int *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_unsignedInt - *a = SOAP_DEFAULT_unsignedInt; -#else - *a = (unsigned int)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedInt(struct soap *soap, const unsigned int *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_unsignedInt); - if (soap_out_unsignedInt(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedInt(struct soap *soap, const char *tag, int id, const unsigned int *a, const char *type) -{ - return soap_outunsignedInt(soap, tag, id, a, type, SOAP_TYPE_unsignedInt); -} - -SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_get_unsignedInt(struct soap *soap, unsigned int *p, const char *tag, const char *type) -{ - if ((p = soap_in_unsignedInt(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_in_unsignedInt(struct soap *soap, const char *tag, unsigned int *a, const char *type) -{ - return soap_inunsignedInt(soap, tag, a, type, SOAP_TYPE_unsignedInt); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__positiveInteger(struct soap *soap, ULONG64 *a) -{ soap_default_unsignedLONG64(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__positiveInteger(struct soap *soap, const ULONG64 *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__positiveInteger); - if (soap_out_xsd__positiveInteger(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__positiveInteger(struct soap *soap, const char *tag, int id, const ULONG64 *a, const char *type) -{ - return soap_outULONG64(soap, tag, id, a, type, SOAP_TYPE_xsd__positiveInteger); -} - -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_get_xsd__positiveInteger(struct soap *soap, ULONG64 *p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__positiveInteger(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_in_xsd__positiveInteger(struct soap *soap, const char *tag, ULONG64 *a, const char *type) -{ - return soap_inULONG64(soap, tag, a, type, SOAP_TYPE_xsd__positiveInteger); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedLONG64(struct soap *soap, ULONG64 *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_unsignedLONG64 - *a = SOAP_DEFAULT_unsignedLONG64; -#else - *a = (ULONG64)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedLONG64(struct soap *soap, const ULONG64 *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_unsignedLONG64); - if (soap_out_unsignedLONG64(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedLONG64(struct soap *soap, const char *tag, int id, const ULONG64 *a, const char *type) -{ - return soap_outULONG64(soap, tag, id, a, type, SOAP_TYPE_unsignedLONG64); -} - -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_get_unsignedLONG64(struct soap *soap, ULONG64 *p, const char *tag, const char *type) -{ - if ((p = soap_in_unsignedLONG64(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_in_unsignedLONG64(struct soap *soap, const char *tag, ULONG64 *a, const char *type) -{ - return soap_inULONG64(soap, tag, a, type, SOAP_TYPE_unsignedLONG64); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__boolean(struct soap *soap, bool *a) -{ soap_default_bool(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__boolean(struct soap *soap, const bool *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__boolean); - if (soap_out_xsd__boolean(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3S const char* SOAP_FMAC4S soap_xsd__boolean2s(struct soap *soap, bool n) -{ return soap_bool2s(soap, n); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__boolean(struct soap *soap, const char *tag, int id, const bool *a, const char *type) -{ soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_xsd__boolean), type); - soap_send(soap, soap_xsd__boolean2s(soap, *a)); - return soap_element_end_out(soap, tag); -} - -SOAP_FMAC3 bool * SOAP_FMAC4 soap_get_xsd__boolean(struct soap *soap, bool *p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__boolean(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3S int SOAP_FMAC4S soap_s2xsd__boolean(struct soap *soap, const char *s, bool *a) -{ - return soap_s2bool(soap, s, a); -} - -SOAP_FMAC3 bool * SOAP_FMAC4 soap_in_xsd__boolean(struct soap *soap, const char *tag, bool *a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 0, NULL)) - return NULL; - if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":boolean")) - { soap->error = SOAP_TYPE; - return NULL; - } - a = (bool *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__boolean, sizeof(bool), 0, NULL, NULL, NULL); - if (!a) - return NULL; - if (soap->body && !*soap->href) - { if (!a || soap_s2xsd__boolean(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (bool *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_xsd__boolean, 0, sizeof(bool), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_bool(struct soap *soap, bool *a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_bool - *a = SOAP_DEFAULT_bool; -#else - *a = (bool)0; -#endif -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_bool(struct soap *soap, const bool *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_bool); - if (soap_out_bool(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -static const struct soap_code_map soap_codes_bool[] = -{ { (long)false, "false" }, - { (long)true, "true" }, - { 0, NULL } -}; - -SOAP_FMAC3S const char* SOAP_FMAC4S soap_bool2s(struct soap *soap, bool n) -{ return soap_code_str(soap_codes_bool, n!=0); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_bool(struct soap *soap, const char *tag, int id, const bool *a, const char *type) -{ soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_bool), type); - soap_send(soap, soap_bool2s(soap, *a)); - return soap_element_end_out(soap, tag); -} - -SOAP_FMAC3 bool * SOAP_FMAC4 soap_get_bool(struct soap *soap, bool *p, const char *tag, const char *type) -{ - if ((p = soap_in_bool(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3S int SOAP_FMAC4S soap_s2bool(struct soap *soap, const char *s, bool *a) -{ - const struct soap_code_map *map; - if (!s) - return SOAP_OK; - map = soap_code(soap_codes_bool, s); - if (map) - *a = (bool)(map->code != 0); - else - { long n; - if (soap_s2long(soap, s, &n) || n < 0 || n > 1) - return soap->error = SOAP_TYPE; - *a = (bool)(n != 0); - } - return SOAP_OK; -} - -SOAP_FMAC3 bool * SOAP_FMAC4 soap_in_bool(struct soap *soap, const char *tag, bool *a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 0, NULL)) - return NULL; - if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":boolean")) - { soap->error = SOAP_TYPE; - return NULL; - } - a = (bool *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_bool, sizeof(bool), 0, NULL, NULL, NULL); - if (!a) - return NULL; - if (soap->body && !*soap->href) - { if (!a || soap_s2bool(soap, soap_value(soap), a) || soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (bool *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_bool, 0, sizeof(bool), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize__QName(soap, &a->faultcode); - soap_serialize_string(soap, &a->faultstring); - soap_serialize_string(soap, &a->faultactor); - soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->detail); - soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Code); - soap_serialize_PointerToSOAP_ENV__Reason(soap, &a->SOAP_ENV__Reason); - soap_serialize_string(soap, &a->SOAP_ENV__Node); - soap_serialize_string(soap, &a->SOAP_ENV__Role); - soap_serialize_PointerToSOAP_ENV__Detail(soap, &a->SOAP_ENV__Detail); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default__QName(soap, &a->faultcode); - soap_default_string(soap, &a->faultstring); - soap_default_string(soap, &a->faultactor); - a->detail = NULL; - a->SOAP_ENV__Code = NULL; - a->SOAP_ENV__Reason = NULL; - soap_default_string(soap, &a->SOAP_ENV__Node); - soap_default_string(soap, &a->SOAP_ENV__Role); - a->SOAP_ENV__Detail = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap *soap, const struct SOAP_ENV__Fault *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Fault); - if (soap_out_SOAP_ENV__Fault(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Fault *a, const char *type) -{ - const char *soap_tmp_faultcode = soap_QName2s(soap, a->faultcode); - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Fault), type); - soap_out__QName(soap, "faultcode", -1, (char*const*)&soap_tmp_faultcode, ""); - soap_out_string(soap, "faultstring", -1, &a->faultstring, ""); - soap_out_string(soap, "faultactor", -1, &a->faultactor, ""); - soap_out_PointerToSOAP_ENV__Detail(soap, "detail", -1, &a->detail, ""); - soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", -1, &a->SOAP_ENV__Code, ""); - soap_out_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", -1, &a->SOAP_ENV__Reason, ""); - soap_out_string(soap, "SOAP-ENV:Node", -1, &a->SOAP_ENV__Node, ""); - soap_out_string(soap, "SOAP-ENV:Role", -1, &a->SOAP_ENV__Role, ""); - soap_out_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", -1, &a->SOAP_ENV__Detail, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap *soap, struct SOAP_ENV__Fault *p, const char *tag, const char *type) -{ - if ((p = soap_in_SOAP_ENV__Fault(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap *soap, const char *tag, struct SOAP_ENV__Fault *a, const char *type) -{ - short soap_flag_faultcode = 1, soap_flag_faultstring = 1, soap_flag_faultactor = 1, soap_flag_detail = 1, soap_flag_SOAP_ENV__Code = 1, soap_flag_SOAP_ENV__Reason = 1, soap_flag_SOAP_ENV__Node = 1, soap_flag_SOAP_ENV__Role = 1, soap_flag_SOAP_ENV__Detail = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Fault *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Fault, sizeof(struct SOAP_ENV__Fault), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_SOAP_ENV__Fault(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_faultcode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in__QName(soap, "faultcode", &a->faultcode, "")) - { soap_flag_faultcode--; - continue; - } - if (soap_flag_faultstring && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_string(soap, "faultstring", &a->faultstring, "xsd:string")) - { soap_flag_faultstring--; - continue; - } - if (soap_flag_faultactor && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_string(soap, "faultactor", &a->faultactor, "xsd:string")) - { soap_flag_faultactor--; - continue; - } - if (soap_flag_detail && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerToSOAP_ENV__Detail(soap, "detail", &a->detail, "")) - { soap_flag_detail--; - continue; - } - if (soap_flag_SOAP_ENV__Code && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Code", &a->SOAP_ENV__Code, "")) - { soap_flag_SOAP_ENV__Code--; - continue; - } - if (soap_flag_SOAP_ENV__Reason && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerToSOAP_ENV__Reason(soap, "SOAP-ENV:Reason", &a->SOAP_ENV__Reason, "")) - { soap_flag_SOAP_ENV__Reason--; - continue; - } - if (soap_flag_SOAP_ENV__Node && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_string(soap, "SOAP-ENV:Node", &a->SOAP_ENV__Node, "xsd:string")) - { soap_flag_SOAP_ENV__Node--; - continue; - } - if (soap_flag_SOAP_ENV__Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_string(soap, "SOAP-ENV:Role", &a->SOAP_ENV__Role, "xsd:string")) - { soap_flag_SOAP_ENV__Role--; - continue; - } - if (soap_flag_SOAP_ENV__Detail && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerToSOAP_ENV__Detail(soap, "SOAP-ENV:Detail", &a->SOAP_ENV__Detail, "")) - { soap_flag_SOAP_ENV__Detail--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_string(soap, &a->SOAP_ENV__Text); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_string(soap, &a->SOAP_ENV__Text); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap *soap, const struct SOAP_ENV__Reason *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Reason); - if (soap_out_SOAP_ENV__Reason(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Reason *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Reason), type); - soap_out_string(soap, "SOAP-ENV:Text", -1, &a->SOAP_ENV__Text, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *p, const char *tag, const char *type) -{ - if ((p = soap_in_SOAP_ENV__Reason(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason *a, const char *type) -{ - short soap_flag_SOAP_ENV__Text = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Reason *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_SOAP_ENV__Reason(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_SOAP_ENV__Text && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_string(soap, "SOAP-ENV:Text", &a->SOAP_ENV__Text, "xsd:string")) - { soap_flag_SOAP_ENV__Text--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_markelement(soap, a->fault, a->__type); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - a->__type = 0; - a->fault = NULL; - a->__any = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap *soap, const struct SOAP_ENV__Detail *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Detail); - if (soap_out_SOAP_ENV__Detail(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Detail *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Detail), type); - soap_putelement(soap, a->fault, "fault", -1, a->__type); - soap_outliteral(soap, "-any", &a->__any, NULL); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *p, const char *tag, const char *type) -{ - if ((p = soap_in_SOAP_ENV__Detail(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail *a, const char *type) -{ - short soap_flag_fault = 1, soap_flag___any = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Detail *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_SOAP_ENV__Detail(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_fault && soap->error == SOAP_TAG_MISMATCH) - if ((a->fault = soap_getelement(soap, &a->__type))) - { soap_flag_fault = 0; - continue; - } - if (soap_flag___any && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_inliteral(soap, "-any", &a->__any)) - { soap_flag___any--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize__QName(soap, &a->SOAP_ENV__Value); - soap_serialize_PointerToSOAP_ENV__Code(soap, &a->SOAP_ENV__Subcode); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default__QName(soap, &a->SOAP_ENV__Value); - a->SOAP_ENV__Subcode = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap *soap, const struct SOAP_ENV__Code *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Code); - if (soap_out_SOAP_ENV__Code(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Code *a, const char *type) -{ - const char *soap_tmp_SOAP_ENV__Value = soap_QName2s(soap, a->SOAP_ENV__Value); - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Code), type); - soap_out__QName(soap, "SOAP-ENV:Value", -1, (char*const*)&soap_tmp_SOAP_ENV__Value, ""); - soap_out_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", -1, &a->SOAP_ENV__Subcode, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *p, const char *tag, const char *type) -{ - if ((p = soap_in_SOAP_ENV__Code(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code *a, const char *type) -{ - short soap_flag_SOAP_ENV__Value = 1, soap_flag_SOAP_ENV__Subcode = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Code *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_SOAP_ENV__Code(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_SOAP_ENV__Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in__QName(soap, "SOAP-ENV:Value", &a->SOAP_ENV__Value, "")) - { soap_flag_SOAP_ENV__Value--; - continue; - } - if (soap_flag_SOAP_ENV__Subcode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerToSOAP_ENV__Code(soap, "SOAP-ENV:Subcode", &a->SOAP_ENV__Subcode, "")) - { soap_flag_SOAP_ENV__Subcode--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - /* transient dummy skipped */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - /* transient dummy skipped */ -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap *soap, const struct SOAP_ENV__Header *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_SOAP_ENV__Header); - if (soap_out_SOAP_ENV__Header(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap *soap, const char *tag, int id, const struct SOAP_ENV__Header *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_SOAP_ENV__Header), type); - /* transient dummy skipped */ - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap *soap, struct SOAP_ENV__Header *p, const char *tag, const char *type) -{ - if ((p = soap_in_SOAP_ENV__Header(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap *soap, const char *tag, struct SOAP_ENV__Header *a, const char *type) -{; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct SOAP_ENV__Header *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_SOAP_ENV__Header, sizeof(struct SOAP_ENV__Header), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_SOAP_ENV__Header(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - /* transient dummy skipped */ - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_mss__MSS_USCORESignatureDummy(struct soap *soap, const struct mss__MSS_USCORESignatureDummy *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_mss__MSS_USCORESignatureDummy(struct soap *soap, struct mss__MSS_USCORESignatureDummy *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_mss__MSS_USCORESignatureDummy(struct soap *soap, const struct mss__MSS_USCORESignatureDummy *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_mss__MSS_USCORESignatureDummy); - if (soap_out_mss__MSS_USCORESignatureDummy(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_mss__MSS_USCORESignatureDummy(struct soap *soap, const char *tag, int id, const struct mss__MSS_USCORESignatureDummy *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_mss__MSS_USCORESignatureDummy), type); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct mss__MSS_USCORESignatureDummy * SOAP_FMAC4 soap_get_mss__MSS_USCORESignatureDummy(struct soap *soap, struct mss__MSS_USCORESignatureDummy *p, const char *tag, const char *type) -{ - if ((p = soap_in_mss__MSS_USCORESignatureDummy(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct mss__MSS_USCORESignatureDummy * SOAP_FMAC4 soap_in_mss__MSS_USCORESignatureDummy(struct soap *soap, const char *tag, struct mss__MSS_USCORESignatureDummy *a, const char *type) -{; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct mss__MSS_USCORESignatureDummy *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_mss__MSS_USCORESignatureDummy, sizeof(struct mss__MSS_USCORESignatureDummy), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_mss__MSS_USCORESignatureDummy(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct mss__MSS_USCORESignatureDummy *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSS_USCORESignatureDummy, 0, sizeof(struct mss__MSS_USCORESignatureDummy), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_mss_DummyResp(struct soap *soap, const struct mss_DummyResp *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->str); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_mss_DummyResp(struct soap *soap, struct mss_DummyResp *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->str); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_mss_DummyResp(struct soap *soap, const struct mss_DummyResp *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_mss_DummyResp); - if (soap_out_mss_DummyResp(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_mss_DummyResp(struct soap *soap, const char *tag, int id, const struct mss_DummyResp *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_mss_DummyResp), type); - if (a->str) - soap_element_result(soap, "str"); - soap_out_xsd__string(soap, "str", -1, &a->str, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct mss_DummyResp * SOAP_FMAC4 soap_get_mss_DummyResp(struct soap *soap, struct mss_DummyResp *p, const char *tag, const char *type) -{ - if ((p = soap_in_mss_DummyResp(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct mss_DummyResp * SOAP_FMAC4 soap_in_mss_DummyResp(struct soap *soap, const char *tag, struct mss_DummyResp *a, const char *type) -{ - short soap_flag_str = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct mss_DummyResp *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_mss_DummyResp, sizeof(struct mss_DummyResp), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_mss_DummyResp(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_str && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "str", &a->str, "xsd:string")) - { soap_flag_str--; - continue; - } - soap_check_result(soap, "str"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct mss_DummyResp *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss_DummyResp, 0, sizeof(struct mss_DummyResp), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileCreateSignatureStatus(struct soap *soap, const struct d__GetMobileCreateSignatureStatus *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileCreateSignatureStatus(struct soap *soap, struct d__GetMobileCreateSignatureStatus *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__boolean(soap, &a->WaitSignature); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileCreateSignatureStatus(struct soap *soap, const struct d__GetMobileCreateSignatureStatus *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetMobileCreateSignatureStatus); - if (soap_out_d__GetMobileCreateSignatureStatus(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileCreateSignatureStatus(struct soap *soap, const char *tag, int id, const struct d__GetMobileCreateSignatureStatus *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetMobileCreateSignatureStatus), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__boolean(soap, "WaitSignature", -1, &a->WaitSignature, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatus * SOAP_FMAC4 soap_get_d__GetMobileCreateSignatureStatus(struct soap *soap, struct d__GetMobileCreateSignatureStatus *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetMobileCreateSignatureStatus(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatus * SOAP_FMAC4 soap_in_d__GetMobileCreateSignatureStatus(struct soap *soap, const char *tag, struct d__GetMobileCreateSignatureStatus *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_WaitSignature = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetMobileCreateSignatureStatus *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetMobileCreateSignatureStatus, sizeof(struct d__GetMobileCreateSignatureStatus), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetMobileCreateSignatureStatus(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_WaitSignature && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "WaitSignature", &a->WaitSignature, "xsd:boolean")) - { soap_flag_WaitSignature--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0 || soap_flag_WaitSignature > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetMobileCreateSignatureStatus *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetMobileCreateSignatureStatus, 0, sizeof(struct d__GetMobileCreateSignatureStatus), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, const struct d__GetMobileCreateSignatureStatusResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->Signature); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, struct d__GetMobileCreateSignatureStatusResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->Signature); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, const struct d__GetMobileCreateSignatureStatusResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse); - if (soap_out_d__GetMobileCreateSignatureStatusResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, const char *tag, int id, const struct d__GetMobileCreateSignatureStatusResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse), type); - soap_element_result(soap, "Sesscode"); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "Signature", -1, &a->Signature, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse * SOAP_FMAC4 soap_get_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, struct d__GetMobileCreateSignatureStatusResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetMobileCreateSignatureStatusResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse * SOAP_FMAC4 soap_in_d__GetMobileCreateSignatureStatusResponse(struct soap *soap, const char *tag, struct d__GetMobileCreateSignatureStatusResponse *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_Status = 1, soap_flag_Signature = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetMobileCreateSignatureStatusResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse, sizeof(struct d__GetMobileCreateSignatureStatusResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetMobileCreateSignatureStatusResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_Signature && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Signature", &a->Signature, "xsd:string")) - { soap_flag_Signature--; - continue; - } - soap_check_result(soap, "Sesscode"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetMobileCreateSignatureStatusResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse, 0, sizeof(struct d__GetMobileCreateSignatureStatusResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileCreateSignature(struct soap *soap, const struct d__MobileCreateSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->IDCode); - soap_serialize_xsd__string(soap, &a->SignersCountry); - soap_serialize_xsd__string(soap, &a->PhoneNo); - soap_serialize_xsd__string(soap, &a->Language); - soap_serialize_xsd__string(soap, &a->ServiceName); - soap_serialize_xsd__string(soap, &a->MessageToDisplay); - soap_serialize_xsd__string(soap, &a->Role); - soap_serialize_xsd__string(soap, &a->City); - soap_serialize_xsd__string(soap, &a->StateOrProvince); - soap_serialize_xsd__string(soap, &a->PostalCode); - soap_serialize_xsd__string(soap, &a->CountryName); - soap_serialize_xsd__string(soap, &a->SigningProfile); - soap_serialize_PointerTod__DataFileDigestList(soap, &a->DataFiles); - soap_serialize_xsd__string(soap, &a->Format); - soap_serialize_xsd__string(soap, &a->Version); - soap_serialize_xsd__string(soap, &a->SignatureID); - soap_serialize_xsd__string(soap, &a->MessagingMode); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileCreateSignature(struct soap *soap, struct d__MobileCreateSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->IDCode); - soap_default_xsd__string(soap, &a->SignersCountry); - soap_default_xsd__string(soap, &a->PhoneNo); - soap_default_xsd__string(soap, &a->Language); - soap_default_xsd__string(soap, &a->ServiceName); - soap_default_xsd__string(soap, &a->MessageToDisplay); - soap_default_xsd__string(soap, &a->Role); - soap_default_xsd__string(soap, &a->City); - soap_default_xsd__string(soap, &a->StateOrProvince); - soap_default_xsd__string(soap, &a->PostalCode); - soap_default_xsd__string(soap, &a->CountryName); - soap_default_xsd__string(soap, &a->SigningProfile); - a->DataFiles = NULL; - soap_default_xsd__string(soap, &a->Format); - soap_default_xsd__string(soap, &a->Version); - soap_default_xsd__string(soap, &a->SignatureID); - soap_default_xsd__string(soap, &a->MessagingMode); - soap_default_xsd__int(soap, &a->AsyncConfiguration); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileCreateSignature(struct soap *soap, const struct d__MobileCreateSignature *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileCreateSignature); - if (soap_out_d__MobileCreateSignature(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileCreateSignature(struct soap *soap, const char *tag, int id, const struct d__MobileCreateSignature *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileCreateSignature), type); - soap_out_xsd__string(soap, "IDCode", -1, &a->IDCode, ""); - soap_out_xsd__string(soap, "SignersCountry", -1, &a->SignersCountry, ""); - soap_out_xsd__string(soap, "PhoneNo", -1, &a->PhoneNo, ""); - soap_out_xsd__string(soap, "Language", -1, &a->Language, ""); - soap_out_xsd__string(soap, "ServiceName", -1, &a->ServiceName, ""); - soap_out_xsd__string(soap, "MessageToDisplay", -1, &a->MessageToDisplay, ""); - soap_out_xsd__string(soap, "Role", -1, &a->Role, ""); - soap_out_xsd__string(soap, "City", -1, &a->City, ""); - soap_out_xsd__string(soap, "StateOrProvince", -1, &a->StateOrProvince, ""); - soap_out_xsd__string(soap, "PostalCode", -1, &a->PostalCode, ""); - soap_out_xsd__string(soap, "CountryName", -1, &a->CountryName, ""); - soap_out_xsd__string(soap, "SigningProfile", -1, &a->SigningProfile, ""); - soap_out_PointerTod__DataFileDigestList(soap, "DataFiles", -1, &a->DataFiles, ""); - soap_out_xsd__string(soap, "Format", -1, &a->Format, ""); - soap_out_xsd__string(soap, "Version", -1, &a->Version, ""); - soap_out_xsd__string(soap, "SignatureID", -1, &a->SignatureID, ""); - soap_out_xsd__string(soap, "MessagingMode", -1, &a->MessagingMode, ""); - soap_out_xsd__int(soap, "AsyncConfiguration", -1, &a->AsyncConfiguration, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileCreateSignature * SOAP_FMAC4 soap_get_d__MobileCreateSignature(struct soap *soap, struct d__MobileCreateSignature *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileCreateSignature(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileCreateSignature * SOAP_FMAC4 soap_in_d__MobileCreateSignature(struct soap *soap, const char *tag, struct d__MobileCreateSignature *a, const char *type) -{ - short soap_flag_IDCode = 1, soap_flag_SignersCountry = 1, soap_flag_PhoneNo = 1, soap_flag_Language = 1, soap_flag_ServiceName = 1, soap_flag_MessageToDisplay = 1, soap_flag_Role = 1, soap_flag_City = 1, soap_flag_StateOrProvince = 1, soap_flag_PostalCode = 1, soap_flag_CountryName = 1, soap_flag_SigningProfile = 1, soap_flag_DataFiles = 1, soap_flag_Format = 1, soap_flag_Version = 1, soap_flag_SignatureID = 1, soap_flag_MessagingMode = 1, soap_flag_AsyncConfiguration = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileCreateSignature *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileCreateSignature, sizeof(struct d__MobileCreateSignature), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileCreateSignature(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_IDCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "IDCode", &a->IDCode, "xsd:string")) - { soap_flag_IDCode--; - continue; - } - if (soap_flag_SignersCountry && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignersCountry", &a->SignersCountry, "xsd:string")) - { soap_flag_SignersCountry--; - continue; - } - if (soap_flag_PhoneNo && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PhoneNo", &a->PhoneNo, "xsd:string")) - { soap_flag_PhoneNo--; - continue; - } - if (soap_flag_Language && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Language", &a->Language, "xsd:string")) - { soap_flag_Language--; - continue; - } - if (soap_flag_ServiceName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ServiceName", &a->ServiceName, "xsd:string")) - { soap_flag_ServiceName--; - continue; - } - if (soap_flag_MessageToDisplay && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MessageToDisplay", &a->MessageToDisplay, "xsd:string")) - { soap_flag_MessageToDisplay--; - continue; - } - if (soap_flag_Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Role", &a->Role, "xsd:string")) - { soap_flag_Role--; - continue; - } - if (soap_flag_City && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "City", &a->City, "xsd:string")) - { soap_flag_City--; - continue; - } - if (soap_flag_StateOrProvince && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "StateOrProvince", &a->StateOrProvince, "xsd:string")) - { soap_flag_StateOrProvince--; - continue; - } - if (soap_flag_PostalCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PostalCode", &a->PostalCode, "xsd:string")) - { soap_flag_PostalCode--; - continue; - } - if (soap_flag_CountryName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CountryName", &a->CountryName, "xsd:string")) - { soap_flag_CountryName--; - continue; - } - if (soap_flag_SigningProfile && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SigningProfile", &a->SigningProfile, "xsd:string")) - { soap_flag_SigningProfile--; - continue; - } - if (soap_flag_DataFiles && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__DataFileDigestList(soap, "DataFiles", &a->DataFiles, "d:DataFileDigestList")) - { soap_flag_DataFiles--; - continue; - } - if (soap_flag_Format && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Format", &a->Format, "xsd:string")) - { soap_flag_Format--; - continue; - } - if (soap_flag_Version && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Version", &a->Version, "xsd:string")) - { soap_flag_Version--; - continue; - } - if (soap_flag_SignatureID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureID", &a->SignatureID, "xsd:string")) - { soap_flag_SignatureID--; - continue; - } - if (soap_flag_MessagingMode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MessagingMode", &a->MessagingMode, "xsd:string")) - { soap_flag_MessagingMode--; - continue; - } - if (soap_flag_AsyncConfiguration && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "AsyncConfiguration", &a->AsyncConfiguration, "xsd:int")) - { soap_flag_AsyncConfiguration--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_AsyncConfiguration > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileCreateSignature *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileCreateSignature, 0, sizeof(struct d__MobileCreateSignature), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileCreateSignatureResponse(struct soap *soap, const struct d__MobileCreateSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->ChallengeID); - soap_serialize_xsd__string(soap, &a->Status); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileCreateSignatureResponse(struct soap *soap, struct d__MobileCreateSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->ChallengeID); - soap_default_xsd__string(soap, &a->Status); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileCreateSignatureResponse(struct soap *soap, const struct d__MobileCreateSignatureResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileCreateSignatureResponse); - if (soap_out_d__MobileCreateSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileCreateSignatureResponse(struct soap *soap, const char *tag, int id, const struct d__MobileCreateSignatureResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileCreateSignatureResponse), type); - soap_element_result(soap, "Sesscode"); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "ChallengeID", -1, &a->ChallengeID, ""); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileCreateSignatureResponse * SOAP_FMAC4 soap_get_d__MobileCreateSignatureResponse(struct soap *soap, struct d__MobileCreateSignatureResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileCreateSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileCreateSignatureResponse * SOAP_FMAC4 soap_in_d__MobileCreateSignatureResponse(struct soap *soap, const char *tag, struct d__MobileCreateSignatureResponse *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_ChallengeID = 1, soap_flag_Status = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileCreateSignatureResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileCreateSignatureResponse, sizeof(struct d__MobileCreateSignatureResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileCreateSignatureResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_ChallengeID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ChallengeID", &a->ChallengeID, "xsd:string")) - { soap_flag_ChallengeID--; - continue; - } - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - soap_check_result(soap, "Sesscode"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileCreateSignatureResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileCreateSignatureResponse, 0, sizeof(struct d__MobileCreateSignatureResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileDigestList(struct soap *soap, const struct d__DataFileDigestList *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - if (a->__ptrDataFileDigest) - { int i; - for (i = 0; i < a->__sizeOfDataFileDigests; i++) - { - soap_embedded(soap, a->__ptrDataFileDigest + i, SOAP_TYPE_d__DataFileDigest); - soap_serialize_d__DataFileDigest(soap, a->__ptrDataFileDigest + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileDigestList(struct soap *soap, struct d__DataFileDigestList *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - a->__sizeOfDataFileDigests = 0; - a->__ptrDataFileDigest = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileDigestList(struct soap *soap, const struct d__DataFileDigestList *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__DataFileDigestList); - if (soap_out_d__DataFileDigestList(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileDigestList(struct soap *soap, const char *tag, int id, const struct d__DataFileDigestList *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__DataFileDigestList), type); - if (a->__ptrDataFileDigest) - { int i; - for (i = 0; i < a->__sizeOfDataFileDigests; i++) - soap_out_d__DataFileDigest(soap, "DataFileDigest", -1, a->__ptrDataFileDigest + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__DataFileDigestList * SOAP_FMAC4 soap_get_d__DataFileDigestList(struct soap *soap, struct d__DataFileDigestList *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__DataFileDigestList(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileDigestList * SOAP_FMAC4 soap_in_d__DataFileDigestList(struct soap *soap, const char *tag, struct d__DataFileDigestList *a, const char *type) -{ - short soap_flag___ptrDataFileDigest = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__DataFileDigestList *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__DataFileDigestList, sizeof(struct d__DataFileDigestList), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__DataFileDigestList(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag___ptrDataFileDigest && soap->error == SOAP_TAG_MISMATCH) - { struct d__DataFileDigest *p; - soap_new_block(soap); - for (a->__sizeOfDataFileDigests = 0; !soap_element_begin_in(soap, "DataFileDigest", 1, NULL); a->__sizeOfDataFileDigests++) - { p = (struct d__DataFileDigest *)soap_push_block(soap, sizeof(struct d__DataFileDigest)); - soap_default_d__DataFileDigest(soap, p); - soap_revert(soap); - if (!soap_in_d__DataFileDigest(soap, "DataFileDigest", p, "d:DataFileDigest")) - break; - soap_flag___ptrDataFileDigest = 0; - } - a->__ptrDataFileDigest = (struct d__DataFileDigest *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrDataFileDigest && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__DataFileDigestList *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__DataFileDigestList, 0, sizeof(struct d__DataFileDigestList), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileDigest(struct soap *soap, const struct d__DataFileDigest *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Id); - soap_serialize_xsd__string(soap, &a->DigestType); - soap_serialize_xsd__string(soap, &a->DigestValue); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileDigest(struct soap *soap, struct d__DataFileDigest *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Id); - soap_default_xsd__string(soap, &a->DigestType); - soap_default_xsd__string(soap, &a->DigestValue); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileDigest(struct soap *soap, const struct d__DataFileDigest *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__DataFileDigest); - if (soap_out_d__DataFileDigest(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileDigest(struct soap *soap, const char *tag, int id, const struct d__DataFileDigest *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__DataFileDigest), type); - soap_out_xsd__string(soap, "Id", -1, &a->Id, ""); - soap_out_xsd__string(soap, "DigestType", -1, &a->DigestType, ""); - soap_out_xsd__string(soap, "DigestValue", -1, &a->DigestValue, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__DataFileDigest * SOAP_FMAC4 soap_get_d__DataFileDigest(struct soap *soap, struct d__DataFileDigest *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__DataFileDigest(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileDigest * SOAP_FMAC4 soap_in_d__DataFileDigest(struct soap *soap, const char *tag, struct d__DataFileDigest *a, const char *type) -{ - short soap_flag_Id = 1, soap_flag_DigestType = 1, soap_flag_DigestValue = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__DataFileDigest *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__DataFileDigest, sizeof(struct d__DataFileDigest), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__DataFileDigest(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Id && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Id", &a->Id, "xsd:string")) - { soap_flag_Id--; - continue; - } - if (soap_flag_DigestType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestType", &a->DigestType, "xsd:string")) - { soap_flag_DigestType--; - continue; - } - if (soap_flag_DigestValue && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestValue", &a->DigestValue, "xsd:string")) - { soap_flag_DigestValue--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__DataFileDigest *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__DataFileDigest, 0, sizeof(struct d__DataFileDigest), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileAuthenticateStatus(struct soap *soap, const struct d__GetMobileAuthenticateStatus *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileAuthenticateStatus(struct soap *soap, struct d__GetMobileAuthenticateStatus *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__boolean(soap, &a->WaitSignature); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileAuthenticateStatus(struct soap *soap, const struct d__GetMobileAuthenticateStatus *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetMobileAuthenticateStatus); - if (soap_out_d__GetMobileAuthenticateStatus(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileAuthenticateStatus(struct soap *soap, const char *tag, int id, const struct d__GetMobileAuthenticateStatus *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetMobileAuthenticateStatus), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__boolean(soap, "WaitSignature", -1, &a->WaitSignature, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatus * SOAP_FMAC4 soap_get_d__GetMobileAuthenticateStatus(struct soap *soap, struct d__GetMobileAuthenticateStatus *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetMobileAuthenticateStatus(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatus * SOAP_FMAC4 soap_in_d__GetMobileAuthenticateStatus(struct soap *soap, const char *tag, struct d__GetMobileAuthenticateStatus *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_WaitSignature = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetMobileAuthenticateStatus *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetMobileAuthenticateStatus, sizeof(struct d__GetMobileAuthenticateStatus), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetMobileAuthenticateStatus(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_WaitSignature && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "WaitSignature", &a->WaitSignature, "xsd:boolean")) - { soap_flag_WaitSignature--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0 || soap_flag_WaitSignature > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetMobileAuthenticateStatus *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetMobileAuthenticateStatus, 0, sizeof(struct d__GetMobileAuthenticateStatus), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileAuthenticateStatusResponse(struct soap *soap, const struct d__GetMobileAuthenticateStatusResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->Signature); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileAuthenticateStatusResponse(struct soap *soap, struct d__GetMobileAuthenticateStatusResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->Signature); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileAuthenticateStatusResponse(struct soap *soap, const struct d__GetMobileAuthenticateStatusResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse); - if (soap_out_d__GetMobileAuthenticateStatusResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileAuthenticateStatusResponse(struct soap *soap, const char *tag, int id, const struct d__GetMobileAuthenticateStatusResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "Signature", -1, &a->Signature, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse * SOAP_FMAC4 soap_get_d__GetMobileAuthenticateStatusResponse(struct soap *soap, struct d__GetMobileAuthenticateStatusResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetMobileAuthenticateStatusResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse * SOAP_FMAC4 soap_in_d__GetMobileAuthenticateStatusResponse(struct soap *soap, const char *tag, struct d__GetMobileAuthenticateStatusResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_Signature = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetMobileAuthenticateStatusResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse, sizeof(struct d__GetMobileAuthenticateStatusResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetMobileAuthenticateStatusResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_Signature && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Signature", &a->Signature, "xsd:string")) - { soap_flag_Signature--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetMobileAuthenticateStatusResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse, 0, sizeof(struct d__GetMobileAuthenticateStatusResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileAuthenticate(struct soap *soap, const struct d__MobileAuthenticate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->IDCode); - soap_serialize_xsd__string(soap, &a->CountryCode); - soap_serialize_xsd__string(soap, &a->PhoneNo); - soap_serialize_xsd__string(soap, &a->Language); - soap_serialize_xsd__string(soap, &a->ServiceName); - soap_serialize_xsd__string(soap, &a->MessageToDisplay); - soap_serialize_xsd__string(soap, &a->SPChallenge); - soap_serialize_xsd__string(soap, &a->MessagingMode); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileAuthenticate(struct soap *soap, struct d__MobileAuthenticate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->IDCode); - soap_default_xsd__string(soap, &a->CountryCode); - soap_default_xsd__string(soap, &a->PhoneNo); - soap_default_xsd__string(soap, &a->Language); - soap_default_xsd__string(soap, &a->ServiceName); - soap_default_xsd__string(soap, &a->MessageToDisplay); - soap_default_xsd__string(soap, &a->SPChallenge); - soap_default_xsd__string(soap, &a->MessagingMode); - soap_default_xsd__int(soap, &a->AsyncConfiguration); - soap_default_xsd__boolean(soap, &a->ReturnCertData); - soap_default_xsd__boolean(soap, &a->ReturnRevocationData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileAuthenticate(struct soap *soap, const struct d__MobileAuthenticate *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileAuthenticate); - if (soap_out_d__MobileAuthenticate(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileAuthenticate(struct soap *soap, const char *tag, int id, const struct d__MobileAuthenticate *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileAuthenticate), type); - soap_out_xsd__string(soap, "IDCode", -1, &a->IDCode, ""); - soap_out_xsd__string(soap, "CountryCode", -1, &a->CountryCode, ""); - soap_out_xsd__string(soap, "PhoneNo", -1, &a->PhoneNo, ""); - soap_out_xsd__string(soap, "Language", -1, &a->Language, ""); - soap_out_xsd__string(soap, "ServiceName", -1, &a->ServiceName, ""); - soap_out_xsd__string(soap, "MessageToDisplay", -1, &a->MessageToDisplay, ""); - soap_out_xsd__string(soap, "SPChallenge", -1, &a->SPChallenge, ""); - soap_out_xsd__string(soap, "MessagingMode", -1, &a->MessagingMode, ""); - soap_out_xsd__int(soap, "AsyncConfiguration", -1, &a->AsyncConfiguration, ""); - soap_out_xsd__boolean(soap, "ReturnCertData", -1, &a->ReturnCertData, ""); - soap_out_xsd__boolean(soap, "ReturnRevocationData", -1, &a->ReturnRevocationData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileAuthenticate * SOAP_FMAC4 soap_get_d__MobileAuthenticate(struct soap *soap, struct d__MobileAuthenticate *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileAuthenticate(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileAuthenticate * SOAP_FMAC4 soap_in_d__MobileAuthenticate(struct soap *soap, const char *tag, struct d__MobileAuthenticate *a, const char *type) -{ - short soap_flag_IDCode = 1, soap_flag_CountryCode = 1, soap_flag_PhoneNo = 1, soap_flag_Language = 1, soap_flag_ServiceName = 1, soap_flag_MessageToDisplay = 1, soap_flag_SPChallenge = 1, soap_flag_MessagingMode = 1, soap_flag_AsyncConfiguration = 1, soap_flag_ReturnCertData = 1, soap_flag_ReturnRevocationData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileAuthenticate *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileAuthenticate, sizeof(struct d__MobileAuthenticate), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileAuthenticate(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_IDCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "IDCode", &a->IDCode, "xsd:string")) - { soap_flag_IDCode--; - continue; - } - if (soap_flag_CountryCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CountryCode", &a->CountryCode, "xsd:string")) - { soap_flag_CountryCode--; - continue; - } - if (soap_flag_PhoneNo && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PhoneNo", &a->PhoneNo, "xsd:string")) - { soap_flag_PhoneNo--; - continue; - } - if (soap_flag_Language && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Language", &a->Language, "xsd:string")) - { soap_flag_Language--; - continue; - } - if (soap_flag_ServiceName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ServiceName", &a->ServiceName, "xsd:string")) - { soap_flag_ServiceName--; - continue; - } - if (soap_flag_MessageToDisplay && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MessageToDisplay", &a->MessageToDisplay, "xsd:string")) - { soap_flag_MessageToDisplay--; - continue; - } - if (soap_flag_SPChallenge && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SPChallenge", &a->SPChallenge, "xsd:string")) - { soap_flag_SPChallenge--; - continue; - } - if (soap_flag_MessagingMode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MessagingMode", &a->MessagingMode, "xsd:string")) - { soap_flag_MessagingMode--; - continue; - } - if (soap_flag_AsyncConfiguration && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "AsyncConfiguration", &a->AsyncConfiguration, "xsd:int")) - { soap_flag_AsyncConfiguration--; - continue; - } - if (soap_flag_ReturnCertData && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "ReturnCertData", &a->ReturnCertData, "xsd:boolean")) - { soap_flag_ReturnCertData--; - continue; - } - if (soap_flag_ReturnRevocationData && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "ReturnRevocationData", &a->ReturnRevocationData, "xsd:boolean")) - { soap_flag_ReturnRevocationData--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_AsyncConfiguration > 0 || soap_flag_ReturnCertData > 0 || soap_flag_ReturnRevocationData > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileAuthenticate *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileAuthenticate, 0, sizeof(struct d__MobileAuthenticate), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileAuthenticateResponse(struct soap *soap, const struct d__MobileAuthenticateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->UserIDCode); - soap_serialize_xsd__string(soap, &a->UserGivenname); - soap_serialize_xsd__string(soap, &a->UserSurname); - soap_serialize_xsd__string(soap, &a->UserCountry); - soap_serialize_xsd__string(soap, &a->UserCN); - soap_serialize_xsd__string(soap, &a->CertificateData); - soap_serialize_xsd__string(soap, &a->ChallengeID); - soap_serialize_xsd__string(soap, &a->Challenge); - soap_serialize_xsd__string(soap, &a->RevocationData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileAuthenticateResponse(struct soap *soap, struct d__MobileAuthenticateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->UserIDCode); - soap_default_xsd__string(soap, &a->UserGivenname); - soap_default_xsd__string(soap, &a->UserSurname); - soap_default_xsd__string(soap, &a->UserCountry); - soap_default_xsd__string(soap, &a->UserCN); - soap_default_xsd__string(soap, &a->CertificateData); - soap_default_xsd__string(soap, &a->ChallengeID); - soap_default_xsd__string(soap, &a->Challenge); - soap_default_xsd__string(soap, &a->RevocationData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileAuthenticateResponse(struct soap *soap, const struct d__MobileAuthenticateResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileAuthenticateResponse); - if (soap_out_d__MobileAuthenticateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileAuthenticateResponse(struct soap *soap, const char *tag, int id, const struct d__MobileAuthenticateResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileAuthenticateResponse), type); - soap_element_result(soap, "Sesscode"); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "UserIDCode", -1, &a->UserIDCode, ""); - soap_out_xsd__string(soap, "UserGivenname", -1, &a->UserGivenname, ""); - soap_out_xsd__string(soap, "UserSurname", -1, &a->UserSurname, ""); - soap_out_xsd__string(soap, "UserCountry", -1, &a->UserCountry, ""); - soap_out_xsd__string(soap, "UserCN", -1, &a->UserCN, ""); - soap_out_xsd__string(soap, "CertificateData", -1, &a->CertificateData, ""); - soap_out_xsd__string(soap, "ChallengeID", -1, &a->ChallengeID, ""); - soap_out_xsd__string(soap, "Challenge", -1, &a->Challenge, ""); - soap_out_xsd__string(soap, "RevocationData", -1, &a->RevocationData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileAuthenticateResponse * SOAP_FMAC4 soap_get_d__MobileAuthenticateResponse(struct soap *soap, struct d__MobileAuthenticateResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileAuthenticateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileAuthenticateResponse * SOAP_FMAC4 soap_in_d__MobileAuthenticateResponse(struct soap *soap, const char *tag, struct d__MobileAuthenticateResponse *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_Status = 1, soap_flag_UserIDCode = 1, soap_flag_UserGivenname = 1, soap_flag_UserSurname = 1, soap_flag_UserCountry = 1, soap_flag_UserCN = 1, soap_flag_CertificateData = 1, soap_flag_ChallengeID = 1, soap_flag_Challenge = 1, soap_flag_RevocationData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileAuthenticateResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileAuthenticateResponse, sizeof(struct d__MobileAuthenticateResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileAuthenticateResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_UserIDCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "UserIDCode", &a->UserIDCode, "xsd:string")) - { soap_flag_UserIDCode--; - continue; - } - if (soap_flag_UserGivenname && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "UserGivenname", &a->UserGivenname, "xsd:string")) - { soap_flag_UserGivenname--; - continue; - } - if (soap_flag_UserSurname && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "UserSurname", &a->UserSurname, "xsd:string")) - { soap_flag_UserSurname--; - continue; - } - if (soap_flag_UserCountry && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "UserCountry", &a->UserCountry, "xsd:string")) - { soap_flag_UserCountry--; - continue; - } - if (soap_flag_UserCN && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "UserCN", &a->UserCN, "xsd:string")) - { soap_flag_UserCN--; - continue; - } - if (soap_flag_CertificateData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CertificateData", &a->CertificateData, "xsd:string")) - { soap_flag_CertificateData--; - continue; - } - if (soap_flag_ChallengeID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ChallengeID", &a->ChallengeID, "xsd:string")) - { soap_flag_ChallengeID--; - continue; - } - if (soap_flag_Challenge && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Challenge", &a->Challenge, "xsd:string")) - { soap_flag_Challenge--; - continue; - } - if (soap_flag_RevocationData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "RevocationData", &a->RevocationData, "xsd:string")) - { soap_flag_RevocationData--; - continue; - } - soap_check_result(soap, "Sesscode"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileAuthenticateResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileAuthenticateResponse, 0, sizeof(struct d__MobileAuthenticateResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetStatusInfo(struct soap *soap, const struct d__GetStatusInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetStatusInfo(struct soap *soap, struct d__GetStatusInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__boolean(soap, &a->ReturnDocInfo); - soap_default_xsd__boolean(soap, &a->WaitSignature); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetStatusInfo(struct soap *soap, const struct d__GetStatusInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetStatusInfo); - if (soap_out_d__GetStatusInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetStatusInfo(struct soap *soap, const char *tag, int id, const struct d__GetStatusInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetStatusInfo), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__boolean(soap, "ReturnDocInfo", -1, &a->ReturnDocInfo, ""); - soap_out_xsd__boolean(soap, "WaitSignature", -1, &a->WaitSignature, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetStatusInfo * SOAP_FMAC4 soap_get_d__GetStatusInfo(struct soap *soap, struct d__GetStatusInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetStatusInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetStatusInfo * SOAP_FMAC4 soap_in_d__GetStatusInfo(struct soap *soap, const char *tag, struct d__GetStatusInfo *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_ReturnDocInfo = 1, soap_flag_WaitSignature = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetStatusInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetStatusInfo, sizeof(struct d__GetStatusInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetStatusInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_ReturnDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "ReturnDocInfo", &a->ReturnDocInfo, "xsd:boolean")) - { soap_flag_ReturnDocInfo--; - continue; - } - if (soap_flag_WaitSignature && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "WaitSignature", &a->WaitSignature, "xsd:boolean")) - { soap_flag_WaitSignature--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0 || soap_flag_ReturnDocInfo > 0 || soap_flag_WaitSignature > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetStatusInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetStatusInfo, 0, sizeof(struct d__GetStatusInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetStatusInfoResponse(struct soap *soap, const struct d__GetStatusInfoResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->StatusCode); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetStatusInfoResponse(struct soap *soap, struct d__GetStatusInfoResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->StatusCode); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetStatusInfoResponse(struct soap *soap, const struct d__GetStatusInfoResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetStatusInfoResponse); - if (soap_out_d__GetStatusInfoResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetStatusInfoResponse(struct soap *soap, const char *tag, int id, const struct d__GetStatusInfoResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetStatusInfoResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "StatusCode", -1, &a->StatusCode, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetStatusInfoResponse * SOAP_FMAC4 soap_get_d__GetStatusInfoResponse(struct soap *soap, struct d__GetStatusInfoResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetStatusInfoResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetStatusInfoResponse * SOAP_FMAC4 soap_in_d__GetStatusInfoResponse(struct soap *soap, const char *tag, struct d__GetStatusInfoResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_StatusCode = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetStatusInfoResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetStatusInfoResponse, sizeof(struct d__GetStatusInfoResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetStatusInfoResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_StatusCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "StatusCode", &a->StatusCode, "xsd:string")) - { soap_flag_StatusCode--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetStatusInfoResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetStatusInfoResponse, 0, sizeof(struct d__GetStatusInfoResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileSign(struct soap *soap, const struct d__MobileSign *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignerIDCode); - soap_serialize_xsd__string(soap, &a->SignersCountry); - soap_serialize_xsd__string(soap, &a->SignerPhoneNo); - soap_serialize_xsd__string(soap, &a->ServiceName); - soap_serialize_xsd__string(soap, &a->AdditionalDataToBeDisplayed); - soap_serialize_xsd__string(soap, &a->Language); - soap_serialize_xsd__string(soap, &a->Role); - soap_serialize_xsd__string(soap, &a->City); - soap_serialize_xsd__string(soap, &a->StateOrProvince); - soap_serialize_xsd__string(soap, &a->PostalCode); - soap_serialize_xsd__string(soap, &a->CountryName); - soap_serialize_xsd__string(soap, &a->SigningProfile); - soap_serialize_xsd__string(soap, &a->MessagingMode); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileSign(struct soap *soap, struct d__MobileSign *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignerIDCode); - soap_default_xsd__string(soap, &a->SignersCountry); - soap_default_xsd__string(soap, &a->SignerPhoneNo); - soap_default_xsd__string(soap, &a->ServiceName); - soap_default_xsd__string(soap, &a->AdditionalDataToBeDisplayed); - soap_default_xsd__string(soap, &a->Language); - soap_default_xsd__string(soap, &a->Role); - soap_default_xsd__string(soap, &a->City); - soap_default_xsd__string(soap, &a->StateOrProvince); - soap_default_xsd__string(soap, &a->PostalCode); - soap_default_xsd__string(soap, &a->CountryName); - soap_default_xsd__string(soap, &a->SigningProfile); - soap_default_xsd__string(soap, &a->MessagingMode); - soap_default_xsd__int(soap, &a->AsyncConfiguration); - soap_default_xsd__boolean(soap, &a->ReturnDocInfo); - soap_default_xsd__boolean(soap, &a->ReturnDocData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileSign(struct soap *soap, const struct d__MobileSign *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileSign); - if (soap_out_d__MobileSign(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileSign(struct soap *soap, const char *tag, int id, const struct d__MobileSign *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileSign), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignerIDCode", -1, &a->SignerIDCode, ""); - soap_out_xsd__string(soap, "SignersCountry", -1, &a->SignersCountry, ""); - soap_out_xsd__string(soap, "SignerPhoneNo", -1, &a->SignerPhoneNo, ""); - soap_out_xsd__string(soap, "ServiceName", -1, &a->ServiceName, ""); - soap_out_xsd__string(soap, "AdditionalDataToBeDisplayed", -1, &a->AdditionalDataToBeDisplayed, ""); - soap_out_xsd__string(soap, "Language", -1, &a->Language, ""); - soap_out_xsd__string(soap, "Role", -1, &a->Role, ""); - soap_out_xsd__string(soap, "City", -1, &a->City, ""); - soap_out_xsd__string(soap, "StateOrProvince", -1, &a->StateOrProvince, ""); - soap_out_xsd__string(soap, "PostalCode", -1, &a->PostalCode, ""); - soap_out_xsd__string(soap, "CountryName", -1, &a->CountryName, ""); - soap_out_xsd__string(soap, "SigningProfile", -1, &a->SigningProfile, ""); - soap_out_xsd__string(soap, "MessagingMode", -1, &a->MessagingMode, ""); - soap_out_xsd__int(soap, "AsyncConfiguration", -1, &a->AsyncConfiguration, ""); - soap_out_xsd__boolean(soap, "ReturnDocInfo", -1, &a->ReturnDocInfo, ""); - soap_out_xsd__boolean(soap, "ReturnDocData", -1, &a->ReturnDocData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileSign * SOAP_FMAC4 soap_get_d__MobileSign(struct soap *soap, struct d__MobileSign *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileSign(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileSign * SOAP_FMAC4 soap_in_d__MobileSign(struct soap *soap, const char *tag, struct d__MobileSign *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignerIDCode = 1, soap_flag_SignersCountry = 1, soap_flag_SignerPhoneNo = 1, soap_flag_ServiceName = 1, soap_flag_AdditionalDataToBeDisplayed = 1, soap_flag_Language = 1, soap_flag_Role = 1, soap_flag_City = 1, soap_flag_StateOrProvince = 1, soap_flag_PostalCode = 1, soap_flag_CountryName = 1, soap_flag_SigningProfile = 1, soap_flag_MessagingMode = 1, soap_flag_AsyncConfiguration = 1, soap_flag_ReturnDocInfo = 1, soap_flag_ReturnDocData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileSign *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileSign, sizeof(struct d__MobileSign), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileSign(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignerIDCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignerIDCode", &a->SignerIDCode, "xsd:string")) - { soap_flag_SignerIDCode--; - continue; - } - if (soap_flag_SignersCountry && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignersCountry", &a->SignersCountry, "xsd:string")) - { soap_flag_SignersCountry--; - continue; - } - if (soap_flag_SignerPhoneNo && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignerPhoneNo", &a->SignerPhoneNo, "xsd:string")) - { soap_flag_SignerPhoneNo--; - continue; - } - if (soap_flag_ServiceName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ServiceName", &a->ServiceName, "xsd:string")) - { soap_flag_ServiceName--; - continue; - } - if (soap_flag_AdditionalDataToBeDisplayed && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "AdditionalDataToBeDisplayed", &a->AdditionalDataToBeDisplayed, "xsd:string")) - { soap_flag_AdditionalDataToBeDisplayed--; - continue; - } - if (soap_flag_Language && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Language", &a->Language, "xsd:string")) - { soap_flag_Language--; - continue; - } - if (soap_flag_Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Role", &a->Role, "xsd:string")) - { soap_flag_Role--; - continue; - } - if (soap_flag_City && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "City", &a->City, "xsd:string")) - { soap_flag_City--; - continue; - } - if (soap_flag_StateOrProvince && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "StateOrProvince", &a->StateOrProvince, "xsd:string")) - { soap_flag_StateOrProvince--; - continue; - } - if (soap_flag_PostalCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PostalCode", &a->PostalCode, "xsd:string")) - { soap_flag_PostalCode--; - continue; - } - if (soap_flag_CountryName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CountryName", &a->CountryName, "xsd:string")) - { soap_flag_CountryName--; - continue; - } - if (soap_flag_SigningProfile && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SigningProfile", &a->SigningProfile, "xsd:string")) - { soap_flag_SigningProfile--; - continue; - } - if (soap_flag_MessagingMode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MessagingMode", &a->MessagingMode, "xsd:string")) - { soap_flag_MessagingMode--; - continue; - } - if (soap_flag_AsyncConfiguration && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "AsyncConfiguration", &a->AsyncConfiguration, "xsd:int")) - { soap_flag_AsyncConfiguration--; - continue; - } - if (soap_flag_ReturnDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "ReturnDocInfo", &a->ReturnDocInfo, "xsd:boolean")) - { soap_flag_ReturnDocInfo--; - continue; - } - if (soap_flag_ReturnDocData && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "ReturnDocData", &a->ReturnDocData, "xsd:boolean")) - { soap_flag_ReturnDocData--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0 || soap_flag_AsyncConfiguration > 0 || soap_flag_ReturnDocInfo > 0 || soap_flag_ReturnDocData > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileSign *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileSign, 0, sizeof(struct d__MobileSign), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileSignResponse(struct soap *soap, const struct d__MobileSignResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->StatusCode); - soap_serialize_xsd__string(soap, &a->ChallengeID); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileSignResponse(struct soap *soap, struct d__MobileSignResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->StatusCode); - soap_default_xsd__string(soap, &a->ChallengeID); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileSignResponse(struct soap *soap, const struct d__MobileSignResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__MobileSignResponse); - if (soap_out_d__MobileSignResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileSignResponse(struct soap *soap, const char *tag, int id, const struct d__MobileSignResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__MobileSignResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "StatusCode", -1, &a->StatusCode, ""); - soap_out_xsd__string(soap, "ChallengeID", -1, &a->ChallengeID, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__MobileSignResponse * SOAP_FMAC4 soap_get_d__MobileSignResponse(struct soap *soap, struct d__MobileSignResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__MobileSignResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileSignResponse * SOAP_FMAC4 soap_in_d__MobileSignResponse(struct soap *soap, const char *tag, struct d__MobileSignResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_StatusCode = 1, soap_flag_ChallengeID = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__MobileSignResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__MobileSignResponse, sizeof(struct d__MobileSignResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__MobileSignResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_StatusCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "StatusCode", &a->StatusCode, "xsd:string")) - { soap_flag_StatusCode--; - continue; - } - if (soap_flag_ChallengeID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ChallengeID", &a->ChallengeID, "xsd:string")) - { soap_flag_ChallengeID--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__MobileSignResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__MobileSignResponse, 0, sizeof(struct d__MobileSignResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetVersion(struct soap *soap, const struct d__GetVersion *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetVersion(struct soap *soap, struct d__GetVersion *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetVersion(struct soap *soap, const struct d__GetVersion *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetVersion); - if (soap_out_d__GetVersion(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetVersion(struct soap *soap, const char *tag, int id, const struct d__GetVersion *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetVersion), type); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetVersion * SOAP_FMAC4 soap_get_d__GetVersion(struct soap *soap, struct d__GetVersion *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetVersion(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetVersion * SOAP_FMAC4 soap_in_d__GetVersion(struct soap *soap, const char *tag, struct d__GetVersion *a, const char *type) -{; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetVersion *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetVersion, sizeof(struct d__GetVersion), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetVersion(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetVersion *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetVersion, 0, sizeof(struct d__GetVersion), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetVersionResponse(struct soap *soap, const struct d__GetVersionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Name); - soap_serialize_xsd__string(soap, &a->Version); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetVersionResponse(struct soap *soap, struct d__GetVersionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Name); - soap_default_xsd__string(soap, &a->Version); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetVersionResponse(struct soap *soap, const struct d__GetVersionResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetVersionResponse); - if (soap_out_d__GetVersionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetVersionResponse(struct soap *soap, const char *tag, int id, const struct d__GetVersionResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetVersionResponse), type); - if (a->Name) - soap_element_result(soap, "Name"); - soap_out_xsd__string(soap, "Name", -1, &a->Name, ""); - soap_out_xsd__string(soap, "Version", -1, &a->Version, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetVersionResponse * SOAP_FMAC4 soap_get_d__GetVersionResponse(struct soap *soap, struct d__GetVersionResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetVersionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetVersionResponse * SOAP_FMAC4 soap_in_d__GetVersionResponse(struct soap *soap, const char *tag, struct d__GetVersionResponse *a, const char *type) -{ - short soap_flag_Name = 1, soap_flag_Version = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetVersionResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetVersionResponse, sizeof(struct d__GetVersionResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetVersionResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Name", &a->Name, "xsd:string")) - { soap_flag_Name--; - continue; - } - if (soap_flag_Version && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Version", &a->Version, "xsd:string")) - { soap_flag_Version--; - continue; - } - soap_check_result(soap, "Name"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetVersionResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetVersionResponse, 0, sizeof(struct d__GetVersionResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveSignature(struct soap *soap, const struct d__RemoveSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveSignature(struct soap *soap, struct d__RemoveSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveSignature(struct soap *soap, const struct d__RemoveSignature *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__RemoveSignature); - if (soap_out_d__RemoveSignature(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveSignature(struct soap *soap, const char *tag, int id, const struct d__RemoveSignature *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__RemoveSignature), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__RemoveSignature * SOAP_FMAC4 soap_get_d__RemoveSignature(struct soap *soap, struct d__RemoveSignature *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__RemoveSignature(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveSignature * SOAP_FMAC4 soap_in_d__RemoveSignature(struct soap *soap, const char *tag, struct d__RemoveSignature *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__RemoveSignature *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__RemoveSignature, sizeof(struct d__RemoveSignature), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__RemoveSignature(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__RemoveSignature *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__RemoveSignature, 0, sizeof(struct d__RemoveSignature), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveSignatureResponse(struct soap *soap, const struct d__RemoveSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveSignatureResponse(struct soap *soap, struct d__RemoveSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveSignatureResponse(struct soap *soap, const struct d__RemoveSignatureResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__RemoveSignatureResponse); - if (soap_out_d__RemoveSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveSignatureResponse(struct soap *soap, const char *tag, int id, const struct d__RemoveSignatureResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__RemoveSignatureResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__RemoveSignatureResponse * SOAP_FMAC4 soap_get_d__RemoveSignatureResponse(struct soap *soap, struct d__RemoveSignatureResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__RemoveSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveSignatureResponse * SOAP_FMAC4 soap_in_d__RemoveSignatureResponse(struct soap *soap, const char *tag, struct d__RemoveSignatureResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__RemoveSignatureResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__RemoveSignatureResponse, sizeof(struct d__RemoveSignatureResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__RemoveSignatureResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__RemoveSignatureResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__RemoveSignatureResponse, 0, sizeof(struct d__RemoveSignatureResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__FinalizeSignature(struct soap *soap, const struct d__FinalizeSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); - soap_serialize_xsd__string(soap, &a->SignatureValue); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__FinalizeSignature(struct soap *soap, struct d__FinalizeSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); - soap_default_xsd__string(soap, &a->SignatureValue); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__FinalizeSignature(struct soap *soap, const struct d__FinalizeSignature *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__FinalizeSignature); - if (soap_out_d__FinalizeSignature(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__FinalizeSignature(struct soap *soap, const char *tag, int id, const struct d__FinalizeSignature *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__FinalizeSignature), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_out_xsd__string(soap, "SignatureValue", -1, &a->SignatureValue, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__FinalizeSignature * SOAP_FMAC4 soap_get_d__FinalizeSignature(struct soap *soap, struct d__FinalizeSignature *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__FinalizeSignature(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__FinalizeSignature * SOAP_FMAC4 soap_in_d__FinalizeSignature(struct soap *soap, const char *tag, struct d__FinalizeSignature *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1, soap_flag_SignatureValue = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__FinalizeSignature *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__FinalizeSignature, sizeof(struct d__FinalizeSignature), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__FinalizeSignature(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap_flag_SignatureValue && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureValue", &a->SignatureValue, "xsd:string")) - { soap_flag_SignatureValue--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__FinalizeSignature *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__FinalizeSignature, 0, sizeof(struct d__FinalizeSignature), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__FinalizeSignatureResponse(struct soap *soap, const struct d__FinalizeSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__FinalizeSignatureResponse(struct soap *soap, struct d__FinalizeSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__FinalizeSignatureResponse(struct soap *soap, const struct d__FinalizeSignatureResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__FinalizeSignatureResponse); - if (soap_out_d__FinalizeSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__FinalizeSignatureResponse(struct soap *soap, const char *tag, int id, const struct d__FinalizeSignatureResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__FinalizeSignatureResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__FinalizeSignatureResponse * SOAP_FMAC4 soap_get_d__FinalizeSignatureResponse(struct soap *soap, struct d__FinalizeSignatureResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__FinalizeSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__FinalizeSignatureResponse * SOAP_FMAC4 soap_in_d__FinalizeSignatureResponse(struct soap *soap, const char *tag, struct d__FinalizeSignatureResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__FinalizeSignatureResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__FinalizeSignatureResponse, sizeof(struct d__FinalizeSignatureResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__FinalizeSignatureResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__FinalizeSignatureResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__FinalizeSignatureResponse, 0, sizeof(struct d__FinalizeSignatureResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__PrepareSignature(struct soap *soap, const struct d__PrepareSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignersCertificate); - soap_serialize_xsd__string(soap, &a->SignersTokenId); - soap_serialize_xsd__string(soap, &a->Role); - soap_serialize_xsd__string(soap, &a->City); - soap_serialize_xsd__string(soap, &a->State); - soap_serialize_xsd__string(soap, &a->PostalCode); - soap_serialize_xsd__string(soap, &a->Country); - soap_serialize_xsd__string(soap, &a->SigningProfile); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__PrepareSignature(struct soap *soap, struct d__PrepareSignature *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignersCertificate); - soap_default_xsd__string(soap, &a->SignersTokenId); - soap_default_xsd__string(soap, &a->Role); - soap_default_xsd__string(soap, &a->City); - soap_default_xsd__string(soap, &a->State); - soap_default_xsd__string(soap, &a->PostalCode); - soap_default_xsd__string(soap, &a->Country); - soap_default_xsd__string(soap, &a->SigningProfile); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__PrepareSignature(struct soap *soap, const struct d__PrepareSignature *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__PrepareSignature); - if (soap_out_d__PrepareSignature(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__PrepareSignature(struct soap *soap, const char *tag, int id, const struct d__PrepareSignature *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__PrepareSignature), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignersCertificate", -1, &a->SignersCertificate, ""); - soap_out_xsd__string(soap, "SignersTokenId", -1, &a->SignersTokenId, ""); - soap_out_xsd__string(soap, "Role", -1, &a->Role, ""); - soap_out_xsd__string(soap, "City", -1, &a->City, ""); - soap_out_xsd__string(soap, "State", -1, &a->State, ""); - soap_out_xsd__string(soap, "PostalCode", -1, &a->PostalCode, ""); - soap_out_xsd__string(soap, "Country", -1, &a->Country, ""); - soap_out_xsd__string(soap, "SigningProfile", -1, &a->SigningProfile, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__PrepareSignature * SOAP_FMAC4 soap_get_d__PrepareSignature(struct soap *soap, struct d__PrepareSignature *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__PrepareSignature(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__PrepareSignature * SOAP_FMAC4 soap_in_d__PrepareSignature(struct soap *soap, const char *tag, struct d__PrepareSignature *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignersCertificate = 1, soap_flag_SignersTokenId = 1, soap_flag_Role = 1, soap_flag_City = 1, soap_flag_State = 1, soap_flag_PostalCode = 1, soap_flag_Country = 1, soap_flag_SigningProfile = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__PrepareSignature *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__PrepareSignature, sizeof(struct d__PrepareSignature), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__PrepareSignature(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignersCertificate && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignersCertificate", &a->SignersCertificate, "xsd:string")) - { soap_flag_SignersCertificate--; - continue; - } - if (soap_flag_SignersTokenId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignersTokenId", &a->SignersTokenId, "xsd:string")) - { soap_flag_SignersTokenId--; - continue; - } - if (soap_flag_Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Role", &a->Role, "xsd:string")) - { soap_flag_Role--; - continue; - } - if (soap_flag_City && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "City", &a->City, "xsd:string")) - { soap_flag_City--; - continue; - } - if (soap_flag_State && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "State", &a->State, "xsd:string")) - { soap_flag_State--; - continue; - } - if (soap_flag_PostalCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PostalCode", &a->PostalCode, "xsd:string")) - { soap_flag_PostalCode--; - continue; - } - if (soap_flag_Country && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Country", &a->Country, "xsd:string")) - { soap_flag_Country--; - continue; - } - if (soap_flag_SigningProfile && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SigningProfile", &a->SigningProfile, "xsd:string")) - { soap_flag_SigningProfile--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__PrepareSignature *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__PrepareSignature, 0, sizeof(struct d__PrepareSignature), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__PrepareSignatureResponse(struct soap *soap, const struct d__PrepareSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->SignatureId); - soap_serialize_xsd__string(soap, &a->SignedInfoDigest); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__PrepareSignatureResponse(struct soap *soap, struct d__PrepareSignatureResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->SignatureId); - soap_default_xsd__string(soap, &a->SignedInfoDigest); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__PrepareSignatureResponse(struct soap *soap, const struct d__PrepareSignatureResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__PrepareSignatureResponse); - if (soap_out_d__PrepareSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__PrepareSignatureResponse(struct soap *soap, const char *tag, int id, const struct d__PrepareSignatureResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__PrepareSignatureResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_out_xsd__string(soap, "SignedInfoDigest", -1, &a->SignedInfoDigest, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__PrepareSignatureResponse * SOAP_FMAC4 soap_get_d__PrepareSignatureResponse(struct soap *soap, struct d__PrepareSignatureResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__PrepareSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__PrepareSignatureResponse * SOAP_FMAC4 soap_in_d__PrepareSignatureResponse(struct soap *soap, const char *tag, struct d__PrepareSignatureResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignatureId = 1, soap_flag_SignedInfoDigest = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__PrepareSignatureResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__PrepareSignatureResponse, sizeof(struct d__PrepareSignatureResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__PrepareSignatureResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap_flag_SignedInfoDigest && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignedInfoDigest", &a->SignedInfoDigest, "xsd:string")) - { soap_flag_SignedInfoDigest--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__PrepareSignatureResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__PrepareSignatureResponse, 0, sizeof(struct d__PrepareSignatureResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignatureModules(struct soap *soap, const struct d__GetSignatureModules *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Platform); - soap_serialize_xsd__string(soap, &a->Phase); - soap_serialize_xsd__string(soap, &a->Type); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignatureModules(struct soap *soap, struct d__GetSignatureModules *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->Platform); - soap_default_xsd__string(soap, &a->Phase); - soap_default_xsd__string(soap, &a->Type); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignatureModules(struct soap *soap, const struct d__GetSignatureModules *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignatureModules); - if (soap_out_d__GetSignatureModules(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignatureModules(struct soap *soap, const char *tag, int id, const struct d__GetSignatureModules *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignatureModules), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "Platform", -1, &a->Platform, ""); - soap_out_xsd__string(soap, "Phase", -1, &a->Phase, ""); - soap_out_xsd__string(soap, "Type", -1, &a->Type, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignatureModules * SOAP_FMAC4 soap_get_d__GetSignatureModules(struct soap *soap, struct d__GetSignatureModules *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignatureModules(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignatureModules * SOAP_FMAC4 soap_in_d__GetSignatureModules(struct soap *soap, const char *tag, struct d__GetSignatureModules *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_Platform = 1, soap_flag_Phase = 1, soap_flag_Type = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignatureModules *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignatureModules, sizeof(struct d__GetSignatureModules), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignatureModules(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_Platform && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Platform", &a->Platform, "xsd:string")) - { soap_flag_Platform--; - continue; - } - if (soap_flag_Phase && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Phase", &a->Phase, "xsd:string")) - { soap_flag_Phase--; - continue; - } - if (soap_flag_Type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Type", &a->Type, "xsd:string")) - { soap_flag_Type--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignatureModules *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignatureModules, 0, sizeof(struct d__GetSignatureModules), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignatureModulesResponse(struct soap *soap, const struct d__GetSignatureModulesResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignatureModulesArray(soap, &a->Modules); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignatureModulesResponse(struct soap *soap, struct d__GetSignatureModulesResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->Modules = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignatureModulesResponse(struct soap *soap, const struct d__GetSignatureModulesResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignatureModulesResponse); - if (soap_out_d__GetSignatureModulesResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignatureModulesResponse(struct soap *soap, const char *tag, int id, const struct d__GetSignatureModulesResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignatureModulesResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignatureModulesArray(soap, "Modules", -1, &a->Modules, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignatureModulesResponse * SOAP_FMAC4 soap_get_d__GetSignatureModulesResponse(struct soap *soap, struct d__GetSignatureModulesResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignatureModulesResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignatureModulesResponse * SOAP_FMAC4 soap_in_d__GetSignatureModulesResponse(struct soap *soap, const char *tag, struct d__GetSignatureModulesResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_Modules = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignatureModulesResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignatureModulesResponse, sizeof(struct d__GetSignatureModulesResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignatureModulesResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_Modules && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignatureModulesArray(soap, "Modules", &a->Modules, "d:SignatureModulesArray")) - { soap_flag_Modules--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignatureModulesResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignatureModulesResponse, 0, sizeof(struct d__GetSignatureModulesResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureModulesArray(struct soap *soap, const struct d__SignatureModulesArray *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - if (a->__ptrModules) - { int i; - for (i = 0; i < a->__sizeOfModules; i++) - { - soap_embedded(soap, a->__ptrModules + i, SOAP_TYPE_d__SignatureModule); - soap_serialize_d__SignatureModule(soap, a->__ptrModules + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureModulesArray(struct soap *soap, struct d__SignatureModulesArray *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - a->__sizeOfModules = 0; - a->__ptrModules = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureModulesArray(struct soap *soap, const struct d__SignatureModulesArray *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignatureModulesArray); - if (soap_out_d__SignatureModulesArray(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureModulesArray(struct soap *soap, const char *tag, int id, const struct d__SignatureModulesArray *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignatureModulesArray), type); - if (a->__ptrModules) - { int i; - for (i = 0; i < a->__sizeOfModules; i++) - soap_out_d__SignatureModule(soap, "Modules", -1, a->__ptrModules + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignatureModulesArray * SOAP_FMAC4 soap_get_d__SignatureModulesArray(struct soap *soap, struct d__SignatureModulesArray *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignatureModulesArray(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureModulesArray * SOAP_FMAC4 soap_in_d__SignatureModulesArray(struct soap *soap, const char *tag, struct d__SignatureModulesArray *a, const char *type) -{ - short soap_flag___ptrModules = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignatureModulesArray *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignatureModulesArray, sizeof(struct d__SignatureModulesArray), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignatureModulesArray(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag___ptrModules && soap->error == SOAP_TAG_MISMATCH) - { struct d__SignatureModule *p; - soap_new_block(soap); - for (a->__sizeOfModules = 0; !soap_element_begin_in(soap, "Modules", 1, NULL); a->__sizeOfModules++) - { p = (struct d__SignatureModule *)soap_push_block(soap, sizeof(struct d__SignatureModule)); - soap_default_d__SignatureModule(soap, p); - soap_revert(soap); - if (!soap_in_d__SignatureModule(soap, "Modules", p, "d:SignatureModule")) - break; - soap_flag___ptrModules = 0; - } - a->__ptrModules = (struct d__SignatureModule *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrModules && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignatureModulesArray *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignatureModulesArray, 0, sizeof(struct d__SignatureModulesArray), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureModule(struct soap *soap, const struct d__SignatureModule *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Name); - soap_serialize_xsd__string(soap, &a->Type); - soap_serialize_xsd__string(soap, &a->Location); - soap_serialize_xsd__string(soap, &a->ContentType); - soap_serialize_xsd__string(soap, &a->Content); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureModule(struct soap *soap, struct d__SignatureModule *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Name); - soap_default_xsd__string(soap, &a->Type); - soap_default_xsd__string(soap, &a->Location); - soap_default_xsd__string(soap, &a->ContentType); - soap_default_xsd__string(soap, &a->Content); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureModule(struct soap *soap, const struct d__SignatureModule *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignatureModule); - if (soap_out_d__SignatureModule(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureModule(struct soap *soap, const char *tag, int id, const struct d__SignatureModule *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignatureModule), type); - soap_out_xsd__string(soap, "Name", -1, &a->Name, ""); - soap_out_xsd__string(soap, "Type", -1, &a->Type, ""); - soap_out_xsd__string(soap, "Location", -1, &a->Location, ""); - soap_out_xsd__string(soap, "ContentType", -1, &a->ContentType, ""); - soap_out_xsd__string(soap, "Content", -1, &a->Content, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignatureModule * SOAP_FMAC4 soap_get_d__SignatureModule(struct soap *soap, struct d__SignatureModule *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignatureModule(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureModule * SOAP_FMAC4 soap_in_d__SignatureModule(struct soap *soap, const char *tag, struct d__SignatureModule *a, const char *type) -{ - short soap_flag_Name = 1, soap_flag_Type = 1, soap_flag_Location = 1, soap_flag_ContentType = 1, soap_flag_Content = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignatureModule *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignatureModule, sizeof(struct d__SignatureModule), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignatureModule(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Name", &a->Name, "xsd:string")) - { soap_flag_Name--; - continue; - } - if (soap_flag_Type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Type", &a->Type, "xsd:string")) - { soap_flag_Type--; - continue; - } - if (soap_flag_Location && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Location", &a->Location, "xsd:string")) - { soap_flag_Location--; - continue; - } - if (soap_flag_ContentType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ContentType", &a->ContentType, "xsd:string")) - { soap_flag_ContentType--; - continue; - } - if (soap_flag_Content && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Content", &a->Content, "xsd:string")) - { soap_flag_Content--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignatureModule *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignatureModule, 0, sizeof(struct d__SignatureModule), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetCRL(struct soap *soap, const struct d__GetCRL *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetCRL(struct soap *soap, struct d__GetCRL *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetCRL(struct soap *soap, const struct d__GetCRL *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetCRL); - if (soap_out_d__GetCRL(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetCRL(struct soap *soap, const char *tag, int id, const struct d__GetCRL *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetCRL), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetCRL * SOAP_FMAC4 soap_get_d__GetCRL(struct soap *soap, struct d__GetCRL *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetCRL(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetCRL * SOAP_FMAC4 soap_in_d__GetCRL(struct soap *soap, const char *tag, struct d__GetCRL *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetCRL *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetCRL, sizeof(struct d__GetCRL), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetCRL(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetCRL *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetCRL, 0, sizeof(struct d__GetCRL), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetCRLResponse(struct soap *soap, const struct d__GetCRLResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->CRLData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetCRLResponse(struct soap *soap, struct d__GetCRLResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->CRLData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetCRLResponse(struct soap *soap, const struct d__GetCRLResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetCRLResponse); - if (soap_out_d__GetCRLResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetCRLResponse(struct soap *soap, const char *tag, int id, const struct d__GetCRLResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetCRLResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "CRLData", -1, &a->CRLData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetCRLResponse * SOAP_FMAC4 soap_get_d__GetCRLResponse(struct soap *soap, struct d__GetCRLResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetCRLResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetCRLResponse * SOAP_FMAC4 soap_in_d__GetCRLResponse(struct soap *soap, const char *tag, struct d__GetCRLResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_CRLData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetCRLResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetCRLResponse, sizeof(struct d__GetCRLResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetCRLResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_CRLData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CRLData", &a->CRLData, "xsd:string")) - { soap_flag_CRLData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetCRLResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetCRLResponse, 0, sizeof(struct d__GetCRLResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTimestamp(struct soap *soap, const struct d__GetTimestamp *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->TimestampId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTimestamp(struct soap *soap, struct d__GetTimestamp *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->TimestampId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTimestamp(struct soap *soap, const struct d__GetTimestamp *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetTimestamp); - if (soap_out_d__GetTimestamp(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTimestamp(struct soap *soap, const char *tag, int id, const struct d__GetTimestamp *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetTimestamp), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "TimestampId", -1, &a->TimestampId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetTimestamp * SOAP_FMAC4 soap_get_d__GetTimestamp(struct soap *soap, struct d__GetTimestamp *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetTimestamp(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTimestamp * SOAP_FMAC4 soap_in_d__GetTimestamp(struct soap *soap, const char *tag, struct d__GetTimestamp *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_TimestampId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetTimestamp *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetTimestamp, sizeof(struct d__GetTimestamp), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetTimestamp(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_TimestampId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "TimestampId", &a->TimestampId, "xsd:string")) - { soap_flag_TimestampId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetTimestamp *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetTimestamp, 0, sizeof(struct d__GetTimestamp), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTimestampResponse(struct soap *soap, const struct d__GetTimestampResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->TimestampData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTimestampResponse(struct soap *soap, struct d__GetTimestampResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->TimestampData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTimestampResponse(struct soap *soap, const struct d__GetTimestampResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetTimestampResponse); - if (soap_out_d__GetTimestampResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTimestampResponse(struct soap *soap, const char *tag, int id, const struct d__GetTimestampResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetTimestampResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "TimestampData", -1, &a->TimestampData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetTimestampResponse * SOAP_FMAC4 soap_get_d__GetTimestampResponse(struct soap *soap, struct d__GetTimestampResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetTimestampResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTimestampResponse * SOAP_FMAC4 soap_in_d__GetTimestampResponse(struct soap *soap, const char *tag, struct d__GetTimestampResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_TimestampData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetTimestampResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetTimestampResponse, sizeof(struct d__GetTimestampResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetTimestampResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_TimestampData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "TimestampData", &a->TimestampData, "xsd:string")) - { soap_flag_TimestampData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetTimestampResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetTimestampResponse, 0, sizeof(struct d__GetTimestampResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTSACertificate(struct soap *soap, const struct d__GetTSACertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->TimestampId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTSACertificate(struct soap *soap, struct d__GetTSACertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->TimestampId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTSACertificate(struct soap *soap, const struct d__GetTSACertificate *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetTSACertificate); - if (soap_out_d__GetTSACertificate(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTSACertificate(struct soap *soap, const char *tag, int id, const struct d__GetTSACertificate *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetTSACertificate), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "TimestampId", -1, &a->TimestampId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetTSACertificate * SOAP_FMAC4 soap_get_d__GetTSACertificate(struct soap *soap, struct d__GetTSACertificate *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetTSACertificate(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTSACertificate * SOAP_FMAC4 soap_in_d__GetTSACertificate(struct soap *soap, const char *tag, struct d__GetTSACertificate *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_TimestampId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetTSACertificate *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetTSACertificate, sizeof(struct d__GetTSACertificate), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetTSACertificate(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_TimestampId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "TimestampId", &a->TimestampId, "xsd:string")) - { soap_flag_TimestampId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetTSACertificate *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetTSACertificate, 0, sizeof(struct d__GetTSACertificate), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTSACertificateResponse(struct soap *soap, const struct d__GetTSACertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTSACertificateResponse(struct soap *soap, struct d__GetTSACertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTSACertificateResponse(struct soap *soap, const struct d__GetTSACertificateResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetTSACertificateResponse); - if (soap_out_d__GetTSACertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTSACertificateResponse(struct soap *soap, const char *tag, int id, const struct d__GetTSACertificateResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetTSACertificateResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "CertificateData", -1, &a->CertificateData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetTSACertificateResponse * SOAP_FMAC4 soap_get_d__GetTSACertificateResponse(struct soap *soap, struct d__GetTSACertificateResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetTSACertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTSACertificateResponse * SOAP_FMAC4 soap_in_d__GetTSACertificateResponse(struct soap *soap, const char *tag, struct d__GetTSACertificateResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_CertificateData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetTSACertificateResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetTSACertificateResponse, sizeof(struct d__GetTSACertificateResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetTSACertificateResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_CertificateData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CertificateData", &a->CertificateData, "xsd:string")) - { soap_flag_CertificateData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetTSACertificateResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetTSACertificateResponse, 0, sizeof(struct d__GetTSACertificateResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotary(struct soap *soap, const struct d__GetNotary *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotary(struct soap *soap, struct d__GetNotary *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotary(struct soap *soap, const struct d__GetNotary *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetNotary); - if (soap_out_d__GetNotary(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotary(struct soap *soap, const char *tag, int id, const struct d__GetNotary *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetNotary), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetNotary * SOAP_FMAC4 soap_get_d__GetNotary(struct soap *soap, struct d__GetNotary *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetNotary(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotary * SOAP_FMAC4 soap_in_d__GetNotary(struct soap *soap, const char *tag, struct d__GetNotary *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetNotary *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetNotary, sizeof(struct d__GetNotary), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetNotary(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetNotary *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetNotary, 0, sizeof(struct d__GetNotary), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotaryResponse(struct soap *soap, const struct d__GetNotaryResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->OcspData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotaryResponse(struct soap *soap, struct d__GetNotaryResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->OcspData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotaryResponse(struct soap *soap, const struct d__GetNotaryResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetNotaryResponse); - if (soap_out_d__GetNotaryResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotaryResponse(struct soap *soap, const char *tag, int id, const struct d__GetNotaryResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetNotaryResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "OcspData", -1, &a->OcspData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetNotaryResponse * SOAP_FMAC4 soap_get_d__GetNotaryResponse(struct soap *soap, struct d__GetNotaryResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetNotaryResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotaryResponse * SOAP_FMAC4 soap_in_d__GetNotaryResponse(struct soap *soap, const char *tag, struct d__GetNotaryResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_OcspData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetNotaryResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetNotaryResponse, sizeof(struct d__GetNotaryResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetNotaryResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_OcspData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "OcspData", &a->OcspData, "xsd:string")) - { soap_flag_OcspData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetNotaryResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetNotaryResponse, 0, sizeof(struct d__GetNotaryResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotarysCertificate(struct soap *soap, const struct d__GetNotarysCertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotarysCertificate(struct soap *soap, struct d__GetNotarysCertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotarysCertificate(struct soap *soap, const struct d__GetNotarysCertificate *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetNotarysCertificate); - if (soap_out_d__GetNotarysCertificate(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotarysCertificate(struct soap *soap, const char *tag, int id, const struct d__GetNotarysCertificate *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetNotarysCertificate), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetNotarysCertificate * SOAP_FMAC4 soap_get_d__GetNotarysCertificate(struct soap *soap, struct d__GetNotarysCertificate *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetNotarysCertificate(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotarysCertificate * SOAP_FMAC4 soap_in_d__GetNotarysCertificate(struct soap *soap, const char *tag, struct d__GetNotarysCertificate *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetNotarysCertificate *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetNotarysCertificate, sizeof(struct d__GetNotarysCertificate), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetNotarysCertificate(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetNotarysCertificate *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetNotarysCertificate, 0, sizeof(struct d__GetNotarysCertificate), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotarysCertificateResponse(struct soap *soap, const struct d__GetNotarysCertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotarysCertificateResponse(struct soap *soap, struct d__GetNotarysCertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotarysCertificateResponse(struct soap *soap, const struct d__GetNotarysCertificateResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetNotarysCertificateResponse); - if (soap_out_d__GetNotarysCertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotarysCertificateResponse(struct soap *soap, const char *tag, int id, const struct d__GetNotarysCertificateResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetNotarysCertificateResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "CertificateData", -1, &a->CertificateData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetNotarysCertificateResponse * SOAP_FMAC4 soap_get_d__GetNotarysCertificateResponse(struct soap *soap, struct d__GetNotarysCertificateResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetNotarysCertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotarysCertificateResponse * SOAP_FMAC4 soap_in_d__GetNotarysCertificateResponse(struct soap *soap, const char *tag, struct d__GetNotarysCertificateResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_CertificateData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetNotarysCertificateResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetNotarysCertificateResponse, sizeof(struct d__GetNotarysCertificateResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetNotarysCertificateResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_CertificateData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CertificateData", &a->CertificateData, "xsd:string")) - { soap_flag_CertificateData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetNotarysCertificateResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetNotarysCertificateResponse, 0, sizeof(struct d__GetNotarysCertificateResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignersCertificate(struct soap *soap, const struct d__GetSignersCertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignersCertificate(struct soap *soap, struct d__GetSignersCertificate *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->SignatureId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignersCertificate(struct soap *soap, const struct d__GetSignersCertificate *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignersCertificate); - if (soap_out_d__GetSignersCertificate(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignersCertificate(struct soap *soap, const char *tag, int id, const struct d__GetSignersCertificate *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignersCertificate), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "SignatureId", -1, &a->SignatureId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignersCertificate * SOAP_FMAC4 soap_get_d__GetSignersCertificate(struct soap *soap, struct d__GetSignersCertificate *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignersCertificate(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignersCertificate * SOAP_FMAC4 soap_in_d__GetSignersCertificate(struct soap *soap, const char *tag, struct d__GetSignersCertificate *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_SignatureId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignersCertificate *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignersCertificate, sizeof(struct d__GetSignersCertificate), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignersCertificate(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignatureId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignatureId", &a->SignatureId, "xsd:string")) - { soap_flag_SignatureId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignersCertificate *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignersCertificate, 0, sizeof(struct d__GetSignersCertificate), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignersCertificateResponse(struct soap *soap, const struct d__GetSignersCertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignersCertificateResponse(struct soap *soap, struct d__GetSignersCertificateResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->CertificateData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignersCertificateResponse(struct soap *soap, const struct d__GetSignersCertificateResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignersCertificateResponse); - if (soap_out_d__GetSignersCertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignersCertificateResponse(struct soap *soap, const char *tag, int id, const struct d__GetSignersCertificateResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignersCertificateResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "CertificateData", -1, &a->CertificateData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignersCertificateResponse * SOAP_FMAC4 soap_get_d__GetSignersCertificateResponse(struct soap *soap, struct d__GetSignersCertificateResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignersCertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignersCertificateResponse * SOAP_FMAC4 soap_in_d__GetSignersCertificateResponse(struct soap *soap, const char *tag, struct d__GetSignersCertificateResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_CertificateData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignersCertificateResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignersCertificateResponse, sizeof(struct d__GetSignersCertificateResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignersCertificateResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_CertificateData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CertificateData", &a->CertificateData, "xsd:string")) - { soap_flag_CertificateData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignersCertificateResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignersCertificateResponse, 0, sizeof(struct d__GetSignersCertificateResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetDataFile(struct soap *soap, const struct d__GetDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->DataFileId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetDataFile(struct soap *soap, struct d__GetDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->DataFileId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetDataFile(struct soap *soap, const struct d__GetDataFile *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetDataFile); - if (soap_out_d__GetDataFile(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetDataFile(struct soap *soap, const char *tag, int id, const struct d__GetDataFile *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetDataFile), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "DataFileId", -1, &a->DataFileId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetDataFile * SOAP_FMAC4 soap_get_d__GetDataFile(struct soap *soap, struct d__GetDataFile *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetDataFile(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetDataFile * SOAP_FMAC4 soap_in_d__GetDataFile(struct soap *soap, const char *tag, struct d__GetDataFile *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_DataFileId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetDataFile *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetDataFile, sizeof(struct d__GetDataFile), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetDataFile(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_DataFileId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DataFileId", &a->DataFileId, "xsd:string")) - { soap_flag_DataFileId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetDataFile *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetDataFile, 0, sizeof(struct d__GetDataFile), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetDataFileResponse(struct soap *soap, const struct d__GetDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__DataFileData(soap, &a->DataFileData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetDataFileResponse(struct soap *soap, struct d__GetDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->DataFileData = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetDataFileResponse(struct soap *soap, const struct d__GetDataFileResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetDataFileResponse); - if (soap_out_d__GetDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetDataFileResponse(struct soap *soap, const char *tag, int id, const struct d__GetDataFileResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetDataFileResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__DataFileData(soap, "DataFileData", -1, &a->DataFileData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetDataFileResponse * SOAP_FMAC4 soap_get_d__GetDataFileResponse(struct soap *soap, struct d__GetDataFileResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetDataFileResponse * SOAP_FMAC4 soap_in_d__GetDataFileResponse(struct soap *soap, const char *tag, struct d__GetDataFileResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_DataFileData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetDataFileResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetDataFileResponse, sizeof(struct d__GetDataFileResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetDataFileResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_DataFileData && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__DataFileData(soap, "DataFileData", &a->DataFileData, "d:DataFileData")) - { soap_flag_DataFileData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetDataFileResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetDataFileResponse, 0, sizeof(struct d__GetDataFileResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocInfo(struct soap *soap, const struct d__GetSignedDocInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocInfo(struct soap *soap, struct d__GetSignedDocInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocInfo(struct soap *soap, const struct d__GetSignedDocInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignedDocInfo); - if (soap_out_d__GetSignedDocInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocInfo(struct soap *soap, const char *tag, int id, const struct d__GetSignedDocInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignedDocInfo), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignedDocInfo * SOAP_FMAC4 soap_get_d__GetSignedDocInfo(struct soap *soap, struct d__GetSignedDocInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignedDocInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDocInfo * SOAP_FMAC4 soap_in_d__GetSignedDocInfo(struct soap *soap, const char *tag, struct d__GetSignedDocInfo *a, const char *type) -{ - short soap_flag_Sesscode = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignedDocInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignedDocInfo, sizeof(struct d__GetSignedDocInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignedDocInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignedDocInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignedDocInfo, 0, sizeof(struct d__GetSignedDocInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocInfoResponse(struct soap *soap, const struct d__GetSignedDocInfoResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocInfoResponse(struct soap *soap, struct d__GetSignedDocInfoResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocInfoResponse(struct soap *soap, const struct d__GetSignedDocInfoResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignedDocInfoResponse); - if (soap_out_d__GetSignedDocInfoResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocInfoResponse(struct soap *soap, const char *tag, int id, const struct d__GetSignedDocInfoResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignedDocInfoResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignedDocInfoResponse * SOAP_FMAC4 soap_get_d__GetSignedDocInfoResponse(struct soap *soap, struct d__GetSignedDocInfoResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignedDocInfoResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDocInfoResponse * SOAP_FMAC4 soap_in_d__GetSignedDocInfoResponse(struct soap *soap, const char *tag, struct d__GetSignedDocInfoResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignedDocInfoResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignedDocInfoResponse, sizeof(struct d__GetSignedDocInfoResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignedDocInfoResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignedDocInfoResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignedDocInfoResponse, 0, sizeof(struct d__GetSignedDocInfoResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDoc(struct soap *soap, const struct d__GetSignedDoc *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDoc(struct soap *soap, struct d__GetSignedDoc *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDoc(struct soap *soap, const struct d__GetSignedDoc *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignedDoc); - if (soap_out_d__GetSignedDoc(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDoc(struct soap *soap, const char *tag, int id, const struct d__GetSignedDoc *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignedDoc), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignedDoc * SOAP_FMAC4 soap_get_d__GetSignedDoc(struct soap *soap, struct d__GetSignedDoc *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignedDoc(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDoc * SOAP_FMAC4 soap_in_d__GetSignedDoc(struct soap *soap, const char *tag, struct d__GetSignedDoc *a, const char *type) -{ - short soap_flag_Sesscode = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignedDoc *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignedDoc, sizeof(struct d__GetSignedDoc), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignedDoc(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignedDoc *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignedDoc, 0, sizeof(struct d__GetSignedDoc), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocResponse(struct soap *soap, const struct d__GetSignedDocResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_xsd__string(soap, &a->SignedDocData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocResponse(struct soap *soap, struct d__GetSignedDocResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__string(soap, &a->SignedDocData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocResponse(struct soap *soap, const struct d__GetSignedDocResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__GetSignedDocResponse); - if (soap_out_d__GetSignedDocResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocResponse(struct soap *soap, const char *tag, int id, const struct d__GetSignedDocResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__GetSignedDocResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__string(soap, "SignedDocData", -1, &a->SignedDocData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__GetSignedDocResponse * SOAP_FMAC4 soap_get_d__GetSignedDocResponse(struct soap *soap, struct d__GetSignedDocResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__GetSignedDocResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDocResponse * SOAP_FMAC4 soap_in_d__GetSignedDocResponse(struct soap *soap, const char *tag, struct d__GetSignedDocResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__GetSignedDocResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__GetSignedDocResponse, sizeof(struct d__GetSignedDocResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__GetSignedDocResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SignedDocData", &a->SignedDocData, "xsd:string")) - { soap_flag_SignedDocData--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__GetSignedDocResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__GetSignedDocResponse, 0, sizeof(struct d__GetSignedDocResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveDataFile(struct soap *soap, const struct d__RemoveDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->DataFileId); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveDataFile(struct soap *soap, struct d__RemoveDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->DataFileId); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveDataFile(struct soap *soap, const struct d__RemoveDataFile *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__RemoveDataFile); - if (soap_out_d__RemoveDataFile(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveDataFile(struct soap *soap, const char *tag, int id, const struct d__RemoveDataFile *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__RemoveDataFile), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "DataFileId", -1, &a->DataFileId, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__RemoveDataFile * SOAP_FMAC4 soap_get_d__RemoveDataFile(struct soap *soap, struct d__RemoveDataFile *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__RemoveDataFile(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveDataFile * SOAP_FMAC4 soap_in_d__RemoveDataFile(struct soap *soap, const char *tag, struct d__RemoveDataFile *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_DataFileId = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__RemoveDataFile *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__RemoveDataFile, sizeof(struct d__RemoveDataFile), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__RemoveDataFile(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_DataFileId && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DataFileId", &a->DataFileId, "xsd:string")) - { soap_flag_DataFileId--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__RemoveDataFile *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__RemoveDataFile, 0, sizeof(struct d__RemoveDataFile), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveDataFileResponse(struct soap *soap, const struct d__RemoveDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveDataFileResponse(struct soap *soap, struct d__RemoveDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveDataFileResponse(struct soap *soap, const struct d__RemoveDataFileResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__RemoveDataFileResponse); - if (soap_out_d__RemoveDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveDataFileResponse(struct soap *soap, const char *tag, int id, const struct d__RemoveDataFileResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__RemoveDataFileResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__RemoveDataFileResponse * SOAP_FMAC4 soap_get_d__RemoveDataFileResponse(struct soap *soap, struct d__RemoveDataFileResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__RemoveDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveDataFileResponse * SOAP_FMAC4 soap_in_d__RemoveDataFileResponse(struct soap *soap, const char *tag, struct d__RemoveDataFileResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__RemoveDataFileResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__RemoveDataFileResponse, sizeof(struct d__RemoveDataFileResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__RemoveDataFileResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__RemoveDataFileResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__RemoveDataFileResponse, 0, sizeof(struct d__RemoveDataFileResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__AddDataFile(struct soap *soap, const struct d__AddDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->FileName); - soap_serialize_xsd__string(soap, &a->MimeType); - soap_serialize_xsd__string(soap, &a->ContentType); - soap_serialize_xsd__string(soap, &a->DigestType); - soap_serialize_xsd__string(soap, &a->DigestValue); - soap_serialize_xsd__string(soap, &a->Content); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__AddDataFile(struct soap *soap, struct d__AddDataFile *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->FileName); - soap_default_xsd__string(soap, &a->MimeType); - soap_default_xsd__string(soap, &a->ContentType); - soap_default_xsd__int(soap, &a->Size); - soap_default_xsd__string(soap, &a->DigestType); - soap_default_xsd__string(soap, &a->DigestValue); - soap_default_xsd__string(soap, &a->Content); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__AddDataFile(struct soap *soap, const struct d__AddDataFile *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__AddDataFile); - if (soap_out_d__AddDataFile(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__AddDataFile(struct soap *soap, const char *tag, int id, const struct d__AddDataFile *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__AddDataFile), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "FileName", -1, &a->FileName, ""); - soap_out_xsd__string(soap, "MimeType", -1, &a->MimeType, ""); - soap_out_xsd__string(soap, "ContentType", -1, &a->ContentType, ""); - soap_out_xsd__int(soap, "Size", -1, &a->Size, ""); - soap_out_xsd__string(soap, "DigestType", -1, &a->DigestType, ""); - soap_out_xsd__string(soap, "DigestValue", -1, &a->DigestValue, ""); - soap_out_xsd__string(soap, "Content", -1, &a->Content, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__AddDataFile * SOAP_FMAC4 soap_get_d__AddDataFile(struct soap *soap, struct d__AddDataFile *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__AddDataFile(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__AddDataFile * SOAP_FMAC4 soap_in_d__AddDataFile(struct soap *soap, const char *tag, struct d__AddDataFile *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_FileName = 1, soap_flag_MimeType = 1, soap_flag_ContentType = 1, soap_flag_Size = 1, soap_flag_DigestType = 1, soap_flag_DigestValue = 1, soap_flag_Content = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__AddDataFile *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__AddDataFile, sizeof(struct d__AddDataFile), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__AddDataFile(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_FileName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "FileName", &a->FileName, "xsd:string")) - { soap_flag_FileName--; - continue; - } - if (soap_flag_MimeType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MimeType", &a->MimeType, "xsd:string")) - { soap_flag_MimeType--; - continue; - } - if (soap_flag_ContentType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ContentType", &a->ContentType, "xsd:string")) - { soap_flag_ContentType--; - continue; - } - if (soap_flag_Size && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Size", &a->Size, "xsd:int")) - { soap_flag_Size--; - continue; - } - if (soap_flag_DigestType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestType", &a->DigestType, "xsd:string")) - { soap_flag_DigestType--; - continue; - } - if (soap_flag_DigestValue && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestValue", &a->DigestValue, "xsd:string")) - { soap_flag_DigestValue--; - continue; - } - if (soap_flag_Content && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Content", &a->Content, "xsd:string")) - { soap_flag_Content--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0 || soap_flag_Size > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__AddDataFile *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__AddDataFile, 0, sizeof(struct d__AddDataFile), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__AddDataFileResponse(struct soap *soap, const struct d__AddDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__AddDataFileResponse(struct soap *soap, struct d__AddDataFileResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__AddDataFileResponse(struct soap *soap, const struct d__AddDataFileResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__AddDataFileResponse); - if (soap_out_d__AddDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__AddDataFileResponse(struct soap *soap, const char *tag, int id, const struct d__AddDataFileResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__AddDataFileResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__AddDataFileResponse * SOAP_FMAC4 soap_get_d__AddDataFileResponse(struct soap *soap, struct d__AddDataFileResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__AddDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__AddDataFileResponse * SOAP_FMAC4 soap_in_d__AddDataFileResponse(struct soap *soap, const char *tag, struct d__AddDataFileResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__AddDataFileResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__AddDataFileResponse, sizeof(struct d__AddDataFileResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__AddDataFileResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__AddDataFileResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__AddDataFileResponse, 0, sizeof(struct d__AddDataFileResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CreateSignedDoc(struct soap *soap, const struct d__CreateSignedDoc *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Format); - soap_serialize_xsd__string(soap, &a->Version); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CreateSignedDoc(struct soap *soap, struct d__CreateSignedDoc *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); - soap_default_xsd__string(soap, &a->Format); - soap_default_xsd__string(soap, &a->Version); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CreateSignedDoc(struct soap *soap, const struct d__CreateSignedDoc *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CreateSignedDoc); - if (soap_out_d__CreateSignedDoc(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CreateSignedDoc(struct soap *soap, const char *tag, int id, const struct d__CreateSignedDoc *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CreateSignedDoc), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_xsd__string(soap, "Format", -1, &a->Format, ""); - soap_out_xsd__string(soap, "Version", -1, &a->Version, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CreateSignedDoc * SOAP_FMAC4 soap_get_d__CreateSignedDoc(struct soap *soap, struct d__CreateSignedDoc *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CreateSignedDoc(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CreateSignedDoc * SOAP_FMAC4 soap_in_d__CreateSignedDoc(struct soap *soap, const char *tag, struct d__CreateSignedDoc *a, const char *type) -{ - short soap_flag_Sesscode = 1, soap_flag_Format = 1, soap_flag_Version = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CreateSignedDoc *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CreateSignedDoc, sizeof(struct d__CreateSignedDoc), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CreateSignedDoc(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_Format && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Format", &a->Format, "xsd:string")) - { soap_flag_Format--; - continue; - } - if (soap_flag_Version && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Version", &a->Version, "xsd:string")) - { soap_flag_Version--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CreateSignedDoc *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CreateSignedDoc, 0, sizeof(struct d__CreateSignedDoc), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CreateSignedDocResponse(struct soap *soap, const struct d__CreateSignedDocResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CreateSignedDocResponse(struct soap *soap, struct d__CreateSignedDocResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CreateSignedDocResponse(struct soap *soap, const struct d__CreateSignedDocResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CreateSignedDocResponse); - if (soap_out_d__CreateSignedDocResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CreateSignedDocResponse(struct soap *soap, const char *tag, int id, const struct d__CreateSignedDocResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CreateSignedDocResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CreateSignedDocResponse * SOAP_FMAC4 soap_get_d__CreateSignedDocResponse(struct soap *soap, struct d__CreateSignedDocResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CreateSignedDocResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CreateSignedDocResponse * SOAP_FMAC4 soap_in_d__CreateSignedDocResponse(struct soap *soap, const char *tag, struct d__CreateSignedDocResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CreateSignedDocResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CreateSignedDocResponse, sizeof(struct d__CreateSignedDocResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CreateSignedDocResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CreateSignedDocResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CreateSignedDocResponse, 0, sizeof(struct d__CreateSignedDocResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CloseSession(struct soap *soap, const struct d__CloseSession *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CloseSession(struct soap *soap, struct d__CloseSession *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Sesscode); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CloseSession(struct soap *soap, const struct d__CloseSession *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CloseSession); - if (soap_out_d__CloseSession(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CloseSession(struct soap *soap, const char *tag, int id, const struct d__CloseSession *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CloseSession), type); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CloseSession * SOAP_FMAC4 soap_get_d__CloseSession(struct soap *soap, struct d__CloseSession *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CloseSession(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CloseSession * SOAP_FMAC4 soap_in_d__CloseSession(struct soap *soap, const char *tag, struct d__CloseSession *a, const char *type) -{ - short soap_flag_Sesscode = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CloseSession *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CloseSession, sizeof(struct d__CloseSession), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CloseSession(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CloseSession *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CloseSession, 0, sizeof(struct d__CloseSession), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CloseSessionResponse(struct soap *soap, const struct d__CloseSessionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CloseSessionResponse(struct soap *soap, struct d__CloseSessionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CloseSessionResponse(struct soap *soap, const struct d__CloseSessionResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CloseSessionResponse); - if (soap_out_d__CloseSessionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CloseSessionResponse(struct soap *soap, const char *tag, int id, const struct d__CloseSessionResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CloseSessionResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CloseSessionResponse * SOAP_FMAC4 soap_get_d__CloseSessionResponse(struct soap *soap, struct d__CloseSessionResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CloseSessionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CloseSessionResponse * SOAP_FMAC4 soap_in_d__CloseSessionResponse(struct soap *soap, const char *tag, struct d__CloseSessionResponse *a, const char *type) -{ - short soap_flag_Status = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CloseSessionResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CloseSessionResponse, sizeof(struct d__CloseSessionResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CloseSessionResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CloseSessionResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CloseSessionResponse, 0, sizeof(struct d__CloseSessionResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__StartSession(struct soap *soap, const struct d__StartSession *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SigningProfile); - soap_serialize_xsd__string(soap, &a->SigDocXML); - soap_serialize_PointerTod__DataFileData(soap, &a->datafile); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__StartSession(struct soap *soap, struct d__StartSession *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->SigningProfile); - soap_default_xsd__string(soap, &a->SigDocXML); - soap_default_xsd__boolean(soap, &a->bHoldSession); - a->datafile = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__StartSession(struct soap *soap, const struct d__StartSession *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__StartSession); - if (soap_out_d__StartSession(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__StartSession(struct soap *soap, const char *tag, int id, const struct d__StartSession *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__StartSession), type); - soap_out_xsd__string(soap, "SigningProfile", -1, &a->SigningProfile, ""); - soap_out_xsd__string(soap, "SigDocXML", -1, &a->SigDocXML, ""); - soap_out_xsd__boolean(soap, "bHoldSession", -1, &a->bHoldSession, ""); - soap_out_PointerTod__DataFileData(soap, "datafile", -1, &a->datafile, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__StartSession * SOAP_FMAC4 soap_get_d__StartSession(struct soap *soap, struct d__StartSession *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__StartSession(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__StartSession * SOAP_FMAC4 soap_in_d__StartSession(struct soap *soap, const char *tag, struct d__StartSession *a, const char *type) -{ - short soap_flag_SigningProfile = 1, soap_flag_SigDocXML = 1, soap_flag_bHoldSession = 1, soap_flag_datafile = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__StartSession *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__StartSession, sizeof(struct d__StartSession), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__StartSession(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_SigningProfile && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SigningProfile", &a->SigningProfile, "xsd:string")) - { soap_flag_SigningProfile--; - continue; - } - if (soap_flag_SigDocXML && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SigDocXML", &a->SigDocXML, "xsd:string")) - { soap_flag_SigDocXML--; - continue; - } - if (soap_flag_bHoldSession && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "bHoldSession", &a->bHoldSession, "xsd:boolean")) - { soap_flag_bHoldSession--; - continue; - } - if (soap_flag_datafile && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__DataFileData(soap, "datafile", &a->datafile, "d:DataFileData")) - { soap_flag_datafile--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_bHoldSession > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__StartSession *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__StartSession, 0, sizeof(struct d__StartSession), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__StartSessionResponse(struct soap *soap, const struct d__StartSessionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__SignedDocInfo(soap, &a->SignedDocInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__StartSessionResponse(struct soap *soap, struct d__StartSessionResponse *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Status); - soap_default_xsd__int(soap, &a->Sesscode); - a->SignedDocInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__StartSessionResponse(struct soap *soap, const struct d__StartSessionResponse *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__StartSessionResponse); - if (soap_out_d__StartSessionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__StartSessionResponse(struct soap *soap, const char *tag, int id, const struct d__StartSessionResponse *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__StartSessionResponse), type); - if (a->Status) - soap_element_result(soap, "Status"); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_xsd__int(soap, "Sesscode", -1, &a->Sesscode, ""); - soap_out_PointerTod__SignedDocInfo(soap, "SignedDocInfo", -1, &a->SignedDocInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__StartSessionResponse * SOAP_FMAC4 soap_get_d__StartSessionResponse(struct soap *soap, struct d__StartSessionResponse *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__StartSessionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__StartSessionResponse * SOAP_FMAC4 soap_in_d__StartSessionResponse(struct soap *soap, const char *tag, struct d__StartSessionResponse *a, const char *type) -{ - short soap_flag_Status = 1, soap_flag_Sesscode = 1, soap_flag_SignedDocInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__StartSessionResponse *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__StartSessionResponse, sizeof(struct d__StartSessionResponse), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__StartSessionResponse(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_Sesscode && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Sesscode", &a->Sesscode, "xsd:int")) - { soap_flag_Sesscode--; - continue; - } - if (soap_flag_SignedDocInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignedDocInfo(soap, "SignedDocInfo", &a->SignedDocInfo, "d:SignedDocInfo")) - { soap_flag_SignedDocInfo--; - continue; - } - soap_check_result(soap, "Status"); - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sesscode > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__StartSessionResponse *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__StartSessionResponse, 0, sizeof(struct d__StartSessionResponse), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileData(struct soap *soap, const struct d__DataFileData *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Id); - soap_serialize_xsd__string(soap, &a->Filename); - soap_serialize_xsd__string(soap, &a->MimeType); - soap_serialize_xsd__string(soap, &a->ContentType); - soap_serialize_xsd__string(soap, &a->DigestType); - soap_serialize_xsd__string(soap, &a->DigestValue); - if (a->__ptrAttributes) - { int i; - for (i = 0; i < a->__sizeOfAttributes; i++) - { - soap_embedded(soap, a->__ptrAttributes + i, SOAP_TYPE_d__DataFileAttribute); - soap_serialize_d__DataFileAttribute(soap, a->__ptrAttributes + i); - } - } - soap_serialize_xsd__string(soap, &a->DfData); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileData(struct soap *soap, struct d__DataFileData *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Id); - soap_default_xsd__string(soap, &a->Filename); - soap_default_xsd__string(soap, &a->MimeType); - soap_default_xsd__string(soap, &a->ContentType); - soap_default_xsd__string(soap, &a->DigestType); - soap_default_xsd__string(soap, &a->DigestValue); - soap_default_xsd__int(soap, &a->Size); - a->__sizeOfAttributes = 0; - a->__ptrAttributes = NULL; - soap_default_xsd__string(soap, &a->DfData); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileData(struct soap *soap, const struct d__DataFileData *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__DataFileData); - if (soap_out_d__DataFileData(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileData(struct soap *soap, const char *tag, int id, const struct d__DataFileData *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__DataFileData), type); - soap_out_xsd__string(soap, "Id", -1, &a->Id, ""); - soap_out_xsd__string(soap, "Filename", -1, &a->Filename, ""); - soap_out_xsd__string(soap, "MimeType", -1, &a->MimeType, ""); - soap_out_xsd__string(soap, "ContentType", -1, &a->ContentType, ""); - soap_out_xsd__string(soap, "DigestType", -1, &a->DigestType, ""); - soap_out_xsd__string(soap, "DigestValue", -1, &a->DigestValue, ""); - soap_out_xsd__int(soap, "Size", -1, &a->Size, ""); - if (a->__ptrAttributes) - { int i; - for (i = 0; i < a->__sizeOfAttributes; i++) - soap_out_d__DataFileAttribute(soap, "Attributes", -1, a->__ptrAttributes + i, ""); - } - soap_out_xsd__string(soap, "DfData", -1, &a->DfData, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__DataFileData * SOAP_FMAC4 soap_get_d__DataFileData(struct soap *soap, struct d__DataFileData *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__DataFileData(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileData * SOAP_FMAC4 soap_in_d__DataFileData(struct soap *soap, const char *tag, struct d__DataFileData *a, const char *type) -{ - short soap_flag_Id = 1, soap_flag_Filename = 1, soap_flag_MimeType = 1, soap_flag_ContentType = 1, soap_flag_DigestType = 1, soap_flag_DigestValue = 1, soap_flag_Size = 1, soap_flag___ptrAttributes = 1, soap_flag_DfData = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__DataFileData *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__DataFileData, sizeof(struct d__DataFileData), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__DataFileData(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Id && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Id", &a->Id, "xsd:string")) - { soap_flag_Id--; - continue; - } - if (soap_flag_Filename && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Filename", &a->Filename, "xsd:string")) - { soap_flag_Filename--; - continue; - } - if (soap_flag_MimeType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MimeType", &a->MimeType, "xsd:string")) - { soap_flag_MimeType--; - continue; - } - if (soap_flag_ContentType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ContentType", &a->ContentType, "xsd:string")) - { soap_flag_ContentType--; - continue; - } - if (soap_flag_DigestType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestType", &a->DigestType, "xsd:string")) - { soap_flag_DigestType--; - continue; - } - if (soap_flag_DigestValue && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestValue", &a->DigestValue, "xsd:string")) - { soap_flag_DigestValue--; - continue; - } - if (soap_flag_Size && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Size", &a->Size, "xsd:int")) - { soap_flag_Size--; - continue; - } - if (soap_flag___ptrAttributes && soap->error == SOAP_TAG_MISMATCH) - { struct d__DataFileAttribute *p; - soap_new_block(soap); - for (a->__sizeOfAttributes = 0; !soap_element_begin_in(soap, "Attributes", 1, NULL); a->__sizeOfAttributes++) - { p = (struct d__DataFileAttribute *)soap_push_block(soap, sizeof(struct d__DataFileAttribute)); - soap_default_d__DataFileAttribute(soap, p); - soap_revert(soap); - if (!soap_in_d__DataFileAttribute(soap, "Attributes", p, "d:DataFileAttribute")) - break; - soap_flag___ptrAttributes = 0; - } - a->__ptrAttributes = (struct d__DataFileAttribute *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrAttributes && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap_flag_DfData && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DfData", &a->DfData, "xsd:string")) - { soap_flag_DfData--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Size > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__DataFileData *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__DataFileData, 0, sizeof(struct d__DataFileData), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignedDocInfo(struct soap *soap, const struct d__SignedDocInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Format); - soap_serialize_xsd__string(soap, &a->Version); - if (a->__ptrDataFileInfo) - { int i; - for (i = 0; i < a->__sizeOfDataFileInfos; i++) - { - soap_embedded(soap, a->__ptrDataFileInfo + i, SOAP_TYPE_d__DataFileInfo); - soap_serialize_d__DataFileInfo(soap, a->__ptrDataFileInfo + i); - } - } - if (a->__ptrSignatureInfo) - { int i; - for (i = 0; i < a->__sizeOfSignatureInfos; i++) - { - soap_embedded(soap, a->__ptrSignatureInfo + i, SOAP_TYPE_d__SignatureInfo); - soap_serialize_d__SignatureInfo(soap, a->__ptrSignatureInfo + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignedDocInfo(struct soap *soap, struct d__SignedDocInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Format); - soap_default_xsd__string(soap, &a->Version); - a->__sizeOfDataFileInfos = 0; - a->__ptrDataFileInfo = NULL; - a->__sizeOfSignatureInfos = 0; - a->__ptrSignatureInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignedDocInfo(struct soap *soap, const struct d__SignedDocInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignedDocInfo); - if (soap_out_d__SignedDocInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignedDocInfo(struct soap *soap, const char *tag, int id, const struct d__SignedDocInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignedDocInfo), type); - soap_out_xsd__string(soap, "Format", -1, &a->Format, ""); - soap_out_xsd__string(soap, "Version", -1, &a->Version, ""); - if (a->__ptrDataFileInfo) - { int i; - for (i = 0; i < a->__sizeOfDataFileInfos; i++) - soap_out_d__DataFileInfo(soap, "DataFileInfo", -1, a->__ptrDataFileInfo + i, ""); - } - if (a->__ptrSignatureInfo) - { int i; - for (i = 0; i < a->__sizeOfSignatureInfos; i++) - soap_out_d__SignatureInfo(soap, "SignatureInfo", -1, a->__ptrSignatureInfo + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignedDocInfo * SOAP_FMAC4 soap_get_d__SignedDocInfo(struct soap *soap, struct d__SignedDocInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignedDocInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignedDocInfo * SOAP_FMAC4 soap_in_d__SignedDocInfo(struct soap *soap, const char *tag, struct d__SignedDocInfo *a, const char *type) -{ - short soap_flag_Format = 1, soap_flag_Version = 1, soap_flag___ptrDataFileInfo = 1, soap_flag___ptrSignatureInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignedDocInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignedDocInfo, sizeof(struct d__SignedDocInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignedDocInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Format && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Format", &a->Format, "xsd:string")) - { soap_flag_Format--; - continue; - } - if (soap_flag_Version && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Version", &a->Version, "xsd:string")) - { soap_flag_Version--; - continue; - } - if (soap_flag___ptrDataFileInfo && soap->error == SOAP_TAG_MISMATCH) - { struct d__DataFileInfo *p; - soap_new_block(soap); - for (a->__sizeOfDataFileInfos = 0; !soap_element_begin_in(soap, "DataFileInfo", 1, NULL); a->__sizeOfDataFileInfos++) - { p = (struct d__DataFileInfo *)soap_push_block(soap, sizeof(struct d__DataFileInfo)); - soap_default_d__DataFileInfo(soap, p); - soap_revert(soap); - if (!soap_in_d__DataFileInfo(soap, "DataFileInfo", p, "d:DataFileInfo")) - break; - soap_flag___ptrDataFileInfo = 0; - } - a->__ptrDataFileInfo = (struct d__DataFileInfo *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrDataFileInfo && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap_flag___ptrSignatureInfo && soap->error == SOAP_TAG_MISMATCH) - { struct d__SignatureInfo *p; - soap_new_block(soap); - for (a->__sizeOfSignatureInfos = 0; !soap_element_begin_in(soap, "SignatureInfo", 1, NULL); a->__sizeOfSignatureInfos++) - { p = (struct d__SignatureInfo *)soap_push_block(soap, sizeof(struct d__SignatureInfo)); - soap_default_d__SignatureInfo(soap, p); - soap_revert(soap); - if (!soap_in_d__SignatureInfo(soap, "SignatureInfo", p, "d:SignatureInfo")) - break; - soap_flag___ptrSignatureInfo = 0; - } - a->__ptrSignatureInfo = (struct d__SignatureInfo *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrSignatureInfo && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignedDocInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignedDocInfo, 0, sizeof(struct d__SignedDocInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureInfo(struct soap *soap, const struct d__SignatureInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Id); - soap_serialize_xsd__string(soap, &a->Status); - soap_serialize_PointerTod__Error(soap, &a->Error); - soap_serialize_xsd__dateTime(soap, &a->SigningTime); - if (a->__ptrSignerRole) - { int i; - for (i = 0; i < a->__sizeRoles; i++) - { - soap_embedded(soap, a->__ptrSignerRole + i, SOAP_TYPE_d__SignerRole); - soap_serialize_d__SignerRole(soap, a->__ptrSignerRole + i); - } - } - soap_serialize_PointerTod__SignatureProductionPlace(soap, &a->SignatureProductionPlace); - soap_serialize_PointerTod__SignerInfo(soap, &a->Signer); - soap_serialize_PointerTod__ConfirmationInfo(soap, &a->Confirmation); - if (a->__ptrTimestamps) - { int i; - for (i = 0; i < a->__sizeTimestamps; i++) - { - soap_embedded(soap, a->__ptrTimestamps + i, SOAP_TYPE_d__TstInfo); - soap_serialize_d__TstInfo(soap, a->__ptrTimestamps + i); - } - } - soap_serialize_PointerTod__CRLInfo(soap, &a->CRLInfo); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureInfo(struct soap *soap, struct d__SignatureInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Id); - soap_default_xsd__string(soap, &a->Status); - a->Error = NULL; - soap_default_xsd__dateTime(soap, &a->SigningTime); - a->__sizeRoles = 0; - a->__ptrSignerRole = NULL; - a->SignatureProductionPlace = NULL; - a->Signer = NULL; - a->Confirmation = NULL; - a->__sizeTimestamps = 0; - a->__ptrTimestamps = NULL; - a->CRLInfo = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureInfo(struct soap *soap, const struct d__SignatureInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignatureInfo); - if (soap_out_d__SignatureInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureInfo(struct soap *soap, const char *tag, int id, const struct d__SignatureInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignatureInfo), type); - soap_out_xsd__string(soap, "Id", -1, &a->Id, ""); - soap_out_xsd__string(soap, "Status", -1, &a->Status, ""); - soap_out_PointerTod__Error(soap, "Error", -1, &a->Error, ""); - soap_out_xsd__dateTime(soap, "SigningTime", -1, &a->SigningTime, ""); - if (a->__ptrSignerRole) - { int i; - for (i = 0; i < a->__sizeRoles; i++) - soap_out_d__SignerRole(soap, "SignerRole", -1, a->__ptrSignerRole + i, ""); - } - soap_out_PointerTod__SignatureProductionPlace(soap, "SignatureProductionPlace", -1, &a->SignatureProductionPlace, ""); - soap_out_PointerTod__SignerInfo(soap, "Signer", -1, &a->Signer, ""); - soap_out_PointerTod__ConfirmationInfo(soap, "Confirmation", -1, &a->Confirmation, ""); - if (a->__ptrTimestamps) - { int i; - for (i = 0; i < a->__sizeTimestamps; i++) - soap_out_d__TstInfo(soap, "Timestamps", -1, a->__ptrTimestamps + i, ""); - } - soap_out_PointerTod__CRLInfo(soap, "CRLInfo", -1, &a->CRLInfo, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignatureInfo * SOAP_FMAC4 soap_get_d__SignatureInfo(struct soap *soap, struct d__SignatureInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignatureInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureInfo * SOAP_FMAC4 soap_in_d__SignatureInfo(struct soap *soap, const char *tag, struct d__SignatureInfo *a, const char *type) -{ - short soap_flag_Id = 1, soap_flag_Status = 1, soap_flag_Error = 1, soap_flag_SigningTime = 1, soap_flag___ptrSignerRole = 1, soap_flag_SignatureProductionPlace = 1, soap_flag_Signer = 1, soap_flag_Confirmation = 1, soap_flag___ptrTimestamps = 1, soap_flag_CRLInfo = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignatureInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignatureInfo, sizeof(struct d__SignatureInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignatureInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Id && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Id", &a->Id, "xsd:string")) - { soap_flag_Id--; - continue; - } - if (soap_flag_Status && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Status", &a->Status, "xsd:string")) - { soap_flag_Status--; - continue; - } - if (soap_flag_Error && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__Error(soap, "Error", &a->Error, "d:Error")) - { soap_flag_Error--; - continue; - } - if (soap_flag_SigningTime && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "SigningTime", &a->SigningTime, "xsd:dateTime")) - { soap_flag_SigningTime--; - continue; - } - if (soap_flag___ptrSignerRole && soap->error == SOAP_TAG_MISMATCH) - { struct d__SignerRole *p; - soap_new_block(soap); - for (a->__sizeRoles = 0; !soap_element_begin_in(soap, "SignerRole", 1, NULL); a->__sizeRoles++) - { p = (struct d__SignerRole *)soap_push_block(soap, sizeof(struct d__SignerRole)); - soap_default_d__SignerRole(soap, p); - soap_revert(soap); - if (!soap_in_d__SignerRole(soap, "SignerRole", p, "d:SignerRole")) - break; - soap_flag___ptrSignerRole = 0; - } - a->__ptrSignerRole = (struct d__SignerRole *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrSignerRole && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap_flag_SignatureProductionPlace && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignatureProductionPlace(soap, "SignatureProductionPlace", &a->SignatureProductionPlace, "d:SignatureProductionPlace")) - { soap_flag_SignatureProductionPlace--; - continue; - } - if (soap_flag_Signer && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__SignerInfo(soap, "Signer", &a->Signer, "d:SignerInfo")) - { soap_flag_Signer--; - continue; - } - if (soap_flag_Confirmation && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__ConfirmationInfo(soap, "Confirmation", &a->Confirmation, "d:ConfirmationInfo")) - { soap_flag_Confirmation--; - continue; - } - if (soap_flag___ptrTimestamps && soap->error == SOAP_TAG_MISMATCH) - { struct d__TstInfo *p; - soap_new_block(soap); - for (a->__sizeTimestamps = 0; !soap_element_begin_in(soap, "Timestamps", 1, NULL); a->__sizeTimestamps++) - { p = (struct d__TstInfo *)soap_push_block(soap, sizeof(struct d__TstInfo)); - soap_default_d__TstInfo(soap, p); - soap_revert(soap); - if (!soap_in_d__TstInfo(soap, "Timestamps", p, "d:TstInfo")) - break; - soap_flag___ptrTimestamps = 0; - } - a->__ptrTimestamps = (struct d__TstInfo *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrTimestamps && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap_flag_CRLInfo && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__CRLInfo(soap, "CRLInfo", &a->CRLInfo, "d:CRLInfo")) - { soap_flag_CRLInfo--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignatureInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignatureInfo, 0, sizeof(struct d__SignatureInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__Error(struct soap *soap, const struct d__Error *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Category); - soap_serialize_xsd__string(soap, &a->Description); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__Error(struct soap *soap, struct d__Error *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Code); - soap_default_xsd__string(soap, &a->Category); - soap_default_xsd__string(soap, &a->Description); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__Error(struct soap *soap, const struct d__Error *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__Error); - if (soap_out_d__Error(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__Error(struct soap *soap, const char *tag, int id, const struct d__Error *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__Error), type); - soap_out_xsd__int(soap, "Code", -1, &a->Code, ""); - soap_out_xsd__string(soap, "Category", -1, &a->Category, ""); - soap_out_xsd__string(soap, "Description", -1, &a->Description, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__Error * SOAP_FMAC4 soap_get_d__Error(struct soap *soap, struct d__Error *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__Error(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__Error * SOAP_FMAC4 soap_in_d__Error(struct soap *soap, const char *tag, struct d__Error *a, const char *type) -{ - short soap_flag_Code = 1, soap_flag_Category = 1, soap_flag_Description = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__Error *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__Error, sizeof(struct d__Error), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__Error(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Code && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Code", &a->Code, "xsd:int")) - { soap_flag_Code--; - continue; - } - if (soap_flag_Category && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Category", &a->Category, "xsd:string")) - { soap_flag_Category--; - continue; - } - if (soap_flag_Description && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Description", &a->Description, "xsd:string")) - { soap_flag_Description--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Code > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__Error *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__Error, 0, sizeof(struct d__Error), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CRLInfo(struct soap *soap, const struct d__CRLInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Issuer); - soap_serialize_xsd__dateTime(soap, &a->LastUpdate); - soap_serialize_xsd__dateTime(soap, &a->NextUpdate); - if (a->__ptrRevocations) - { int i; - for (i = 0; i < a->__sizeOfRevocations; i++) - { - soap_embedded(soap, a->__ptrRevocations + i, SOAP_TYPE_d__RevokedInfo); - soap_serialize_d__RevokedInfo(soap, a->__ptrRevocations + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CRLInfo(struct soap *soap, struct d__CRLInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Issuer); - soap_default_xsd__dateTime(soap, &a->LastUpdate); - soap_default_xsd__dateTime(soap, &a->NextUpdate); - a->__sizeOfRevocations = 0; - a->__ptrRevocations = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CRLInfo(struct soap *soap, const struct d__CRLInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CRLInfo); - if (soap_out_d__CRLInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CRLInfo(struct soap *soap, const char *tag, int id, const struct d__CRLInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CRLInfo), type); - soap_out_xsd__string(soap, "Issuer", -1, &a->Issuer, ""); - soap_out_xsd__dateTime(soap, "LastUpdate", -1, &a->LastUpdate, ""); - soap_out_xsd__dateTime(soap, "NextUpdate", -1, &a->NextUpdate, ""); - if (a->__ptrRevocations) - { int i; - for (i = 0; i < a->__sizeOfRevocations; i++) - soap_out_d__RevokedInfo(soap, "Revocations", -1, a->__ptrRevocations + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CRLInfo * SOAP_FMAC4 soap_get_d__CRLInfo(struct soap *soap, struct d__CRLInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CRLInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CRLInfo * SOAP_FMAC4 soap_in_d__CRLInfo(struct soap *soap, const char *tag, struct d__CRLInfo *a, const char *type) -{ - short soap_flag_Issuer = 1, soap_flag_LastUpdate = 1, soap_flag_NextUpdate = 1, soap_flag___ptrRevocations = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CRLInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CRLInfo, sizeof(struct d__CRLInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CRLInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Issuer && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Issuer", &a->Issuer, "xsd:string")) - { soap_flag_Issuer--; - continue; - } - if (soap_flag_LastUpdate && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "LastUpdate", &a->LastUpdate, "xsd:dateTime")) - { soap_flag_LastUpdate--; - continue; - } - if (soap_flag_NextUpdate && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "NextUpdate", &a->NextUpdate, "xsd:dateTime")) - { soap_flag_NextUpdate--; - continue; - } - if (soap_flag___ptrRevocations && soap->error == SOAP_TAG_MISMATCH) - { struct d__RevokedInfo *p; - soap_new_block(soap); - for (a->__sizeOfRevocations = 0; !soap_element_begin_in(soap, "Revocations", 1, NULL); a->__sizeOfRevocations++) - { p = (struct d__RevokedInfo *)soap_push_block(soap, sizeof(struct d__RevokedInfo)); - soap_default_d__RevokedInfo(soap, p); - soap_revert(soap); - if (!soap_in_d__RevokedInfo(soap, "Revocations", p, "d:RevokedInfo")) - break; - soap_flag___ptrRevocations = 0; - } - a->__ptrRevocations = (struct d__RevokedInfo *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrRevocations && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CRLInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CRLInfo, 0, sizeof(struct d__CRLInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RevokedInfo(struct soap *soap, const struct d__RevokedInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->SerialNumber); - soap_serialize_xsd__dateTime(soap, &a->RevocationDate); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RevokedInfo(struct soap *soap, struct d__RevokedInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__positiveInteger(soap, &a->Sequence); - soap_default_xsd__string(soap, &a->SerialNumber); - soap_default_xsd__dateTime(soap, &a->RevocationDate); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RevokedInfo(struct soap *soap, const struct d__RevokedInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__RevokedInfo); - if (soap_out_d__RevokedInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RevokedInfo(struct soap *soap, const char *tag, int id, const struct d__RevokedInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__RevokedInfo), type); - soap_out_xsd__positiveInteger(soap, "Sequence", -1, &a->Sequence, ""); - soap_out_xsd__string(soap, "SerialNumber", -1, &a->SerialNumber, ""); - soap_out_xsd__dateTime(soap, "RevocationDate", -1, &a->RevocationDate, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__RevokedInfo * SOAP_FMAC4 soap_get_d__RevokedInfo(struct soap *soap, struct d__RevokedInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__RevokedInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RevokedInfo * SOAP_FMAC4 soap_in_d__RevokedInfo(struct soap *soap, const char *tag, struct d__RevokedInfo *a, const char *type) -{ - short soap_flag_Sequence = 1, soap_flag_SerialNumber = 1, soap_flag_RevocationDate = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__RevokedInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__RevokedInfo, sizeof(struct d__RevokedInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__RevokedInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Sequence && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__positiveInteger(soap, "Sequence", &a->Sequence, "xsd:positiveInteger")) - { soap_flag_Sequence--; - continue; - } - if (soap_flag_SerialNumber && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SerialNumber", &a->SerialNumber, "xsd:string")) - { soap_flag_SerialNumber--; - continue; - } - if (soap_flag_RevocationDate && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "RevocationDate", &a->RevocationDate, "xsd:dateTime")) - { soap_flag_RevocationDate--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Sequence > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__RevokedInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__RevokedInfo, 0, sizeof(struct d__RevokedInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__TstInfo(struct soap *soap, const struct d__TstInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Id); - soap_serialize_xsd__string(soap, &a->Type); - soap_serialize_xsd__string(soap, &a->SerialNumber); - soap_serialize_xsd__dateTime(soap, &a->CreationTime); - soap_serialize_xsd__string(soap, &a->Policy); - soap_serialize_xsd__string(soap, &a->ErrorBound); - soap_serialize_xsd__string(soap, &a->TSA); - soap_serialize_PointerTod__CertificateInfo(soap, &a->Certificate); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__TstInfo(struct soap *soap, struct d__TstInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Id); - soap_default_xsd__string(soap, &a->Type); - soap_default_xsd__string(soap, &a->SerialNumber); - soap_default_xsd__dateTime(soap, &a->CreationTime); - soap_default_xsd__string(soap, &a->Policy); - soap_default_xsd__string(soap, &a->ErrorBound); - soap_default_xsd__boolean(soap, &a->Ordered); - soap_default_xsd__string(soap, &a->TSA); - a->Certificate = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__TstInfo(struct soap *soap, const struct d__TstInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__TstInfo); - if (soap_out_d__TstInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__TstInfo(struct soap *soap, const char *tag, int id, const struct d__TstInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__TstInfo), type); - soap_out_xsd__string(soap, "Id", -1, &a->Id, ""); - soap_out_xsd__string(soap, "Type", -1, &a->Type, ""); - soap_out_xsd__string(soap, "SerialNumber", -1, &a->SerialNumber, ""); - soap_out_xsd__dateTime(soap, "CreationTime", -1, &a->CreationTime, ""); - soap_out_xsd__string(soap, "Policy", -1, &a->Policy, ""); - soap_out_xsd__string(soap, "ErrorBound", -1, &a->ErrorBound, ""); - soap_out_xsd__boolean(soap, "Ordered", -1, &a->Ordered, ""); - soap_out_xsd__string(soap, "TSA", -1, &a->TSA, ""); - soap_out_PointerTod__CertificateInfo(soap, "Certificate", -1, &a->Certificate, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__TstInfo * SOAP_FMAC4 soap_get_d__TstInfo(struct soap *soap, struct d__TstInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__TstInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__TstInfo * SOAP_FMAC4 soap_in_d__TstInfo(struct soap *soap, const char *tag, struct d__TstInfo *a, const char *type) -{ - short soap_flag_Id = 1, soap_flag_Type = 1, soap_flag_SerialNumber = 1, soap_flag_CreationTime = 1, soap_flag_Policy = 1, soap_flag_ErrorBound = 1, soap_flag_Ordered = 1, soap_flag_TSA = 1, soap_flag_Certificate = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__TstInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__TstInfo, sizeof(struct d__TstInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__TstInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Id && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Id", &a->Id, "xsd:string")) - { soap_flag_Id--; - continue; - } - if (soap_flag_Type && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Type", &a->Type, "xsd:string")) - { soap_flag_Type--; - continue; - } - if (soap_flag_SerialNumber && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "SerialNumber", &a->SerialNumber, "xsd:string")) - { soap_flag_SerialNumber--; - continue; - } - if (soap_flag_CreationTime && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "CreationTime", &a->CreationTime, "xsd:dateTime")) - { soap_flag_CreationTime--; - continue; - } - if (soap_flag_Policy && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Policy", &a->Policy, "xsd:string")) - { soap_flag_Policy--; - continue; - } - if (soap_flag_ErrorBound && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ErrorBound", &a->ErrorBound, "xsd:string")) - { soap_flag_ErrorBound--; - continue; - } - if (soap_flag_Ordered && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__boolean(soap, "Ordered", &a->Ordered, "xsd:boolean")) - { soap_flag_Ordered--; - continue; - } - if (soap_flag_TSA && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "TSA", &a->TSA, "xsd:string")) - { soap_flag_TSA--; - continue; - } - if (soap_flag_Certificate && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__CertificateInfo(soap, "Certificate", &a->Certificate, "d:CertificateInfo")) - { soap_flag_Certificate--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Ordered > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__TstInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__TstInfo, 0, sizeof(struct d__TstInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__ConfirmationInfo(struct soap *soap, const struct d__ConfirmationInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->ResponderID); - soap_serialize_xsd__string(soap, &a->ProducedAt); - soap_serialize_PointerTod__CertificateInfo(soap, &a->ResponderCertificate); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__ConfirmationInfo(struct soap *soap, struct d__ConfirmationInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->ResponderID); - soap_default_xsd__string(soap, &a->ProducedAt); - a->ResponderCertificate = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__ConfirmationInfo(struct soap *soap, const struct d__ConfirmationInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__ConfirmationInfo); - if (soap_out_d__ConfirmationInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__ConfirmationInfo(struct soap *soap, const char *tag, int id, const struct d__ConfirmationInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__ConfirmationInfo), type); - soap_out_xsd__string(soap, "ResponderID", -1, &a->ResponderID, ""); - soap_out_xsd__string(soap, "ProducedAt", -1, &a->ProducedAt, ""); - soap_out_PointerTod__CertificateInfo(soap, "ResponderCertificate", -1, &a->ResponderCertificate, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__ConfirmationInfo * SOAP_FMAC4 soap_get_d__ConfirmationInfo(struct soap *soap, struct d__ConfirmationInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__ConfirmationInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__ConfirmationInfo * SOAP_FMAC4 soap_in_d__ConfirmationInfo(struct soap *soap, const char *tag, struct d__ConfirmationInfo *a, const char *type) -{ - short soap_flag_ResponderID = 1, soap_flag_ProducedAt = 1, soap_flag_ResponderCertificate = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__ConfirmationInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__ConfirmationInfo, sizeof(struct d__ConfirmationInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__ConfirmationInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_ResponderID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ResponderID", &a->ResponderID, "xsd:string")) - { soap_flag_ResponderID--; - continue; - } - if (soap_flag_ProducedAt && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ProducedAt", &a->ProducedAt, "xsd:string")) - { soap_flag_ProducedAt--; - continue; - } - if (soap_flag_ResponderCertificate && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__CertificateInfo(soap, "ResponderCertificate", &a->ResponderCertificate, "d:CertificateInfo")) - { soap_flag_ResponderCertificate--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__ConfirmationInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__ConfirmationInfo, 0, sizeof(struct d__ConfirmationInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignerInfo(struct soap *soap, const struct d__SignerInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->CommonName); - soap_serialize_xsd__string(soap, &a->IDCode); - soap_serialize_PointerTod__CertificateInfo(soap, &a->Certificate); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignerInfo(struct soap *soap, struct d__SignerInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->CommonName); - soap_default_xsd__string(soap, &a->IDCode); - a->Certificate = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignerInfo(struct soap *soap, const struct d__SignerInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignerInfo); - if (soap_out_d__SignerInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignerInfo(struct soap *soap, const char *tag, int id, const struct d__SignerInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignerInfo), type); - soap_out_xsd__string(soap, "CommonName", -1, &a->CommonName, ""); - soap_out_xsd__string(soap, "IDCode", -1, &a->IDCode, ""); - soap_out_PointerTod__CertificateInfo(soap, "Certificate", -1, &a->Certificate, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignerInfo * SOAP_FMAC4 soap_get_d__SignerInfo(struct soap *soap, struct d__SignerInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignerInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignerInfo * SOAP_FMAC4 soap_in_d__SignerInfo(struct soap *soap, const char *tag, struct d__SignerInfo *a, const char *type) -{ - short soap_flag_CommonName = 1, soap_flag_IDCode = 1, soap_flag_Certificate = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignerInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignerInfo, sizeof(struct d__SignerInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignerInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_CommonName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CommonName", &a->CommonName, "xsd:string")) - { soap_flag_CommonName--; - continue; - } - if (soap_flag_IDCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "IDCode", &a->IDCode, "xsd:string")) - { soap_flag_IDCode--; - continue; - } - if (soap_flag_Certificate && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_PointerTod__CertificateInfo(soap, "Certificate", &a->Certificate, "d:CertificateInfo")) - { soap_flag_Certificate--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignerInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignerInfo, 0, sizeof(struct d__SignerInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CertificateInfo(struct soap *soap, const struct d__CertificateInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Issuer); - soap_serialize_xsd__string(soap, &a->Subject); - soap_serialize_xsd__dateTime(soap, &a->ValidFrom); - soap_serialize_xsd__dateTime(soap, &a->ValidTo); - soap_serialize_xsd__string(soap, &a->IssuerSerial); - if (a->__ptrPolicies) - { int i; - for (i = 0; i < a->__sizePolicies; i++) - { - soap_embedded(soap, a->__ptrPolicies + i, SOAP_TYPE_d__CertificatePolicy); - soap_serialize_d__CertificatePolicy(soap, a->__ptrPolicies + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CertificateInfo(struct soap *soap, struct d__CertificateInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Issuer); - soap_default_xsd__string(soap, &a->Subject); - soap_default_xsd__dateTime(soap, &a->ValidFrom); - soap_default_xsd__dateTime(soap, &a->ValidTo); - soap_default_xsd__string(soap, &a->IssuerSerial); - a->__sizePolicies = 0; - a->__ptrPolicies = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CertificateInfo(struct soap *soap, const struct d__CertificateInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CertificateInfo); - if (soap_out_d__CertificateInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CertificateInfo(struct soap *soap, const char *tag, int id, const struct d__CertificateInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CertificateInfo), type); - soap_out_xsd__string(soap, "Issuer", -1, &a->Issuer, ""); - soap_out_xsd__string(soap, "Subject", -1, &a->Subject, ""); - soap_out_xsd__dateTime(soap, "ValidFrom", -1, &a->ValidFrom, ""); - soap_out_xsd__dateTime(soap, "ValidTo", -1, &a->ValidTo, ""); - soap_out_xsd__string(soap, "IssuerSerial", -1, &a->IssuerSerial, ""); - if (a->__ptrPolicies) - { int i; - for (i = 0; i < a->__sizePolicies; i++) - soap_out_d__CertificatePolicy(soap, "Policies", -1, a->__ptrPolicies + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CertificateInfo * SOAP_FMAC4 soap_get_d__CertificateInfo(struct soap *soap, struct d__CertificateInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CertificateInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CertificateInfo * SOAP_FMAC4 soap_in_d__CertificateInfo(struct soap *soap, const char *tag, struct d__CertificateInfo *a, const char *type) -{ - short soap_flag_Issuer = 1, soap_flag_Subject = 1, soap_flag_ValidFrom = 1, soap_flag_ValidTo = 1, soap_flag_IssuerSerial = 1, soap_flag___ptrPolicies = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CertificateInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CertificateInfo, sizeof(struct d__CertificateInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CertificateInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Issuer && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Issuer", &a->Issuer, "xsd:string")) - { soap_flag_Issuer--; - continue; - } - if (soap_flag_Subject && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Subject", &a->Subject, "xsd:string")) - { soap_flag_Subject--; - continue; - } - if (soap_flag_ValidFrom && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "ValidFrom", &a->ValidFrom, "xsd:dateTime")) - { soap_flag_ValidFrom--; - continue; - } - if (soap_flag_ValidTo && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__dateTime(soap, "ValidTo", &a->ValidTo, "xsd:dateTime")) - { soap_flag_ValidTo--; - continue; - } - if (soap_flag_IssuerSerial && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "IssuerSerial", &a->IssuerSerial, "xsd:string")) - { soap_flag_IssuerSerial--; - continue; - } - if (soap_flag___ptrPolicies && soap->error == SOAP_TAG_MISMATCH) - { struct d__CertificatePolicy *p; - soap_new_block(soap); - for (a->__sizePolicies = 0; !soap_element_begin_in(soap, "Policies", 1, NULL); a->__sizePolicies++) - { p = (struct d__CertificatePolicy *)soap_push_block(soap, sizeof(struct d__CertificatePolicy)); - soap_default_d__CertificatePolicy(soap, p); - soap_revert(soap); - if (!soap_in_d__CertificatePolicy(soap, "Policies", p, "d:CertificatePolicy")) - break; - soap_flag___ptrPolicies = 0; - } - a->__ptrPolicies = (struct d__CertificatePolicy *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrPolicies && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CertificateInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CertificateInfo, 0, sizeof(struct d__CertificateInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CertificatePolicy(struct soap *soap, const struct d__CertificatePolicy *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->OID); - soap_serialize_xsd__string(soap, &a->URL); - soap_serialize_xsd__string(soap, &a->Description); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CertificatePolicy(struct soap *soap, struct d__CertificatePolicy *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->OID); - soap_default_xsd__string(soap, &a->URL); - soap_default_xsd__string(soap, &a->Description); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CertificatePolicy(struct soap *soap, const struct d__CertificatePolicy *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__CertificatePolicy); - if (soap_out_d__CertificatePolicy(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CertificatePolicy(struct soap *soap, const char *tag, int id, const struct d__CertificatePolicy *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__CertificatePolicy), type); - soap_out_xsd__string(soap, "OID", -1, &a->OID, ""); - soap_out_xsd__string(soap, "URL", -1, &a->URL, ""); - soap_out_xsd__string(soap, "Description", -1, &a->Description, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__CertificatePolicy * SOAP_FMAC4 soap_get_d__CertificatePolicy(struct soap *soap, struct d__CertificatePolicy *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__CertificatePolicy(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CertificatePolicy * SOAP_FMAC4 soap_in_d__CertificatePolicy(struct soap *soap, const char *tag, struct d__CertificatePolicy *a, const char *type) -{ - short soap_flag_OID = 1, soap_flag_URL = 1, soap_flag_Description = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__CertificatePolicy *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__CertificatePolicy, sizeof(struct d__CertificatePolicy), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__CertificatePolicy(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_OID && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "OID", &a->OID, "xsd:string")) - { soap_flag_OID--; - continue; - } - if (soap_flag_URL && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "URL", &a->URL, "xsd:string")) - { soap_flag_URL--; - continue; - } - if (soap_flag_Description && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Description", &a->Description, "xsd:string")) - { soap_flag_Description--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__CertificatePolicy *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__CertificatePolicy, 0, sizeof(struct d__CertificatePolicy), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureProductionPlace(struct soap *soap, const struct d__SignatureProductionPlace *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->City); - soap_serialize_xsd__string(soap, &a->StateOrProvince); - soap_serialize_xsd__string(soap, &a->PostalCode); - soap_serialize_xsd__string(soap, &a->CountryName); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureProductionPlace(struct soap *soap, struct d__SignatureProductionPlace *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->City); - soap_default_xsd__string(soap, &a->StateOrProvince); - soap_default_xsd__string(soap, &a->PostalCode); - soap_default_xsd__string(soap, &a->CountryName); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureProductionPlace(struct soap *soap, const struct d__SignatureProductionPlace *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignatureProductionPlace); - if (soap_out_d__SignatureProductionPlace(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureProductionPlace(struct soap *soap, const char *tag, int id, const struct d__SignatureProductionPlace *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignatureProductionPlace), type); - soap_out_xsd__string(soap, "City", -1, &a->City, ""); - soap_out_xsd__string(soap, "StateOrProvince", -1, &a->StateOrProvince, ""); - soap_out_xsd__string(soap, "PostalCode", -1, &a->PostalCode, ""); - soap_out_xsd__string(soap, "CountryName", -1, &a->CountryName, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignatureProductionPlace * SOAP_FMAC4 soap_get_d__SignatureProductionPlace(struct soap *soap, struct d__SignatureProductionPlace *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignatureProductionPlace(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureProductionPlace * SOAP_FMAC4 soap_in_d__SignatureProductionPlace(struct soap *soap, const char *tag, struct d__SignatureProductionPlace *a, const char *type) -{ - short soap_flag_City = 1, soap_flag_StateOrProvince = 1, soap_flag_PostalCode = 1, soap_flag_CountryName = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignatureProductionPlace *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignatureProductionPlace, sizeof(struct d__SignatureProductionPlace), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignatureProductionPlace(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_City && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "City", &a->City, "xsd:string")) - { soap_flag_City--; - continue; - } - if (soap_flag_StateOrProvince && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "StateOrProvince", &a->StateOrProvince, "xsd:string")) - { soap_flag_StateOrProvince--; - continue; - } - if (soap_flag_PostalCode && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "PostalCode", &a->PostalCode, "xsd:string")) - { soap_flag_PostalCode--; - continue; - } - if (soap_flag_CountryName && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "CountryName", &a->CountryName, "xsd:string")) - { soap_flag_CountryName--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignatureProductionPlace *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignatureProductionPlace, 0, sizeof(struct d__SignatureProductionPlace), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignerRole(struct soap *soap, const struct d__SignerRole *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Role); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignerRole(struct soap *soap, struct d__SignerRole *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__int(soap, &a->Certified); - soap_default_xsd__string(soap, &a->Role); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignerRole(struct soap *soap, const struct d__SignerRole *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__SignerRole); - if (soap_out_d__SignerRole(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignerRole(struct soap *soap, const char *tag, int id, const struct d__SignerRole *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__SignerRole), type); - soap_out_xsd__int(soap, "Certified", -1, &a->Certified, ""); - soap_out_xsd__string(soap, "Role", -1, &a->Role, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__SignerRole * SOAP_FMAC4 soap_get_d__SignerRole(struct soap *soap, struct d__SignerRole *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__SignerRole(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignerRole * SOAP_FMAC4 soap_in_d__SignerRole(struct soap *soap, const char *tag, struct d__SignerRole *a, const char *type) -{ - short soap_flag_Certified = 1, soap_flag_Role = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__SignerRole *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__SignerRole, sizeof(struct d__SignerRole), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__SignerRole(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Certified && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Certified", &a->Certified, "xsd:int")) - { soap_flag_Certified--; - continue; - } - if (soap_flag_Role && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Role", &a->Role, "xsd:string")) - { soap_flag_Role--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Certified > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__SignerRole *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__SignerRole, 0, sizeof(struct d__SignerRole), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileInfo(struct soap *soap, const struct d__DataFileInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Id); - soap_serialize_xsd__string(soap, &a->Filename); - soap_serialize_xsd__string(soap, &a->MimeType); - soap_serialize_xsd__string(soap, &a->ContentType); - soap_serialize_xsd__string(soap, &a->DigestType); - soap_serialize_xsd__string(soap, &a->DigestValue); - if (a->__ptrAttributes) - { int i; - for (i = 0; i < a->__sizeOfAttributes; i++) - { - soap_embedded(soap, a->__ptrAttributes + i, SOAP_TYPE_d__DataFileAttribute); - soap_serialize_d__DataFileAttribute(soap, a->__ptrAttributes + i); - } - } -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileInfo(struct soap *soap, struct d__DataFileInfo *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Id); - soap_default_xsd__string(soap, &a->Filename); - soap_default_xsd__string(soap, &a->MimeType); - soap_default_xsd__string(soap, &a->ContentType); - soap_default_xsd__int(soap, &a->Size); - soap_default_xsd__string(soap, &a->DigestType); - soap_default_xsd__string(soap, &a->DigestValue); - a->__sizeOfAttributes = 0; - a->__ptrAttributes = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileInfo(struct soap *soap, const struct d__DataFileInfo *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__DataFileInfo); - if (soap_out_d__DataFileInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileInfo(struct soap *soap, const char *tag, int id, const struct d__DataFileInfo *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__DataFileInfo), type); - soap_out_xsd__string(soap, "Id", -1, &a->Id, ""); - soap_out_xsd__string(soap, "Filename", -1, &a->Filename, ""); - soap_out_xsd__string(soap, "MimeType", -1, &a->MimeType, ""); - soap_out_xsd__string(soap, "ContentType", -1, &a->ContentType, ""); - soap_out_xsd__int(soap, "Size", -1, &a->Size, ""); - soap_out_xsd__string(soap, "DigestType", -1, &a->DigestType, ""); - soap_out_xsd__string(soap, "DigestValue", -1, &a->DigestValue, ""); - if (a->__ptrAttributes) - { int i; - for (i = 0; i < a->__sizeOfAttributes; i++) - soap_out_d__DataFileAttribute(soap, "Attributes", -1, a->__ptrAttributes + i, ""); - } - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__DataFileInfo * SOAP_FMAC4 soap_get_d__DataFileInfo(struct soap *soap, struct d__DataFileInfo *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__DataFileInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileInfo * SOAP_FMAC4 soap_in_d__DataFileInfo(struct soap *soap, const char *tag, struct d__DataFileInfo *a, const char *type) -{ - short soap_flag_Id = 1, soap_flag_Filename = 1, soap_flag_MimeType = 1, soap_flag_ContentType = 1, soap_flag_Size = 1, soap_flag_DigestType = 1, soap_flag_DigestValue = 1, soap_flag___ptrAttributes = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__DataFileInfo *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__DataFileInfo, sizeof(struct d__DataFileInfo), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__DataFileInfo(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Id && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Id", &a->Id, "xsd:string")) - { soap_flag_Id--; - continue; - } - if (soap_flag_Filename && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Filename", &a->Filename, "xsd:string")) - { soap_flag_Filename--; - continue; - } - if (soap_flag_MimeType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "MimeType", &a->MimeType, "xsd:string")) - { soap_flag_MimeType--; - continue; - } - if (soap_flag_ContentType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "ContentType", &a->ContentType, "xsd:string")) - { soap_flag_ContentType--; - continue; - } - if (soap_flag_Size && soap->error == SOAP_TAG_MISMATCH) - if (soap_in_xsd__int(soap, "Size", &a->Size, "xsd:int")) - { soap_flag_Size--; - continue; - } - if (soap_flag_DigestType && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestType", &a->DigestType, "xsd:string")) - { soap_flag_DigestType--; - continue; - } - if (soap_flag_DigestValue && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "DigestValue", &a->DigestValue, "xsd:string")) - { soap_flag_DigestValue--; - continue; - } - if (soap_flag___ptrAttributes && soap->error == SOAP_TAG_MISMATCH) - { struct d__DataFileAttribute *p; - soap_new_block(soap); - for (a->__sizeOfAttributes = 0; !soap_element_begin_in(soap, "Attributes", 1, NULL); a->__sizeOfAttributes++) - { p = (struct d__DataFileAttribute *)soap_push_block(soap, sizeof(struct d__DataFileAttribute)); - soap_default_d__DataFileAttribute(soap, p); - soap_revert(soap); - if (!soap_in_d__DataFileAttribute(soap, "Attributes", p, "d:DataFileAttribute")) - break; - soap_flag___ptrAttributes = 0; - } - a->__ptrAttributes = (struct d__DataFileAttribute *)soap_save_block(soap, NULL, 1); - if (!soap_flag___ptrAttributes && soap->error == SOAP_TAG_MISMATCH) - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if ((soap->mode & SOAP_XML_STRICT) && (soap_flag_Size > 0)) - { soap->error = SOAP_OCCURS; - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__DataFileInfo *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__DataFileInfo, 0, sizeof(struct d__DataFileInfo), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileAttribute(struct soap *soap, const struct d__DataFileAttribute *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_serialize_xsd__string(soap, &a->Name); - soap_serialize_xsd__string(soap, &a->Value); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileAttribute(struct soap *soap, struct d__DataFileAttribute *a) -{ - (void)soap; (void)a; /* appease -Wall -Werror */ - soap_default_xsd__string(soap, &a->Name); - soap_default_xsd__string(soap, &a->Value); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileAttribute(struct soap *soap, const struct d__DataFileAttribute *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_d__DataFileAttribute); - if (soap_out_d__DataFileAttribute(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileAttribute(struct soap *soap, const char *tag, int id, const struct d__DataFileAttribute *a, const char *type) -{ - soap_element_begin_out(soap, tag, soap_embedded_id(soap, id, a, SOAP_TYPE_d__DataFileAttribute), type); - soap_out_xsd__string(soap, "Name", -1, &a->Name, ""); - soap_out_xsd__string(soap, "Value", -1, &a->Value, ""); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct d__DataFileAttribute * SOAP_FMAC4 soap_get_d__DataFileAttribute(struct soap *soap, struct d__DataFileAttribute *p, const char *tag, const char *type) -{ - if ((p = soap_in_d__DataFileAttribute(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileAttribute * SOAP_FMAC4 soap_in_d__DataFileAttribute(struct soap *soap, const char *tag, struct d__DataFileAttribute *a, const char *type) -{ - short soap_flag_Name = 1, soap_flag_Value = 1; - if (soap_element_begin_in(soap, tag, 0, type)) - return NULL; - a = (struct d__DataFileAttribute *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_d__DataFileAttribute, sizeof(struct d__DataFileAttribute), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_d__DataFileAttribute(soap, a); - if (soap->body && !*soap->href) - { - for (;;) - { soap->error = SOAP_TAG_MISMATCH; - if (soap_flag_Name && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Name", &a->Name, "xsd:string")) - { soap_flag_Name--; - continue; - } - if (soap_flag_Value && (soap->error == SOAP_TAG_MISMATCH || soap->error == SOAP_NO_TAG)) - if (soap_in_xsd__string(soap, "Value", &a->Value, "xsd:string")) - { soap_flag_Value--; - continue; - } - if (soap->error == SOAP_TAG_MISMATCH) - soap->error = soap_ignore_element(soap); - if (soap->error == SOAP_NO_TAG) - break; - if (soap->error) - return NULL; - } - if (soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct d__DataFileAttribute *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_d__DataFileAttribute, 0, sizeof(struct d__DataFileAttribute), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__hexBinary(struct soap *soap, struct xsd__hexBinary const*a) -{ - if (a->__ptr) - soap_array_reference(soap, a, (struct soap_array*)&a->__ptr, 1, SOAP_TYPE_xsd__hexBinary); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__hexBinary(struct soap *soap, struct xsd__hexBinary *a) -{ - a->__size = 0; - a->__ptr = NULL; -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__hexBinary(struct soap *soap, const struct xsd__hexBinary *a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, (struct soap_array*)&a->__ptr, 1, tag, SOAP_TYPE_xsd__hexBinary); - if (soap_out_xsd__hexBinary(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__hexBinary(struct soap *soap, const char *tag, int id, const struct xsd__hexBinary *a, const char *type) -{ - id = soap_element_id(soap, tag, id, a, (struct soap_array*)&a->__ptr, 1, type, SOAP_TYPE_xsd__hexBinary); - if (id < 0) - return soap->error; - soap_element_begin_out(soap, tag, id, type); - soap_puthex(soap, a->__ptr, a->__size); - soap_element_end_out(soap, tag); - return SOAP_OK; -} - -SOAP_FMAC3 struct xsd__hexBinary * SOAP_FMAC4 soap_get_xsd__hexBinary(struct soap *soap, struct xsd__hexBinary *p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__hexBinary(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct xsd__hexBinary * SOAP_FMAC4 soap_in_xsd__hexBinary(struct soap *soap, const char *tag, struct xsd__hexBinary *a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (*soap->type && soap_match_tag(soap, soap->type, type) && soap_match_tag(soap, soap->type, ":hexBinary")) - { soap->error = SOAP_TYPE; - return NULL; - } - a = (struct xsd__hexBinary *)soap_id_enter(soap, soap->id, a, SOAP_TYPE_xsd__hexBinary, sizeof(struct xsd__hexBinary), 0, NULL, NULL, NULL); - if (!a) - return NULL; - soap_default_xsd__hexBinary(soap, a); - if (soap->body && !*soap->href) - { - a->__ptr = soap_gethex(soap, &a->__size); - if ((!a->__ptr && soap->error) || soap_element_end_in(soap, tag)) - return NULL; - } - else - { a = (struct xsd__hexBinary *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_xsd__hexBinary, 0, sizeof(struct xsd__hexBinary), 0, NULL); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Reason)) - soap_serialize_SOAP_ENV__Reason(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Reason); - if (soap_out_PointerToSOAP_ENV__Reason(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Reason *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Reason); - if (id < 0) - return soap->error; - return soap_out_SOAP_ENV__Reason(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap *soap, struct SOAP_ENV__Reason **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerToSOAP_ENV__Reason(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap *soap, const char *tag, struct SOAP_ENV__Reason **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct SOAP_ENV__Reason **)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_SOAP_ENV__Reason(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct SOAP_ENV__Reason **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Reason, sizeof(struct SOAP_ENV__Reason), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Detail)) - soap_serialize_SOAP_ENV__Detail(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Detail); - if (soap_out_PointerToSOAP_ENV__Detail(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Detail *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Detail); - if (id < 0) - return soap->error; - return soap_out_SOAP_ENV__Detail(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap *soap, struct SOAP_ENV__Detail **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerToSOAP_ENV__Detail(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap *soap, const char *tag, struct SOAP_ENV__Detail **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct SOAP_ENV__Detail **)soap_malloc(soap, sizeof(struct SOAP_ENV__Detail *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_SOAP_ENV__Detail(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct SOAP_ENV__Detail **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Detail, sizeof(struct SOAP_ENV__Detail), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -#ifndef WITH_NOGLOBAL - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_SOAP_ENV__Code)) - soap_serialize_SOAP_ENV__Code(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerToSOAP_ENV__Code); - if (soap_out_PointerToSOAP_ENV__Code(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, int id, struct SOAP_ENV__Code *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_SOAP_ENV__Code); - if (id < 0) - return soap->error; - return soap_out_SOAP_ENV__Code(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap *soap, struct SOAP_ENV__Code **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerToSOAP_ENV__Code(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap *soap, const char *tag, struct SOAP_ENV__Code **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct SOAP_ENV__Code **)soap_malloc(soap, sizeof(struct SOAP_ENV__Code *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_SOAP_ENV__Code(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct SOAP_ENV__Code **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_SOAP_ENV__Code, sizeof(struct SOAP_ENV__Code), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -#endif - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTomss_DummyResp(struct soap *soap, struct mss_DummyResp *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_mss_DummyResp)) - soap_serialize_mss_DummyResp(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTomss_DummyResp(struct soap *soap, struct mss_DummyResp *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTomss_DummyResp); - if (soap_out_PointerTomss_DummyResp(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTomss_DummyResp(struct soap *soap, const char *tag, int id, struct mss_DummyResp *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_mss_DummyResp); - if (id < 0) - return soap->error; - return soap_out_mss_DummyResp(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct mss_DummyResp ** SOAP_FMAC4 soap_get_PointerTomss_DummyResp(struct soap *soap, struct mss_DummyResp **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTomss_DummyResp(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct mss_DummyResp ** SOAP_FMAC4 soap_in_PointerTomss_DummyResp(struct soap *soap, const char *tag, struct mss_DummyResp **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct mss_DummyResp **)soap_malloc(soap, sizeof(struct mss_DummyResp *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_mss_DummyResp(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct mss_DummyResp **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_mss_DummyResp, sizeof(struct mss_DummyResp), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap *soap, struct d__GetMobileCreateSignatureStatusResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse)) - soap_serialize_d__GetMobileCreateSignatureStatusResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap *soap, struct d__GetMobileCreateSignatureStatusResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse); - if (soap_out_PointerTod__GetMobileCreateSignatureStatusResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap *soap, const char *tag, int id, struct d__GetMobileCreateSignatureStatusResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetMobileCreateSignatureStatusResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse ** SOAP_FMAC4 soap_get_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap *soap, struct d__GetMobileCreateSignatureStatusResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetMobileCreateSignatureStatusResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse ** SOAP_FMAC4 soap_in_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap *soap, const char *tag, struct d__GetMobileCreateSignatureStatusResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetMobileCreateSignatureStatusResponse **)soap_malloc(soap, sizeof(struct d__GetMobileCreateSignatureStatusResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetMobileCreateSignatureStatusResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetMobileCreateSignatureStatusResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse, sizeof(struct d__GetMobileCreateSignatureStatusResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileCreateSignatureResponse(struct soap *soap, struct d__MobileCreateSignatureResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__MobileCreateSignatureResponse)) - soap_serialize_d__MobileCreateSignatureResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileCreateSignatureResponse(struct soap *soap, struct d__MobileCreateSignatureResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__MobileCreateSignatureResponse); - if (soap_out_PointerTod__MobileCreateSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileCreateSignatureResponse(struct soap *soap, const char *tag, int id, struct d__MobileCreateSignatureResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__MobileCreateSignatureResponse); - if (id < 0) - return soap->error; - return soap_out_d__MobileCreateSignatureResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__MobileCreateSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileCreateSignatureResponse(struct soap *soap, struct d__MobileCreateSignatureResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__MobileCreateSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileCreateSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileCreateSignatureResponse(struct soap *soap, const char *tag, struct d__MobileCreateSignatureResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__MobileCreateSignatureResponse **)soap_malloc(soap, sizeof(struct d__MobileCreateSignatureResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__MobileCreateSignatureResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__MobileCreateSignatureResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__MobileCreateSignatureResponse, sizeof(struct d__MobileCreateSignatureResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileDigestList(struct soap *soap, struct d__DataFileDigestList *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__DataFileDigestList)) - soap_serialize_d__DataFileDigestList(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileDigestList(struct soap *soap, struct d__DataFileDigestList *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__DataFileDigestList); - if (soap_out_PointerTod__DataFileDigestList(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileDigestList(struct soap *soap, const char *tag, int id, struct d__DataFileDigestList *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__DataFileDigestList); - if (id < 0) - return soap->error; - return soap_out_d__DataFileDigestList(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__DataFileDigestList ** SOAP_FMAC4 soap_get_PointerTod__DataFileDigestList(struct soap *soap, struct d__DataFileDigestList **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__DataFileDigestList(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileDigestList ** SOAP_FMAC4 soap_in_PointerTod__DataFileDigestList(struct soap *soap, const char *tag, struct d__DataFileDigestList **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__DataFileDigestList **)soap_malloc(soap, sizeof(struct d__DataFileDigestList *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__DataFileDigestList(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__DataFileDigestList **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__DataFileDigestList, sizeof(struct d__DataFileDigestList), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileDigest(struct soap *soap, struct d__DataFileDigest *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__DataFileDigest)) - soap_serialize_d__DataFileDigest(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileDigest(struct soap *soap, struct d__DataFileDigest *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__DataFileDigest); - if (soap_out_PointerTod__DataFileDigest(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileDigest(struct soap *soap, const char *tag, int id, struct d__DataFileDigest *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__DataFileDigest); - if (id < 0) - return soap->error; - return soap_out_d__DataFileDigest(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__DataFileDigest ** SOAP_FMAC4 soap_get_PointerTod__DataFileDigest(struct soap *soap, struct d__DataFileDigest **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__DataFileDigest(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileDigest ** SOAP_FMAC4 soap_in_PointerTod__DataFileDigest(struct soap *soap, const char *tag, struct d__DataFileDigest **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__DataFileDigest **)soap_malloc(soap, sizeof(struct d__DataFileDigest *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__DataFileDigest(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__DataFileDigest **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__DataFileDigest, sizeof(struct d__DataFileDigest), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetMobileAuthenticateStatusResponse(struct soap *soap, struct d__GetMobileAuthenticateStatusResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse)) - soap_serialize_d__GetMobileAuthenticateStatusResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetMobileAuthenticateStatusResponse(struct soap *soap, struct d__GetMobileAuthenticateStatusResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse); - if (soap_out_PointerTod__GetMobileAuthenticateStatusResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetMobileAuthenticateStatusResponse(struct soap *soap, const char *tag, int id, struct d__GetMobileAuthenticateStatusResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetMobileAuthenticateStatusResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse ** SOAP_FMAC4 soap_get_PointerTod__GetMobileAuthenticateStatusResponse(struct soap *soap, struct d__GetMobileAuthenticateStatusResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetMobileAuthenticateStatusResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse ** SOAP_FMAC4 soap_in_PointerTod__GetMobileAuthenticateStatusResponse(struct soap *soap, const char *tag, struct d__GetMobileAuthenticateStatusResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetMobileAuthenticateStatusResponse **)soap_malloc(soap, sizeof(struct d__GetMobileAuthenticateStatusResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetMobileAuthenticateStatusResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetMobileAuthenticateStatusResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetMobileAuthenticateStatusResponse, sizeof(struct d__GetMobileAuthenticateStatusResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileAuthenticateResponse(struct soap *soap, struct d__MobileAuthenticateResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__MobileAuthenticateResponse)) - soap_serialize_d__MobileAuthenticateResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileAuthenticateResponse(struct soap *soap, struct d__MobileAuthenticateResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__MobileAuthenticateResponse); - if (soap_out_PointerTod__MobileAuthenticateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileAuthenticateResponse(struct soap *soap, const char *tag, int id, struct d__MobileAuthenticateResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__MobileAuthenticateResponse); - if (id < 0) - return soap->error; - return soap_out_d__MobileAuthenticateResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__MobileAuthenticateResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileAuthenticateResponse(struct soap *soap, struct d__MobileAuthenticateResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__MobileAuthenticateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileAuthenticateResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileAuthenticateResponse(struct soap *soap, const char *tag, struct d__MobileAuthenticateResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__MobileAuthenticateResponse **)soap_malloc(soap, sizeof(struct d__MobileAuthenticateResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__MobileAuthenticateResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__MobileAuthenticateResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__MobileAuthenticateResponse, sizeof(struct d__MobileAuthenticateResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetStatusInfoResponse(struct soap *soap, struct d__GetStatusInfoResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetStatusInfoResponse)) - soap_serialize_d__GetStatusInfoResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetStatusInfoResponse(struct soap *soap, struct d__GetStatusInfoResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetStatusInfoResponse); - if (soap_out_PointerTod__GetStatusInfoResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetStatusInfoResponse(struct soap *soap, const char *tag, int id, struct d__GetStatusInfoResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetStatusInfoResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetStatusInfoResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetStatusInfoResponse ** SOAP_FMAC4 soap_get_PointerTod__GetStatusInfoResponse(struct soap *soap, struct d__GetStatusInfoResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetStatusInfoResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetStatusInfoResponse ** SOAP_FMAC4 soap_in_PointerTod__GetStatusInfoResponse(struct soap *soap, const char *tag, struct d__GetStatusInfoResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetStatusInfoResponse **)soap_malloc(soap, sizeof(struct d__GetStatusInfoResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetStatusInfoResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetStatusInfoResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetStatusInfoResponse, sizeof(struct d__GetStatusInfoResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileSignResponse(struct soap *soap, struct d__MobileSignResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__MobileSignResponse)) - soap_serialize_d__MobileSignResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileSignResponse(struct soap *soap, struct d__MobileSignResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__MobileSignResponse); - if (soap_out_PointerTod__MobileSignResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileSignResponse(struct soap *soap, const char *tag, int id, struct d__MobileSignResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__MobileSignResponse); - if (id < 0) - return soap->error; - return soap_out_d__MobileSignResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__MobileSignResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileSignResponse(struct soap *soap, struct d__MobileSignResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__MobileSignResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__MobileSignResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileSignResponse(struct soap *soap, const char *tag, struct d__MobileSignResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__MobileSignResponse **)soap_malloc(soap, sizeof(struct d__MobileSignResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__MobileSignResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__MobileSignResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__MobileSignResponse, sizeof(struct d__MobileSignResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetVersionResponse(struct soap *soap, struct d__GetVersionResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetVersionResponse)) - soap_serialize_d__GetVersionResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetVersionResponse(struct soap *soap, struct d__GetVersionResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetVersionResponse); - if (soap_out_PointerTod__GetVersionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetVersionResponse(struct soap *soap, const char *tag, int id, struct d__GetVersionResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetVersionResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetVersionResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetVersionResponse ** SOAP_FMAC4 soap_get_PointerTod__GetVersionResponse(struct soap *soap, struct d__GetVersionResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetVersionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetVersionResponse ** SOAP_FMAC4 soap_in_PointerTod__GetVersionResponse(struct soap *soap, const char *tag, struct d__GetVersionResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetVersionResponse **)soap_malloc(soap, sizeof(struct d__GetVersionResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetVersionResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetVersionResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetVersionResponse, sizeof(struct d__GetVersionResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RemoveSignatureResponse(struct soap *soap, struct d__RemoveSignatureResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__RemoveSignatureResponse)) - soap_serialize_d__RemoveSignatureResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RemoveSignatureResponse(struct soap *soap, struct d__RemoveSignatureResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__RemoveSignatureResponse); - if (soap_out_PointerTod__RemoveSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RemoveSignatureResponse(struct soap *soap, const char *tag, int id, struct d__RemoveSignatureResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__RemoveSignatureResponse); - if (id < 0) - return soap->error; - return soap_out_d__RemoveSignatureResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__RemoveSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__RemoveSignatureResponse(struct soap *soap, struct d__RemoveSignatureResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__RemoveSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__RemoveSignatureResponse(struct soap *soap, const char *tag, struct d__RemoveSignatureResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__RemoveSignatureResponse **)soap_malloc(soap, sizeof(struct d__RemoveSignatureResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__RemoveSignatureResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__RemoveSignatureResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__RemoveSignatureResponse, sizeof(struct d__RemoveSignatureResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__FinalizeSignatureResponse(struct soap *soap, struct d__FinalizeSignatureResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__FinalizeSignatureResponse)) - soap_serialize_d__FinalizeSignatureResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__FinalizeSignatureResponse(struct soap *soap, struct d__FinalizeSignatureResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__FinalizeSignatureResponse); - if (soap_out_PointerTod__FinalizeSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__FinalizeSignatureResponse(struct soap *soap, const char *tag, int id, struct d__FinalizeSignatureResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__FinalizeSignatureResponse); - if (id < 0) - return soap->error; - return soap_out_d__FinalizeSignatureResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__FinalizeSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__FinalizeSignatureResponse(struct soap *soap, struct d__FinalizeSignatureResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__FinalizeSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__FinalizeSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__FinalizeSignatureResponse(struct soap *soap, const char *tag, struct d__FinalizeSignatureResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__FinalizeSignatureResponse **)soap_malloc(soap, sizeof(struct d__FinalizeSignatureResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__FinalizeSignatureResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__FinalizeSignatureResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__FinalizeSignatureResponse, sizeof(struct d__FinalizeSignatureResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__PrepareSignatureResponse(struct soap *soap, struct d__PrepareSignatureResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__PrepareSignatureResponse)) - soap_serialize_d__PrepareSignatureResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__PrepareSignatureResponse(struct soap *soap, struct d__PrepareSignatureResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__PrepareSignatureResponse); - if (soap_out_PointerTod__PrepareSignatureResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__PrepareSignatureResponse(struct soap *soap, const char *tag, int id, struct d__PrepareSignatureResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__PrepareSignatureResponse); - if (id < 0) - return soap->error; - return soap_out_d__PrepareSignatureResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__PrepareSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__PrepareSignatureResponse(struct soap *soap, struct d__PrepareSignatureResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__PrepareSignatureResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__PrepareSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__PrepareSignatureResponse(struct soap *soap, const char *tag, struct d__PrepareSignatureResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__PrepareSignatureResponse **)soap_malloc(soap, sizeof(struct d__PrepareSignatureResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__PrepareSignatureResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__PrepareSignatureResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__PrepareSignatureResponse, sizeof(struct d__PrepareSignatureResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignatureModulesResponse(struct soap *soap, struct d__GetSignatureModulesResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetSignatureModulesResponse)) - soap_serialize_d__GetSignatureModulesResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignatureModulesResponse(struct soap *soap, struct d__GetSignatureModulesResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetSignatureModulesResponse); - if (soap_out_PointerTod__GetSignatureModulesResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignatureModulesResponse(struct soap *soap, const char *tag, int id, struct d__GetSignatureModulesResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetSignatureModulesResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetSignatureModulesResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetSignatureModulesResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignatureModulesResponse(struct soap *soap, struct d__GetSignatureModulesResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetSignatureModulesResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignatureModulesResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignatureModulesResponse(struct soap *soap, const char *tag, struct d__GetSignatureModulesResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetSignatureModulesResponse **)soap_malloc(soap, sizeof(struct d__GetSignatureModulesResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetSignatureModulesResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetSignatureModulesResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetSignatureModulesResponse, sizeof(struct d__GetSignatureModulesResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureModulesArray(struct soap *soap, struct d__SignatureModulesArray *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignatureModulesArray)) - soap_serialize_d__SignatureModulesArray(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureModulesArray(struct soap *soap, struct d__SignatureModulesArray *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignatureModulesArray); - if (soap_out_PointerTod__SignatureModulesArray(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureModulesArray(struct soap *soap, const char *tag, int id, struct d__SignatureModulesArray *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignatureModulesArray); - if (id < 0) - return soap->error; - return soap_out_d__SignatureModulesArray(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignatureModulesArray ** SOAP_FMAC4 soap_get_PointerTod__SignatureModulesArray(struct soap *soap, struct d__SignatureModulesArray **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignatureModulesArray(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureModulesArray ** SOAP_FMAC4 soap_in_PointerTod__SignatureModulesArray(struct soap *soap, const char *tag, struct d__SignatureModulesArray **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignatureModulesArray **)soap_malloc(soap, sizeof(struct d__SignatureModulesArray *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignatureModulesArray(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignatureModulesArray **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignatureModulesArray, sizeof(struct d__SignatureModulesArray), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureModule(struct soap *soap, struct d__SignatureModule *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignatureModule)) - soap_serialize_d__SignatureModule(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureModule(struct soap *soap, struct d__SignatureModule *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignatureModule); - if (soap_out_PointerTod__SignatureModule(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureModule(struct soap *soap, const char *tag, int id, struct d__SignatureModule *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignatureModule); - if (id < 0) - return soap->error; - return soap_out_d__SignatureModule(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignatureModule ** SOAP_FMAC4 soap_get_PointerTod__SignatureModule(struct soap *soap, struct d__SignatureModule **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignatureModule(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureModule ** SOAP_FMAC4 soap_in_PointerTod__SignatureModule(struct soap *soap, const char *tag, struct d__SignatureModule **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignatureModule **)soap_malloc(soap, sizeof(struct d__SignatureModule *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignatureModule(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignatureModule **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignatureModule, sizeof(struct d__SignatureModule), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetCRLResponse(struct soap *soap, struct d__GetCRLResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetCRLResponse)) - soap_serialize_d__GetCRLResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetCRLResponse(struct soap *soap, struct d__GetCRLResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetCRLResponse); - if (soap_out_PointerTod__GetCRLResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetCRLResponse(struct soap *soap, const char *tag, int id, struct d__GetCRLResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetCRLResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetCRLResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetCRLResponse ** SOAP_FMAC4 soap_get_PointerTod__GetCRLResponse(struct soap *soap, struct d__GetCRLResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetCRLResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetCRLResponse ** SOAP_FMAC4 soap_in_PointerTod__GetCRLResponse(struct soap *soap, const char *tag, struct d__GetCRLResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetCRLResponse **)soap_malloc(soap, sizeof(struct d__GetCRLResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetCRLResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetCRLResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetCRLResponse, sizeof(struct d__GetCRLResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetTimestampResponse(struct soap *soap, struct d__GetTimestampResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetTimestampResponse)) - soap_serialize_d__GetTimestampResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetTimestampResponse(struct soap *soap, struct d__GetTimestampResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetTimestampResponse); - if (soap_out_PointerTod__GetTimestampResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetTimestampResponse(struct soap *soap, const char *tag, int id, struct d__GetTimestampResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetTimestampResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetTimestampResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetTimestampResponse ** SOAP_FMAC4 soap_get_PointerTod__GetTimestampResponse(struct soap *soap, struct d__GetTimestampResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetTimestampResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTimestampResponse ** SOAP_FMAC4 soap_in_PointerTod__GetTimestampResponse(struct soap *soap, const char *tag, struct d__GetTimestampResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetTimestampResponse **)soap_malloc(soap, sizeof(struct d__GetTimestampResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetTimestampResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetTimestampResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetTimestampResponse, sizeof(struct d__GetTimestampResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetTSACertificateResponse(struct soap *soap, struct d__GetTSACertificateResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetTSACertificateResponse)) - soap_serialize_d__GetTSACertificateResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetTSACertificateResponse(struct soap *soap, struct d__GetTSACertificateResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetTSACertificateResponse); - if (soap_out_PointerTod__GetTSACertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetTSACertificateResponse(struct soap *soap, const char *tag, int id, struct d__GetTSACertificateResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetTSACertificateResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetTSACertificateResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetTSACertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetTSACertificateResponse(struct soap *soap, struct d__GetTSACertificateResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetTSACertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetTSACertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetTSACertificateResponse(struct soap *soap, const char *tag, struct d__GetTSACertificateResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetTSACertificateResponse **)soap_malloc(soap, sizeof(struct d__GetTSACertificateResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetTSACertificateResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetTSACertificateResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetTSACertificateResponse, sizeof(struct d__GetTSACertificateResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetNotaryResponse(struct soap *soap, struct d__GetNotaryResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetNotaryResponse)) - soap_serialize_d__GetNotaryResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetNotaryResponse(struct soap *soap, struct d__GetNotaryResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetNotaryResponse); - if (soap_out_PointerTod__GetNotaryResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetNotaryResponse(struct soap *soap, const char *tag, int id, struct d__GetNotaryResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetNotaryResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetNotaryResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetNotaryResponse ** SOAP_FMAC4 soap_get_PointerTod__GetNotaryResponse(struct soap *soap, struct d__GetNotaryResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetNotaryResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotaryResponse ** SOAP_FMAC4 soap_in_PointerTod__GetNotaryResponse(struct soap *soap, const char *tag, struct d__GetNotaryResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetNotaryResponse **)soap_malloc(soap, sizeof(struct d__GetNotaryResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetNotaryResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetNotaryResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetNotaryResponse, sizeof(struct d__GetNotaryResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetNotarysCertificateResponse(struct soap *soap, struct d__GetNotarysCertificateResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetNotarysCertificateResponse)) - soap_serialize_d__GetNotarysCertificateResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetNotarysCertificateResponse(struct soap *soap, struct d__GetNotarysCertificateResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetNotarysCertificateResponse); - if (soap_out_PointerTod__GetNotarysCertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetNotarysCertificateResponse(struct soap *soap, const char *tag, int id, struct d__GetNotarysCertificateResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetNotarysCertificateResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetNotarysCertificateResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetNotarysCertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetNotarysCertificateResponse(struct soap *soap, struct d__GetNotarysCertificateResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetNotarysCertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetNotarysCertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetNotarysCertificateResponse(struct soap *soap, const char *tag, struct d__GetNotarysCertificateResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetNotarysCertificateResponse **)soap_malloc(soap, sizeof(struct d__GetNotarysCertificateResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetNotarysCertificateResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetNotarysCertificateResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetNotarysCertificateResponse, sizeof(struct d__GetNotarysCertificateResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignersCertificateResponse(struct soap *soap, struct d__GetSignersCertificateResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetSignersCertificateResponse)) - soap_serialize_d__GetSignersCertificateResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignersCertificateResponse(struct soap *soap, struct d__GetSignersCertificateResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetSignersCertificateResponse); - if (soap_out_PointerTod__GetSignersCertificateResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignersCertificateResponse(struct soap *soap, const char *tag, int id, struct d__GetSignersCertificateResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetSignersCertificateResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetSignersCertificateResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetSignersCertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignersCertificateResponse(struct soap *soap, struct d__GetSignersCertificateResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetSignersCertificateResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignersCertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignersCertificateResponse(struct soap *soap, const char *tag, struct d__GetSignersCertificateResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetSignersCertificateResponse **)soap_malloc(soap, sizeof(struct d__GetSignersCertificateResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetSignersCertificateResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetSignersCertificateResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetSignersCertificateResponse, sizeof(struct d__GetSignersCertificateResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetDataFileResponse(struct soap *soap, struct d__GetDataFileResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetDataFileResponse)) - soap_serialize_d__GetDataFileResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetDataFileResponse(struct soap *soap, struct d__GetDataFileResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetDataFileResponse); - if (soap_out_PointerTod__GetDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetDataFileResponse(struct soap *soap, const char *tag, int id, struct d__GetDataFileResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetDataFileResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetDataFileResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__GetDataFileResponse(struct soap *soap, struct d__GetDataFileResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__GetDataFileResponse(struct soap *soap, const char *tag, struct d__GetDataFileResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetDataFileResponse **)soap_malloc(soap, sizeof(struct d__GetDataFileResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetDataFileResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetDataFileResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetDataFileResponse, sizeof(struct d__GetDataFileResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignedDocInfoResponse(struct soap *soap, struct d__GetSignedDocInfoResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetSignedDocInfoResponse)) - soap_serialize_d__GetSignedDocInfoResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignedDocInfoResponse(struct soap *soap, struct d__GetSignedDocInfoResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetSignedDocInfoResponse); - if (soap_out_PointerTod__GetSignedDocInfoResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignedDocInfoResponse(struct soap *soap, const char *tag, int id, struct d__GetSignedDocInfoResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetSignedDocInfoResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetSignedDocInfoResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetSignedDocInfoResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignedDocInfoResponse(struct soap *soap, struct d__GetSignedDocInfoResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetSignedDocInfoResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDocInfoResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignedDocInfoResponse(struct soap *soap, const char *tag, struct d__GetSignedDocInfoResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetSignedDocInfoResponse **)soap_malloc(soap, sizeof(struct d__GetSignedDocInfoResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetSignedDocInfoResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetSignedDocInfoResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetSignedDocInfoResponse, sizeof(struct d__GetSignedDocInfoResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignedDocResponse(struct soap *soap, struct d__GetSignedDocResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__GetSignedDocResponse)) - soap_serialize_d__GetSignedDocResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignedDocResponse(struct soap *soap, struct d__GetSignedDocResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__GetSignedDocResponse); - if (soap_out_PointerTod__GetSignedDocResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignedDocResponse(struct soap *soap, const char *tag, int id, struct d__GetSignedDocResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__GetSignedDocResponse); - if (id < 0) - return soap->error; - return soap_out_d__GetSignedDocResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__GetSignedDocResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignedDocResponse(struct soap *soap, struct d__GetSignedDocResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__GetSignedDocResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__GetSignedDocResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignedDocResponse(struct soap *soap, const char *tag, struct d__GetSignedDocResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__GetSignedDocResponse **)soap_malloc(soap, sizeof(struct d__GetSignedDocResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__GetSignedDocResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__GetSignedDocResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__GetSignedDocResponse, sizeof(struct d__GetSignedDocResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RemoveDataFileResponse(struct soap *soap, struct d__RemoveDataFileResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__RemoveDataFileResponse)) - soap_serialize_d__RemoveDataFileResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RemoveDataFileResponse(struct soap *soap, struct d__RemoveDataFileResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__RemoveDataFileResponse); - if (soap_out_PointerTod__RemoveDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RemoveDataFileResponse(struct soap *soap, const char *tag, int id, struct d__RemoveDataFileResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__RemoveDataFileResponse); - if (id < 0) - return soap->error; - return soap_out_d__RemoveDataFileResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__RemoveDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__RemoveDataFileResponse(struct soap *soap, struct d__RemoveDataFileResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__RemoveDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RemoveDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__RemoveDataFileResponse(struct soap *soap, const char *tag, struct d__RemoveDataFileResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__RemoveDataFileResponse **)soap_malloc(soap, sizeof(struct d__RemoveDataFileResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__RemoveDataFileResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__RemoveDataFileResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__RemoveDataFileResponse, sizeof(struct d__RemoveDataFileResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__AddDataFileResponse(struct soap *soap, struct d__AddDataFileResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__AddDataFileResponse)) - soap_serialize_d__AddDataFileResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__AddDataFileResponse(struct soap *soap, struct d__AddDataFileResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__AddDataFileResponse); - if (soap_out_PointerTod__AddDataFileResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__AddDataFileResponse(struct soap *soap, const char *tag, int id, struct d__AddDataFileResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__AddDataFileResponse); - if (id < 0) - return soap->error; - return soap_out_d__AddDataFileResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__AddDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__AddDataFileResponse(struct soap *soap, struct d__AddDataFileResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__AddDataFileResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__AddDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__AddDataFileResponse(struct soap *soap, const char *tag, struct d__AddDataFileResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__AddDataFileResponse **)soap_malloc(soap, sizeof(struct d__AddDataFileResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__AddDataFileResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__AddDataFileResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__AddDataFileResponse, sizeof(struct d__AddDataFileResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CreateSignedDocResponse(struct soap *soap, struct d__CreateSignedDocResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__CreateSignedDocResponse)) - soap_serialize_d__CreateSignedDocResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CreateSignedDocResponse(struct soap *soap, struct d__CreateSignedDocResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__CreateSignedDocResponse); - if (soap_out_PointerTod__CreateSignedDocResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CreateSignedDocResponse(struct soap *soap, const char *tag, int id, struct d__CreateSignedDocResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__CreateSignedDocResponse); - if (id < 0) - return soap->error; - return soap_out_d__CreateSignedDocResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__CreateSignedDocResponse ** SOAP_FMAC4 soap_get_PointerTod__CreateSignedDocResponse(struct soap *soap, struct d__CreateSignedDocResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__CreateSignedDocResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CreateSignedDocResponse ** SOAP_FMAC4 soap_in_PointerTod__CreateSignedDocResponse(struct soap *soap, const char *tag, struct d__CreateSignedDocResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__CreateSignedDocResponse **)soap_malloc(soap, sizeof(struct d__CreateSignedDocResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__CreateSignedDocResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__CreateSignedDocResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__CreateSignedDocResponse, sizeof(struct d__CreateSignedDocResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CloseSessionResponse(struct soap *soap, struct d__CloseSessionResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__CloseSessionResponse)) - soap_serialize_d__CloseSessionResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CloseSessionResponse(struct soap *soap, struct d__CloseSessionResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__CloseSessionResponse); - if (soap_out_PointerTod__CloseSessionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CloseSessionResponse(struct soap *soap, const char *tag, int id, struct d__CloseSessionResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__CloseSessionResponse); - if (id < 0) - return soap->error; - return soap_out_d__CloseSessionResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__CloseSessionResponse ** SOAP_FMAC4 soap_get_PointerTod__CloseSessionResponse(struct soap *soap, struct d__CloseSessionResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__CloseSessionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CloseSessionResponse ** SOAP_FMAC4 soap_in_PointerTod__CloseSessionResponse(struct soap *soap, const char *tag, struct d__CloseSessionResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__CloseSessionResponse **)soap_malloc(soap, sizeof(struct d__CloseSessionResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__CloseSessionResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__CloseSessionResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__CloseSessionResponse, sizeof(struct d__CloseSessionResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__StartSessionResponse(struct soap *soap, struct d__StartSessionResponse *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__StartSessionResponse)) - soap_serialize_d__StartSessionResponse(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__StartSessionResponse(struct soap *soap, struct d__StartSessionResponse *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__StartSessionResponse); - if (soap_out_PointerTod__StartSessionResponse(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__StartSessionResponse(struct soap *soap, const char *tag, int id, struct d__StartSessionResponse *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__StartSessionResponse); - if (id < 0) - return soap->error; - return soap_out_d__StartSessionResponse(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__StartSessionResponse ** SOAP_FMAC4 soap_get_PointerTod__StartSessionResponse(struct soap *soap, struct d__StartSessionResponse **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__StartSessionResponse(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__StartSessionResponse ** SOAP_FMAC4 soap_in_PointerTod__StartSessionResponse(struct soap *soap, const char *tag, struct d__StartSessionResponse **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__StartSessionResponse **)soap_malloc(soap, sizeof(struct d__StartSessionResponse *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__StartSessionResponse(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__StartSessionResponse **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__StartSessionResponse, sizeof(struct d__StartSessionResponse), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileData(struct soap *soap, struct d__DataFileData *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__DataFileData)) - soap_serialize_d__DataFileData(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileData(struct soap *soap, struct d__DataFileData *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__DataFileData); - if (soap_out_PointerTod__DataFileData(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileData(struct soap *soap, const char *tag, int id, struct d__DataFileData *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__DataFileData); - if (id < 0) - return soap->error; - return soap_out_d__DataFileData(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__DataFileData ** SOAP_FMAC4 soap_get_PointerTod__DataFileData(struct soap *soap, struct d__DataFileData **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__DataFileData(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileData ** SOAP_FMAC4 soap_in_PointerTod__DataFileData(struct soap *soap, const char *tag, struct d__DataFileData **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__DataFileData **)soap_malloc(soap, sizeof(struct d__DataFileData *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__DataFileData(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__DataFileData **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__DataFileData, sizeof(struct d__DataFileData), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignedDocInfo(struct soap *soap, struct d__SignedDocInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignedDocInfo)) - soap_serialize_d__SignedDocInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignedDocInfo(struct soap *soap, struct d__SignedDocInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignedDocInfo); - if (soap_out_PointerTod__SignedDocInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignedDocInfo(struct soap *soap, const char *tag, int id, struct d__SignedDocInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignedDocInfo); - if (id < 0) - return soap->error; - return soap_out_d__SignedDocInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignedDocInfo ** SOAP_FMAC4 soap_get_PointerTod__SignedDocInfo(struct soap *soap, struct d__SignedDocInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignedDocInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignedDocInfo ** SOAP_FMAC4 soap_in_PointerTod__SignedDocInfo(struct soap *soap, const char *tag, struct d__SignedDocInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignedDocInfo **)soap_malloc(soap, sizeof(struct d__SignedDocInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignedDocInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignedDocInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignedDocInfo, sizeof(struct d__SignedDocInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureInfo(struct soap *soap, struct d__SignatureInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignatureInfo)) - soap_serialize_d__SignatureInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureInfo(struct soap *soap, struct d__SignatureInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignatureInfo); - if (soap_out_PointerTod__SignatureInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureInfo(struct soap *soap, const char *tag, int id, struct d__SignatureInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignatureInfo); - if (id < 0) - return soap->error; - return soap_out_d__SignatureInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignatureInfo ** SOAP_FMAC4 soap_get_PointerTod__SignatureInfo(struct soap *soap, struct d__SignatureInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignatureInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureInfo ** SOAP_FMAC4 soap_in_PointerTod__SignatureInfo(struct soap *soap, const char *tag, struct d__SignatureInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignatureInfo **)soap_malloc(soap, sizeof(struct d__SignatureInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignatureInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignatureInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignatureInfo, sizeof(struct d__SignatureInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileInfo(struct soap *soap, struct d__DataFileInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__DataFileInfo)) - soap_serialize_d__DataFileInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileInfo(struct soap *soap, struct d__DataFileInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__DataFileInfo); - if (soap_out_PointerTod__DataFileInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileInfo(struct soap *soap, const char *tag, int id, struct d__DataFileInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__DataFileInfo); - if (id < 0) - return soap->error; - return soap_out_d__DataFileInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__DataFileInfo ** SOAP_FMAC4 soap_get_PointerTod__DataFileInfo(struct soap *soap, struct d__DataFileInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__DataFileInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileInfo ** SOAP_FMAC4 soap_in_PointerTod__DataFileInfo(struct soap *soap, const char *tag, struct d__DataFileInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__DataFileInfo **)soap_malloc(soap, sizeof(struct d__DataFileInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__DataFileInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__DataFileInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__DataFileInfo, sizeof(struct d__DataFileInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CRLInfo(struct soap *soap, struct d__CRLInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__CRLInfo)) - soap_serialize_d__CRLInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CRLInfo(struct soap *soap, struct d__CRLInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__CRLInfo); - if (soap_out_PointerTod__CRLInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CRLInfo(struct soap *soap, const char *tag, int id, struct d__CRLInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__CRLInfo); - if (id < 0) - return soap->error; - return soap_out_d__CRLInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__CRLInfo ** SOAP_FMAC4 soap_get_PointerTod__CRLInfo(struct soap *soap, struct d__CRLInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__CRLInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CRLInfo ** SOAP_FMAC4 soap_in_PointerTod__CRLInfo(struct soap *soap, const char *tag, struct d__CRLInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__CRLInfo **)soap_malloc(soap, sizeof(struct d__CRLInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__CRLInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__CRLInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__CRLInfo, sizeof(struct d__CRLInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__TstInfo(struct soap *soap, struct d__TstInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__TstInfo)) - soap_serialize_d__TstInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__TstInfo(struct soap *soap, struct d__TstInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__TstInfo); - if (soap_out_PointerTod__TstInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__TstInfo(struct soap *soap, const char *tag, int id, struct d__TstInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__TstInfo); - if (id < 0) - return soap->error; - return soap_out_d__TstInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__TstInfo ** SOAP_FMAC4 soap_get_PointerTod__TstInfo(struct soap *soap, struct d__TstInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__TstInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__TstInfo ** SOAP_FMAC4 soap_in_PointerTod__TstInfo(struct soap *soap, const char *tag, struct d__TstInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__TstInfo **)soap_malloc(soap, sizeof(struct d__TstInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__TstInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__TstInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__TstInfo, sizeof(struct d__TstInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__ConfirmationInfo(struct soap *soap, struct d__ConfirmationInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__ConfirmationInfo)) - soap_serialize_d__ConfirmationInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__ConfirmationInfo(struct soap *soap, struct d__ConfirmationInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__ConfirmationInfo); - if (soap_out_PointerTod__ConfirmationInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__ConfirmationInfo(struct soap *soap, const char *tag, int id, struct d__ConfirmationInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__ConfirmationInfo); - if (id < 0) - return soap->error; - return soap_out_d__ConfirmationInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__ConfirmationInfo ** SOAP_FMAC4 soap_get_PointerTod__ConfirmationInfo(struct soap *soap, struct d__ConfirmationInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__ConfirmationInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__ConfirmationInfo ** SOAP_FMAC4 soap_in_PointerTod__ConfirmationInfo(struct soap *soap, const char *tag, struct d__ConfirmationInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__ConfirmationInfo **)soap_malloc(soap, sizeof(struct d__ConfirmationInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__ConfirmationInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__ConfirmationInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__ConfirmationInfo, sizeof(struct d__ConfirmationInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignerInfo(struct soap *soap, struct d__SignerInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignerInfo)) - soap_serialize_d__SignerInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignerInfo(struct soap *soap, struct d__SignerInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignerInfo); - if (soap_out_PointerTod__SignerInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignerInfo(struct soap *soap, const char *tag, int id, struct d__SignerInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignerInfo); - if (id < 0) - return soap->error; - return soap_out_d__SignerInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignerInfo ** SOAP_FMAC4 soap_get_PointerTod__SignerInfo(struct soap *soap, struct d__SignerInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignerInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignerInfo ** SOAP_FMAC4 soap_in_PointerTod__SignerInfo(struct soap *soap, const char *tag, struct d__SignerInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignerInfo **)soap_malloc(soap, sizeof(struct d__SignerInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignerInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignerInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignerInfo, sizeof(struct d__SignerInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureProductionPlace(struct soap *soap, struct d__SignatureProductionPlace *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignatureProductionPlace)) - soap_serialize_d__SignatureProductionPlace(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureProductionPlace(struct soap *soap, struct d__SignatureProductionPlace *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignatureProductionPlace); - if (soap_out_PointerTod__SignatureProductionPlace(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureProductionPlace(struct soap *soap, const char *tag, int id, struct d__SignatureProductionPlace *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignatureProductionPlace); - if (id < 0) - return soap->error; - return soap_out_d__SignatureProductionPlace(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignatureProductionPlace ** SOAP_FMAC4 soap_get_PointerTod__SignatureProductionPlace(struct soap *soap, struct d__SignatureProductionPlace **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignatureProductionPlace(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignatureProductionPlace ** SOAP_FMAC4 soap_in_PointerTod__SignatureProductionPlace(struct soap *soap, const char *tag, struct d__SignatureProductionPlace **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignatureProductionPlace **)soap_malloc(soap, sizeof(struct d__SignatureProductionPlace *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignatureProductionPlace(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignatureProductionPlace **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignatureProductionPlace, sizeof(struct d__SignatureProductionPlace), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignerRole(struct soap *soap, struct d__SignerRole *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__SignerRole)) - soap_serialize_d__SignerRole(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignerRole(struct soap *soap, struct d__SignerRole *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__SignerRole); - if (soap_out_PointerTod__SignerRole(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignerRole(struct soap *soap, const char *tag, int id, struct d__SignerRole *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__SignerRole); - if (id < 0) - return soap->error; - return soap_out_d__SignerRole(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__SignerRole ** SOAP_FMAC4 soap_get_PointerTod__SignerRole(struct soap *soap, struct d__SignerRole **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__SignerRole(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__SignerRole ** SOAP_FMAC4 soap_in_PointerTod__SignerRole(struct soap *soap, const char *tag, struct d__SignerRole **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__SignerRole **)soap_malloc(soap, sizeof(struct d__SignerRole *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__SignerRole(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__SignerRole **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__SignerRole, sizeof(struct d__SignerRole), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__Error(struct soap *soap, struct d__Error *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__Error)) - soap_serialize_d__Error(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__Error(struct soap *soap, struct d__Error *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__Error); - if (soap_out_PointerTod__Error(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__Error(struct soap *soap, const char *tag, int id, struct d__Error *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__Error); - if (id < 0) - return soap->error; - return soap_out_d__Error(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__Error ** SOAP_FMAC4 soap_get_PointerTod__Error(struct soap *soap, struct d__Error **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__Error(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__Error ** SOAP_FMAC4 soap_in_PointerTod__Error(struct soap *soap, const char *tag, struct d__Error **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__Error **)soap_malloc(soap, sizeof(struct d__Error *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__Error(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__Error **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__Error, sizeof(struct d__Error), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RevokedInfo(struct soap *soap, struct d__RevokedInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__RevokedInfo)) - soap_serialize_d__RevokedInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RevokedInfo(struct soap *soap, struct d__RevokedInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__RevokedInfo); - if (soap_out_PointerTod__RevokedInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RevokedInfo(struct soap *soap, const char *tag, int id, struct d__RevokedInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__RevokedInfo); - if (id < 0) - return soap->error; - return soap_out_d__RevokedInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__RevokedInfo ** SOAP_FMAC4 soap_get_PointerTod__RevokedInfo(struct soap *soap, struct d__RevokedInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__RevokedInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__RevokedInfo ** SOAP_FMAC4 soap_in_PointerTod__RevokedInfo(struct soap *soap, const char *tag, struct d__RevokedInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__RevokedInfo **)soap_malloc(soap, sizeof(struct d__RevokedInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__RevokedInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__RevokedInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__RevokedInfo, sizeof(struct d__RevokedInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CertificateInfo(struct soap *soap, struct d__CertificateInfo *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__CertificateInfo)) - soap_serialize_d__CertificateInfo(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CertificateInfo(struct soap *soap, struct d__CertificateInfo *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__CertificateInfo); - if (soap_out_PointerTod__CertificateInfo(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CertificateInfo(struct soap *soap, const char *tag, int id, struct d__CertificateInfo *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__CertificateInfo); - if (id < 0) - return soap->error; - return soap_out_d__CertificateInfo(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__CertificateInfo ** SOAP_FMAC4 soap_get_PointerTod__CertificateInfo(struct soap *soap, struct d__CertificateInfo **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__CertificateInfo(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CertificateInfo ** SOAP_FMAC4 soap_in_PointerTod__CertificateInfo(struct soap *soap, const char *tag, struct d__CertificateInfo **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__CertificateInfo **)soap_malloc(soap, sizeof(struct d__CertificateInfo *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__CertificateInfo(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__CertificateInfo **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__CertificateInfo, sizeof(struct d__CertificateInfo), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CertificatePolicy(struct soap *soap, struct d__CertificatePolicy *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__CertificatePolicy)) - soap_serialize_d__CertificatePolicy(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CertificatePolicy(struct soap *soap, struct d__CertificatePolicy *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__CertificatePolicy); - if (soap_out_PointerTod__CertificatePolicy(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CertificatePolicy(struct soap *soap, const char *tag, int id, struct d__CertificatePolicy *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__CertificatePolicy); - if (id < 0) - return soap->error; - return soap_out_d__CertificatePolicy(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__CertificatePolicy ** SOAP_FMAC4 soap_get_PointerTod__CertificatePolicy(struct soap *soap, struct d__CertificatePolicy **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__CertificatePolicy(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__CertificatePolicy ** SOAP_FMAC4 soap_in_PointerTod__CertificatePolicy(struct soap *soap, const char *tag, struct d__CertificatePolicy **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__CertificatePolicy **)soap_malloc(soap, sizeof(struct d__CertificatePolicy *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__CertificatePolicy(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__CertificatePolicy **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__CertificatePolicy, sizeof(struct d__CertificatePolicy), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileAttribute(struct soap *soap, struct d__DataFileAttribute *const*a) -{ - if (!soap_reference(soap, *a, SOAP_TYPE_d__DataFileAttribute)) - soap_serialize_d__DataFileAttribute(soap, *a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileAttribute(struct soap *soap, struct d__DataFileAttribute *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTod__DataFileAttribute); - if (soap_out_PointerTod__DataFileAttribute(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileAttribute(struct soap *soap, const char *tag, int id, struct d__DataFileAttribute *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_d__DataFileAttribute); - if (id < 0) - return soap->error; - return soap_out_d__DataFileAttribute(soap, tag, id, *a, type); -} - -SOAP_FMAC3 struct d__DataFileAttribute ** SOAP_FMAC4 soap_get_PointerTod__DataFileAttribute(struct soap *soap, struct d__DataFileAttribute **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTod__DataFileAttribute(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 struct d__DataFileAttribute ** SOAP_FMAC4 soap_in_PointerTod__DataFileAttribute(struct soap *soap, const char *tag, struct d__DataFileAttribute **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (struct d__DataFileAttribute **)soap_malloc(soap, sizeof(struct d__DataFileAttribute *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_d__DataFileAttribute(soap, tag, *a, type))) - return NULL; - } - else - { a = (struct d__DataFileAttribute **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_d__DataFileAttribute, sizeof(struct d__DataFileAttribute), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedByte(struct soap *soap, unsigned char *const*a) -{ - soap_reference(soap, *a, SOAP_TYPE_unsignedByte); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedByte(struct soap *soap, unsigned char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_PointerTounsignedByte); - if (soap_out_PointerTounsignedByte(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedByte(struct soap *soap, const char *tag, int id, unsigned char *const*a, const char *type) -{ - id = soap_element_id(soap, tag, id, *a, NULL, 0, type, SOAP_TYPE_unsignedByte); - if (id < 0) - return soap->error; - return soap_out_unsignedByte(soap, tag, id, *a, type); -} - -SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_get_PointerTounsignedByte(struct soap *soap, unsigned char **p, const char *tag, const char *type) -{ - if ((p = soap_in_PointerTounsignedByte(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_in_PointerTounsignedByte(struct soap *soap, const char *tag, unsigned char **a, const char *type) -{ - if (soap_element_begin_in(soap, tag, 1, NULL)) - return NULL; - if (!a) - if (!(a = (unsigned char **)soap_malloc(soap, sizeof(unsigned char *)))) - return NULL; - *a = NULL; - if (!soap->null && *soap->href != '#') - { soap_revert(soap); - if (!(*a = soap_in_unsignedByte(soap, tag, *a, type))) - return NULL; - } - else - { a = (unsigned char **)soap_id_lookup(soap, soap->href, (void**)a, SOAP_TYPE_unsignedByte, sizeof(unsigned char), 0); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - } - return a; -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__dateTime(struct soap *soap, char **a) -{ soap_default_string(soap, a); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__dateTime(struct soap *soap, char *const*a) -{ soap_serialize_string(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__dateTime(struct soap *soap, char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__dateTime); - if (soap_out_xsd__dateTime(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__dateTime(struct soap *soap, const char *tag, int id, char *const*a, const char *type) -{ - return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_xsd__dateTime); -} - -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__dateTime(struct soap *soap, char **p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__dateTime(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__dateTime(struct soap *soap, const char *tag, char **a, const char *type) -{ - return soap_instring(soap, tag, a, type, SOAP_TYPE_xsd__dateTime, 1, -1, -1); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__anyURI(struct soap *soap, char **a) -{ soap_default_string(soap, a); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__anyURI(struct soap *soap, char *const*a) -{ soap_serialize_string(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__anyURI(struct soap *soap, char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__anyURI); - if (soap_out_xsd__anyURI(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__anyURI(struct soap *soap, const char *tag, int id, char *const*a, const char *type) -{ - return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_xsd__anyURI); -} - -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__anyURI(struct soap *soap, char **p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__anyURI(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__anyURI(struct soap *soap, const char *tag, char **a, const char *type) -{ - return soap_instring(soap, tag, a, type, SOAP_TYPE_xsd__anyURI, 1, -1, -1); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__string(struct soap *soap, char **a) -{ soap_default_string(soap, a); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__string(struct soap *soap, char *const*a) -{ soap_serialize_string(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__string(struct soap *soap, char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_xsd__string); - if (soap_out_xsd__string(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__string(struct soap *soap, const char *tag, int id, char *const*a, const char *type) -{ - return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_xsd__string); -} - -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__string(struct soap *soap, char **p, const char *tag, const char *type) -{ - if ((p = soap_in_xsd__string(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__string(struct soap *soap, const char *tag, char **a, const char *type) -{ - return soap_instring(soap, tag, a, type, SOAP_TYPE_xsd__string, 1, -1, -1); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap *soap, char **a) -{ soap_default_string(soap, a); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap *soap, char *const*a) -{ soap_serialize_string(soap, a); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap *soap, char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE__QName); - if (soap_out__QName(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap *soap, const char *tag, int id, char *const*a, const char *type) -{ - return soap_outstring(soap, tag, id, a, type, SOAP_TYPE__QName); -} - -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap *soap, char **p, const char *tag, const char *type) -{ - if ((p = soap_in__QName(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap *soap, const char *tag, char **a, const char *type) -{ - return soap_instring(soap, tag, a, type, SOAP_TYPE__QName, 2, -1, -1); -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap *soap, char **a) -{ (void)soap; /* appease -Wall -Werror */ -#ifdef SOAP_DEFAULT_string - *a = SOAP_DEFAULT_string; -#else - *a = (char *)0; -#endif -} - -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap *soap, char *const*a) -{ - soap_reference(soap, *a, SOAP_TYPE_string); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap *soap, char *const*a, const char *tag, const char *type) -{ - register int id = soap_embed(soap, (void*)a, NULL, 0, tag, SOAP_TYPE_string); - if (soap_out_string(soap, tag, id, a, type)) - return soap->error; - return soap_putindependent(soap); -} - -SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap *soap, const char *tag, int id, char *const*a, const char *type) -{ - return soap_outstring(soap, tag, id, a, type, SOAP_TYPE_string); -} - -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap *soap, char **p, const char *tag, const char *type) -{ - if ((p = soap_in_string(soap, tag, p, type))) - soap_getindependent(soap); - return p; -} - -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap *soap, const char *tag, char **a, const char *type) -{ - return soap_instring(soap, tag, a, type, SOAP_TYPE_string, 1, -1, -1); -} - -#ifdef __cplusplus -} -#endif - -/* End of ddsC.c */ diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/ddsClient.c libdigidoc-3.7.0.875/DigiDocServiceClient/ddsClient.c --- libdigidoc-2.7.0/DigiDocServiceClient/ddsClient.c 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/ddsClient.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1398 +0,0 @@ -/* ddsClient.c - Generated by gSOAP 2.7.9 from DigiDocService.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. - This part of the software is released under one of the following licenses: - GPL, the gSOAP public license, or Genivia's license for commercial use. -*/ -#include "ddsH.h" -#ifdef __cplusplus -extern "C" { -#endif - -SOAP_SOURCE_STAMP("@(#) ddsClient.c ver 2.7.9 2007-03-12 16:55:20 GMT") - - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__StartSession(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *SigningProfile, char *SigDocXML, bool bHoldSession, struct d__DataFileData *datafile, struct d__StartSessionResponse *result) -{ struct d__StartSession soap_tmp_d__StartSession; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__StartSession.SigningProfile = SigningProfile; - soap_tmp_d__StartSession.SigDocXML = SigDocXML; - soap_tmp_d__StartSession.bHoldSession = bHoldSession; - soap_tmp_d__StartSession.datafile = datafile; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__StartSession(soap, &soap_tmp_d__StartSession); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__StartSession(soap, &soap_tmp_d__StartSession, "d:StartSession", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__StartSession(soap, &soap_tmp_d__StartSession, "d:StartSession", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__StartSessionResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__StartSessionResponse(soap, result, "d:StartSessionResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__CloseSession(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__CloseSessionResponse *result) -{ struct d__CloseSession soap_tmp_d__CloseSession; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__CloseSession.Sesscode = Sesscode; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__CloseSession(soap, &soap_tmp_d__CloseSession); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__CloseSession(soap, &soap_tmp_d__CloseSession, "d:CloseSession", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__CloseSession(soap, &soap_tmp_d__CloseSession, "d:CloseSession", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__CloseSessionResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__CloseSessionResponse(soap, result, "d:CloseSessionResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__CreateSignedDoc(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *Format, char *Version, struct d__CreateSignedDocResponse *result) -{ struct d__CreateSignedDoc soap_tmp_d__CreateSignedDoc; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__CreateSignedDoc.Sesscode = Sesscode; - soap_tmp_d__CreateSignedDoc.Format = Format; - soap_tmp_d__CreateSignedDoc.Version = Version; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__CreateSignedDoc(soap, &soap_tmp_d__CreateSignedDoc); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__CreateSignedDoc(soap, &soap_tmp_d__CreateSignedDoc, "d:CreateSignedDoc", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__CreateSignedDoc(soap, &soap_tmp_d__CreateSignedDoc, "d:CreateSignedDoc", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__CreateSignedDocResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__CreateSignedDocResponse(soap, result, "d:CreateSignedDocResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__AddDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *FileName, char *MimeType, char *ContentType, long Size, char *DigestType, char *DigestValue, char *Content, struct d__AddDataFileResponse *result) -{ struct d__AddDataFile soap_tmp_d__AddDataFile; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__AddDataFile.Sesscode = Sesscode; - soap_tmp_d__AddDataFile.FileName = FileName; - soap_tmp_d__AddDataFile.MimeType = MimeType; - soap_tmp_d__AddDataFile.ContentType = ContentType; - soap_tmp_d__AddDataFile.Size = Size; - soap_tmp_d__AddDataFile.DigestType = DigestType; - soap_tmp_d__AddDataFile.DigestValue = DigestValue; - soap_tmp_d__AddDataFile.Content = Content; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__AddDataFile(soap, &soap_tmp_d__AddDataFile); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__AddDataFile(soap, &soap_tmp_d__AddDataFile, "d:AddDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__AddDataFile(soap, &soap_tmp_d__AddDataFile, "d:AddDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__AddDataFileResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__AddDataFileResponse(soap, result, "d:AddDataFileResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__RemoveDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *DataFileId, struct d__RemoveDataFileResponse *result) -{ struct d__RemoveDataFile soap_tmp_d__RemoveDataFile; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__RemoveDataFile.Sesscode = Sesscode; - soap_tmp_d__RemoveDataFile.DataFileId = DataFileId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__RemoveDataFile(soap, &soap_tmp_d__RemoveDataFile); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__RemoveDataFile(soap, &soap_tmp_d__RemoveDataFile, "d:RemoveDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__RemoveDataFile(soap, &soap_tmp_d__RemoveDataFile, "d:RemoveDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__RemoveDataFileResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__RemoveDataFileResponse(soap, result, "d:RemoveDataFileResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignedDoc(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__GetSignedDocResponse *result) -{ struct d__GetSignedDoc soap_tmp_d__GetSignedDoc; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetSignedDoc.Sesscode = Sesscode; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetSignedDoc(soap, &soap_tmp_d__GetSignedDoc); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignedDoc(soap, &soap_tmp_d__GetSignedDoc, "d:GetSignedDoc", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignedDoc(soap, &soap_tmp_d__GetSignedDoc, "d:GetSignedDoc", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetSignedDocResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetSignedDocResponse(soap, result, "d:GetSignedDocResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignedDocInfo(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__GetSignedDocInfoResponse *result) -{ struct d__GetSignedDocInfo soap_tmp_d__GetSignedDocInfo; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetSignedDocInfo.Sesscode = Sesscode; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetSignedDocInfo(soap, &soap_tmp_d__GetSignedDocInfo); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignedDocInfo(soap, &soap_tmp_d__GetSignedDocInfo, "d:GetSignedDocInfo", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignedDocInfo(soap, &soap_tmp_d__GetSignedDocInfo, "d:GetSignedDocInfo", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetSignedDocInfoResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetSignedDocInfoResponse(soap, result, "d:GetSignedDocInfoResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *DataFileId, struct d__GetDataFileResponse *result) -{ struct d__GetDataFile soap_tmp_d__GetDataFile; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetDataFile.Sesscode = Sesscode; - soap_tmp_d__GetDataFile.DataFileId = DataFileId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetDataFile(soap, &soap_tmp_d__GetDataFile); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetDataFile(soap, &soap_tmp_d__GetDataFile, "d:GetDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetDataFile(soap, &soap_tmp_d__GetDataFile, "d:GetDataFile", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetDataFileResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetDataFileResponse(soap, result, "d:GetDataFileResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignersCertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetSignersCertificateResponse *result) -{ struct d__GetSignersCertificate soap_tmp_d__GetSignersCertificate; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetSignersCertificate.Sesscode = Sesscode; - soap_tmp_d__GetSignersCertificate.SignatureId = SignatureId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetSignersCertificate(soap, &soap_tmp_d__GetSignersCertificate); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignersCertificate(soap, &soap_tmp_d__GetSignersCertificate, "d:GetSignersCertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignersCertificate(soap, &soap_tmp_d__GetSignersCertificate, "d:GetSignersCertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetSignersCertificateResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetSignersCertificateResponse(soap, result, "d:GetSignersCertificateResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetNotarysCertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetNotarysCertificateResponse *result) -{ struct d__GetNotarysCertificate soap_tmp_d__GetNotarysCertificate; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetNotarysCertificate.Sesscode = Sesscode; - soap_tmp_d__GetNotarysCertificate.SignatureId = SignatureId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetNotarysCertificate(soap, &soap_tmp_d__GetNotarysCertificate); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetNotarysCertificate(soap, &soap_tmp_d__GetNotarysCertificate, "d:GetNotarysCertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetNotarysCertificate(soap, &soap_tmp_d__GetNotarysCertificate, "d:GetNotarysCertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetNotarysCertificateResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetNotarysCertificateResponse(soap, result, "d:GetNotarysCertificateResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetNotary(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetNotaryResponse *result) -{ struct d__GetNotary soap_tmp_d__GetNotary; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetNotary.Sesscode = Sesscode; - soap_tmp_d__GetNotary.SignatureId = SignatureId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetNotary(soap, &soap_tmp_d__GetNotary); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetNotary(soap, &soap_tmp_d__GetNotary, "d:GetNotary", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetNotary(soap, &soap_tmp_d__GetNotary, "d:GetNotary", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetNotaryResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetNotaryResponse(soap, result, "d:GetNotaryResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetTSACertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *TimestampId, struct d__GetTSACertificateResponse *result) -{ struct d__GetTSACertificate soap_tmp_d__GetTSACertificate; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetTSACertificate.Sesscode = Sesscode; - soap_tmp_d__GetTSACertificate.TimestampId = TimestampId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetTSACertificate(soap, &soap_tmp_d__GetTSACertificate); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetTSACertificate(soap, &soap_tmp_d__GetTSACertificate, "d:GetTSACertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetTSACertificate(soap, &soap_tmp_d__GetTSACertificate, "d:GetTSACertificate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetTSACertificateResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetTSACertificateResponse(soap, result, "d:GetTSACertificateResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetTimestamp(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *TimestampId, struct d__GetTimestampResponse *result) -{ struct d__GetTimestamp soap_tmp_d__GetTimestamp; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetTimestamp.Sesscode = Sesscode; - soap_tmp_d__GetTimestamp.TimestampId = TimestampId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetTimestamp(soap, &soap_tmp_d__GetTimestamp); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetTimestamp(soap, &soap_tmp_d__GetTimestamp, "d:GetTimestamp", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetTimestamp(soap, &soap_tmp_d__GetTimestamp, "d:GetTimestamp", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetTimestampResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetTimestampResponse(soap, result, "d:GetTimestampResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetCRL(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetCRLResponse *result) -{ struct d__GetCRL soap_tmp_d__GetCRL; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetCRL.Sesscode = Sesscode; - soap_tmp_d__GetCRL.SignatureId = SignatureId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetCRL(soap, &soap_tmp_d__GetCRL); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetCRL(soap, &soap_tmp_d__GetCRL, "d:GetCRL", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetCRL(soap, &soap_tmp_d__GetCRL, "d:GetCRL", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetCRLResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetCRLResponse(soap, result, "d:GetCRLResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignatureModules(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *Platform, char *Phase, char *Type, struct d__GetSignatureModulesResponse *result) -{ struct d__GetSignatureModules soap_tmp_d__GetSignatureModules; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetSignatureModules.Sesscode = Sesscode; - soap_tmp_d__GetSignatureModules.Platform = Platform; - soap_tmp_d__GetSignatureModules.Phase = Phase; - soap_tmp_d__GetSignatureModules.Type = Type; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetSignatureModules(soap, &soap_tmp_d__GetSignatureModules); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignatureModules(soap, &soap_tmp_d__GetSignatureModules, "d:GetSignatureModules", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetSignatureModules(soap, &soap_tmp_d__GetSignatureModules, "d:GetSignatureModules", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetSignatureModulesResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetSignatureModulesResponse(soap, result, "d:GetSignatureModulesResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__PrepareSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignersCertificate, char *SignersTokenId, char *Role, char *City, char *State, char *PostalCode, char *Country, char *SigningProfile, struct d__PrepareSignatureResponse *result) -{ struct d__PrepareSignature soap_tmp_d__PrepareSignature; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__PrepareSignature.Sesscode = Sesscode; - soap_tmp_d__PrepareSignature.SignersCertificate = SignersCertificate; - soap_tmp_d__PrepareSignature.SignersTokenId = SignersTokenId; - soap_tmp_d__PrepareSignature.Role = Role; - soap_tmp_d__PrepareSignature.City = City; - soap_tmp_d__PrepareSignature.State = State; - soap_tmp_d__PrepareSignature.PostalCode = PostalCode; - soap_tmp_d__PrepareSignature.Country = Country; - soap_tmp_d__PrepareSignature.SigningProfile = SigningProfile; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__PrepareSignature(soap, &soap_tmp_d__PrepareSignature); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__PrepareSignature(soap, &soap_tmp_d__PrepareSignature, "d:PrepareSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__PrepareSignature(soap, &soap_tmp_d__PrepareSignature, "d:PrepareSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__PrepareSignatureResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__PrepareSignatureResponse(soap, result, "d:PrepareSignatureResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__FinalizeSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, char *SignatureValue, struct d__FinalizeSignatureResponse *result) -{ struct d__FinalizeSignature soap_tmp_d__FinalizeSignature; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__FinalizeSignature.Sesscode = Sesscode; - soap_tmp_d__FinalizeSignature.SignatureId = SignatureId; - soap_tmp_d__FinalizeSignature.SignatureValue = SignatureValue; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__FinalizeSignature(soap, &soap_tmp_d__FinalizeSignature); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__FinalizeSignature(soap, &soap_tmp_d__FinalizeSignature, "d:FinalizeSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__FinalizeSignature(soap, &soap_tmp_d__FinalizeSignature, "d:FinalizeSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__FinalizeSignatureResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__FinalizeSignatureResponse(soap, result, "d:FinalizeSignatureResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__RemoveSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__RemoveSignatureResponse *result) -{ struct d__RemoveSignature soap_tmp_d__RemoveSignature; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__RemoveSignature.Sesscode = Sesscode; - soap_tmp_d__RemoveSignature.SignatureId = SignatureId; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__RemoveSignature(soap, &soap_tmp_d__RemoveSignature); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__RemoveSignature(soap, &soap_tmp_d__RemoveSignature, "d:RemoveSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__RemoveSignature(soap, &soap_tmp_d__RemoveSignature, "d:RemoveSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__RemoveSignatureResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__RemoveSignatureResponse(soap, result, "d:RemoveSignatureResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetVersion(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct d__GetVersionResponse *result) -{ struct d__GetVersion soap_tmp_d__GetVersion; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetVersion(soap, &soap_tmp_d__GetVersion); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetVersion(soap, &soap_tmp_d__GetVersion, "d:GetVersion", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetVersion(soap, &soap_tmp_d__GetVersion, "d:GetVersion", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetVersionResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetVersionResponse(soap, result, "d:GetVersionResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileSign(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignerIDCode, char *SignersCountry, char *SignerPhoneNo, char *ServiceName, char *AdditionalDataToBeDisplayed, char *Language, char *Role, char *City, char *StateOrProvince, char *PostalCode, char *CountryName, char *SigningProfile, char *MessagingMode, long AsyncConfiguration, bool ReturnDocInfo, bool ReturnDocData, struct d__MobileSignResponse *result) -{ struct d__MobileSign soap_tmp_d__MobileSign; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__MobileSign.Sesscode = Sesscode; - soap_tmp_d__MobileSign.SignerIDCode = SignerIDCode; - soap_tmp_d__MobileSign.SignersCountry = SignersCountry; - soap_tmp_d__MobileSign.SignerPhoneNo = SignerPhoneNo; - soap_tmp_d__MobileSign.ServiceName = ServiceName; - soap_tmp_d__MobileSign.AdditionalDataToBeDisplayed = AdditionalDataToBeDisplayed; - soap_tmp_d__MobileSign.Language = Language; - soap_tmp_d__MobileSign.Role = Role; - soap_tmp_d__MobileSign.City = City; - soap_tmp_d__MobileSign.StateOrProvince = StateOrProvince; - soap_tmp_d__MobileSign.PostalCode = PostalCode; - soap_tmp_d__MobileSign.CountryName = CountryName; - soap_tmp_d__MobileSign.SigningProfile = SigningProfile; - soap_tmp_d__MobileSign.MessagingMode = MessagingMode; - soap_tmp_d__MobileSign.AsyncConfiguration = AsyncConfiguration; - soap_tmp_d__MobileSign.ReturnDocInfo = ReturnDocInfo; - soap_tmp_d__MobileSign.ReturnDocData = ReturnDocData; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__MobileSign(soap, &soap_tmp_d__MobileSign); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileSign(soap, &soap_tmp_d__MobileSign, "d:MobileSign", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileSign(soap, &soap_tmp_d__MobileSign, "d:MobileSign", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__MobileSignResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__MobileSignResponse(soap, result, "d:MobileSignResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetStatusInfo(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool ReturnDocInfo, bool WaitSignature, struct d__GetStatusInfoResponse *result) -{ struct d__GetStatusInfo soap_tmp_d__GetStatusInfo; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetStatusInfo.Sesscode = Sesscode; - soap_tmp_d__GetStatusInfo.ReturnDocInfo = ReturnDocInfo; - soap_tmp_d__GetStatusInfo.WaitSignature = WaitSignature; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetStatusInfo(soap, &soap_tmp_d__GetStatusInfo); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetStatusInfo(soap, &soap_tmp_d__GetStatusInfo, "d:GetStatusInfo", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetStatusInfo(soap, &soap_tmp_d__GetStatusInfo, "d:GetStatusInfo", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetStatusInfoResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetStatusInfoResponse(soap, result, "d:GetStatusInfoResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileAuthenticate(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *IDCode, char *CountryCode, char *PhoneNo, char *Language, char *ServiceName, char *MessageToDisplay, char *SPChallenge, char *MessagingMode, long AsyncConfiguration, bool ReturnCertData, bool ReturnRevocationData, struct d__MobileAuthenticateResponse *result) -{ struct d__MobileAuthenticate soap_tmp_d__MobileAuthenticate; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__MobileAuthenticate.IDCode = IDCode; - soap_tmp_d__MobileAuthenticate.CountryCode = CountryCode; - soap_tmp_d__MobileAuthenticate.PhoneNo = PhoneNo; - soap_tmp_d__MobileAuthenticate.Language = Language; - soap_tmp_d__MobileAuthenticate.ServiceName = ServiceName; - soap_tmp_d__MobileAuthenticate.MessageToDisplay = MessageToDisplay; - soap_tmp_d__MobileAuthenticate.SPChallenge = SPChallenge; - soap_tmp_d__MobileAuthenticate.MessagingMode = MessagingMode; - soap_tmp_d__MobileAuthenticate.AsyncConfiguration = AsyncConfiguration; - soap_tmp_d__MobileAuthenticate.ReturnCertData = ReturnCertData; - soap_tmp_d__MobileAuthenticate.ReturnRevocationData = ReturnRevocationData; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__MobileAuthenticate(soap, &soap_tmp_d__MobileAuthenticate); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileAuthenticate(soap, &soap_tmp_d__MobileAuthenticate, "d:MobileAuthenticate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileAuthenticate(soap, &soap_tmp_d__MobileAuthenticate, "d:MobileAuthenticate", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__MobileAuthenticateResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__MobileAuthenticateResponse(soap, result, "d:MobileAuthenticateResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetMobileAuthenticateStatus(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool WaitSignature, struct d__GetMobileAuthenticateStatusResponse *result) -{ struct d__GetMobileAuthenticateStatus soap_tmp_d__GetMobileAuthenticateStatus; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetMobileAuthenticateStatus.Sesscode = Sesscode; - soap_tmp_d__GetMobileAuthenticateStatus.WaitSignature = WaitSignature; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetMobileAuthenticateStatus(soap, &soap_tmp_d__GetMobileAuthenticateStatus); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetMobileAuthenticateStatus(soap, &soap_tmp_d__GetMobileAuthenticateStatus, "d:GetMobileAuthenticateStatus", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetMobileAuthenticateStatus(soap, &soap_tmp_d__GetMobileAuthenticateStatus, "d:GetMobileAuthenticateStatus", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetMobileAuthenticateStatusResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetMobileAuthenticateStatusResponse(soap, result, "d:GetMobileAuthenticateStatusResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileCreateSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *IDCode, char *SignersCountry, char *PhoneNo, char *Language, char *ServiceName, char *MessageToDisplay, char *Role, char *City, char *StateOrProvince, char *PostalCode, char *CountryName, char *SigningProfile, struct d__DataFileDigestList *DataFiles, char *Format, char *Version, char *SignatureID, char *MessagingMode, long AsyncConfiguration, struct d__MobileCreateSignatureResponse *result) -{ struct d__MobileCreateSignature soap_tmp_d__MobileCreateSignature; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__MobileCreateSignature.IDCode = IDCode; - soap_tmp_d__MobileCreateSignature.SignersCountry = SignersCountry; - soap_tmp_d__MobileCreateSignature.PhoneNo = PhoneNo; - soap_tmp_d__MobileCreateSignature.Language = Language; - soap_tmp_d__MobileCreateSignature.ServiceName = ServiceName; - soap_tmp_d__MobileCreateSignature.MessageToDisplay = MessageToDisplay; - soap_tmp_d__MobileCreateSignature.Role = Role; - soap_tmp_d__MobileCreateSignature.City = City; - soap_tmp_d__MobileCreateSignature.StateOrProvince = StateOrProvince; - soap_tmp_d__MobileCreateSignature.PostalCode = PostalCode; - soap_tmp_d__MobileCreateSignature.CountryName = CountryName; - soap_tmp_d__MobileCreateSignature.SigningProfile = SigningProfile; - soap_tmp_d__MobileCreateSignature.DataFiles = DataFiles; - soap_tmp_d__MobileCreateSignature.Format = Format; - soap_tmp_d__MobileCreateSignature.Version = Version; - soap_tmp_d__MobileCreateSignature.SignatureID = SignatureID; - soap_tmp_d__MobileCreateSignature.MessagingMode = MessagingMode; - soap_tmp_d__MobileCreateSignature.AsyncConfiguration = AsyncConfiguration; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__MobileCreateSignature(soap, &soap_tmp_d__MobileCreateSignature); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileCreateSignature(soap, &soap_tmp_d__MobileCreateSignature, "d:MobileCreateSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__MobileCreateSignature(soap, &soap_tmp_d__MobileCreateSignature, "d:MobileCreateSignature", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__MobileCreateSignatureResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__MobileCreateSignatureResponse(soap, result, "d:MobileCreateSignatureResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetMobileCreateSignatureStatus(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool WaitSignature, struct d__GetMobileCreateSignatureStatusResponse *result) -{ struct d__GetMobileCreateSignatureStatus soap_tmp_d__GetMobileCreateSignatureStatus; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8095/DigiDocService"; - soap->encodingStyle = ""; - soap_tmp_d__GetMobileCreateSignatureStatus.Sesscode = Sesscode; - soap_tmp_d__GetMobileCreateSignatureStatus.WaitSignature = WaitSignature; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_d__GetMobileCreateSignatureStatus(soap, &soap_tmp_d__GetMobileCreateSignatureStatus); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetMobileCreateSignatureStatus(soap, &soap_tmp_d__GetMobileCreateSignatureStatus, "d:GetMobileCreateSignatureStatus", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_d__GetMobileCreateSignatureStatus(soap, &soap_tmp_d__GetMobileCreateSignatureStatus, "d:GetMobileCreateSignatureStatus", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_d__GetMobileCreateSignatureStatusResponse(soap, result); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_d__GetMobileCreateSignatureStatusResponse(soap, result, "d:GetMobileCreateSignatureStatusResponse", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_mss__MSS_USCORESignatureDummy(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct mss_DummyResp *resp) -{ struct mss__MSS_USCORESignatureDummy soap_tmp_mss__MSS_USCORESignatureDummy; - if (!soap_endpoint) - soap_endpoint = "http://www.sk.ee:8096/MSSP_GW"; - soap->encodingStyle = NULL; - soap_begin(soap); - soap_serializeheader(soap); - soap_serialize_mss__MSS_USCORESignatureDummy(soap, &soap_tmp_mss__MSS_USCORESignatureDummy); - if (soap_begin_count(soap)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - { if (soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_mss__MSS_USCORESignatureDummy(soap, &soap_tmp_mss__MSS_USCORESignatureDummy, "mss:MSS_SignatureDummy", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap)) - return soap->error; - } - if (soap_end_count(soap)) - return soap->error; - if (soap_connect(soap, soap_endpoint, soap_action) - || soap_envelope_begin_out(soap) - || soap_putheader(soap) - || soap_body_begin_out(soap) - || soap_put_mss__MSS_USCORESignatureDummy(soap, &soap_tmp_mss__MSS_USCORESignatureDummy, "mss:MSS_SignatureDummy", "") - || soap_body_end_out(soap) - || soap_envelope_end_out(soap) - || soap_end_send(soap)) - return soap_closesock(soap); - soap_default_mss_DummyResp(soap, resp); - if (soap_begin_recv(soap) - || soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap)) - return soap_closesock(soap); - soap_get_mss_DummyResp(soap, resp, "mss-DummyResp", ""); - if (soap->error) - { if (soap->error == SOAP_TAG_MISMATCH && soap->level == 2) - return soap_recv_fault(soap); - return soap_closesock(soap); - } - if (soap_body_end_in(soap) - || soap_envelope_end_in(soap) - || soap_end_recv(soap)) - return soap_closesock(soap); - return soap_closesock(soap); -} - -#ifdef __cplusplus -} -#endif - -/* End of ddsClient.c */ diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/ddsH.h libdigidoc-3.7.0.875/DigiDocServiceClient/ddsH.h --- libdigidoc-2.7.0/DigiDocServiceClient/ddsH.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/ddsH.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1447 +0,0 @@ -/* ddsH.h - Generated by gSOAP 2.7.9 from DigiDocService.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. - This part of the software is released under one of the following licenses: - GPL, the gSOAP public license, or Genivia's license for commercial use. -*/ - -#ifndef ddsH_H -#define ddsH_H -#include "ddsStub.h" -#ifdef __cplusplus -extern "C" { -#endif -SOAP_FMAC3 int SOAP_FMAC4 soap_ignore_element(struct soap*); -#ifndef WITH_NOIDREF -SOAP_FMAC3 int SOAP_FMAC4 soap_putindependent(struct soap*); -SOAP_FMAC3 int SOAP_FMAC4 soap_getindependent(struct soap*); -SOAP_FMAC3 void SOAP_FMAC4 soap_markelement(struct soap*, const void*, int); -SOAP_FMAC3 int SOAP_FMAC4 soap_putelement(struct soap*, const void*, const char*, int, int); -SOAP_FMAC3 void * SOAP_FMAC4 soap_getelement(struct soap*, int*); -#endif - -#ifndef SOAP_TYPE_byte -#define SOAP_TYPE_byte (2) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_byte(struct soap*, char *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_byte(struct soap*, const char *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_byte(struct soap*, const char*, int, const char *, const char*); -SOAP_FMAC3 char * SOAP_FMAC4 soap_get_byte(struct soap*, char *, const char*, const char*); -SOAP_FMAC3 char * SOAP_FMAC4 soap_in_byte(struct soap*, const char*, char *, const char*); - -#ifndef SOAP_TYPE_int -#define SOAP_TYPE_int (1) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_int(struct soap*, int *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_int(struct soap*, const int *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_int(struct soap*, const char*, int, const int *, const char*); -SOAP_FMAC3 int * SOAP_FMAC4 soap_get_int(struct soap*, int *, const char*, const char*); -SOAP_FMAC3 int * SOAP_FMAC4 soap_in_int(struct soap*, const char*, int *, const char*); - -#ifndef SOAP_TYPE_xsd__int -#define SOAP_TYPE_xsd__int (11) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__int(struct soap*, long *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__int(struct soap*, const long *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__int(struct soap*, const char*, int, const long *, const char*); -SOAP_FMAC3 long * SOAP_FMAC4 soap_get_xsd__int(struct soap*, long *, const char*, const char*); -SOAP_FMAC3 long * SOAP_FMAC4 soap_in_xsd__int(struct soap*, const char*, long *, const char*); - -#ifndef SOAP_TYPE_long -#define SOAP_TYPE_long (10) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_long(struct soap*, long *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_long(struct soap*, const long *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_long(struct soap*, const char*, int, const long *, const char*); -SOAP_FMAC3 long * SOAP_FMAC4 soap_get_long(struct soap*, long *, const char*, const char*); -SOAP_FMAC3 long * SOAP_FMAC4 soap_in_long(struct soap*, const char*, long *, const char*); - -#ifndef SOAP_TYPE_LONG64 -#define SOAP_TYPE_LONG64 (15) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_LONG64(struct soap*, LONG64 *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_LONG64(struct soap*, const LONG64 *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_LONG64(struct soap*, const char*, int, const LONG64 *, const char*); -SOAP_FMAC3 LONG64 * SOAP_FMAC4 soap_get_LONG64(struct soap*, LONG64 *, const char*, const char*); -SOAP_FMAC3 LONG64 * SOAP_FMAC4 soap_in_LONG64(struct soap*, const char*, LONG64 *, const char*); - -#ifndef SOAP_TYPE_xsd__float -#define SOAP_TYPE_xsd__float (9) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__float(struct soap*, float *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__float(struct soap*, const float *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__float(struct soap*, const char*, int, const float *, const char*); -SOAP_FMAC3 float * SOAP_FMAC4 soap_get_xsd__float(struct soap*, float *, const char*, const char*); -SOAP_FMAC3 float * SOAP_FMAC4 soap_in_xsd__float(struct soap*, const char*, float *, const char*); - -#ifndef SOAP_TYPE_float -#define SOAP_TYPE_float (8) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_float(struct soap*, float *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_float(struct soap*, const float *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_float(struct soap*, const char*, int, const float *, const char*); -SOAP_FMAC3 float * SOAP_FMAC4 soap_get_float(struct soap*, float *, const char*, const char*); -SOAP_FMAC3 float * SOAP_FMAC4 soap_in_float(struct soap*, const char*, float *, const char*); - -#ifndef SOAP_TYPE_unsignedByte -#define SOAP_TYPE_unsignedByte (21) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedByte(struct soap*, unsigned char *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedByte(struct soap*, const unsigned char *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedByte(struct soap*, const char*, int, const unsigned char *, const char*); -SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_get_unsignedByte(struct soap*, unsigned char *, const char*, const char*); -SOAP_FMAC3 unsigned char * SOAP_FMAC4 soap_in_unsignedByte(struct soap*, const char*, unsigned char *, const char*); - -#ifndef SOAP_TYPE_unsignedInt -#define SOAP_TYPE_unsignedInt (14) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedInt(struct soap*, unsigned int *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedInt(struct soap*, const unsigned int *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedInt(struct soap*, const char*, int, const unsigned int *, const char*); -SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_get_unsignedInt(struct soap*, unsigned int *, const char*, const char*); -SOAP_FMAC3 unsigned int * SOAP_FMAC4 soap_in_unsignedInt(struct soap*, const char*, unsigned int *, const char*); - -#ifndef SOAP_TYPE_xsd__positiveInteger -#define SOAP_TYPE_xsd__positiveInteger (17) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__positiveInteger(struct soap*, ULONG64 *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__positiveInteger(struct soap*, const ULONG64 *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__positiveInteger(struct soap*, const char*, int, const ULONG64 *, const char*); -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_get_xsd__positiveInteger(struct soap*, ULONG64 *, const char*, const char*); -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_in_xsd__positiveInteger(struct soap*, const char*, ULONG64 *, const char*); - -#ifndef SOAP_TYPE_unsignedLONG64 -#define SOAP_TYPE_unsignedLONG64 (16) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_unsignedLONG64(struct soap*, ULONG64 *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_unsignedLONG64(struct soap*, const ULONG64 *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_unsignedLONG64(struct soap*, const char*, int, const ULONG64 *, const char*); -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_get_unsignedLONG64(struct soap*, ULONG64 *, const char*, const char*); -SOAP_FMAC3 ULONG64 * SOAP_FMAC4 soap_in_unsignedLONG64(struct soap*, const char*, ULONG64 *, const char*); - -#ifndef SOAP_TYPE_xsd__boolean -#define SOAP_TYPE_xsd__boolean (13) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__boolean(struct soap*, bool *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__boolean(struct soap*, const bool *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__boolean(struct soap*, const char*, int, const bool *, const char*); - -SOAP_FMAC3S const char* SOAP_FMAC4S soap_xsd__boolean2s(struct soap*, bool); -SOAP_FMAC3 bool * SOAP_FMAC4 soap_get_xsd__boolean(struct soap*, bool *, const char*, const char*); -SOAP_FMAC3 bool * SOAP_FMAC4 soap_in_xsd__boolean(struct soap*, const char*, bool *, const char*); - -SOAP_FMAC3S int SOAP_FMAC4S soap_s2xsd__boolean(struct soap*, const char*, bool *); - -#ifndef SOAP_TYPE_bool -#define SOAP_TYPE_bool (12) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_bool(struct soap*, bool *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_bool(struct soap*, const bool *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_bool(struct soap*, const char*, int, const bool *, const char*); - -SOAP_FMAC3S const char* SOAP_FMAC4S soap_bool2s(struct soap*, bool); -SOAP_FMAC3 bool * SOAP_FMAC4 soap_get_bool(struct soap*, bool *, const char*, const char*); -SOAP_FMAC3 bool * SOAP_FMAC4 soap_in_bool(struct soap*, const char*, bool *, const char*); - -SOAP_FMAC3S int SOAP_FMAC4S soap_s2bool(struct soap*, const char*, bool *); - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_SOAP_ENV__Fault -#define SOAP_TYPE_SOAP_ENV__Fault (172) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Fault(struct soap*, const struct SOAP_ENV__Fault *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Fault(struct soap*, const char*, int, const struct SOAP_ENV__Fault *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_get_SOAP_ENV__Fault(struct soap*, struct SOAP_ENV__Fault *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Fault * SOAP_FMAC4 soap_in_SOAP_ENV__Fault(struct soap*, const char*, struct SOAP_ENV__Fault *, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_SOAP_ENV__Reason -#define SOAP_TYPE_SOAP_ENV__Reason (171) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Reason(struct soap*, const struct SOAP_ENV__Reason *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Reason(struct soap*, const char*, int, const struct SOAP_ENV__Reason *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_get_SOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason * SOAP_FMAC4 soap_in_SOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason *, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_SOAP_ENV__Detail -#define SOAP_TYPE_SOAP_ENV__Detail (170) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Detail(struct soap*, const struct SOAP_ENV__Detail *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Detail(struct soap*, const char*, int, const struct SOAP_ENV__Detail *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_get_SOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail * SOAP_FMAC4 soap_in_SOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail *, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_SOAP_ENV__Code -#define SOAP_TYPE_SOAP_ENV__Code (168) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Code(struct soap*, const struct SOAP_ENV__Code *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Code(struct soap*, const char*, int, const struct SOAP_ENV__Code *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_get_SOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code * SOAP_FMAC4 soap_in_SOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code *, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_SOAP_ENV__Header -#define SOAP_TYPE_SOAP_ENV__Header (167) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_SOAP_ENV__Header(struct soap*, const struct SOAP_ENV__Header *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_SOAP_ENV__Header(struct soap*, const char*, int, const struct SOAP_ENV__Header *, const char*); -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_get_SOAP_ENV__Header(struct soap*, struct SOAP_ENV__Header *, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Header * SOAP_FMAC4 soap_in_SOAP_ENV__Header(struct soap*, const char*, struct SOAP_ENV__Header *, const char*); - -#endif - -#ifndef SOAP_TYPE_mss__MSS_USCORESignatureDummy -#define SOAP_TYPE_mss__MSS_USCORESignatureDummy (164) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_mss__MSS_USCORESignatureDummy(struct soap*, const struct mss__MSS_USCORESignatureDummy *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_mss__MSS_USCORESignatureDummy(struct soap*, struct mss__MSS_USCORESignatureDummy *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_mss__MSS_USCORESignatureDummy(struct soap*, const struct mss__MSS_USCORESignatureDummy *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_mss__MSS_USCORESignatureDummy(struct soap*, const char*, int, const struct mss__MSS_USCORESignatureDummy *, const char*); -SOAP_FMAC3 struct mss__MSS_USCORESignatureDummy * SOAP_FMAC4 soap_get_mss__MSS_USCORESignatureDummy(struct soap*, struct mss__MSS_USCORESignatureDummy *, const char*, const char*); -SOAP_FMAC3 struct mss__MSS_USCORESignatureDummy * SOAP_FMAC4 soap_in_mss__MSS_USCORESignatureDummy(struct soap*, const char*, struct mss__MSS_USCORESignatureDummy *, const char*); - -#ifndef SOAP_TYPE_mss_DummyResp -#define SOAP_TYPE_mss_DummyResp (161) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_mss_DummyResp(struct soap*, const struct mss_DummyResp *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_mss_DummyResp(struct soap*, struct mss_DummyResp *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_mss_DummyResp(struct soap*, const struct mss_DummyResp *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_mss_DummyResp(struct soap*, const char*, int, const struct mss_DummyResp *, const char*); -SOAP_FMAC3 struct mss_DummyResp * SOAP_FMAC4 soap_get_mss_DummyResp(struct soap*, struct mss_DummyResp *, const char*, const char*); -SOAP_FMAC3 struct mss_DummyResp * SOAP_FMAC4 soap_in_mss_DummyResp(struct soap*, const char*, struct mss_DummyResp *, const char*); - -#ifndef SOAP_TYPE_d__GetMobileCreateSignatureStatus -#define SOAP_TYPE_d__GetMobileCreateSignatureStatus (160) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileCreateSignatureStatus(struct soap*, const struct d__GetMobileCreateSignatureStatus *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileCreateSignatureStatus(struct soap*, struct d__GetMobileCreateSignatureStatus *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileCreateSignatureStatus(struct soap*, const struct d__GetMobileCreateSignatureStatus *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileCreateSignatureStatus(struct soap*, const char*, int, const struct d__GetMobileCreateSignatureStatus *, const char*); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatus * SOAP_FMAC4 soap_get_d__GetMobileCreateSignatureStatus(struct soap*, struct d__GetMobileCreateSignatureStatus *, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatus * SOAP_FMAC4 soap_in_d__GetMobileCreateSignatureStatus(struct soap*, const char*, struct d__GetMobileCreateSignatureStatus *, const char*); - -#ifndef SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse -#define SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse (157) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileCreateSignatureStatusResponse(struct soap*, const struct d__GetMobileCreateSignatureStatusResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileCreateSignatureStatusResponse(struct soap*, struct d__GetMobileCreateSignatureStatusResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileCreateSignatureStatusResponse(struct soap*, const struct d__GetMobileCreateSignatureStatusResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileCreateSignatureStatusResponse(struct soap*, const char*, int, const struct d__GetMobileCreateSignatureStatusResponse *, const char*); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse * SOAP_FMAC4 soap_get_d__GetMobileCreateSignatureStatusResponse(struct soap*, struct d__GetMobileCreateSignatureStatusResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse * SOAP_FMAC4 soap_in_d__GetMobileCreateSignatureStatusResponse(struct soap*, const char*, struct d__GetMobileCreateSignatureStatusResponse *, const char*); - -#ifndef SOAP_TYPE_d__MobileCreateSignature -#define SOAP_TYPE_d__MobileCreateSignature (156) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileCreateSignature(struct soap*, const struct d__MobileCreateSignature *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileCreateSignature(struct soap*, struct d__MobileCreateSignature *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileCreateSignature(struct soap*, const struct d__MobileCreateSignature *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileCreateSignature(struct soap*, const char*, int, const struct d__MobileCreateSignature *, const char*); -SOAP_FMAC3 struct d__MobileCreateSignature * SOAP_FMAC4 soap_get_d__MobileCreateSignature(struct soap*, struct d__MobileCreateSignature *, const char*, const char*); -SOAP_FMAC3 struct d__MobileCreateSignature * SOAP_FMAC4 soap_in_d__MobileCreateSignature(struct soap*, const char*, struct d__MobileCreateSignature *, const char*); - -#ifndef SOAP_TYPE_d__MobileCreateSignatureResponse -#define SOAP_TYPE_d__MobileCreateSignatureResponse (152) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileCreateSignatureResponse(struct soap*, const struct d__MobileCreateSignatureResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileCreateSignatureResponse(struct soap*, struct d__MobileCreateSignatureResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileCreateSignatureResponse(struct soap*, const struct d__MobileCreateSignatureResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileCreateSignatureResponse(struct soap*, const char*, int, const struct d__MobileCreateSignatureResponse *, const char*); -SOAP_FMAC3 struct d__MobileCreateSignatureResponse * SOAP_FMAC4 soap_get_d__MobileCreateSignatureResponse(struct soap*, struct d__MobileCreateSignatureResponse *, const char*, const char*); -SOAP_FMAC3 struct d__MobileCreateSignatureResponse * SOAP_FMAC4 soap_in_d__MobileCreateSignatureResponse(struct soap*, const char*, struct d__MobileCreateSignatureResponse *, const char*); - -#ifndef SOAP_TYPE_d__DataFileDigestList -#define SOAP_TYPE_d__DataFileDigestList (150) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileDigestList(struct soap*, const struct d__DataFileDigestList *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileDigestList(struct soap*, struct d__DataFileDigestList *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileDigestList(struct soap*, const struct d__DataFileDigestList *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileDigestList(struct soap*, const char*, int, const struct d__DataFileDigestList *, const char*); -SOAP_FMAC3 struct d__DataFileDigestList * SOAP_FMAC4 soap_get_d__DataFileDigestList(struct soap*, struct d__DataFileDigestList *, const char*, const char*); -SOAP_FMAC3 struct d__DataFileDigestList * SOAP_FMAC4 soap_in_d__DataFileDigestList(struct soap*, const char*, struct d__DataFileDigestList *, const char*); - -#ifndef SOAP_TYPE_d__DataFileDigest -#define SOAP_TYPE_d__DataFileDigest (149) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileDigest(struct soap*, const struct d__DataFileDigest *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileDigest(struct soap*, struct d__DataFileDigest *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileDigest(struct soap*, const struct d__DataFileDigest *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileDigest(struct soap*, const char*, int, const struct d__DataFileDigest *, const char*); -SOAP_FMAC3 struct d__DataFileDigest * SOAP_FMAC4 soap_get_d__DataFileDigest(struct soap*, struct d__DataFileDigest *, const char*, const char*); -SOAP_FMAC3 struct d__DataFileDigest * SOAP_FMAC4 soap_in_d__DataFileDigest(struct soap*, const char*, struct d__DataFileDigest *, const char*); - -#ifndef SOAP_TYPE_d__GetMobileAuthenticateStatus -#define SOAP_TYPE_d__GetMobileAuthenticateStatus (148) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileAuthenticateStatus(struct soap*, const struct d__GetMobileAuthenticateStatus *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileAuthenticateStatus(struct soap*, struct d__GetMobileAuthenticateStatus *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileAuthenticateStatus(struct soap*, const struct d__GetMobileAuthenticateStatus *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileAuthenticateStatus(struct soap*, const char*, int, const struct d__GetMobileAuthenticateStatus *, const char*); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatus * SOAP_FMAC4 soap_get_d__GetMobileAuthenticateStatus(struct soap*, struct d__GetMobileAuthenticateStatus *, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatus * SOAP_FMAC4 soap_in_d__GetMobileAuthenticateStatus(struct soap*, const char*, struct d__GetMobileAuthenticateStatus *, const char*); - -#ifndef SOAP_TYPE_d__GetMobileAuthenticateStatusResponse -#define SOAP_TYPE_d__GetMobileAuthenticateStatusResponse (145) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetMobileAuthenticateStatusResponse(struct soap*, const struct d__GetMobileAuthenticateStatusResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetMobileAuthenticateStatusResponse(struct soap*, struct d__GetMobileAuthenticateStatusResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetMobileAuthenticateStatusResponse(struct soap*, const struct d__GetMobileAuthenticateStatusResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetMobileAuthenticateStatusResponse(struct soap*, const char*, int, const struct d__GetMobileAuthenticateStatusResponse *, const char*); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse * SOAP_FMAC4 soap_get_d__GetMobileAuthenticateStatusResponse(struct soap*, struct d__GetMobileAuthenticateStatusResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse * SOAP_FMAC4 soap_in_d__GetMobileAuthenticateStatusResponse(struct soap*, const char*, struct d__GetMobileAuthenticateStatusResponse *, const char*); - -#ifndef SOAP_TYPE_d__MobileAuthenticate -#define SOAP_TYPE_d__MobileAuthenticate (144) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileAuthenticate(struct soap*, const struct d__MobileAuthenticate *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileAuthenticate(struct soap*, struct d__MobileAuthenticate *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileAuthenticate(struct soap*, const struct d__MobileAuthenticate *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileAuthenticate(struct soap*, const char*, int, const struct d__MobileAuthenticate *, const char*); -SOAP_FMAC3 struct d__MobileAuthenticate * SOAP_FMAC4 soap_get_d__MobileAuthenticate(struct soap*, struct d__MobileAuthenticate *, const char*, const char*); -SOAP_FMAC3 struct d__MobileAuthenticate * SOAP_FMAC4 soap_in_d__MobileAuthenticate(struct soap*, const char*, struct d__MobileAuthenticate *, const char*); - -#ifndef SOAP_TYPE_d__MobileAuthenticateResponse -#define SOAP_TYPE_d__MobileAuthenticateResponse (141) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileAuthenticateResponse(struct soap*, const struct d__MobileAuthenticateResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileAuthenticateResponse(struct soap*, struct d__MobileAuthenticateResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileAuthenticateResponse(struct soap*, const struct d__MobileAuthenticateResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileAuthenticateResponse(struct soap*, const char*, int, const struct d__MobileAuthenticateResponse *, const char*); -SOAP_FMAC3 struct d__MobileAuthenticateResponse * SOAP_FMAC4 soap_get_d__MobileAuthenticateResponse(struct soap*, struct d__MobileAuthenticateResponse *, const char*, const char*); -SOAP_FMAC3 struct d__MobileAuthenticateResponse * SOAP_FMAC4 soap_in_d__MobileAuthenticateResponse(struct soap*, const char*, struct d__MobileAuthenticateResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetStatusInfo -#define SOAP_TYPE_d__GetStatusInfo (140) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetStatusInfo(struct soap*, const struct d__GetStatusInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetStatusInfo(struct soap*, struct d__GetStatusInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetStatusInfo(struct soap*, const struct d__GetStatusInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetStatusInfo(struct soap*, const char*, int, const struct d__GetStatusInfo *, const char*); -SOAP_FMAC3 struct d__GetStatusInfo * SOAP_FMAC4 soap_get_d__GetStatusInfo(struct soap*, struct d__GetStatusInfo *, const char*, const char*); -SOAP_FMAC3 struct d__GetStatusInfo * SOAP_FMAC4 soap_in_d__GetStatusInfo(struct soap*, const char*, struct d__GetStatusInfo *, const char*); - -#ifndef SOAP_TYPE_d__GetStatusInfoResponse -#define SOAP_TYPE_d__GetStatusInfoResponse (137) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetStatusInfoResponse(struct soap*, const struct d__GetStatusInfoResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetStatusInfoResponse(struct soap*, struct d__GetStatusInfoResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetStatusInfoResponse(struct soap*, const struct d__GetStatusInfoResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetStatusInfoResponse(struct soap*, const char*, int, const struct d__GetStatusInfoResponse *, const char*); -SOAP_FMAC3 struct d__GetStatusInfoResponse * SOAP_FMAC4 soap_get_d__GetStatusInfoResponse(struct soap*, struct d__GetStatusInfoResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetStatusInfoResponse * SOAP_FMAC4 soap_in_d__GetStatusInfoResponse(struct soap*, const char*, struct d__GetStatusInfoResponse *, const char*); - -#ifndef SOAP_TYPE_d__MobileSign -#define SOAP_TYPE_d__MobileSign (136) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileSign(struct soap*, const struct d__MobileSign *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileSign(struct soap*, struct d__MobileSign *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileSign(struct soap*, const struct d__MobileSign *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileSign(struct soap*, const char*, int, const struct d__MobileSign *, const char*); -SOAP_FMAC3 struct d__MobileSign * SOAP_FMAC4 soap_get_d__MobileSign(struct soap*, struct d__MobileSign *, const char*, const char*); -SOAP_FMAC3 struct d__MobileSign * SOAP_FMAC4 soap_in_d__MobileSign(struct soap*, const char*, struct d__MobileSign *, const char*); - -#ifndef SOAP_TYPE_d__MobileSignResponse -#define SOAP_TYPE_d__MobileSignResponse (133) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__MobileSignResponse(struct soap*, const struct d__MobileSignResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__MobileSignResponse(struct soap*, struct d__MobileSignResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__MobileSignResponse(struct soap*, const struct d__MobileSignResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__MobileSignResponse(struct soap*, const char*, int, const struct d__MobileSignResponse *, const char*); -SOAP_FMAC3 struct d__MobileSignResponse * SOAP_FMAC4 soap_get_d__MobileSignResponse(struct soap*, struct d__MobileSignResponse *, const char*, const char*); -SOAP_FMAC3 struct d__MobileSignResponse * SOAP_FMAC4 soap_in_d__MobileSignResponse(struct soap*, const char*, struct d__MobileSignResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetVersion -#define SOAP_TYPE_d__GetVersion (132) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetVersion(struct soap*, const struct d__GetVersion *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetVersion(struct soap*, struct d__GetVersion *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetVersion(struct soap*, const struct d__GetVersion *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetVersion(struct soap*, const char*, int, const struct d__GetVersion *, const char*); -SOAP_FMAC3 struct d__GetVersion * SOAP_FMAC4 soap_get_d__GetVersion(struct soap*, struct d__GetVersion *, const char*, const char*); -SOAP_FMAC3 struct d__GetVersion * SOAP_FMAC4 soap_in_d__GetVersion(struct soap*, const char*, struct d__GetVersion *, const char*); - -#ifndef SOAP_TYPE_d__GetVersionResponse -#define SOAP_TYPE_d__GetVersionResponse (129) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetVersionResponse(struct soap*, const struct d__GetVersionResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetVersionResponse(struct soap*, struct d__GetVersionResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetVersionResponse(struct soap*, const struct d__GetVersionResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetVersionResponse(struct soap*, const char*, int, const struct d__GetVersionResponse *, const char*); -SOAP_FMAC3 struct d__GetVersionResponse * SOAP_FMAC4 soap_get_d__GetVersionResponse(struct soap*, struct d__GetVersionResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetVersionResponse * SOAP_FMAC4 soap_in_d__GetVersionResponse(struct soap*, const char*, struct d__GetVersionResponse *, const char*); - -#ifndef SOAP_TYPE_d__RemoveSignature -#define SOAP_TYPE_d__RemoveSignature (128) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveSignature(struct soap*, const struct d__RemoveSignature *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveSignature(struct soap*, struct d__RemoveSignature *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveSignature(struct soap*, const struct d__RemoveSignature *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveSignature(struct soap*, const char*, int, const struct d__RemoveSignature *, const char*); -SOAP_FMAC3 struct d__RemoveSignature * SOAP_FMAC4 soap_get_d__RemoveSignature(struct soap*, struct d__RemoveSignature *, const char*, const char*); -SOAP_FMAC3 struct d__RemoveSignature * SOAP_FMAC4 soap_in_d__RemoveSignature(struct soap*, const char*, struct d__RemoveSignature *, const char*); - -#ifndef SOAP_TYPE_d__RemoveSignatureResponse -#define SOAP_TYPE_d__RemoveSignatureResponse (125) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveSignatureResponse(struct soap*, const struct d__RemoveSignatureResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveSignatureResponse(struct soap*, struct d__RemoveSignatureResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveSignatureResponse(struct soap*, const struct d__RemoveSignatureResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveSignatureResponse(struct soap*, const char*, int, const struct d__RemoveSignatureResponse *, const char*); -SOAP_FMAC3 struct d__RemoveSignatureResponse * SOAP_FMAC4 soap_get_d__RemoveSignatureResponse(struct soap*, struct d__RemoveSignatureResponse *, const char*, const char*); -SOAP_FMAC3 struct d__RemoveSignatureResponse * SOAP_FMAC4 soap_in_d__RemoveSignatureResponse(struct soap*, const char*, struct d__RemoveSignatureResponse *, const char*); - -#ifndef SOAP_TYPE_d__FinalizeSignature -#define SOAP_TYPE_d__FinalizeSignature (124) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__FinalizeSignature(struct soap*, const struct d__FinalizeSignature *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__FinalizeSignature(struct soap*, struct d__FinalizeSignature *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__FinalizeSignature(struct soap*, const struct d__FinalizeSignature *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__FinalizeSignature(struct soap*, const char*, int, const struct d__FinalizeSignature *, const char*); -SOAP_FMAC3 struct d__FinalizeSignature * SOAP_FMAC4 soap_get_d__FinalizeSignature(struct soap*, struct d__FinalizeSignature *, const char*, const char*); -SOAP_FMAC3 struct d__FinalizeSignature * SOAP_FMAC4 soap_in_d__FinalizeSignature(struct soap*, const char*, struct d__FinalizeSignature *, const char*); - -#ifndef SOAP_TYPE_d__FinalizeSignatureResponse -#define SOAP_TYPE_d__FinalizeSignatureResponse (121) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__FinalizeSignatureResponse(struct soap*, const struct d__FinalizeSignatureResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__FinalizeSignatureResponse(struct soap*, struct d__FinalizeSignatureResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__FinalizeSignatureResponse(struct soap*, const struct d__FinalizeSignatureResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__FinalizeSignatureResponse(struct soap*, const char*, int, const struct d__FinalizeSignatureResponse *, const char*); -SOAP_FMAC3 struct d__FinalizeSignatureResponse * SOAP_FMAC4 soap_get_d__FinalizeSignatureResponse(struct soap*, struct d__FinalizeSignatureResponse *, const char*, const char*); -SOAP_FMAC3 struct d__FinalizeSignatureResponse * SOAP_FMAC4 soap_in_d__FinalizeSignatureResponse(struct soap*, const char*, struct d__FinalizeSignatureResponse *, const char*); - -#ifndef SOAP_TYPE_d__PrepareSignature -#define SOAP_TYPE_d__PrepareSignature (120) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__PrepareSignature(struct soap*, const struct d__PrepareSignature *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__PrepareSignature(struct soap*, struct d__PrepareSignature *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__PrepareSignature(struct soap*, const struct d__PrepareSignature *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__PrepareSignature(struct soap*, const char*, int, const struct d__PrepareSignature *, const char*); -SOAP_FMAC3 struct d__PrepareSignature * SOAP_FMAC4 soap_get_d__PrepareSignature(struct soap*, struct d__PrepareSignature *, const char*, const char*); -SOAP_FMAC3 struct d__PrepareSignature * SOAP_FMAC4 soap_in_d__PrepareSignature(struct soap*, const char*, struct d__PrepareSignature *, const char*); - -#ifndef SOAP_TYPE_d__PrepareSignatureResponse -#define SOAP_TYPE_d__PrepareSignatureResponse (117) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__PrepareSignatureResponse(struct soap*, const struct d__PrepareSignatureResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__PrepareSignatureResponse(struct soap*, struct d__PrepareSignatureResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__PrepareSignatureResponse(struct soap*, const struct d__PrepareSignatureResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__PrepareSignatureResponse(struct soap*, const char*, int, const struct d__PrepareSignatureResponse *, const char*); -SOAP_FMAC3 struct d__PrepareSignatureResponse * SOAP_FMAC4 soap_get_d__PrepareSignatureResponse(struct soap*, struct d__PrepareSignatureResponse *, const char*, const char*); -SOAP_FMAC3 struct d__PrepareSignatureResponse * SOAP_FMAC4 soap_in_d__PrepareSignatureResponse(struct soap*, const char*, struct d__PrepareSignatureResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetSignatureModules -#define SOAP_TYPE_d__GetSignatureModules (116) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignatureModules(struct soap*, const struct d__GetSignatureModules *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignatureModules(struct soap*, struct d__GetSignatureModules *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignatureModules(struct soap*, const struct d__GetSignatureModules *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignatureModules(struct soap*, const char*, int, const struct d__GetSignatureModules *, const char*); -SOAP_FMAC3 struct d__GetSignatureModules * SOAP_FMAC4 soap_get_d__GetSignatureModules(struct soap*, struct d__GetSignatureModules *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignatureModules * SOAP_FMAC4 soap_in_d__GetSignatureModules(struct soap*, const char*, struct d__GetSignatureModules *, const char*); - -#ifndef SOAP_TYPE_d__GetSignatureModulesResponse -#define SOAP_TYPE_d__GetSignatureModulesResponse (112) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignatureModulesResponse(struct soap*, const struct d__GetSignatureModulesResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignatureModulesResponse(struct soap*, struct d__GetSignatureModulesResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignatureModulesResponse(struct soap*, const struct d__GetSignatureModulesResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignatureModulesResponse(struct soap*, const char*, int, const struct d__GetSignatureModulesResponse *, const char*); -SOAP_FMAC3 struct d__GetSignatureModulesResponse * SOAP_FMAC4 soap_get_d__GetSignatureModulesResponse(struct soap*, struct d__GetSignatureModulesResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignatureModulesResponse * SOAP_FMAC4 soap_in_d__GetSignatureModulesResponse(struct soap*, const char*, struct d__GetSignatureModulesResponse *, const char*); - -#ifndef SOAP_TYPE_d__SignatureModulesArray -#define SOAP_TYPE_d__SignatureModulesArray (110) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureModulesArray(struct soap*, const struct d__SignatureModulesArray *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureModulesArray(struct soap*, struct d__SignatureModulesArray *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureModulesArray(struct soap*, const struct d__SignatureModulesArray *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureModulesArray(struct soap*, const char*, int, const struct d__SignatureModulesArray *, const char*); -SOAP_FMAC3 struct d__SignatureModulesArray * SOAP_FMAC4 soap_get_d__SignatureModulesArray(struct soap*, struct d__SignatureModulesArray *, const char*, const char*); -SOAP_FMAC3 struct d__SignatureModulesArray * SOAP_FMAC4 soap_in_d__SignatureModulesArray(struct soap*, const char*, struct d__SignatureModulesArray *, const char*); - -#ifndef SOAP_TYPE_d__SignatureModule -#define SOAP_TYPE_d__SignatureModule (109) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureModule(struct soap*, const struct d__SignatureModule *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureModule(struct soap*, struct d__SignatureModule *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureModule(struct soap*, const struct d__SignatureModule *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureModule(struct soap*, const char*, int, const struct d__SignatureModule *, const char*); -SOAP_FMAC3 struct d__SignatureModule * SOAP_FMAC4 soap_get_d__SignatureModule(struct soap*, struct d__SignatureModule *, const char*, const char*); -SOAP_FMAC3 struct d__SignatureModule * SOAP_FMAC4 soap_in_d__SignatureModule(struct soap*, const char*, struct d__SignatureModule *, const char*); - -#ifndef SOAP_TYPE_d__GetCRL -#define SOAP_TYPE_d__GetCRL (108) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetCRL(struct soap*, const struct d__GetCRL *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetCRL(struct soap*, struct d__GetCRL *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetCRL(struct soap*, const struct d__GetCRL *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetCRL(struct soap*, const char*, int, const struct d__GetCRL *, const char*); -SOAP_FMAC3 struct d__GetCRL * SOAP_FMAC4 soap_get_d__GetCRL(struct soap*, struct d__GetCRL *, const char*, const char*); -SOAP_FMAC3 struct d__GetCRL * SOAP_FMAC4 soap_in_d__GetCRL(struct soap*, const char*, struct d__GetCRL *, const char*); - -#ifndef SOAP_TYPE_d__GetCRLResponse -#define SOAP_TYPE_d__GetCRLResponse (105) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetCRLResponse(struct soap*, const struct d__GetCRLResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetCRLResponse(struct soap*, struct d__GetCRLResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetCRLResponse(struct soap*, const struct d__GetCRLResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetCRLResponse(struct soap*, const char*, int, const struct d__GetCRLResponse *, const char*); -SOAP_FMAC3 struct d__GetCRLResponse * SOAP_FMAC4 soap_get_d__GetCRLResponse(struct soap*, struct d__GetCRLResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetCRLResponse * SOAP_FMAC4 soap_in_d__GetCRLResponse(struct soap*, const char*, struct d__GetCRLResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetTimestamp -#define SOAP_TYPE_d__GetTimestamp (104) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTimestamp(struct soap*, const struct d__GetTimestamp *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTimestamp(struct soap*, struct d__GetTimestamp *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTimestamp(struct soap*, const struct d__GetTimestamp *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTimestamp(struct soap*, const char*, int, const struct d__GetTimestamp *, const char*); -SOAP_FMAC3 struct d__GetTimestamp * SOAP_FMAC4 soap_get_d__GetTimestamp(struct soap*, struct d__GetTimestamp *, const char*, const char*); -SOAP_FMAC3 struct d__GetTimestamp * SOAP_FMAC4 soap_in_d__GetTimestamp(struct soap*, const char*, struct d__GetTimestamp *, const char*); - -#ifndef SOAP_TYPE_d__GetTimestampResponse -#define SOAP_TYPE_d__GetTimestampResponse (101) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTimestampResponse(struct soap*, const struct d__GetTimestampResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTimestampResponse(struct soap*, struct d__GetTimestampResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTimestampResponse(struct soap*, const struct d__GetTimestampResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTimestampResponse(struct soap*, const char*, int, const struct d__GetTimestampResponse *, const char*); -SOAP_FMAC3 struct d__GetTimestampResponse * SOAP_FMAC4 soap_get_d__GetTimestampResponse(struct soap*, struct d__GetTimestampResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetTimestampResponse * SOAP_FMAC4 soap_in_d__GetTimestampResponse(struct soap*, const char*, struct d__GetTimestampResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetTSACertificate -#define SOAP_TYPE_d__GetTSACertificate (100) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTSACertificate(struct soap*, const struct d__GetTSACertificate *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTSACertificate(struct soap*, struct d__GetTSACertificate *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTSACertificate(struct soap*, const struct d__GetTSACertificate *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTSACertificate(struct soap*, const char*, int, const struct d__GetTSACertificate *, const char*); -SOAP_FMAC3 struct d__GetTSACertificate * SOAP_FMAC4 soap_get_d__GetTSACertificate(struct soap*, struct d__GetTSACertificate *, const char*, const char*); -SOAP_FMAC3 struct d__GetTSACertificate * SOAP_FMAC4 soap_in_d__GetTSACertificate(struct soap*, const char*, struct d__GetTSACertificate *, const char*); - -#ifndef SOAP_TYPE_d__GetTSACertificateResponse -#define SOAP_TYPE_d__GetTSACertificateResponse (97) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetTSACertificateResponse(struct soap*, const struct d__GetTSACertificateResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetTSACertificateResponse(struct soap*, struct d__GetTSACertificateResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetTSACertificateResponse(struct soap*, const struct d__GetTSACertificateResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetTSACertificateResponse(struct soap*, const char*, int, const struct d__GetTSACertificateResponse *, const char*); -SOAP_FMAC3 struct d__GetTSACertificateResponse * SOAP_FMAC4 soap_get_d__GetTSACertificateResponse(struct soap*, struct d__GetTSACertificateResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetTSACertificateResponse * SOAP_FMAC4 soap_in_d__GetTSACertificateResponse(struct soap*, const char*, struct d__GetTSACertificateResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetNotary -#define SOAP_TYPE_d__GetNotary (96) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotary(struct soap*, const struct d__GetNotary *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotary(struct soap*, struct d__GetNotary *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotary(struct soap*, const struct d__GetNotary *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotary(struct soap*, const char*, int, const struct d__GetNotary *, const char*); -SOAP_FMAC3 struct d__GetNotary * SOAP_FMAC4 soap_get_d__GetNotary(struct soap*, struct d__GetNotary *, const char*, const char*); -SOAP_FMAC3 struct d__GetNotary * SOAP_FMAC4 soap_in_d__GetNotary(struct soap*, const char*, struct d__GetNotary *, const char*); - -#ifndef SOAP_TYPE_d__GetNotaryResponse -#define SOAP_TYPE_d__GetNotaryResponse (93) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotaryResponse(struct soap*, const struct d__GetNotaryResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotaryResponse(struct soap*, struct d__GetNotaryResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotaryResponse(struct soap*, const struct d__GetNotaryResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotaryResponse(struct soap*, const char*, int, const struct d__GetNotaryResponse *, const char*); -SOAP_FMAC3 struct d__GetNotaryResponse * SOAP_FMAC4 soap_get_d__GetNotaryResponse(struct soap*, struct d__GetNotaryResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetNotaryResponse * SOAP_FMAC4 soap_in_d__GetNotaryResponse(struct soap*, const char*, struct d__GetNotaryResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetNotarysCertificate -#define SOAP_TYPE_d__GetNotarysCertificate (92) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotarysCertificate(struct soap*, const struct d__GetNotarysCertificate *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotarysCertificate(struct soap*, struct d__GetNotarysCertificate *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotarysCertificate(struct soap*, const struct d__GetNotarysCertificate *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotarysCertificate(struct soap*, const char*, int, const struct d__GetNotarysCertificate *, const char*); -SOAP_FMAC3 struct d__GetNotarysCertificate * SOAP_FMAC4 soap_get_d__GetNotarysCertificate(struct soap*, struct d__GetNotarysCertificate *, const char*, const char*); -SOAP_FMAC3 struct d__GetNotarysCertificate * SOAP_FMAC4 soap_in_d__GetNotarysCertificate(struct soap*, const char*, struct d__GetNotarysCertificate *, const char*); - -#ifndef SOAP_TYPE_d__GetNotarysCertificateResponse -#define SOAP_TYPE_d__GetNotarysCertificateResponse (89) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetNotarysCertificateResponse(struct soap*, const struct d__GetNotarysCertificateResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetNotarysCertificateResponse(struct soap*, struct d__GetNotarysCertificateResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetNotarysCertificateResponse(struct soap*, const struct d__GetNotarysCertificateResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetNotarysCertificateResponse(struct soap*, const char*, int, const struct d__GetNotarysCertificateResponse *, const char*); -SOAP_FMAC3 struct d__GetNotarysCertificateResponse * SOAP_FMAC4 soap_get_d__GetNotarysCertificateResponse(struct soap*, struct d__GetNotarysCertificateResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetNotarysCertificateResponse * SOAP_FMAC4 soap_in_d__GetNotarysCertificateResponse(struct soap*, const char*, struct d__GetNotarysCertificateResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetSignersCertificate -#define SOAP_TYPE_d__GetSignersCertificate (88) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignersCertificate(struct soap*, const struct d__GetSignersCertificate *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignersCertificate(struct soap*, struct d__GetSignersCertificate *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignersCertificate(struct soap*, const struct d__GetSignersCertificate *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignersCertificate(struct soap*, const char*, int, const struct d__GetSignersCertificate *, const char*); -SOAP_FMAC3 struct d__GetSignersCertificate * SOAP_FMAC4 soap_get_d__GetSignersCertificate(struct soap*, struct d__GetSignersCertificate *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignersCertificate * SOAP_FMAC4 soap_in_d__GetSignersCertificate(struct soap*, const char*, struct d__GetSignersCertificate *, const char*); - -#ifndef SOAP_TYPE_d__GetSignersCertificateResponse -#define SOAP_TYPE_d__GetSignersCertificateResponse (85) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignersCertificateResponse(struct soap*, const struct d__GetSignersCertificateResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignersCertificateResponse(struct soap*, struct d__GetSignersCertificateResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignersCertificateResponse(struct soap*, const struct d__GetSignersCertificateResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignersCertificateResponse(struct soap*, const char*, int, const struct d__GetSignersCertificateResponse *, const char*); -SOAP_FMAC3 struct d__GetSignersCertificateResponse * SOAP_FMAC4 soap_get_d__GetSignersCertificateResponse(struct soap*, struct d__GetSignersCertificateResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignersCertificateResponse * SOAP_FMAC4 soap_in_d__GetSignersCertificateResponse(struct soap*, const char*, struct d__GetSignersCertificateResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetDataFile -#define SOAP_TYPE_d__GetDataFile (84) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetDataFile(struct soap*, const struct d__GetDataFile *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetDataFile(struct soap*, struct d__GetDataFile *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetDataFile(struct soap*, const struct d__GetDataFile *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetDataFile(struct soap*, const char*, int, const struct d__GetDataFile *, const char*); -SOAP_FMAC3 struct d__GetDataFile * SOAP_FMAC4 soap_get_d__GetDataFile(struct soap*, struct d__GetDataFile *, const char*, const char*); -SOAP_FMAC3 struct d__GetDataFile * SOAP_FMAC4 soap_in_d__GetDataFile(struct soap*, const char*, struct d__GetDataFile *, const char*); - -#ifndef SOAP_TYPE_d__GetDataFileResponse -#define SOAP_TYPE_d__GetDataFileResponse (81) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetDataFileResponse(struct soap*, const struct d__GetDataFileResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetDataFileResponse(struct soap*, struct d__GetDataFileResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetDataFileResponse(struct soap*, const struct d__GetDataFileResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetDataFileResponse(struct soap*, const char*, int, const struct d__GetDataFileResponse *, const char*); -SOAP_FMAC3 struct d__GetDataFileResponse * SOAP_FMAC4 soap_get_d__GetDataFileResponse(struct soap*, struct d__GetDataFileResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetDataFileResponse * SOAP_FMAC4 soap_in_d__GetDataFileResponse(struct soap*, const char*, struct d__GetDataFileResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetSignedDocInfo -#define SOAP_TYPE_d__GetSignedDocInfo (80) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocInfo(struct soap*, const struct d__GetSignedDocInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocInfo(struct soap*, struct d__GetSignedDocInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocInfo(struct soap*, const struct d__GetSignedDocInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocInfo(struct soap*, const char*, int, const struct d__GetSignedDocInfo *, const char*); -SOAP_FMAC3 struct d__GetSignedDocInfo * SOAP_FMAC4 soap_get_d__GetSignedDocInfo(struct soap*, struct d__GetSignedDocInfo *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDocInfo * SOAP_FMAC4 soap_in_d__GetSignedDocInfo(struct soap*, const char*, struct d__GetSignedDocInfo *, const char*); - -#ifndef SOAP_TYPE_d__GetSignedDocInfoResponse -#define SOAP_TYPE_d__GetSignedDocInfoResponse (77) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocInfoResponse(struct soap*, const struct d__GetSignedDocInfoResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocInfoResponse(struct soap*, struct d__GetSignedDocInfoResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocInfoResponse(struct soap*, const struct d__GetSignedDocInfoResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocInfoResponse(struct soap*, const char*, int, const struct d__GetSignedDocInfoResponse *, const char*); -SOAP_FMAC3 struct d__GetSignedDocInfoResponse * SOAP_FMAC4 soap_get_d__GetSignedDocInfoResponse(struct soap*, struct d__GetSignedDocInfoResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDocInfoResponse * SOAP_FMAC4 soap_in_d__GetSignedDocInfoResponse(struct soap*, const char*, struct d__GetSignedDocInfoResponse *, const char*); - -#ifndef SOAP_TYPE_d__GetSignedDoc -#define SOAP_TYPE_d__GetSignedDoc (76) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDoc(struct soap*, const struct d__GetSignedDoc *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDoc(struct soap*, struct d__GetSignedDoc *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDoc(struct soap*, const struct d__GetSignedDoc *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDoc(struct soap*, const char*, int, const struct d__GetSignedDoc *, const char*); -SOAP_FMAC3 struct d__GetSignedDoc * SOAP_FMAC4 soap_get_d__GetSignedDoc(struct soap*, struct d__GetSignedDoc *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDoc * SOAP_FMAC4 soap_in_d__GetSignedDoc(struct soap*, const char*, struct d__GetSignedDoc *, const char*); - -#ifndef SOAP_TYPE_d__GetSignedDocResponse -#define SOAP_TYPE_d__GetSignedDocResponse (73) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__GetSignedDocResponse(struct soap*, const struct d__GetSignedDocResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__GetSignedDocResponse(struct soap*, struct d__GetSignedDocResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__GetSignedDocResponse(struct soap*, const struct d__GetSignedDocResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__GetSignedDocResponse(struct soap*, const char*, int, const struct d__GetSignedDocResponse *, const char*); -SOAP_FMAC3 struct d__GetSignedDocResponse * SOAP_FMAC4 soap_get_d__GetSignedDocResponse(struct soap*, struct d__GetSignedDocResponse *, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDocResponse * SOAP_FMAC4 soap_in_d__GetSignedDocResponse(struct soap*, const char*, struct d__GetSignedDocResponse *, const char*); - -#ifndef SOAP_TYPE_d__RemoveDataFile -#define SOAP_TYPE_d__RemoveDataFile (72) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveDataFile(struct soap*, const struct d__RemoveDataFile *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveDataFile(struct soap*, struct d__RemoveDataFile *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveDataFile(struct soap*, const struct d__RemoveDataFile *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveDataFile(struct soap*, const char*, int, const struct d__RemoveDataFile *, const char*); -SOAP_FMAC3 struct d__RemoveDataFile * SOAP_FMAC4 soap_get_d__RemoveDataFile(struct soap*, struct d__RemoveDataFile *, const char*, const char*); -SOAP_FMAC3 struct d__RemoveDataFile * SOAP_FMAC4 soap_in_d__RemoveDataFile(struct soap*, const char*, struct d__RemoveDataFile *, const char*); - -#ifndef SOAP_TYPE_d__RemoveDataFileResponse -#define SOAP_TYPE_d__RemoveDataFileResponse (69) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RemoveDataFileResponse(struct soap*, const struct d__RemoveDataFileResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RemoveDataFileResponse(struct soap*, struct d__RemoveDataFileResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RemoveDataFileResponse(struct soap*, const struct d__RemoveDataFileResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RemoveDataFileResponse(struct soap*, const char*, int, const struct d__RemoveDataFileResponse *, const char*); -SOAP_FMAC3 struct d__RemoveDataFileResponse * SOAP_FMAC4 soap_get_d__RemoveDataFileResponse(struct soap*, struct d__RemoveDataFileResponse *, const char*, const char*); -SOAP_FMAC3 struct d__RemoveDataFileResponse * SOAP_FMAC4 soap_in_d__RemoveDataFileResponse(struct soap*, const char*, struct d__RemoveDataFileResponse *, const char*); - -#ifndef SOAP_TYPE_d__AddDataFile -#define SOAP_TYPE_d__AddDataFile (68) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__AddDataFile(struct soap*, const struct d__AddDataFile *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__AddDataFile(struct soap*, struct d__AddDataFile *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__AddDataFile(struct soap*, const struct d__AddDataFile *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__AddDataFile(struct soap*, const char*, int, const struct d__AddDataFile *, const char*); -SOAP_FMAC3 struct d__AddDataFile * SOAP_FMAC4 soap_get_d__AddDataFile(struct soap*, struct d__AddDataFile *, const char*, const char*); -SOAP_FMAC3 struct d__AddDataFile * SOAP_FMAC4 soap_in_d__AddDataFile(struct soap*, const char*, struct d__AddDataFile *, const char*); - -#ifndef SOAP_TYPE_d__AddDataFileResponse -#define SOAP_TYPE_d__AddDataFileResponse (65) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__AddDataFileResponse(struct soap*, const struct d__AddDataFileResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__AddDataFileResponse(struct soap*, struct d__AddDataFileResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__AddDataFileResponse(struct soap*, const struct d__AddDataFileResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__AddDataFileResponse(struct soap*, const char*, int, const struct d__AddDataFileResponse *, const char*); -SOAP_FMAC3 struct d__AddDataFileResponse * SOAP_FMAC4 soap_get_d__AddDataFileResponse(struct soap*, struct d__AddDataFileResponse *, const char*, const char*); -SOAP_FMAC3 struct d__AddDataFileResponse * SOAP_FMAC4 soap_in_d__AddDataFileResponse(struct soap*, const char*, struct d__AddDataFileResponse *, const char*); - -#ifndef SOAP_TYPE_d__CreateSignedDoc -#define SOAP_TYPE_d__CreateSignedDoc (64) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CreateSignedDoc(struct soap*, const struct d__CreateSignedDoc *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CreateSignedDoc(struct soap*, struct d__CreateSignedDoc *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CreateSignedDoc(struct soap*, const struct d__CreateSignedDoc *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CreateSignedDoc(struct soap*, const char*, int, const struct d__CreateSignedDoc *, const char*); -SOAP_FMAC3 struct d__CreateSignedDoc * SOAP_FMAC4 soap_get_d__CreateSignedDoc(struct soap*, struct d__CreateSignedDoc *, const char*, const char*); -SOAP_FMAC3 struct d__CreateSignedDoc * SOAP_FMAC4 soap_in_d__CreateSignedDoc(struct soap*, const char*, struct d__CreateSignedDoc *, const char*); - -#ifndef SOAP_TYPE_d__CreateSignedDocResponse -#define SOAP_TYPE_d__CreateSignedDocResponse (61) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CreateSignedDocResponse(struct soap*, const struct d__CreateSignedDocResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CreateSignedDocResponse(struct soap*, struct d__CreateSignedDocResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CreateSignedDocResponse(struct soap*, const struct d__CreateSignedDocResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CreateSignedDocResponse(struct soap*, const char*, int, const struct d__CreateSignedDocResponse *, const char*); -SOAP_FMAC3 struct d__CreateSignedDocResponse * SOAP_FMAC4 soap_get_d__CreateSignedDocResponse(struct soap*, struct d__CreateSignedDocResponse *, const char*, const char*); -SOAP_FMAC3 struct d__CreateSignedDocResponse * SOAP_FMAC4 soap_in_d__CreateSignedDocResponse(struct soap*, const char*, struct d__CreateSignedDocResponse *, const char*); - -#ifndef SOAP_TYPE_d__CloseSession -#define SOAP_TYPE_d__CloseSession (60) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CloseSession(struct soap*, const struct d__CloseSession *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CloseSession(struct soap*, struct d__CloseSession *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CloseSession(struct soap*, const struct d__CloseSession *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CloseSession(struct soap*, const char*, int, const struct d__CloseSession *, const char*); -SOAP_FMAC3 struct d__CloseSession * SOAP_FMAC4 soap_get_d__CloseSession(struct soap*, struct d__CloseSession *, const char*, const char*); -SOAP_FMAC3 struct d__CloseSession * SOAP_FMAC4 soap_in_d__CloseSession(struct soap*, const char*, struct d__CloseSession *, const char*); - -#ifndef SOAP_TYPE_d__CloseSessionResponse -#define SOAP_TYPE_d__CloseSessionResponse (57) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CloseSessionResponse(struct soap*, const struct d__CloseSessionResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CloseSessionResponse(struct soap*, struct d__CloseSessionResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CloseSessionResponse(struct soap*, const struct d__CloseSessionResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CloseSessionResponse(struct soap*, const char*, int, const struct d__CloseSessionResponse *, const char*); -SOAP_FMAC3 struct d__CloseSessionResponse * SOAP_FMAC4 soap_get_d__CloseSessionResponse(struct soap*, struct d__CloseSessionResponse *, const char*, const char*); -SOAP_FMAC3 struct d__CloseSessionResponse * SOAP_FMAC4 soap_in_d__CloseSessionResponse(struct soap*, const char*, struct d__CloseSessionResponse *, const char*); - -#ifndef SOAP_TYPE_d__StartSession -#define SOAP_TYPE_d__StartSession (56) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__StartSession(struct soap*, const struct d__StartSession *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__StartSession(struct soap*, struct d__StartSession *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__StartSession(struct soap*, const struct d__StartSession *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__StartSession(struct soap*, const char*, int, const struct d__StartSession *, const char*); -SOAP_FMAC3 struct d__StartSession * SOAP_FMAC4 soap_get_d__StartSession(struct soap*, struct d__StartSession *, const char*, const char*); -SOAP_FMAC3 struct d__StartSession * SOAP_FMAC4 soap_in_d__StartSession(struct soap*, const char*, struct d__StartSession *, const char*); - -#ifndef SOAP_TYPE_d__StartSessionResponse -#define SOAP_TYPE_d__StartSessionResponse (51) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__StartSessionResponse(struct soap*, const struct d__StartSessionResponse *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__StartSessionResponse(struct soap*, struct d__StartSessionResponse *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__StartSessionResponse(struct soap*, const struct d__StartSessionResponse *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__StartSessionResponse(struct soap*, const char*, int, const struct d__StartSessionResponse *, const char*); -SOAP_FMAC3 struct d__StartSessionResponse * SOAP_FMAC4 soap_get_d__StartSessionResponse(struct soap*, struct d__StartSessionResponse *, const char*, const char*); -SOAP_FMAC3 struct d__StartSessionResponse * SOAP_FMAC4 soap_in_d__StartSessionResponse(struct soap*, const char*, struct d__StartSessionResponse *, const char*); - -#ifndef SOAP_TYPE_d__DataFileData -#define SOAP_TYPE_d__DataFileData (50) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileData(struct soap*, const struct d__DataFileData *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileData(struct soap*, struct d__DataFileData *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileData(struct soap*, const struct d__DataFileData *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileData(struct soap*, const char*, int, const struct d__DataFileData *, const char*); -SOAP_FMAC3 struct d__DataFileData * SOAP_FMAC4 soap_get_d__DataFileData(struct soap*, struct d__DataFileData *, const char*, const char*); -SOAP_FMAC3 struct d__DataFileData * SOAP_FMAC4 soap_in_d__DataFileData(struct soap*, const char*, struct d__DataFileData *, const char*); - -#ifndef SOAP_TYPE_d__SignedDocInfo -#define SOAP_TYPE_d__SignedDocInfo (47) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignedDocInfo(struct soap*, const struct d__SignedDocInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignedDocInfo(struct soap*, struct d__SignedDocInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignedDocInfo(struct soap*, const struct d__SignedDocInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignedDocInfo(struct soap*, const char*, int, const struct d__SignedDocInfo *, const char*); -SOAP_FMAC3 struct d__SignedDocInfo * SOAP_FMAC4 soap_get_d__SignedDocInfo(struct soap*, struct d__SignedDocInfo *, const char*, const char*); -SOAP_FMAC3 struct d__SignedDocInfo * SOAP_FMAC4 soap_in_d__SignedDocInfo(struct soap*, const char*, struct d__SignedDocInfo *, const char*); - -#ifndef SOAP_TYPE_d__SignatureInfo -#define SOAP_TYPE_d__SignatureInfo (39) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureInfo(struct soap*, const struct d__SignatureInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureInfo(struct soap*, struct d__SignatureInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureInfo(struct soap*, const struct d__SignatureInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureInfo(struct soap*, const char*, int, const struct d__SignatureInfo *, const char*); -SOAP_FMAC3 struct d__SignatureInfo * SOAP_FMAC4 soap_get_d__SignatureInfo(struct soap*, struct d__SignatureInfo *, const char*, const char*); -SOAP_FMAC3 struct d__SignatureInfo * SOAP_FMAC4 soap_in_d__SignatureInfo(struct soap*, const char*, struct d__SignatureInfo *, const char*); - -#ifndef SOAP_TYPE_d__Error -#define SOAP_TYPE_d__Error (38) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__Error(struct soap*, const struct d__Error *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__Error(struct soap*, struct d__Error *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__Error(struct soap*, const struct d__Error *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__Error(struct soap*, const char*, int, const struct d__Error *, const char*); -SOAP_FMAC3 struct d__Error * SOAP_FMAC4 soap_get_d__Error(struct soap*, struct d__Error *, const char*, const char*); -SOAP_FMAC3 struct d__Error * SOAP_FMAC4 soap_in_d__Error(struct soap*, const char*, struct d__Error *, const char*); - -#ifndef SOAP_TYPE_d__CRLInfo -#define SOAP_TYPE_d__CRLInfo (36) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CRLInfo(struct soap*, const struct d__CRLInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CRLInfo(struct soap*, struct d__CRLInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CRLInfo(struct soap*, const struct d__CRLInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CRLInfo(struct soap*, const char*, int, const struct d__CRLInfo *, const char*); -SOAP_FMAC3 struct d__CRLInfo * SOAP_FMAC4 soap_get_d__CRLInfo(struct soap*, struct d__CRLInfo *, const char*, const char*); -SOAP_FMAC3 struct d__CRLInfo * SOAP_FMAC4 soap_in_d__CRLInfo(struct soap*, const char*, struct d__CRLInfo *, const char*); - -#ifndef SOAP_TYPE_d__RevokedInfo -#define SOAP_TYPE_d__RevokedInfo (35) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__RevokedInfo(struct soap*, const struct d__RevokedInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__RevokedInfo(struct soap*, struct d__RevokedInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__RevokedInfo(struct soap*, const struct d__RevokedInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__RevokedInfo(struct soap*, const char*, int, const struct d__RevokedInfo *, const char*); -SOAP_FMAC3 struct d__RevokedInfo * SOAP_FMAC4 soap_get_d__RevokedInfo(struct soap*, struct d__RevokedInfo *, const char*, const char*); -SOAP_FMAC3 struct d__RevokedInfo * SOAP_FMAC4 soap_in_d__RevokedInfo(struct soap*, const char*, struct d__RevokedInfo *, const char*); - -#ifndef SOAP_TYPE_d__TstInfo -#define SOAP_TYPE_d__TstInfo (34) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__TstInfo(struct soap*, const struct d__TstInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__TstInfo(struct soap*, struct d__TstInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__TstInfo(struct soap*, const struct d__TstInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__TstInfo(struct soap*, const char*, int, const struct d__TstInfo *, const char*); -SOAP_FMAC3 struct d__TstInfo * SOAP_FMAC4 soap_get_d__TstInfo(struct soap*, struct d__TstInfo *, const char*, const char*); -SOAP_FMAC3 struct d__TstInfo * SOAP_FMAC4 soap_in_d__TstInfo(struct soap*, const char*, struct d__TstInfo *, const char*); - -#ifndef SOAP_TYPE_d__ConfirmationInfo -#define SOAP_TYPE_d__ConfirmationInfo (33) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__ConfirmationInfo(struct soap*, const struct d__ConfirmationInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__ConfirmationInfo(struct soap*, struct d__ConfirmationInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__ConfirmationInfo(struct soap*, const struct d__ConfirmationInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__ConfirmationInfo(struct soap*, const char*, int, const struct d__ConfirmationInfo *, const char*); -SOAP_FMAC3 struct d__ConfirmationInfo * SOAP_FMAC4 soap_get_d__ConfirmationInfo(struct soap*, struct d__ConfirmationInfo *, const char*, const char*); -SOAP_FMAC3 struct d__ConfirmationInfo * SOAP_FMAC4 soap_in_d__ConfirmationInfo(struct soap*, const char*, struct d__ConfirmationInfo *, const char*); - -#ifndef SOAP_TYPE_d__SignerInfo -#define SOAP_TYPE_d__SignerInfo (31) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignerInfo(struct soap*, const struct d__SignerInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignerInfo(struct soap*, struct d__SignerInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignerInfo(struct soap*, const struct d__SignerInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignerInfo(struct soap*, const char*, int, const struct d__SignerInfo *, const char*); -SOAP_FMAC3 struct d__SignerInfo * SOAP_FMAC4 soap_get_d__SignerInfo(struct soap*, struct d__SignerInfo *, const char*, const char*); -SOAP_FMAC3 struct d__SignerInfo * SOAP_FMAC4 soap_in_d__SignerInfo(struct soap*, const char*, struct d__SignerInfo *, const char*); - -#ifndef SOAP_TYPE_d__CertificateInfo -#define SOAP_TYPE_d__CertificateInfo (29) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CertificateInfo(struct soap*, const struct d__CertificateInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CertificateInfo(struct soap*, struct d__CertificateInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CertificateInfo(struct soap*, const struct d__CertificateInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CertificateInfo(struct soap*, const char*, int, const struct d__CertificateInfo *, const char*); -SOAP_FMAC3 struct d__CertificateInfo * SOAP_FMAC4 soap_get_d__CertificateInfo(struct soap*, struct d__CertificateInfo *, const char*, const char*); -SOAP_FMAC3 struct d__CertificateInfo * SOAP_FMAC4 soap_in_d__CertificateInfo(struct soap*, const char*, struct d__CertificateInfo *, const char*); - -#ifndef SOAP_TYPE_d__CertificatePolicy -#define SOAP_TYPE_d__CertificatePolicy (28) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__CertificatePolicy(struct soap*, const struct d__CertificatePolicy *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__CertificatePolicy(struct soap*, struct d__CertificatePolicy *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__CertificatePolicy(struct soap*, const struct d__CertificatePolicy *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__CertificatePolicy(struct soap*, const char*, int, const struct d__CertificatePolicy *, const char*); -SOAP_FMAC3 struct d__CertificatePolicy * SOAP_FMAC4 soap_get_d__CertificatePolicy(struct soap*, struct d__CertificatePolicy *, const char*, const char*); -SOAP_FMAC3 struct d__CertificatePolicy * SOAP_FMAC4 soap_in_d__CertificatePolicy(struct soap*, const char*, struct d__CertificatePolicy *, const char*); - -#ifndef SOAP_TYPE_d__SignatureProductionPlace -#define SOAP_TYPE_d__SignatureProductionPlace (27) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignatureProductionPlace(struct soap*, const struct d__SignatureProductionPlace *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignatureProductionPlace(struct soap*, struct d__SignatureProductionPlace *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignatureProductionPlace(struct soap*, const struct d__SignatureProductionPlace *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignatureProductionPlace(struct soap*, const char*, int, const struct d__SignatureProductionPlace *, const char*); -SOAP_FMAC3 struct d__SignatureProductionPlace * SOAP_FMAC4 soap_get_d__SignatureProductionPlace(struct soap*, struct d__SignatureProductionPlace *, const char*, const char*); -SOAP_FMAC3 struct d__SignatureProductionPlace * SOAP_FMAC4 soap_in_d__SignatureProductionPlace(struct soap*, const char*, struct d__SignatureProductionPlace *, const char*); - -#ifndef SOAP_TYPE_d__SignerRole -#define SOAP_TYPE_d__SignerRole (26) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__SignerRole(struct soap*, const struct d__SignerRole *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__SignerRole(struct soap*, struct d__SignerRole *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__SignerRole(struct soap*, const struct d__SignerRole *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__SignerRole(struct soap*, const char*, int, const struct d__SignerRole *, const char*); -SOAP_FMAC3 struct d__SignerRole * SOAP_FMAC4 soap_get_d__SignerRole(struct soap*, struct d__SignerRole *, const char*, const char*); -SOAP_FMAC3 struct d__SignerRole * SOAP_FMAC4 soap_in_d__SignerRole(struct soap*, const char*, struct d__SignerRole *, const char*); - -#ifndef SOAP_TYPE_d__DataFileInfo -#define SOAP_TYPE_d__DataFileInfo (24) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileInfo(struct soap*, const struct d__DataFileInfo *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileInfo(struct soap*, struct d__DataFileInfo *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileInfo(struct soap*, const struct d__DataFileInfo *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileInfo(struct soap*, const char*, int, const struct d__DataFileInfo *, const char*); -SOAP_FMAC3 struct d__DataFileInfo * SOAP_FMAC4 soap_get_d__DataFileInfo(struct soap*, struct d__DataFileInfo *, const char*, const char*); -SOAP_FMAC3 struct d__DataFileInfo * SOAP_FMAC4 soap_in_d__DataFileInfo(struct soap*, const char*, struct d__DataFileInfo *, const char*); - -#ifndef SOAP_TYPE_d__DataFileAttribute -#define SOAP_TYPE_d__DataFileAttribute (23) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_d__DataFileAttribute(struct soap*, const struct d__DataFileAttribute *); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_d__DataFileAttribute(struct soap*, struct d__DataFileAttribute *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_d__DataFileAttribute(struct soap*, const struct d__DataFileAttribute *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_d__DataFileAttribute(struct soap*, const char*, int, const struct d__DataFileAttribute *, const char*); -SOAP_FMAC3 struct d__DataFileAttribute * SOAP_FMAC4 soap_get_d__DataFileAttribute(struct soap*, struct d__DataFileAttribute *, const char*, const char*); -SOAP_FMAC3 struct d__DataFileAttribute * SOAP_FMAC4 soap_in_d__DataFileAttribute(struct soap*, const char*, struct d__DataFileAttribute *, const char*); - -#ifndef SOAP_TYPE_xsd__hexBinary -#define SOAP_TYPE_xsd__hexBinary (20) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__hexBinary(struct soap*, struct xsd__hexBinary const*); -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__hexBinary(struct soap*, struct xsd__hexBinary *); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__hexBinary(struct soap*, const struct xsd__hexBinary *, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__hexBinary(struct soap*, const char*, int, const struct xsd__hexBinary *, const char*); -SOAP_FMAC3 struct xsd__hexBinary * SOAP_FMAC4 soap_get_xsd__hexBinary(struct soap*, struct xsd__hexBinary *, const char*, const char*); -SOAP_FMAC3 struct xsd__hexBinary * SOAP_FMAC4 soap_in_xsd__hexBinary(struct soap*, const char*, struct xsd__hexBinary *, const char*); - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_PointerToSOAP_ENV__Reason -#define SOAP_TYPE_PointerToSOAP_ENV__Reason (174) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Reason(struct soap*, const char *, int, struct SOAP_ENV__Reason *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Reason(struct soap*, struct SOAP_ENV__Reason **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Reason ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Reason(struct soap*, const char*, struct SOAP_ENV__Reason **, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_PointerToSOAP_ENV__Detail -#define SOAP_TYPE_PointerToSOAP_ENV__Detail (173) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Detail(struct soap*, const char *, int, struct SOAP_ENV__Detail *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Detail(struct soap*, struct SOAP_ENV__Detail **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Detail ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Detail(struct soap*, const char*, struct SOAP_ENV__Detail **, const char*); - -#endif - -#ifndef WITH_NOGLOBAL - -#ifndef SOAP_TYPE_PointerToSOAP_ENV__Code -#define SOAP_TYPE_PointerToSOAP_ENV__Code (169) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerToSOAP_ENV__Code(struct soap*, const char *, int, struct SOAP_ENV__Code *const*, const char *); -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_get_PointerToSOAP_ENV__Code(struct soap*, struct SOAP_ENV__Code **, const char*, const char*); -SOAP_FMAC3 struct SOAP_ENV__Code ** SOAP_FMAC4 soap_in_PointerToSOAP_ENV__Code(struct soap*, const char*, struct SOAP_ENV__Code **, const char*); - -#endif - -#ifndef SOAP_TYPE_PointerTomss_DummyResp -#define SOAP_TYPE_PointerTomss_DummyResp (162) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTomss_DummyResp(struct soap*, struct mss_DummyResp *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTomss_DummyResp(struct soap*, struct mss_DummyResp *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTomss_DummyResp(struct soap*, const char *, int, struct mss_DummyResp *const*, const char *); -SOAP_FMAC3 struct mss_DummyResp ** SOAP_FMAC4 soap_get_PointerTomss_DummyResp(struct soap*, struct mss_DummyResp **, const char*, const char*); -SOAP_FMAC3 struct mss_DummyResp ** SOAP_FMAC4 soap_in_PointerTomss_DummyResp(struct soap*, const char*, struct mss_DummyResp **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse -#define SOAP_TYPE_PointerTod__GetMobileCreateSignatureStatusResponse (158) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap*, struct d__GetMobileCreateSignatureStatusResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap*, struct d__GetMobileCreateSignatureStatusResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap*, const char *, int, struct d__GetMobileCreateSignatureStatusResponse *const*, const char *); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse ** SOAP_FMAC4 soap_get_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap*, struct d__GetMobileCreateSignatureStatusResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileCreateSignatureStatusResponse ** SOAP_FMAC4 soap_in_PointerTod__GetMobileCreateSignatureStatusResponse(struct soap*, const char*, struct d__GetMobileCreateSignatureStatusResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__MobileCreateSignatureResponse -#define SOAP_TYPE_PointerTod__MobileCreateSignatureResponse (154) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileCreateSignatureResponse(struct soap*, struct d__MobileCreateSignatureResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileCreateSignatureResponse(struct soap*, struct d__MobileCreateSignatureResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileCreateSignatureResponse(struct soap*, const char *, int, struct d__MobileCreateSignatureResponse *const*, const char *); -SOAP_FMAC3 struct d__MobileCreateSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileCreateSignatureResponse(struct soap*, struct d__MobileCreateSignatureResponse **, const char*, const char*); -SOAP_FMAC3 struct d__MobileCreateSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileCreateSignatureResponse(struct soap*, const char*, struct d__MobileCreateSignatureResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__DataFileDigestList -#define SOAP_TYPE_PointerTod__DataFileDigestList (153) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileDigestList(struct soap*, struct d__DataFileDigestList *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileDigestList(struct soap*, struct d__DataFileDigestList *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileDigestList(struct soap*, const char *, int, struct d__DataFileDigestList *const*, const char *); -SOAP_FMAC3 struct d__DataFileDigestList ** SOAP_FMAC4 soap_get_PointerTod__DataFileDigestList(struct soap*, struct d__DataFileDigestList **, const char*, const char*); -SOAP_FMAC3 struct d__DataFileDigestList ** SOAP_FMAC4 soap_in_PointerTod__DataFileDigestList(struct soap*, const char*, struct d__DataFileDigestList **, const char*); - -#ifndef SOAP_TYPE_PointerTod__DataFileDigest -#define SOAP_TYPE_PointerTod__DataFileDigest (151) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileDigest(struct soap*, struct d__DataFileDigest *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileDigest(struct soap*, struct d__DataFileDigest *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileDigest(struct soap*, const char *, int, struct d__DataFileDigest *const*, const char *); -SOAP_FMAC3 struct d__DataFileDigest ** SOAP_FMAC4 soap_get_PointerTod__DataFileDigest(struct soap*, struct d__DataFileDigest **, const char*, const char*); -SOAP_FMAC3 struct d__DataFileDigest ** SOAP_FMAC4 soap_in_PointerTod__DataFileDigest(struct soap*, const char*, struct d__DataFileDigest **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse -#define SOAP_TYPE_PointerTod__GetMobileAuthenticateStatusResponse (146) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetMobileAuthenticateStatusResponse(struct soap*, struct d__GetMobileAuthenticateStatusResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetMobileAuthenticateStatusResponse(struct soap*, struct d__GetMobileAuthenticateStatusResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetMobileAuthenticateStatusResponse(struct soap*, const char *, int, struct d__GetMobileAuthenticateStatusResponse *const*, const char *); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse ** SOAP_FMAC4 soap_get_PointerTod__GetMobileAuthenticateStatusResponse(struct soap*, struct d__GetMobileAuthenticateStatusResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetMobileAuthenticateStatusResponse ** SOAP_FMAC4 soap_in_PointerTod__GetMobileAuthenticateStatusResponse(struct soap*, const char*, struct d__GetMobileAuthenticateStatusResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__MobileAuthenticateResponse -#define SOAP_TYPE_PointerTod__MobileAuthenticateResponse (142) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileAuthenticateResponse(struct soap*, struct d__MobileAuthenticateResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileAuthenticateResponse(struct soap*, struct d__MobileAuthenticateResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileAuthenticateResponse(struct soap*, const char *, int, struct d__MobileAuthenticateResponse *const*, const char *); -SOAP_FMAC3 struct d__MobileAuthenticateResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileAuthenticateResponse(struct soap*, struct d__MobileAuthenticateResponse **, const char*, const char*); -SOAP_FMAC3 struct d__MobileAuthenticateResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileAuthenticateResponse(struct soap*, const char*, struct d__MobileAuthenticateResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetStatusInfoResponse -#define SOAP_TYPE_PointerTod__GetStatusInfoResponse (138) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetStatusInfoResponse(struct soap*, struct d__GetStatusInfoResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetStatusInfoResponse(struct soap*, struct d__GetStatusInfoResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetStatusInfoResponse(struct soap*, const char *, int, struct d__GetStatusInfoResponse *const*, const char *); -SOAP_FMAC3 struct d__GetStatusInfoResponse ** SOAP_FMAC4 soap_get_PointerTod__GetStatusInfoResponse(struct soap*, struct d__GetStatusInfoResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetStatusInfoResponse ** SOAP_FMAC4 soap_in_PointerTod__GetStatusInfoResponse(struct soap*, const char*, struct d__GetStatusInfoResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__MobileSignResponse -#define SOAP_TYPE_PointerTod__MobileSignResponse (134) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__MobileSignResponse(struct soap*, struct d__MobileSignResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__MobileSignResponse(struct soap*, struct d__MobileSignResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__MobileSignResponse(struct soap*, const char *, int, struct d__MobileSignResponse *const*, const char *); -SOAP_FMAC3 struct d__MobileSignResponse ** SOAP_FMAC4 soap_get_PointerTod__MobileSignResponse(struct soap*, struct d__MobileSignResponse **, const char*, const char*); -SOAP_FMAC3 struct d__MobileSignResponse ** SOAP_FMAC4 soap_in_PointerTod__MobileSignResponse(struct soap*, const char*, struct d__MobileSignResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetVersionResponse -#define SOAP_TYPE_PointerTod__GetVersionResponse (130) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetVersionResponse(struct soap*, struct d__GetVersionResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetVersionResponse(struct soap*, struct d__GetVersionResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetVersionResponse(struct soap*, const char *, int, struct d__GetVersionResponse *const*, const char *); -SOAP_FMAC3 struct d__GetVersionResponse ** SOAP_FMAC4 soap_get_PointerTod__GetVersionResponse(struct soap*, struct d__GetVersionResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetVersionResponse ** SOAP_FMAC4 soap_in_PointerTod__GetVersionResponse(struct soap*, const char*, struct d__GetVersionResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__RemoveSignatureResponse -#define SOAP_TYPE_PointerTod__RemoveSignatureResponse (126) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RemoveSignatureResponse(struct soap*, struct d__RemoveSignatureResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RemoveSignatureResponse(struct soap*, struct d__RemoveSignatureResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RemoveSignatureResponse(struct soap*, const char *, int, struct d__RemoveSignatureResponse *const*, const char *); -SOAP_FMAC3 struct d__RemoveSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__RemoveSignatureResponse(struct soap*, struct d__RemoveSignatureResponse **, const char*, const char*); -SOAP_FMAC3 struct d__RemoveSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__RemoveSignatureResponse(struct soap*, const char*, struct d__RemoveSignatureResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__FinalizeSignatureResponse -#define SOAP_TYPE_PointerTod__FinalizeSignatureResponse (122) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__FinalizeSignatureResponse(struct soap*, struct d__FinalizeSignatureResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__FinalizeSignatureResponse(struct soap*, struct d__FinalizeSignatureResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__FinalizeSignatureResponse(struct soap*, const char *, int, struct d__FinalizeSignatureResponse *const*, const char *); -SOAP_FMAC3 struct d__FinalizeSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__FinalizeSignatureResponse(struct soap*, struct d__FinalizeSignatureResponse **, const char*, const char*); -SOAP_FMAC3 struct d__FinalizeSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__FinalizeSignatureResponse(struct soap*, const char*, struct d__FinalizeSignatureResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__PrepareSignatureResponse -#define SOAP_TYPE_PointerTod__PrepareSignatureResponse (118) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__PrepareSignatureResponse(struct soap*, struct d__PrepareSignatureResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__PrepareSignatureResponse(struct soap*, struct d__PrepareSignatureResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__PrepareSignatureResponse(struct soap*, const char *, int, struct d__PrepareSignatureResponse *const*, const char *); -SOAP_FMAC3 struct d__PrepareSignatureResponse ** SOAP_FMAC4 soap_get_PointerTod__PrepareSignatureResponse(struct soap*, struct d__PrepareSignatureResponse **, const char*, const char*); -SOAP_FMAC3 struct d__PrepareSignatureResponse ** SOAP_FMAC4 soap_in_PointerTod__PrepareSignatureResponse(struct soap*, const char*, struct d__PrepareSignatureResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetSignatureModulesResponse -#define SOAP_TYPE_PointerTod__GetSignatureModulesResponse (114) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignatureModulesResponse(struct soap*, struct d__GetSignatureModulesResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignatureModulesResponse(struct soap*, struct d__GetSignatureModulesResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignatureModulesResponse(struct soap*, const char *, int, struct d__GetSignatureModulesResponse *const*, const char *); -SOAP_FMAC3 struct d__GetSignatureModulesResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignatureModulesResponse(struct soap*, struct d__GetSignatureModulesResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetSignatureModulesResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignatureModulesResponse(struct soap*, const char*, struct d__GetSignatureModulesResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignatureModulesArray -#define SOAP_TYPE_PointerTod__SignatureModulesArray (113) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureModulesArray(struct soap*, struct d__SignatureModulesArray *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureModulesArray(struct soap*, struct d__SignatureModulesArray *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureModulesArray(struct soap*, const char *, int, struct d__SignatureModulesArray *const*, const char *); -SOAP_FMAC3 struct d__SignatureModulesArray ** SOAP_FMAC4 soap_get_PointerTod__SignatureModulesArray(struct soap*, struct d__SignatureModulesArray **, const char*, const char*); -SOAP_FMAC3 struct d__SignatureModulesArray ** SOAP_FMAC4 soap_in_PointerTod__SignatureModulesArray(struct soap*, const char*, struct d__SignatureModulesArray **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignatureModule -#define SOAP_TYPE_PointerTod__SignatureModule (111) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureModule(struct soap*, struct d__SignatureModule *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureModule(struct soap*, struct d__SignatureModule *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureModule(struct soap*, const char *, int, struct d__SignatureModule *const*, const char *); -SOAP_FMAC3 struct d__SignatureModule ** SOAP_FMAC4 soap_get_PointerTod__SignatureModule(struct soap*, struct d__SignatureModule **, const char*, const char*); -SOAP_FMAC3 struct d__SignatureModule ** SOAP_FMAC4 soap_in_PointerTod__SignatureModule(struct soap*, const char*, struct d__SignatureModule **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetCRLResponse -#define SOAP_TYPE_PointerTod__GetCRLResponse (106) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetCRLResponse(struct soap*, struct d__GetCRLResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetCRLResponse(struct soap*, struct d__GetCRLResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetCRLResponse(struct soap*, const char *, int, struct d__GetCRLResponse *const*, const char *); -SOAP_FMAC3 struct d__GetCRLResponse ** SOAP_FMAC4 soap_get_PointerTod__GetCRLResponse(struct soap*, struct d__GetCRLResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetCRLResponse ** SOAP_FMAC4 soap_in_PointerTod__GetCRLResponse(struct soap*, const char*, struct d__GetCRLResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetTimestampResponse -#define SOAP_TYPE_PointerTod__GetTimestampResponse (102) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetTimestampResponse(struct soap*, struct d__GetTimestampResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetTimestampResponse(struct soap*, struct d__GetTimestampResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetTimestampResponse(struct soap*, const char *, int, struct d__GetTimestampResponse *const*, const char *); -SOAP_FMAC3 struct d__GetTimestampResponse ** SOAP_FMAC4 soap_get_PointerTod__GetTimestampResponse(struct soap*, struct d__GetTimestampResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetTimestampResponse ** SOAP_FMAC4 soap_in_PointerTod__GetTimestampResponse(struct soap*, const char*, struct d__GetTimestampResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetTSACertificateResponse -#define SOAP_TYPE_PointerTod__GetTSACertificateResponse (98) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetTSACertificateResponse(struct soap*, struct d__GetTSACertificateResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetTSACertificateResponse(struct soap*, struct d__GetTSACertificateResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetTSACertificateResponse(struct soap*, const char *, int, struct d__GetTSACertificateResponse *const*, const char *); -SOAP_FMAC3 struct d__GetTSACertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetTSACertificateResponse(struct soap*, struct d__GetTSACertificateResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetTSACertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetTSACertificateResponse(struct soap*, const char*, struct d__GetTSACertificateResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetNotaryResponse -#define SOAP_TYPE_PointerTod__GetNotaryResponse (94) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetNotaryResponse(struct soap*, struct d__GetNotaryResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetNotaryResponse(struct soap*, struct d__GetNotaryResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetNotaryResponse(struct soap*, const char *, int, struct d__GetNotaryResponse *const*, const char *); -SOAP_FMAC3 struct d__GetNotaryResponse ** SOAP_FMAC4 soap_get_PointerTod__GetNotaryResponse(struct soap*, struct d__GetNotaryResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetNotaryResponse ** SOAP_FMAC4 soap_in_PointerTod__GetNotaryResponse(struct soap*, const char*, struct d__GetNotaryResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetNotarysCertificateResponse -#define SOAP_TYPE_PointerTod__GetNotarysCertificateResponse (90) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetNotarysCertificateResponse(struct soap*, struct d__GetNotarysCertificateResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetNotarysCertificateResponse(struct soap*, struct d__GetNotarysCertificateResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetNotarysCertificateResponse(struct soap*, const char *, int, struct d__GetNotarysCertificateResponse *const*, const char *); -SOAP_FMAC3 struct d__GetNotarysCertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetNotarysCertificateResponse(struct soap*, struct d__GetNotarysCertificateResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetNotarysCertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetNotarysCertificateResponse(struct soap*, const char*, struct d__GetNotarysCertificateResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetSignersCertificateResponse -#define SOAP_TYPE_PointerTod__GetSignersCertificateResponse (86) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignersCertificateResponse(struct soap*, struct d__GetSignersCertificateResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignersCertificateResponse(struct soap*, struct d__GetSignersCertificateResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignersCertificateResponse(struct soap*, const char *, int, struct d__GetSignersCertificateResponse *const*, const char *); -SOAP_FMAC3 struct d__GetSignersCertificateResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignersCertificateResponse(struct soap*, struct d__GetSignersCertificateResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetSignersCertificateResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignersCertificateResponse(struct soap*, const char*, struct d__GetSignersCertificateResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetDataFileResponse -#define SOAP_TYPE_PointerTod__GetDataFileResponse (82) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetDataFileResponse(struct soap*, struct d__GetDataFileResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetDataFileResponse(struct soap*, struct d__GetDataFileResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetDataFileResponse(struct soap*, const char *, int, struct d__GetDataFileResponse *const*, const char *); -SOAP_FMAC3 struct d__GetDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__GetDataFileResponse(struct soap*, struct d__GetDataFileResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__GetDataFileResponse(struct soap*, const char*, struct d__GetDataFileResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetSignedDocInfoResponse -#define SOAP_TYPE_PointerTod__GetSignedDocInfoResponse (78) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignedDocInfoResponse(struct soap*, struct d__GetSignedDocInfoResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignedDocInfoResponse(struct soap*, struct d__GetSignedDocInfoResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignedDocInfoResponse(struct soap*, const char *, int, struct d__GetSignedDocInfoResponse *const*, const char *); -SOAP_FMAC3 struct d__GetSignedDocInfoResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignedDocInfoResponse(struct soap*, struct d__GetSignedDocInfoResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDocInfoResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignedDocInfoResponse(struct soap*, const char*, struct d__GetSignedDocInfoResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__GetSignedDocResponse -#define SOAP_TYPE_PointerTod__GetSignedDocResponse (74) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__GetSignedDocResponse(struct soap*, struct d__GetSignedDocResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__GetSignedDocResponse(struct soap*, struct d__GetSignedDocResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__GetSignedDocResponse(struct soap*, const char *, int, struct d__GetSignedDocResponse *const*, const char *); -SOAP_FMAC3 struct d__GetSignedDocResponse ** SOAP_FMAC4 soap_get_PointerTod__GetSignedDocResponse(struct soap*, struct d__GetSignedDocResponse **, const char*, const char*); -SOAP_FMAC3 struct d__GetSignedDocResponse ** SOAP_FMAC4 soap_in_PointerTod__GetSignedDocResponse(struct soap*, const char*, struct d__GetSignedDocResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__RemoveDataFileResponse -#define SOAP_TYPE_PointerTod__RemoveDataFileResponse (70) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RemoveDataFileResponse(struct soap*, struct d__RemoveDataFileResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RemoveDataFileResponse(struct soap*, struct d__RemoveDataFileResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RemoveDataFileResponse(struct soap*, const char *, int, struct d__RemoveDataFileResponse *const*, const char *); -SOAP_FMAC3 struct d__RemoveDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__RemoveDataFileResponse(struct soap*, struct d__RemoveDataFileResponse **, const char*, const char*); -SOAP_FMAC3 struct d__RemoveDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__RemoveDataFileResponse(struct soap*, const char*, struct d__RemoveDataFileResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__AddDataFileResponse -#define SOAP_TYPE_PointerTod__AddDataFileResponse (66) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__AddDataFileResponse(struct soap*, struct d__AddDataFileResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__AddDataFileResponse(struct soap*, struct d__AddDataFileResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__AddDataFileResponse(struct soap*, const char *, int, struct d__AddDataFileResponse *const*, const char *); -SOAP_FMAC3 struct d__AddDataFileResponse ** SOAP_FMAC4 soap_get_PointerTod__AddDataFileResponse(struct soap*, struct d__AddDataFileResponse **, const char*, const char*); -SOAP_FMAC3 struct d__AddDataFileResponse ** SOAP_FMAC4 soap_in_PointerTod__AddDataFileResponse(struct soap*, const char*, struct d__AddDataFileResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__CreateSignedDocResponse -#define SOAP_TYPE_PointerTod__CreateSignedDocResponse (62) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CreateSignedDocResponse(struct soap*, struct d__CreateSignedDocResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CreateSignedDocResponse(struct soap*, struct d__CreateSignedDocResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CreateSignedDocResponse(struct soap*, const char *, int, struct d__CreateSignedDocResponse *const*, const char *); -SOAP_FMAC3 struct d__CreateSignedDocResponse ** SOAP_FMAC4 soap_get_PointerTod__CreateSignedDocResponse(struct soap*, struct d__CreateSignedDocResponse **, const char*, const char*); -SOAP_FMAC3 struct d__CreateSignedDocResponse ** SOAP_FMAC4 soap_in_PointerTod__CreateSignedDocResponse(struct soap*, const char*, struct d__CreateSignedDocResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__CloseSessionResponse -#define SOAP_TYPE_PointerTod__CloseSessionResponse (58) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CloseSessionResponse(struct soap*, struct d__CloseSessionResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CloseSessionResponse(struct soap*, struct d__CloseSessionResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CloseSessionResponse(struct soap*, const char *, int, struct d__CloseSessionResponse *const*, const char *); -SOAP_FMAC3 struct d__CloseSessionResponse ** SOAP_FMAC4 soap_get_PointerTod__CloseSessionResponse(struct soap*, struct d__CloseSessionResponse **, const char*, const char*); -SOAP_FMAC3 struct d__CloseSessionResponse ** SOAP_FMAC4 soap_in_PointerTod__CloseSessionResponse(struct soap*, const char*, struct d__CloseSessionResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__StartSessionResponse -#define SOAP_TYPE_PointerTod__StartSessionResponse (54) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__StartSessionResponse(struct soap*, struct d__StartSessionResponse *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__StartSessionResponse(struct soap*, struct d__StartSessionResponse *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__StartSessionResponse(struct soap*, const char *, int, struct d__StartSessionResponse *const*, const char *); -SOAP_FMAC3 struct d__StartSessionResponse ** SOAP_FMAC4 soap_get_PointerTod__StartSessionResponse(struct soap*, struct d__StartSessionResponse **, const char*, const char*); -SOAP_FMAC3 struct d__StartSessionResponse ** SOAP_FMAC4 soap_in_PointerTod__StartSessionResponse(struct soap*, const char*, struct d__StartSessionResponse **, const char*); - -#ifndef SOAP_TYPE_PointerTod__DataFileData -#define SOAP_TYPE_PointerTod__DataFileData (53) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileData(struct soap*, struct d__DataFileData *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileData(struct soap*, struct d__DataFileData *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileData(struct soap*, const char *, int, struct d__DataFileData *const*, const char *); -SOAP_FMAC3 struct d__DataFileData ** SOAP_FMAC4 soap_get_PointerTod__DataFileData(struct soap*, struct d__DataFileData **, const char*, const char*); -SOAP_FMAC3 struct d__DataFileData ** SOAP_FMAC4 soap_in_PointerTod__DataFileData(struct soap*, const char*, struct d__DataFileData **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignedDocInfo -#define SOAP_TYPE_PointerTod__SignedDocInfo (52) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignedDocInfo(struct soap*, struct d__SignedDocInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignedDocInfo(struct soap*, struct d__SignedDocInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignedDocInfo(struct soap*, const char *, int, struct d__SignedDocInfo *const*, const char *); -SOAP_FMAC3 struct d__SignedDocInfo ** SOAP_FMAC4 soap_get_PointerTod__SignedDocInfo(struct soap*, struct d__SignedDocInfo **, const char*, const char*); -SOAP_FMAC3 struct d__SignedDocInfo ** SOAP_FMAC4 soap_in_PointerTod__SignedDocInfo(struct soap*, const char*, struct d__SignedDocInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignatureInfo -#define SOAP_TYPE_PointerTod__SignatureInfo (49) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureInfo(struct soap*, struct d__SignatureInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureInfo(struct soap*, struct d__SignatureInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureInfo(struct soap*, const char *, int, struct d__SignatureInfo *const*, const char *); -SOAP_FMAC3 struct d__SignatureInfo ** SOAP_FMAC4 soap_get_PointerTod__SignatureInfo(struct soap*, struct d__SignatureInfo **, const char*, const char*); -SOAP_FMAC3 struct d__SignatureInfo ** SOAP_FMAC4 soap_in_PointerTod__SignatureInfo(struct soap*, const char*, struct d__SignatureInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__DataFileInfo -#define SOAP_TYPE_PointerTod__DataFileInfo (48) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileInfo(struct soap*, struct d__DataFileInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileInfo(struct soap*, struct d__DataFileInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileInfo(struct soap*, const char *, int, struct d__DataFileInfo *const*, const char *); -SOAP_FMAC3 struct d__DataFileInfo ** SOAP_FMAC4 soap_get_PointerTod__DataFileInfo(struct soap*, struct d__DataFileInfo **, const char*, const char*); -SOAP_FMAC3 struct d__DataFileInfo ** SOAP_FMAC4 soap_in_PointerTod__DataFileInfo(struct soap*, const char*, struct d__DataFileInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__CRLInfo -#define SOAP_TYPE_PointerTod__CRLInfo (46) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CRLInfo(struct soap*, struct d__CRLInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CRLInfo(struct soap*, struct d__CRLInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CRLInfo(struct soap*, const char *, int, struct d__CRLInfo *const*, const char *); -SOAP_FMAC3 struct d__CRLInfo ** SOAP_FMAC4 soap_get_PointerTod__CRLInfo(struct soap*, struct d__CRLInfo **, const char*, const char*); -SOAP_FMAC3 struct d__CRLInfo ** SOAP_FMAC4 soap_in_PointerTod__CRLInfo(struct soap*, const char*, struct d__CRLInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__TstInfo -#define SOAP_TYPE_PointerTod__TstInfo (45) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__TstInfo(struct soap*, struct d__TstInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__TstInfo(struct soap*, struct d__TstInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__TstInfo(struct soap*, const char *, int, struct d__TstInfo *const*, const char *); -SOAP_FMAC3 struct d__TstInfo ** SOAP_FMAC4 soap_get_PointerTod__TstInfo(struct soap*, struct d__TstInfo **, const char*, const char*); -SOAP_FMAC3 struct d__TstInfo ** SOAP_FMAC4 soap_in_PointerTod__TstInfo(struct soap*, const char*, struct d__TstInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__ConfirmationInfo -#define SOAP_TYPE_PointerTod__ConfirmationInfo (44) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__ConfirmationInfo(struct soap*, struct d__ConfirmationInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__ConfirmationInfo(struct soap*, struct d__ConfirmationInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__ConfirmationInfo(struct soap*, const char *, int, struct d__ConfirmationInfo *const*, const char *); -SOAP_FMAC3 struct d__ConfirmationInfo ** SOAP_FMAC4 soap_get_PointerTod__ConfirmationInfo(struct soap*, struct d__ConfirmationInfo **, const char*, const char*); -SOAP_FMAC3 struct d__ConfirmationInfo ** SOAP_FMAC4 soap_in_PointerTod__ConfirmationInfo(struct soap*, const char*, struct d__ConfirmationInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignerInfo -#define SOAP_TYPE_PointerTod__SignerInfo (43) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignerInfo(struct soap*, struct d__SignerInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignerInfo(struct soap*, struct d__SignerInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignerInfo(struct soap*, const char *, int, struct d__SignerInfo *const*, const char *); -SOAP_FMAC3 struct d__SignerInfo ** SOAP_FMAC4 soap_get_PointerTod__SignerInfo(struct soap*, struct d__SignerInfo **, const char*, const char*); -SOAP_FMAC3 struct d__SignerInfo ** SOAP_FMAC4 soap_in_PointerTod__SignerInfo(struct soap*, const char*, struct d__SignerInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignatureProductionPlace -#define SOAP_TYPE_PointerTod__SignatureProductionPlace (42) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignatureProductionPlace(struct soap*, struct d__SignatureProductionPlace *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignatureProductionPlace(struct soap*, struct d__SignatureProductionPlace *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignatureProductionPlace(struct soap*, const char *, int, struct d__SignatureProductionPlace *const*, const char *); -SOAP_FMAC3 struct d__SignatureProductionPlace ** SOAP_FMAC4 soap_get_PointerTod__SignatureProductionPlace(struct soap*, struct d__SignatureProductionPlace **, const char*, const char*); -SOAP_FMAC3 struct d__SignatureProductionPlace ** SOAP_FMAC4 soap_in_PointerTod__SignatureProductionPlace(struct soap*, const char*, struct d__SignatureProductionPlace **, const char*); - -#ifndef SOAP_TYPE_PointerTod__SignerRole -#define SOAP_TYPE_PointerTod__SignerRole (41) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__SignerRole(struct soap*, struct d__SignerRole *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__SignerRole(struct soap*, struct d__SignerRole *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__SignerRole(struct soap*, const char *, int, struct d__SignerRole *const*, const char *); -SOAP_FMAC3 struct d__SignerRole ** SOAP_FMAC4 soap_get_PointerTod__SignerRole(struct soap*, struct d__SignerRole **, const char*, const char*); -SOAP_FMAC3 struct d__SignerRole ** SOAP_FMAC4 soap_in_PointerTod__SignerRole(struct soap*, const char*, struct d__SignerRole **, const char*); - -#ifndef SOAP_TYPE_PointerTod__Error -#define SOAP_TYPE_PointerTod__Error (40) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__Error(struct soap*, struct d__Error *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__Error(struct soap*, struct d__Error *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__Error(struct soap*, const char *, int, struct d__Error *const*, const char *); -SOAP_FMAC3 struct d__Error ** SOAP_FMAC4 soap_get_PointerTod__Error(struct soap*, struct d__Error **, const char*, const char*); -SOAP_FMAC3 struct d__Error ** SOAP_FMAC4 soap_in_PointerTod__Error(struct soap*, const char*, struct d__Error **, const char*); - -#ifndef SOAP_TYPE_PointerTod__RevokedInfo -#define SOAP_TYPE_PointerTod__RevokedInfo (37) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__RevokedInfo(struct soap*, struct d__RevokedInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__RevokedInfo(struct soap*, struct d__RevokedInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__RevokedInfo(struct soap*, const char *, int, struct d__RevokedInfo *const*, const char *); -SOAP_FMAC3 struct d__RevokedInfo ** SOAP_FMAC4 soap_get_PointerTod__RevokedInfo(struct soap*, struct d__RevokedInfo **, const char*, const char*); -SOAP_FMAC3 struct d__RevokedInfo ** SOAP_FMAC4 soap_in_PointerTod__RevokedInfo(struct soap*, const char*, struct d__RevokedInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__CertificateInfo -#define SOAP_TYPE_PointerTod__CertificateInfo (32) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CertificateInfo(struct soap*, struct d__CertificateInfo *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CertificateInfo(struct soap*, struct d__CertificateInfo *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CertificateInfo(struct soap*, const char *, int, struct d__CertificateInfo *const*, const char *); -SOAP_FMAC3 struct d__CertificateInfo ** SOAP_FMAC4 soap_get_PointerTod__CertificateInfo(struct soap*, struct d__CertificateInfo **, const char*, const char*); -SOAP_FMAC3 struct d__CertificateInfo ** SOAP_FMAC4 soap_in_PointerTod__CertificateInfo(struct soap*, const char*, struct d__CertificateInfo **, const char*); - -#ifndef SOAP_TYPE_PointerTod__CertificatePolicy -#define SOAP_TYPE_PointerTod__CertificatePolicy (30) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__CertificatePolicy(struct soap*, struct d__CertificatePolicy *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__CertificatePolicy(struct soap*, struct d__CertificatePolicy *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__CertificatePolicy(struct soap*, const char *, int, struct d__CertificatePolicy *const*, const char *); -SOAP_FMAC3 struct d__CertificatePolicy ** SOAP_FMAC4 soap_get_PointerTod__CertificatePolicy(struct soap*, struct d__CertificatePolicy **, const char*, const char*); -SOAP_FMAC3 struct d__CertificatePolicy ** SOAP_FMAC4 soap_in_PointerTod__CertificatePolicy(struct soap*, const char*, struct d__CertificatePolicy **, const char*); - -#ifndef SOAP_TYPE_PointerTod__DataFileAttribute -#define SOAP_TYPE_PointerTod__DataFileAttribute (25) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTod__DataFileAttribute(struct soap*, struct d__DataFileAttribute *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTod__DataFileAttribute(struct soap*, struct d__DataFileAttribute *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTod__DataFileAttribute(struct soap*, const char *, int, struct d__DataFileAttribute *const*, const char *); -SOAP_FMAC3 struct d__DataFileAttribute ** SOAP_FMAC4 soap_get_PointerTod__DataFileAttribute(struct soap*, struct d__DataFileAttribute **, const char*, const char*); -SOAP_FMAC3 struct d__DataFileAttribute ** SOAP_FMAC4 soap_in_PointerTod__DataFileAttribute(struct soap*, const char*, struct d__DataFileAttribute **, const char*); - -#ifndef SOAP_TYPE_PointerTounsignedByte -#define SOAP_TYPE_PointerTounsignedByte (22) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_PointerTounsignedByte(struct soap*, unsigned char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_PointerTounsignedByte(struct soap*, unsigned char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_PointerTounsignedByte(struct soap*, const char *, int, unsigned char *const*, const char *); -SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_get_PointerTounsignedByte(struct soap*, unsigned char **, const char*, const char*); -SOAP_FMAC3 unsigned char ** SOAP_FMAC4 soap_in_PointerTounsignedByte(struct soap*, const char*, unsigned char **, const char*); - -#ifndef SOAP_TYPE_xsd__dateTime -#define SOAP_TYPE_xsd__dateTime (19) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__dateTime(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__dateTime(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__dateTime(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__dateTime(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__dateTime(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__dateTime(struct soap*, const char*, char **, const char*); - -#ifndef SOAP_TYPE_xsd__anyURI -#define SOAP_TYPE_xsd__anyURI (7) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__anyURI(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__anyURI(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__anyURI(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__anyURI(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__anyURI(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__anyURI(struct soap*, const char*, char **, const char*); - -#ifndef SOAP_TYPE_xsd__string -#define SOAP_TYPE_xsd__string (6) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_xsd__string(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_xsd__string(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_xsd__string(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_xsd__string(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_xsd__string(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_xsd__string(struct soap*, const char*, char **, const char*); - -#ifndef SOAP_TYPE__QName -#define SOAP_TYPE__QName (5) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default__QName(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize__QName(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put__QName(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out__QName(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get__QName(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in__QName(struct soap*, const char*, char **, const char*); - -#ifndef SOAP_TYPE_string -#define SOAP_TYPE_string (3) -#endif -SOAP_FMAC3 void SOAP_FMAC4 soap_default_string(struct soap*, char **); -SOAP_FMAC3 void SOAP_FMAC4 soap_serialize_string(struct soap*, char *const*); -SOAP_FMAC3 int SOAP_FMAC4 soap_put_string(struct soap*, char *const*, const char*, const char*); -SOAP_FMAC3 int SOAP_FMAC4 soap_out_string(struct soap*, const char*, int, char*const*, const char*); -SOAP_FMAC3 char ** SOAP_FMAC4 soap_get_string(struct soap*, char **, const char*, const char*); -SOAP_FMAC3 char * * SOAP_FMAC4 soap_in_string(struct soap*, const char*, char **, const char*); - -#ifdef __cplusplus -} -#endif - -#endif - -/* End of ddsH.h */ diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/ddsStub.h libdigidoc-3.7.0.875/DigiDocServiceClient/ddsStub.h --- libdigidoc-2.7.0/DigiDocServiceClient/ddsStub.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/ddsStub.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1074 +0,0 @@ -/* ddsStub.h - Generated by gSOAP 2.7.9 from DigiDocService.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. - This part of the software is released under one of the following licenses: - GPL, the gSOAP public license, or Genivia's license for commercial use. -*/ - -#ifndef ddsStub_H -#define ddsStub_H -#include "stdsoap2.h" -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************\ - * * - * Enumerations * - * * -\******************************************************************************/ - - -/******************************************************************************\ - * * - * Classes and Structs * - * * -\******************************************************************************/ - -typedef unsigned char bool; -#define false 0 -#define true !false - -#ifndef SOAP_TYPE_xsd__hexBinary -#define SOAP_TYPE_xsd__hexBinary (20) -/* hexBinary schema type: */ -struct xsd__hexBinary -{ - unsigned char *__ptr; - int __size; -}; -#endif - -#ifndef SOAP_TYPE_d__DataFileAttribute -#define SOAP_TYPE_d__DataFileAttribute (23) -/* d:DataFileAttribute */ -struct d__DataFileAttribute -{ - char *Name; /* optional element of type xsd:string */ - char *Value; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__DataFileInfo -#define SOAP_TYPE_d__DataFileInfo (24) -/* d:DataFileInfo */ -struct d__DataFileInfo -{ - char *Id; /* optional element of type xsd:string */ - char *Filename; /* optional element of type xsd:string */ - char *MimeType; /* optional element of type xsd:string */ - char *ContentType; /* optional element of type xsd:string */ - long Size; /* required element of type xsd:int */ - char *DigestType; /* optional element of type xsd:string */ - char *DigestValue; /* optional element of type xsd:string */ - int __sizeOfAttributes; /* sequence of elements */ - struct d__DataFileAttribute *__ptrAttributes; -}; -#endif - -#ifndef SOAP_TYPE_d__SignerRole -#define SOAP_TYPE_d__SignerRole (26) -/* d:SignerRole */ -struct d__SignerRole -{ - long Certified; /* required element of type xsd:int */ - char *Role; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__SignatureProductionPlace -#define SOAP_TYPE_d__SignatureProductionPlace (27) -/* d:SignatureProductionPlace */ -struct d__SignatureProductionPlace -{ - char *City; /* optional element of type xsd:string */ - char *StateOrProvince; /* optional element of type xsd:string */ - char *PostalCode; /* optional element of type xsd:string */ - char *CountryName; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__CertificatePolicy -#define SOAP_TYPE_d__CertificatePolicy (28) -/* d:CertificatePolicy */ -struct d__CertificatePolicy -{ - char *OID; /* optional element of type xsd:string */ - char *URL; /* optional element of type xsd:string */ - char *Description; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__CertificateInfo -#define SOAP_TYPE_d__CertificateInfo (29) -/* d:CertificateInfo */ -struct d__CertificateInfo -{ - char *Issuer; /* optional element of type xsd:string */ - char *Subject; /* optional element of type xsd:string */ - char *ValidFrom; /* optional element of type xsd:dateTime */ - char *ValidTo; /* optional element of type xsd:dateTime */ - char *IssuerSerial; /* optional element of type xsd:string */ - int __sizePolicies; /* sequence of elements */ - struct d__CertificatePolicy *__ptrPolicies; -}; -#endif - -#ifndef SOAP_TYPE_d__SignerInfo -#define SOAP_TYPE_d__SignerInfo (31) -/* d:SignerInfo */ -struct d__SignerInfo -{ - char *CommonName; /* optional element of type xsd:string */ - char *IDCode; /* optional element of type xsd:string */ - struct d__CertificateInfo *Certificate; /* optional element of type d:CertificateInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__ConfirmationInfo -#define SOAP_TYPE_d__ConfirmationInfo (33) -/* d:ConfirmationInfo */ -struct d__ConfirmationInfo -{ - char *ResponderID; /* optional element of type xsd:string */ - char *ProducedAt; /* optional element of type xsd:string */ - struct d__CertificateInfo *ResponderCertificate; /* optional element of type d:CertificateInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__TstInfo -#define SOAP_TYPE_d__TstInfo (34) -/* d:TstInfo */ -struct d__TstInfo -{ - char *Id; /* optional element of type xsd:string */ - char *Type; /* optional element of type xsd:string */ - char *SerialNumber; /* optional element of type xsd:string */ - char *CreationTime; /* optional element of type xsd:dateTime */ - char *Policy; /* optional element of type xsd:string */ - char *ErrorBound; /* optional element of type xsd:string */ - bool Ordered; /* required element of type xsd:boolean */ - char *TSA; /* optional element of type xsd:string */ - struct d__CertificateInfo *Certificate; /* optional element of type d:CertificateInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__RevokedInfo -#define SOAP_TYPE_d__RevokedInfo (35) -/* d:RevokedInfo */ -struct d__RevokedInfo -{ - ULONG64 Sequence; /* required element of type xsd:positiveInteger */ - char *SerialNumber; /* optional element of type xsd:string */ - char *RevocationDate; /* optional element of type xsd:dateTime */ -}; -#endif - -#ifndef SOAP_TYPE_d__CRLInfo -#define SOAP_TYPE_d__CRLInfo (36) -/* d:CRLInfo */ -struct d__CRLInfo -{ - char *Issuer; /* optional element of type xsd:string */ - char *LastUpdate; /* optional element of type xsd:dateTime */ - char *NextUpdate; /* optional element of type xsd:dateTime */ - int __sizeOfRevocations; /* sequence of elements */ - struct d__RevokedInfo *__ptrRevocations; -}; -#endif - -#ifndef SOAP_TYPE_d__Error -#define SOAP_TYPE_d__Error (38) -/* d:Error */ -struct d__Error -{ - long Code; /* required element of type xsd:int */ - char *Category; /* optional element of type xsd:string */ - char *Description; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__SignatureInfo -#define SOAP_TYPE_d__SignatureInfo (39) -/* d:SignatureInfo */ -struct d__SignatureInfo -{ - char *Id; /* optional element of type xsd:string */ - char *Status; /* optional element of type xsd:string */ - struct d__Error *Error; /* optional element of type d:Error */ - char *SigningTime; /* optional element of type xsd:dateTime */ - int __sizeRoles; /* sequence of elements */ - struct d__SignerRole *__ptrSignerRole; - struct d__SignatureProductionPlace *SignatureProductionPlace; /* optional element of type d:SignatureProductionPlace */ - struct d__SignerInfo *Signer; /* optional element of type d:SignerInfo */ - struct d__ConfirmationInfo *Confirmation; /* optional element of type d:ConfirmationInfo */ - int __sizeTimestamps; /* sequence of elements */ - struct d__TstInfo *__ptrTimestamps; - struct d__CRLInfo *CRLInfo; /* optional element of type d:CRLInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__SignedDocInfo -#define SOAP_TYPE_d__SignedDocInfo (47) -/* d:SignedDocInfo */ -struct d__SignedDocInfo -{ - char *Format; /* optional element of type xsd:string */ - char *Version; /* optional element of type xsd:string */ - int __sizeOfDataFileInfos; /* sequence of elements */ - struct d__DataFileInfo *__ptrDataFileInfo; - int __sizeOfSignatureInfos; /* sequence of elements */ - struct d__SignatureInfo *__ptrSignatureInfo; -}; -#endif - -#ifndef SOAP_TYPE_d__DataFileData -#define SOAP_TYPE_d__DataFileData (50) -/* d:DataFileData */ -struct d__DataFileData -{ - char *Id; /* optional element of type xsd:string */ - char *Filename; /* optional element of type xsd:string */ - char *MimeType; /* optional element of type xsd:string */ - char *ContentType; /* optional element of type xsd:string */ - char *DigestType; /* optional element of type xsd:string */ - char *DigestValue; /* optional element of type xsd:string */ - long Size; /* required element of type xsd:int */ - int __sizeOfAttributes; /* sequence of elements */ - struct d__DataFileAttribute *__ptrAttributes; - char *DfData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__StartSessionResponse -#define SOAP_TYPE_d__StartSessionResponse (51) -/* d:StartSessionResponse */ -struct d__StartSessionResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - long Sesscode; /* required element of type xsd:int */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__StartSession -#define SOAP_TYPE_d__StartSession (56) -/* d:StartSession */ -struct d__StartSession -{ - char *SigningProfile; /* optional element of type xsd:string */ - char *SigDocXML; /* optional element of type xsd:string */ - bool bHoldSession; /* required element of type xsd:boolean */ - struct d__DataFileData *datafile; /* optional element of type d:DataFileData */ -}; -#endif - -#ifndef SOAP_TYPE_d__CloseSessionResponse -#define SOAP_TYPE_d__CloseSessionResponse (57) -/* d:CloseSessionResponse */ -struct d__CloseSessionResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__CloseSession -#define SOAP_TYPE_d__CloseSession (60) -/* d:CloseSession */ -struct d__CloseSession -{ - long Sesscode; /* required element of type xsd:int */ -}; -#endif - -#ifndef SOAP_TYPE_d__CreateSignedDocResponse -#define SOAP_TYPE_d__CreateSignedDocResponse (61) -/* d:CreateSignedDocResponse */ -struct d__CreateSignedDocResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__CreateSignedDoc -#define SOAP_TYPE_d__CreateSignedDoc (64) -/* d:CreateSignedDoc */ -struct d__CreateSignedDoc -{ - long Sesscode; /* required element of type xsd:int */ - char *Format; /* optional element of type xsd:string */ - char *Version; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__AddDataFileResponse -#define SOAP_TYPE_d__AddDataFileResponse (65) -/* d:AddDataFileResponse */ -struct d__AddDataFileResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__AddDataFile -#define SOAP_TYPE_d__AddDataFile (68) -/* d:AddDataFile */ -struct d__AddDataFile -{ - long Sesscode; /* required element of type xsd:int */ - char *FileName; /* optional element of type xsd:string */ - char *MimeType; /* optional element of type xsd:string */ - char *ContentType; /* optional element of type xsd:string */ - long Size; /* required element of type xsd:int */ - char *DigestType; /* optional element of type xsd:string */ - char *DigestValue; /* optional element of type xsd:string */ - char *Content; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__RemoveDataFileResponse -#define SOAP_TYPE_d__RemoveDataFileResponse (69) -/* d:RemoveDataFileResponse */ -struct d__RemoveDataFileResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__RemoveDataFile -#define SOAP_TYPE_d__RemoveDataFile (72) -/* d:RemoveDataFile */ -struct d__RemoveDataFile -{ - long Sesscode; /* required element of type xsd:int */ - char *DataFileId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignedDocResponse -#define SOAP_TYPE_d__GetSignedDocResponse (73) -/* d:GetSignedDocResponse */ -struct d__GetSignedDocResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *SignedDocData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignedDoc -#define SOAP_TYPE_d__GetSignedDoc (76) -/* d:GetSignedDoc */ -struct d__GetSignedDoc -{ - long Sesscode; /* required element of type xsd:int */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignedDocInfoResponse -#define SOAP_TYPE_d__GetSignedDocInfoResponse (77) -/* d:GetSignedDocInfoResponse */ -struct d__GetSignedDocInfoResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignedDocInfo -#define SOAP_TYPE_d__GetSignedDocInfo (80) -/* d:GetSignedDocInfo */ -struct d__GetSignedDocInfo -{ - long Sesscode; /* required element of type xsd:int */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetDataFileResponse -#define SOAP_TYPE_d__GetDataFileResponse (81) -/* d:GetDataFileResponse */ -struct d__GetDataFileResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__DataFileData *DataFileData; /* optional element of type d:DataFileData */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetDataFile -#define SOAP_TYPE_d__GetDataFile (84) -/* d:GetDataFile */ -struct d__GetDataFile -{ - long Sesscode; /* required element of type xsd:int */ - char *DataFileId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignersCertificateResponse -#define SOAP_TYPE_d__GetSignersCertificateResponse (85) -/* d:GetSignersCertificateResponse */ -struct d__GetSignersCertificateResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *CertificateData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignersCertificate -#define SOAP_TYPE_d__GetSignersCertificate (88) -/* d:GetSignersCertificate */ -struct d__GetSignersCertificate -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetNotarysCertificateResponse -#define SOAP_TYPE_d__GetNotarysCertificateResponse (89) -/* d:GetNotarysCertificateResponse */ -struct d__GetNotarysCertificateResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *CertificateData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetNotarysCertificate -#define SOAP_TYPE_d__GetNotarysCertificate (92) -/* d:GetNotarysCertificate */ -struct d__GetNotarysCertificate -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetNotaryResponse -#define SOAP_TYPE_d__GetNotaryResponse (93) -/* d:GetNotaryResponse */ -struct d__GetNotaryResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *OcspData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetNotary -#define SOAP_TYPE_d__GetNotary (96) -/* d:GetNotary */ -struct d__GetNotary -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetTSACertificateResponse -#define SOAP_TYPE_d__GetTSACertificateResponse (97) -/* d:GetTSACertificateResponse */ -struct d__GetTSACertificateResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *CertificateData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetTSACertificate -#define SOAP_TYPE_d__GetTSACertificate (100) -/* d:GetTSACertificate */ -struct d__GetTSACertificate -{ - long Sesscode; /* required element of type xsd:int */ - char *TimestampId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetTimestampResponse -#define SOAP_TYPE_d__GetTimestampResponse (101) -/* d:GetTimestampResponse */ -struct d__GetTimestampResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *TimestampData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetTimestamp -#define SOAP_TYPE_d__GetTimestamp (104) -/* d:GetTimestamp */ -struct d__GetTimestamp -{ - long Sesscode; /* required element of type xsd:int */ - char *TimestampId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetCRLResponse -#define SOAP_TYPE_d__GetCRLResponse (105) -/* d:GetCRLResponse */ -struct d__GetCRLResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *CRLData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetCRL -#define SOAP_TYPE_d__GetCRL (108) -/* d:GetCRL */ -struct d__GetCRL -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__SignatureModule -#define SOAP_TYPE_d__SignatureModule (109) -/* d:SignatureModule */ -struct d__SignatureModule -{ - char *Name; /* optional element of type xsd:string */ - char *Type; /* optional element of type xsd:string */ - char *Location; /* optional element of type xsd:string */ - char *ContentType; /* optional element of type xsd:string */ - char *Content; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__SignatureModulesArray -#define SOAP_TYPE_d__SignatureModulesArray (110) -/* d:SignatureModulesArray */ -struct d__SignatureModulesArray -{ - int __sizeOfModules; /* sequence of elements */ - struct d__SignatureModule *__ptrModules; -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignatureModulesResponse -#define SOAP_TYPE_d__GetSignatureModulesResponse (112) -/* d:GetSignatureModulesResponse */ -struct d__GetSignatureModulesResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignatureModulesArray *Modules; /* optional element of type d:SignatureModulesArray */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetSignatureModules -#define SOAP_TYPE_d__GetSignatureModules (116) -/* d:GetSignatureModules */ -struct d__GetSignatureModules -{ - long Sesscode; /* required element of type xsd:int */ - char *Platform; /* optional element of type xsd:string */ - char *Phase; /* optional element of type xsd:string */ - char *Type; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__PrepareSignatureResponse -#define SOAP_TYPE_d__PrepareSignatureResponse (117) -/* d:PrepareSignatureResponse */ -struct d__PrepareSignatureResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *SignatureId; /* optional element of type xsd:string */ - char *SignedInfoDigest; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__PrepareSignature -#define SOAP_TYPE_d__PrepareSignature (120) -/* d:PrepareSignature */ -struct d__PrepareSignature -{ - long Sesscode; /* required element of type xsd:int */ - char *SignersCertificate; /* optional element of type xsd:string */ - char *SignersTokenId; /* optional element of type xsd:string */ - char *Role; /* optional element of type xsd:string */ - char *City; /* optional element of type xsd:string */ - char *State; /* optional element of type xsd:string */ - char *PostalCode; /* optional element of type xsd:string */ - char *Country; /* optional element of type xsd:string */ - char *SigningProfile; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__FinalizeSignatureResponse -#define SOAP_TYPE_d__FinalizeSignatureResponse (121) -/* d:FinalizeSignatureResponse */ -struct d__FinalizeSignatureResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__FinalizeSignature -#define SOAP_TYPE_d__FinalizeSignature (124) -/* d:FinalizeSignature */ -struct d__FinalizeSignature -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ - char *SignatureValue; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__RemoveSignatureResponse -#define SOAP_TYPE_d__RemoveSignatureResponse (125) -/* d:RemoveSignatureResponse */ -struct d__RemoveSignatureResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__RemoveSignature -#define SOAP_TYPE_d__RemoveSignature (128) -/* d:RemoveSignature */ -struct d__RemoveSignature -{ - long Sesscode; /* required element of type xsd:int */ - char *SignatureId; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetVersionResponse -#define SOAP_TYPE_d__GetVersionResponse (129) -/* d:GetVersionResponse */ -struct d__GetVersionResponse -{ - char *Name; /* RPC return element */ /* optional element of type xsd:string */ - char *Version; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetVersion -#define SOAP_TYPE_d__GetVersion (132) -/* d:GetVersion */ -struct d__GetVersion -{ - void* __dummy; -}; -#endif - -#ifndef SOAP_TYPE_d__MobileSignResponse -#define SOAP_TYPE_d__MobileSignResponse (133) -/* d:MobileSignResponse */ -struct d__MobileSignResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *StatusCode; /* optional element of type xsd:string */ - char *ChallengeID; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__MobileSign -#define SOAP_TYPE_d__MobileSign (136) -/* d:MobileSign */ -struct d__MobileSign -{ - long Sesscode; /* required element of type xsd:int */ - char *SignerIDCode; /* optional element of type xsd:string */ - char *SignersCountry; /* optional element of type xsd:string */ - char *SignerPhoneNo; /* optional element of type xsd:string */ - char *ServiceName; /* optional element of type xsd:string */ - char *AdditionalDataToBeDisplayed; /* optional element of type xsd:string */ - char *Language; /* optional element of type xsd:string */ - char *Role; /* optional element of type xsd:string */ - char *City; /* optional element of type xsd:string */ - char *StateOrProvince; /* optional element of type xsd:string */ - char *PostalCode; /* optional element of type xsd:string */ - char *CountryName; /* optional element of type xsd:string */ - char *SigningProfile; /* optional element of type xsd:string */ - char *MessagingMode; /* optional element of type xsd:string */ - long AsyncConfiguration; /* required element of type xsd:int */ - bool ReturnDocInfo; /* required element of type xsd:boolean */ - bool ReturnDocData; /* required element of type xsd:boolean */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetStatusInfoResponse -#define SOAP_TYPE_d__GetStatusInfoResponse (137) -/* d:GetStatusInfoResponse */ -struct d__GetStatusInfoResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *StatusCode; /* optional element of type xsd:string */ - struct d__SignedDocInfo *SignedDocInfo; /* optional element of type d:SignedDocInfo */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetStatusInfo -#define SOAP_TYPE_d__GetStatusInfo (140) -/* d:GetStatusInfo */ -struct d__GetStatusInfo -{ - long Sesscode; /* required element of type xsd:int */ - bool ReturnDocInfo; /* required element of type xsd:boolean */ - bool WaitSignature; /* required element of type xsd:boolean */ -}; -#endif - -#ifndef SOAP_TYPE_d__MobileAuthenticateResponse -#define SOAP_TYPE_d__MobileAuthenticateResponse (141) -/* d:MobileAuthenticateResponse */ -struct d__MobileAuthenticateResponse -{ - long Sesscode; /* RPC return element */ /* required element of type xsd:int */ - char *Status; /* optional element of type xsd:string */ - char *UserIDCode; /* optional element of type xsd:string */ - char *UserGivenname; /* optional element of type xsd:string */ - char *UserSurname; /* optional element of type xsd:string */ - char *UserCountry; /* optional element of type xsd:string */ - char *UserCN; /* optional element of type xsd:string */ - char *CertificateData; /* optional element of type xsd:string */ - char *ChallengeID; /* optional element of type xsd:string */ - char *Challenge; /* optional element of type xsd:string */ - char *RevocationData; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__MobileAuthenticate -#define SOAP_TYPE_d__MobileAuthenticate (144) -/* d:MobileAuthenticate */ -struct d__MobileAuthenticate -{ - char *IDCode; /* optional element of type xsd:string */ - char *CountryCode; /* optional element of type xsd:string */ - char *PhoneNo; /* optional element of type xsd:string */ - char *Language; /* optional element of type xsd:string */ - char *ServiceName; /* optional element of type xsd:string */ - char *MessageToDisplay; /* optional element of type xsd:string */ - char *SPChallenge; /* optional element of type xsd:string */ - char *MessagingMode; /* optional element of type xsd:string */ - long AsyncConfiguration; /* required element of type xsd:int */ - bool ReturnCertData; /* required element of type xsd:boolean */ - bool ReturnRevocationData; /* required element of type xsd:boolean */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetMobileAuthenticateStatusResponse -#define SOAP_TYPE_d__GetMobileAuthenticateStatusResponse (145) -/* d:GetMobileAuthenticateStatusResponse */ -struct d__GetMobileAuthenticateStatusResponse -{ - char *Status; /* RPC return element */ /* optional element of type xsd:string */ - char *Signature; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetMobileAuthenticateStatus -#define SOAP_TYPE_d__GetMobileAuthenticateStatus (148) -/* d:GetMobileAuthenticateStatus */ -struct d__GetMobileAuthenticateStatus -{ - long Sesscode; /* required element of type xsd:int */ - bool WaitSignature; /* required element of type xsd:boolean */ -}; -#endif - -#ifndef SOAP_TYPE_d__DataFileDigest -#define SOAP_TYPE_d__DataFileDigest (149) -/* d:DataFileDigest */ -struct d__DataFileDigest -{ - char *Id; /* optional element of type xsd:string */ - char *DigestType; /* optional element of type xsd:string */ - char *DigestValue; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__DataFileDigestList -#define SOAP_TYPE_d__DataFileDigestList (150) -/* d:DataFileDigestList */ -struct d__DataFileDigestList -{ - int __sizeOfDataFileDigests; /* sequence of elements */ - struct d__DataFileDigest *__ptrDataFileDigest; -}; -#endif - -#ifndef SOAP_TYPE_d__MobileCreateSignatureResponse -#define SOAP_TYPE_d__MobileCreateSignatureResponse (152) -/* d:MobileCreateSignatureResponse */ -struct d__MobileCreateSignatureResponse -{ - long Sesscode; /* RPC return element */ /* required element of type xsd:int */ - char *ChallengeID; /* optional element of type xsd:string */ - char *Status; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__MobileCreateSignature -#define SOAP_TYPE_d__MobileCreateSignature (156) -/* d:MobileCreateSignature */ -struct d__MobileCreateSignature -{ - char *IDCode; /* optional element of type xsd:string */ - char *SignersCountry; /* optional element of type xsd:string */ - char *PhoneNo; /* optional element of type xsd:string */ - char *Language; /* optional element of type xsd:string */ - char *ServiceName; /* optional element of type xsd:string */ - char *MessageToDisplay; /* optional element of type xsd:string */ - char *Role; /* optional element of type xsd:string */ - char *City; /* optional element of type xsd:string */ - char *StateOrProvince; /* optional element of type xsd:string */ - char *PostalCode; /* optional element of type xsd:string */ - char *CountryName; /* optional element of type xsd:string */ - char *SigningProfile; /* optional element of type xsd:string */ - struct d__DataFileDigestList *DataFiles; /* optional element of type d:DataFileDigestList */ - char *Format; /* optional element of type xsd:string */ - char *Version; /* optional element of type xsd:string */ - char *SignatureID; /* optional element of type xsd:string */ - char *MessagingMode; /* optional element of type xsd:string */ - long AsyncConfiguration; /* required element of type xsd:int */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse -#define SOAP_TYPE_d__GetMobileCreateSignatureStatusResponse (157) -/* d:GetMobileCreateSignatureStatusResponse */ -struct d__GetMobileCreateSignatureStatusResponse -{ - long Sesscode; /* RPC return element */ /* required element of type xsd:int */ - char *Status; /* optional element of type xsd:string */ - char *Signature; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_d__GetMobileCreateSignatureStatus -#define SOAP_TYPE_d__GetMobileCreateSignatureStatus (160) -/* d:GetMobileCreateSignatureStatus */ -struct d__GetMobileCreateSignatureStatus -{ - long Sesscode; /* required element of type xsd:int */ - bool WaitSignature; /* required element of type xsd:boolean */ -}; -#endif - -#ifndef SOAP_TYPE_mss_DummyResp -#define SOAP_TYPE_mss_DummyResp (161) -/* mss-DummyResp */ -struct mss_DummyResp -{ - char *str; /* RPC return element */ /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_mss__MSS_USCORESignatureDummy -#define SOAP_TYPE_mss__MSS_USCORESignatureDummy (164) -/* mss:MSS_SignatureDummy */ -struct mss__MSS_USCORESignatureDummy -{ - void* _dummy; -}; -#endif - -#ifndef SOAP_TYPE_SOAP_ENV__Header -#define SOAP_TYPE_SOAP_ENV__Header (167) -/* SOAP Header: */ -struct SOAP_ENV__Header -{ - void *dummy; /* transient */ -}; -#endif - -#ifndef SOAP_TYPE_SOAP_ENV__Code -#define SOAP_TYPE_SOAP_ENV__Code (168) -/* SOAP Fault Code: */ -struct SOAP_ENV__Code -{ - char *SOAP_ENV__Value; /* optional element of type xsd:QName */ - struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ -}; -#endif - -#ifndef SOAP_TYPE_SOAP_ENV__Detail -#define SOAP_TYPE_SOAP_ENV__Detail (170) -/* SOAP-ENV:Detail */ -struct SOAP_ENV__Detail -{ - int __type; /* any type of element (defined below) */ - void *fault; /* transient */ - char *__any; -}; -#endif - -#ifndef SOAP_TYPE_SOAP_ENV__Reason -#define SOAP_TYPE_SOAP_ENV__Reason (171) -/* SOAP-ENV:Reason */ -struct SOAP_ENV__Reason -{ - char *SOAP_ENV__Text; /* optional element of type xsd:string */ -}; -#endif - -#ifndef SOAP_TYPE_SOAP_ENV__Fault -#define SOAP_TYPE_SOAP_ENV__Fault (172) -/* SOAP Fault: */ -struct SOAP_ENV__Fault -{ - char *faultcode; /* optional element of type xsd:QName */ - char *faultstring; /* optional element of type xsd:string */ - char *faultactor; /* optional element of type xsd:string */ - struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */ - struct SOAP_ENV__Code *SOAP_ENV__Code; /* optional element of type SOAP-ENV:Code */ - struct SOAP_ENV__Reason *SOAP_ENV__Reason; /* optional element of type SOAP-ENV:Reason */ - char *SOAP_ENV__Node; /* optional element of type xsd:string */ - char *SOAP_ENV__Role; /* optional element of type xsd:string */ - struct SOAP_ENV__Detail *SOAP_ENV__Detail; /* optional element of type SOAP-ENV:Detail */ -}; -#endif - -/******************************************************************************\ - * * - * Types with Custom Serializers * - * * -\******************************************************************************/ - - -/******************************************************************************\ - * * - * Typedefs * - * * -\******************************************************************************/ - -#ifndef SOAP_TYPE__XML -#define SOAP_TYPE__XML (4) -typedef char *_XML; -#endif - -#ifndef SOAP_TYPE__QName -#define SOAP_TYPE__QName (5) -typedef char *_QName; -#endif - -#ifndef SOAP_TYPE_xsd__string -#define SOAP_TYPE_xsd__string (6) -typedef char *xsd__string; -#endif - -#ifndef SOAP_TYPE_xsd__anyURI -#define SOAP_TYPE_xsd__anyURI (7) -typedef char *xsd__anyURI; -#endif - -#ifndef SOAP_TYPE_xsd__float -#define SOAP_TYPE_xsd__float (9) -typedef float xsd__float; -#endif - -#ifndef SOAP_TYPE_xsd__int -#define SOAP_TYPE_xsd__int (11) -typedef long xsd__int; -#endif - -#ifndef SOAP_TYPE_xsd__boolean -#define SOAP_TYPE_xsd__boolean (13) -typedef bool xsd__boolean; -#endif - -#ifndef SOAP_TYPE_xsd__positiveInteger -#define SOAP_TYPE_xsd__positiveInteger (17) -typedef ULONG64 xsd__positiveInteger; -#endif - -#ifndef SOAP_TYPE_XML -#define SOAP_TYPE_XML (18) -typedef char *XML; -#endif - -#ifndef SOAP_TYPE_xsd__dateTime -#define SOAP_TYPE_xsd__dateTime (19) -typedef char *xsd__dateTime; -#endif - - -/******************************************************************************\ - * * - * Typedef Synonyms * - * * -\******************************************************************************/ - - -/******************************************************************************\ - * * - * Externals * - * * -\******************************************************************************/ - - -/******************************************************************************\ - * * - * Stubs * - * * -\******************************************************************************/ - - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__StartSession(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *SigningProfile, char *SigDocXML, bool bHoldSession, struct d__DataFileData *datafile, struct d__StartSessionResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__CloseSession(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__CloseSessionResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__CreateSignedDoc(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *Format, char *Version, struct d__CreateSignedDocResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__AddDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *FileName, char *MimeType, char *ContentType, long Size, char *DigestType, char *DigestValue, char *Content, struct d__AddDataFileResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__RemoveDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *DataFileId, struct d__RemoveDataFileResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignedDoc(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__GetSignedDocResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignedDocInfo(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, struct d__GetSignedDocInfoResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetDataFile(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *DataFileId, struct d__GetDataFileResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignersCertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetSignersCertificateResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetNotarysCertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetNotarysCertificateResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetNotary(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetNotaryResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetTSACertificate(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *TimestampId, struct d__GetTSACertificateResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetTimestamp(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *TimestampId, struct d__GetTimestampResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetCRL(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__GetCRLResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetSignatureModules(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *Platform, char *Phase, char *Type, struct d__GetSignatureModulesResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__PrepareSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignersCertificate, char *SignersTokenId, char *Role, char *City, char *State, char *PostalCode, char *Country, char *SigningProfile, struct d__PrepareSignatureResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__FinalizeSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, char *SignatureValue, struct d__FinalizeSignatureResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__RemoveSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignatureId, struct d__RemoveSignatureResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetVersion(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct d__GetVersionResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileSign(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, char *SignerIDCode, char *SignersCountry, char *SignerPhoneNo, char *ServiceName, char *AdditionalDataToBeDisplayed, char *Language, char *Role, char *City, char *StateOrProvince, char *PostalCode, char *CountryName, char *SigningProfile, char *MessagingMode, long AsyncConfiguration, bool ReturnDocInfo, bool ReturnDocData, struct d__MobileSignResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetStatusInfo(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool ReturnDocInfo, bool WaitSignature, struct d__GetStatusInfoResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileAuthenticate(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *IDCode, char *CountryCode, char *PhoneNo, char *Language, char *ServiceName, char *MessageToDisplay, char *SPChallenge, char *MessagingMode, long AsyncConfiguration, bool ReturnCertData, bool ReturnRevocationData, struct d__MobileAuthenticateResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetMobileAuthenticateStatus(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool WaitSignature, struct d__GetMobileAuthenticateStatusResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__MobileCreateSignature(struct soap *soap, const char *soap_endpoint, const char *soap_action, char *IDCode, char *SignersCountry, char *PhoneNo, char *Language, char *ServiceName, char *MessageToDisplay, char *Role, char *City, char *StateOrProvince, char *PostalCode, char *CountryName, char *SigningProfile, struct d__DataFileDigestList *DataFiles, char *Format, char *Version, char *SignatureID, char *MessagingMode, long AsyncConfiguration, struct d__MobileCreateSignatureResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_d__GetMobileCreateSignatureStatus(struct soap *soap, const char *soap_endpoint, const char *soap_action, long Sesscode, bool WaitSignature, struct d__GetMobileCreateSignatureStatusResponse *result); - -SOAP_FMAC5 int SOAP_FMAC6 soap_call_mss__MSS_USCORESignatureDummy(struct soap *soap, const char *soap_endpoint, const char *soap_action, struct mss_DummyResp *resp); - -#ifdef __cplusplus -} -#endif - -#endif - -/* End of ddsStub.h */ diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/ddsdoc.c libdigidoc-3.7.0.875/DigiDocServiceClient/ddsdoc.c --- libdigidoc-2.7.0/DigiDocServiceClient/ddsdoc.c 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/ddsdoc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1318 +0,0 @@ -//================================================== -// FILE: ddsdoc.c -// PROJECT: DigiDocService -// DESCRIPTION: Utility program to demonstrate the -// functionality of DDS webservice client lib -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 14.01.2006 Veiko Sinivee -// Creation -//================================================== - - -#include "DigiDocDds.h" -#include "ddsStub.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include -#include -#include - -//==========< global constants >==================== - -// programm arguments -char* p_szConfigFile = 0; -int g_cgiMode = 0; // 1=output in CGI mode, 0=normal e.g. human readable mode -char* g_szOutputSeparator = 0; -char *errorClass[] = {"NO_ERRORS", "TECHNICAL", "USER", "LIBRARY"}; -char* g_szProgNameVer = "ddsdoc/2.2.4"; - -DDS* g_pDds = 0; -unsigned long g_lSessCode = 0; - -//==========< helper functiosn for argument handling >==================== - - -//-------------------------------------------------- -// Handles one argument -//-------------------------------------------------- -int checkArguments(int argc, char** argv, int* pCounter, char** dest) -{ - int nLen = 0; - - if(argc > (*pCounter)+1 && argv[(*pCounter)+1][0] != '-') { - nLen = strlen(argv[(*pCounter)+1]) * 2; - ddocConvertInput((const char*)argv[(*pCounter)+1], dest); - (*pCounter)++; - } - return nLen; -} - -//-------------------------------------------------- -// checks the existence of one command line argument -//-------------------------------------------------- -int hasCmdLineArg(int argc, char** argv, const char* argName) -{ - int i; - - for(i = 1; i < argc; i++) { - if(argv[i] != NULL && argv[i][0] == '-' && - !strcmp(argv[i], argName)) { - return i; - } - } - return 0; -} - -//-------------------------------------------------- -// Returns the value of one command line argument -//-------------------------------------------------- -int checkCmdLineArg(int argc, char** argv, const char* argName, char** dest) -{ - int i; - - *dest = 0; // mark as not found - for(i = 1; i < argc; i++) { - if(argv[i] != NULL && argv[i][0] == '-' && - !strcmp(argv[i], argName)) { - if((i + 1 < argc) && (argv[i+1][0] != '-')) { - ddocConvertInput((const char*)argv[i+1], dest); - return 0; - } - else - return ERR_BAD_PARAM; - } - } - return 0; // not found but no error -} - -//-------------------------------------------------- -// prints usage statement -//-------------------------------------------------- -void printUsage() -{ - fprintf(stderr, "USAGE: ddsdoc [-config ]\n"); - fprintf(stderr, "COMMANDS:\n"); - fprintf(stderr, "\t[-sesscode ]\n"); - fprintf(stderr, "\t-start-digidoc \n"); - fprintf(stderr, "\t-start-file \n"); - fprintf(stderr, "\t-start\n"); - fprintf(stderr, "\t-close\n"); - fprintf(stderr, "\t-create-ddoc \n"); - fprintf(stderr, "\t-add-datafile \n"); - fprintf(stderr, "\t-del-datafile \n"); - fprintf(stderr, "\t-get-datafile \n"); - fprintf(stderr, "\t-get-ddoc \n"); - fprintf(stderr, "\t-get-info\n"); - fprintf(stderr, "\t-get-signer-cert \n"); - fprintf(stderr, "\t-get-notary-cert \n"); - fprintf(stderr, "\t-get-notary \n"); - fprintf(stderr, "\t-mssp-sign-cntr [] [] [] [ ]\n"); - fprintf(stderr, "\t-mssp-sign-phone [] [] [] [ ]\n"); - fprintf(stderr, "\t-mssp-auth-cntr [] [] []\n"); - fprintf(stderr, "\t-mssp-auth-phone [] [] []\n"); - fprintf(stderr, "\t-mssp-sign2-cntr [] [] [ ]\n"); - fprintf(stderr, "\t-mssp-sign2-phone [] [] [ ]\n"); -} - -//-------------------------------------------------- -// Checks program runtime arguments -//-------------------------------------------------- -int checkProgArguments(int argc, char** argv) -{ - int err = ERR_OK; - - // -?, -help -> print usage - if(!err && hasCmdLineArg(argc, argv, "-?") || - hasCmdLineArg(argc, argv, "-help")) - printUsage(); - // -config - if(!err) - if((err = checkCmdLineArg(argc, argv, "-config", &p_szConfigFile)) != ERR_OK) - addError(err, __FILE__, __LINE__, "Missing or invalid configuration file name"); - // -CGI -> use CGI output mode - if(!err) - if((err = checkCmdLineArg(argc, argv, "-cgimode", &g_szOutputSeparator)) != ERR_OK) - addError(err, __FILE__, __LINE__, "Missing or invalid cgi output separator"); - g_cgiMode = 1; - if(!g_szOutputSeparator || !g_szOutputSeparator[0] || err) { - g_szOutputSeparator = strdup("|"); - err = ERR_OK; - } - return err; -} - -//-------------------------------------------------- -// reads various statusflags from config file -//-------------------------------------------------- -void readConfigParams() -{ - int n = 0; - const char* s = 0; - - // check if we are in CGI mode - n = ConfigItem_lookup_bool("DIGIDOC_CGI_MODE", 0); - if(!g_cgiMode && n) - g_cgiMode = n; - s = ConfigItem_lookup("DIGIDOC_CGI_SEPARATOR"); - if(!g_szOutputSeparator && s) - g_szOutputSeparator = (char*)s; -} - -//==========< display output >===================== - -void displayStatus(const char* funcName) -{ - if(g_cgiMode) - fprintf(stdout, "\n%s%s%ld%s%s%s%s%s%d%s%s%s%s%s%s", funcName, - g_szOutputSeparator, g_pDds->lDdsSesscode, - g_szOutputSeparator, (g_pDds->szStatus ? g_pDds->szStatus : ""), - g_szOutputSeparator, (g_pDds->szStatusCode ? g_pDds->szStatusCode : ""), - g_szOutputSeparator, g_pDds->err, - g_szOutputSeparator, (g_pDds->szSoapFaultCode ? g_pDds->szSoapFaultCode : ""), - g_szOutputSeparator, (g_pDds->szSoapFaultString ? g_pDds->szSoapFaultString : ""), - g_szOutputSeparator, (g_pDds->szSoapFaultDetail ? g_pDds->szSoapFaultDetail : "")); - else - fprintf(stdout, "\n%s session: %ld status: %s status-code: %s rc: %d fault-code: %s fault-string: fault-detail: %s", funcName, - g_pDds->lDdsSesscode, g_pDds->szStatus, g_pDds->szStatusCode, g_pDds->err, - (g_pDds->szSoapFaultCode ? g_pDds->szSoapFaultCode : ""), - (g_pDds->szSoapFaultString ? g_pDds->szSoapFaultString : ""), - (g_pDds->szSoapFaultDetail ? g_pDds->szSoapFaultDetail : "")); - -} - -void displayStringItem(const char* name, const char* value) -{ - if(value) { - if(g_cgiMode) - fprintf(stdout, "%s%s", g_szOutputSeparator, value); - else - fprintf(stdout, " %s: %s", name, value); - } -} - -void displayIntItem(const char* name, int value) -{ - if(g_cgiMode) - fprintf(stdout, "%s%d", g_szOutputSeparator, value); - else - fprintf(stdout, " %s: %d", name, value); -} - -void displayDataFileAttribute(struct d__DataFileAtribute* pAttr) -{ - if(pAttr) { - fprintf(stdout, "\n\t\tATTRIBUTE"); - displayStringItem(pAttr->name, pAttr->value); - } -} - -void displayDataFile(struct d__DataFileInfo* pDf) -{ - int i; - if(pDf) { - fprintf(stdout, "\n\tDATAFILE"); - displayStringItem("Id", pDf->Id); - displayStringItem("Filename", pDf->Filename); - displayStringItem("MimeType", pDf->MimeType); - displayStringItem("ContentType", pDf->ContentType); - displayStringItem("DigestType", pDf->DigestType); - displayStringItem("DigestValue", pDf->DigestValue); - displayIntItem("Size", pDf->Size); - for(i = 0; (pDf->__ptrAtributes) && (i < pDf->__sizeOfAtributes); i++) - displayDataFileAttribute(pDf->__ptrAtributes + i); - } -} - -void displaySignatureError(struct d__Error* pErr) -{ - if(pErr) { - fprintf(stdout, "\n\t\tERROR"); - displayIntItem("code", pErr->code); - displayStringItem("category", pErr->category); - displayStringItem("Filename", pErr->description); - } -} - -void displayRole(struct d__SignerRole* pRole) -{ - if(pRole) { - fprintf(stdout, "\n\t\tROLE"); - displayIntItem("certified", pRole->certified); - displayStringItem("Role", pRole->Role); - } -} - -void displaySignatureProductionPlace(struct d__SignatureProductionPlace* pAdr) -{ - if(pAdr) { - fprintf(stdout, "\n\t\tADR"); - displayStringItem("City", pAdr->City); - displayStringItem("StateOrProvince", pAdr->StateOrProvince); - displayStringItem("PostalCode", pAdr->PostalCode); - displayStringItem("CountryName", pAdr->CountryName); - } -} - -void displayCertPolicy(struct d__CertificatePolicy* pPol) -{ - if(pPol) { - fprintf(stdout, "\n\t\t\t\tCERT-POLICY"); - displayStringItem("OID", pPol->OID); - displayStringItem("URL", pPol->URL); - displayStringItem("Description", pPol->Description); - } -} - -void displayCertificateInfo(struct d__CertificateInfo* pCert) -{ - int i; - if(pCert) { - fprintf(stdout, "\n\t\t\tCERTIFICATE"); - displayStringItem("Issuer", pCert->Issuer); - displayStringItem("Subject", pCert->Subject); - displayStringItem("ValidFrom", pCert->ValidFrom); - displayStringItem("ValidTo", pCert->ValidTo); - displayStringItem("IssuerSerial", pCert->IssuerSerial); - for(i = 0; (pCert->__ptrPolicies) && (i < pCert->__sizePolicies); i++) - displayCertPolicy(pCert->__ptrPolicies + i); - } -} - -void displaySignerInfo(struct d__SignerInfo* pSigner) -{ - if(pSigner) { - fprintf(stdout, "\n\t\t\tSIGNER"); - displayStringItem("CommonName", pSigner->CommonName); - displayStringItem("IDCode", pSigner->IDCode); - displayCertificateInfo(pSigner->Certificate); - } -} - -void displayConfirmationInfo(struct d__ConfirmationInfo* pNot) -{ - if(pNot) { - fprintf(stdout, "\n\t\t\tCONFIRMATION"); - displayStringItem("ResponderID", pNot->ResponderID); - displayStringItem("ProducedAt", pNot->ProducedAt); - displayCertificateInfo(pNot->ResponderCertificate); - } -} - -void displaySignatureInfo(struct d__SignatureInfo* pSig) -{ - int i; - if(pSig) { - fprintf(stdout, "\n\tSIGNATURE"); - displayStringItem("Id", pSig->Id); - displayStringItem("Status", pSig->Status); - displaySignatureError(pSig->Error); - displayStringItem("SigningTime", pSig->SigningTime); - for(i = 0; (pSig->__ptrSignerRole) && (i < pSig->__sizeRoles); i++) - displayRole(pSig->__ptrSignerRole + i); - displaySignatureProductionPlace(pSig->SignatureProductionPlace); - displaySignerInfo(pSig->Signer); - displayConfirmationInfo(pSig->Confirmation); - } -} - - -void displaySignedDoc() -{ - int i; - - if(g_pDds && g_pDds->pSigDocInfo) { - fprintf(stdout, "\nDIGIDOC"); - displayStringItem("format", g_pDds->pSigDocInfo->format); - displayStringItem("version", g_pDds->pSigDocInfo->version); - for(i = 0; (g_pDds->pSigDocInfo->__ptrDataFileInfo) && - (i < g_pDds->pSigDocInfo->__sizeOfDataFileInfos); i++) { - displayDataFile(g_pDds->pSigDocInfo->__ptrDataFileInfo + i); - } - for(i = 0; (g_pDds->pSigDocInfo->__ptrSignatureInfo) && - (i < g_pDds->pSigDocInfo->__sizeOfSignatureInfos); i++) { - displaySignatureInfo(g_pDds->pSigDocInfo->__ptrSignatureInfo + i); - } - } -} - - -//==========< command handlers >==================== - - -//-------------------------------------------------- -// start session by sending a digidoc file to server -//-------------------------------------------------- -int runSessioncodeCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-sesscode")) { - if(argc > i+1 && argv[i+1][0] != '-') { - g_lSessCode = atol(argv[i+1]); - g_pDds->lDdsSesscode = g_lSessCode; - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -sesscode command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// start session by sending a digidoc file to server -//-------------------------------------------------- -int runStartSessionWithDigidocCmds(int argc, char** argv) -{ - int err = ERR_OK, i, bHoldSession = 1; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-start-digidoc")) { - if(argc > i+1 && argv[i+1][0] != '-') { - char* file = NULL; - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsStartSession(g_pDds, bHoldSession, 0, file, 0, 0, 0, 0); - // report success - displayStatus("START-DIGIDC"); - displaySignedDoc(); - // cleanup - if(file) free(file); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -start-digidoc command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// start session by sending a digidoc file to server -//-------------------------------------------------- -int runStartSessionWithFileCmds(int argc, char** argv) -{ - int err = ERR_OK, i, bHoldSession = 1; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-start-file")) { - if(argc > i+1 && argv[i+1][0] != '-') { - char* file = NULL; - char* mime = NULL; - char* content = NULL; - checkArguments(argc, argv, &i, &file); - checkArguments(argc, argv, &i, &mime); - checkArguments(argc, argv, &i, &content); - // send SOAP command - err = ddocDdsStartSession(g_pDds, bHoldSession, 0, 0, file, mime, content, 0); - // report success - displayStatus("START-FILE"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(mime) free(mime); - if(content) free(content); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -start-file command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// start session -//-------------------------------------------------- -int runStartSessionCmds(int argc, char** argv) -{ - int err = ERR_OK, i, bHoldSession = 1; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-start")) { - // send SOAP command - err = ddocDdsStartSession(g_pDds, bHoldSession, 0, 0, 0, 0, 0, 0); - // report success - displayStatus("START"); - displaySignedDoc(); - } - } - } - return err; -} - -//-------------------------------------------------- -// close session -//-------------------------------------------------- -int runCloseSessionCmds(int argc, char** argv) -{ - int err = ERR_OK, i, bHoldSession = 1; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-close")) { - // send SOAP command - err = ddocDdsCloseSession(g_pDds); - // report success - displayStatus("CLOSE"); - } - } - } - return err; -} - - -//-------------------------------------------------- -// create a new signed doc on server -//-------------------------------------------------- -int runCreateSignedDocCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-create-ddoc")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* format = NULL; - char* version = NULL; - checkArguments(argc, argv, &i, &format); - checkArguments(argc, argv, &i, &version); - // send SOAP command - err = ddocDdsCreateSignedDoc(g_pDds, format, version); - // report success - displayStatus("CREATE-DDOC"); - displaySignedDoc(); - // cleanup - if(format) free(format); - if(version) free(version); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing or argument of -create-ddoc command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// add a new datafile -//-------------------------------------------------- -int runAddDataFileCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-add-datafile")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* file = NULL; - char* mime = NULL; - char* content = NULL; - checkArguments(argc, argv, &i, &file); - checkArguments(argc, argv, &i, &mime); - checkArguments(argc, argv, &i, &content); - // send SOAP command - err = ddocDdsAddDataFile(g_pDds, file, mime, content); - // report success - displayStatus("ADD-DF"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(mime) free(mime); - if(content) free(content); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing , or argument of -add-datafile command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// remove a datafile -//-------------------------------------------------- -int runRemoveDataFileCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - // add a DataFile - if(!strcmp(argv[i], "-del-datafile")) { - if(argc > i+1 && argv[i+1][0] != '-') { - char* id = NULL; - checkArguments(argc, argv, &i, &id); - // send SOAP command - err = ddocDdsRemoveDataFile(g_pDds, id); - // report success - displayStatus("DEL-DF"); - displaySignedDoc(); - // cleanup - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -del-datafile command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// retrieve a digidoc from server -//-------------------------------------------------- -int runGetDdocCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-get-ddoc")) { - if(argc > i+1 && argv[i+1][0] != '-') { - char* file = NULL; - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsGetSignedDoc(g_pDds, file); - // report success - displayStatus("GET-DDOC"); - displaySignedDoc(); - // cleanup - if(file) free(file); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -get-ddoc command"); - } - } - } - } - return err; -} - - -//-------------------------------------------------- -// display current session digidoc info -//-------------------------------------------------- -int runInfoCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-info")) { - // send SOAP command - err = ddocDdsGetSignedDocInfo(g_pDds); - // report success - displayStatus("GET-DDOC"); - displaySignedDoc(); - } - } - } - return err; -} - -//-------------------------------------------------- -// get datafile -//-------------------------------------------------- -int runGetDataFileCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-get-datafile")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* file = NULL; - char* id = NULL; - checkArguments(argc, argv, &i, &id); - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsGetDataFile(g_pDds, id, file); - // report success - displayStatus("GET-DF"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing or argument of -get-datafile command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// get signers certificate -//-------------------------------------------------- -int runGetSignerCertCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-get-signer-cert")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* file = NULL; - char* id = NULL; - checkArguments(argc, argv, &i, &id); - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsGetSignersCertificate(g_pDds, id, file); - // report success - displayStatus("GET-SIGNER-CERT"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing or argument of -get-signer-cert command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// get notarys certificate -//-------------------------------------------------- -int runGetNotaryCertCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-get-notary-cert")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* file = NULL; - char* id = NULL; - checkArguments(argc, argv, &i, &id); - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsGetNotarysCertificate(g_pDds, id, file); - // report success - displayStatus("GET-NOTARY-CERT"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing or argument of -get-notary-cert command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// get notarys OCSP confirmation -//-------------------------------------------------- -int runGetNotaryCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-get-notary")) { - if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* file = NULL; - char* id = NULL; - checkArguments(argc, argv, &i, &id); - checkArguments(argc, argv, &i, &file); - // send SOAP command - err = ddocDdsGetNotary(g_pDds, id, file); - // report success - displayStatus("GET-NOTARY"); - displaySignedDoc(); - // cleanup - if(file) free(file); - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing or argument of -get-notary command"); - } - } - } - } - return err; -} - - -// TODO: prepare & finalize - - -//-------------------------------------------------- -// removes a signature -//-------------------------------------------------- -int runRemoveSignatureCmds(int argc, char** argv) -{ - int err = ERR_OK, i; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-del-sig")) { - if(argc > i+1 && argv[i+1][0] != '-') { - char* id = NULL; - checkArguments(argc, argv, &i, &id); - // send SOAP command - err = ddocDdsRemoveSignature(g_pDds, id); - // report success - displayStatus("DEL-SIG"); - displaySignedDoc(); - // cleanup - if(id) free(id); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing argument of -del-sig command"); - } - } - } - } - return err; -} - -//-------------------------------------------------- -// signs via MSSP -//-------------------------------------------------- -int runMobileSignatureCmds(int argc, char** argv) -{ - int err = ERR_OK, i, nPollFreq; -#ifdef WIN32 - time_t tNew, tOld; -#endif - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-mssp-sign-cntr") || - !strcmp(argv[i], "-mssp-sign-phone")) { - char* idcode = NULL; - char* cntrcd = NULL; - char* phone = NULL; - char* datatodisp = NULL; - char* lang = NULL; - char* role = NULL; - char* ddocfile = NULL; - char* city = NULL; - char* state = NULL; - char* zip = NULL; - char* country = NULL; - if(!strcmp(argv[i], "-mssp-sign-cntr")) { - checkArguments(argc, argv, &i, &idcode); - checkArguments(argc, argv, &i, &cntrcd); - } - if(!strcmp(argv[i], "-mssp-sign-phone")) { - checkArguments(argc, argv, &i, &phone); - } - checkArguments(argc, argv, &i, &datatodisp); - checkArguments(argc, argv, &i, &lang); - checkArguments(argc, argv, &i, &ddocfile); - checkArguments(argc, argv, &i, &role); - checkArguments(argc, argv, &i, &city); - checkArguments(argc, argv, &i, &state); - checkArguments(argc, argv, &i, &zip); - checkArguments(argc, argv, &i, &country); - if(((idcode && cntrcd) || phone) && datatodisp) { - // send SOAP command - err = ddocDdsMobileSign(g_pDds, idcode, cntrcd, phone, datatodisp, - lang, role, city, state, zip, country, - 0, "asynchClientServer", NULL, NULL, - 0, 0, ddocfile); - // report success - displayStatus("MSSP-SIG"); - //displaySignedDoc(); - - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing , or argument of -mssp-sign command"); - } - // cleanup - if(idcode) free(idcode); - if(phone) free(phone); - if(datatodisp) free(datatodisp); - if(lang) free(lang); - if(role) free(role); - if(ddocfile) free(ddocfile); - if(city) free(city); - if(state) free(state); - if(zip) free(zip); - if(country) free(country); - if(cntrcd) free(cntrcd); - if(err) return err; - // poll for signature complete, cancel or error status - nPollFreq = ConfigItem_lookup_int("DIGIDOC_MSSP_STATUS_POLL_FREQ", 10); - do { -#ifdef WIN32 - time(&tOld); - do { - time(&tNew); - } while(tNew - tOld < nPollFreq); -#else - sleep(nPollFreq); -#endif - err = ddocDdsGetStatusInfo(g_pDds, 0); - // report success - displayStatus("MSSP-SIG"); - } while(!err && - (!g_pDds->szStatusCode || - !strcmp(g_pDds->szStatusCode, REQUEST_OK_CODE) || - !strcmp(g_pDds->szStatusCode, OUTSTANDING_TRANSACTION_CODE))); - printf("MSSP signature finished rc: %d status: %s", err, g_pDds->szStatus); - } - } - } - return err; -} - - -//-------------------------------------------------- -// signs via MSSP -//-------------------------------------------------- -int runMobileSignature2Cmds(int argc, char** argv) -{ - int err = ERR_OK, i, nPollFreq, l1; - SignedDoc* pSigDoc = 0; - DataFile *pDf = 0; -#ifdef WIN32 - time_t tNew, tOld; -#endif - char buf1[300]; - - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-mssp-sign2-cntr") || - !strcmp(argv[i], "-mssp-sign2-phone")) { - char* file = NULL; - char* mime = NULL; - char* digidoc = NULL; - char* idcode = NULL; - char* cntrcd = NULL; - char* phone = NULL; - char* datatodisp = NULL; - char* lang = NULL; - char* role = NULL; - char* city = NULL; - char* state = NULL; - char* zip = NULL; - char* country = NULL; - char* p = NULL; - // create digidoc file in bas64 format - checkArguments(argc, argv, &i, &file); - checkArguments(argc, argv, &i, &mime); - checkArguments(argc, argv, &i, &digidoc); - err = SignedDoc_new(&pSigDoc, NULL, NULL); //DIGIDOC_XML_1_1_NAME, DIGIDOC_XML_1_3_VER); - err = ddocConvertInput(file, &p); - l1 = sizeof(buf1); - getFullFileName(p, buf1, l1); - if(p) - free(p); - err = DataFile_new(&pDf, pSigDoc, NULL, buf1, - CONTENT_EMBEDDED_BASE64, mime, - 0, NULL, 0, NULL, CHARSET_UTF_8); - if(!err) - err = calculateDataFileSizeAndDigest(pSigDoc, pDf->szId, buf1, DIGEST_SHA1); - err = createSignedDoc(pSigDoc, NULL, digidoc); - print("Created digidoc: %s from input: %s mime: %s", digidoc, file, mime); - // start signing - if(!strcmp(argv[i], "-mssp-sign2-cntr")) { - checkArguments(argc, argv, &i, &idcode); - checkArguments(argc, argv, &i, &cntrcd); - } - if(!strcmp(argv[i], "-mssp-sign2-phone")) { - checkArguments(argc, argv, &i, &phone); - } - checkArguments(argc, argv, &i, &datatodisp); - checkArguments(argc, argv, &i, &lang); - checkArguments(argc, argv, &i, &role); - checkArguments(argc, argv, &i, &city); - checkArguments(argc, argv, &i, &state); - checkArguments(argc, argv, &i, &zip); - checkArguments(argc, argv, &i, &country); - if(((idcode && cntrcd) || phone) && datatodisp) { - // send SOAP command - err = ddocDdsSignDocWpkiStart(pSigDoc, &g_pDds, NULL, - idcode, cntrcd, phone, digidoc, - datatodisp, city, - state, zip, country, lang, NULL); - // report success - displayStatus("MSSP-SIG"); - //displaySignedDoc(); - - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing , or argument of -mssp-sign command"); - } - // cleanup - if(p) free(p); - if(file) free(file); - if(mime) free(mime); - if(idcode) free(idcode); - if(phone) free(phone); - if(datatodisp) free(datatodisp); - if(lang) free(lang); - if(role) free(role); - if(city) free(city); - if(state) free(state); - if(zip) free(zip); - if(country) free(country); - if(cntrcd) free(cntrcd); - if(err) return err; - // poll for signature complete, cancel or error status - nPollFreq = ConfigItem_lookup_int("DIGIDOC_MSSP_STATUS_POLL_FREQ", 10); - do { -#ifdef WIN32 - time(&tOld); - do { - time(&tNew); - } while(tNew - tOld < nPollFreq); -#else - sleep(nPollFreq); -#endif - err = ddocDdsGetStatusInfo(g_pDds, 0); - // report success - displayStatus("MSSP-SIG"); - } while(!err && - (!g_pDds->szStatusCode || - !strcmp(g_pDds->szStatusCode, REQUEST_OK_CODE) || - !strcmp(g_pDds->szStatusCode, OUTSTANDING_TRANSACTION_CODE))); - printf("MSSP signature finished rc: %d status: %s", err, g_pDds->szStatus); - } // if - if(!strcmp(g_pDds->szStatusCode, REQUEST_OK_CODE)) { - err = ddocDdsSignDocWpkiStop(pSigDoc, g_pDds, digidoc, digidoc); - printf("Completed digidoc: %s", digidoc); - } - if(digidoc) free(digidoc); - if(pSigDoc) SignedDoc_free(pSigDoc); - } // if(argv[0]... - } // for - return err; -} - - - -//-------------------------------------------------- -// authenticates via MSSP -//-------------------------------------------------- -int runMobileAuthenticateCmds(int argc, char** argv) -{ - int err = ERR_OK, i, nPollFreq; - DigiDocMemBuf mbuf1, mbuf2, mbuf3, mbuf4, mbuf5, mbuf6, mbuf7, mbuf8, mbuf9; -#ifdef WIN32 - time_t tNew, tOld; -#endif - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - mbuf3.pMem = 0; - mbuf3.nLen = 0; - mbuf4.pMem = 0; - mbuf4.nLen = 0; - mbuf5.pMem = 0; - mbuf5.nLen = 0; - mbuf6.pMem = 0; - mbuf6.nLen = 0; - mbuf7.pMem = 0; - mbuf7.nLen = 0; - mbuf8.pMem = 0; - mbuf8.nLen = 0; - mbuf9.pMem = 0; - mbuf9.nLen = 0; - for(i = 1; (err == ERR_OK) && (i < argc); i++) { - if(argv[i][0] == '-') { // all commands and options must start with - - if(!strcmp(argv[i], "-mssp-auth-cntr") || - !strcmp(argv[i], "-mssp-auth-phone")) { - char* idcode = NULL; - char* cntrcd = NULL; - char* phone = NULL; - char* datatodisp = NULL; - char* lang = NULL; - char* service = NULL; - int bWait = 0; - char* s = NULL; - if(!strcmp(argv[i], "-mssp-auth-cntr")) { - checkArguments(argc, argv, &i, &idcode); - checkArguments(argc, argv, &i, &cntrcd); - } - if(!strcmp(argv[i], "-mssp-auth-phone")) { - checkArguments(argc, argv, &i, &phone); - } - checkArguments(argc, argv, &i, &datatodisp); - checkArguments(argc, argv, &i, &service); - checkArguments(argc, argv, &i, &s); - if(s) - bWait = atoi(s); - checkArguments(argc, argv, &i, &lang); - if(((idcode && cntrcd) || phone) && datatodisp) { - // send SOAP command - err = ddocDdsMobileAuthenticate(g_pDds, idcode, cntrcd, phone, lang, datatodisp, - 0, 0, "asynchClientServer", 0, 0, 0, service, - &mbuf1, &mbuf2, &mbuf3, &mbuf4, - &mbuf5, &mbuf6, &mbuf7, &mbuf8, &mbuf9); - // report success - displayStatus("MSSP-AUTH"); - displayStringItem("ID-Code", (mbuf1.pMem ? (char*)mbuf1.pMem : "-")); - displayStringItem("First Name", (mbuf2.pMem ? (char*)mbuf2.pMem : "-")); - displayStringItem("Last Name", (mbuf3.pMem ? (char*)mbuf3.pMem : "-")); - displayStringItem("Country", (mbuf4.pMem ? (char*)mbuf4.pMem : "-")); - displayStringItem("CN", (mbuf5.pMem ? (char*)mbuf5.pMem : "-")); - displayStringItem("Cert", (mbuf6.pMem ? (char*)mbuf6.pMem : "-")); - displayStringItem("ChallengeID", (mbuf7.pMem ? (char*)mbuf7.pMem : "-")); - displayStringItem("Challenge", (mbuf8.pMem ? (char*)mbuf8.pMem : "-")); - displayStringItem("OCSP", (mbuf9.pMem ? (char*)mbuf9.pMem : "-")); - } else { - err = ERR_BAD_PARAM; - addError(err, __FILE__, __LINE__, "Missing , or argument of -mssp-auth command"); - } - // cleanup - if(idcode) free(idcode); - if(phone) free(phone); - if(cntrcd) free(cntrcd); - if(s) free(s); - if(datatodisp) free(datatodisp); - if(lang) free(lang); - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - ddocMemBuf_free(&mbuf3); - ddocMemBuf_free(&mbuf4); - ddocMemBuf_free(&mbuf5); - ddocMemBuf_free(&mbuf6); - ddocMemBuf_free(&mbuf7); - ddocMemBuf_free(&mbuf8); - ddocMemBuf_free(&mbuf9); - if(err) return err; - - // poll for signature complete, cancel or error status - nPollFreq = ConfigItem_lookup_int("DIGIDOC_MSSP_STATUS_POLL_FREQ", 10); - do { -#ifdef WIN32 - time(&tOld); - do { - time(&tNew); - } while(tNew - tOld < nPollFreq); -#else - sleep(nPollFreq); -#endif - err = ddocDdsGetMobileAuthenticateStatus(g_pDds, bWait, &mbuf1); - // report success - displayStatus("MSSP-AUTH"); - //displayStringItem("Signature", (mbuf1.pMem ? (char*)mbuf1.pMem : "-")); - ddocMemBuf_free(&mbuf1); - } while(!err && - (!g_pDds->szStatus || strcmp(g_pDds->szStatus, "USER_AUTHENTICATED")) && - (!g_pDds->szStatusCode || - !strcmp(g_pDds->szStatusCode, REQUEST_OK_CODE) || - !strcmp(g_pDds->szStatusCode, OUTSTANDING_TRANSACTION_CODE))); - printf("MSSP authentication finished rc: %d status: %s", err, g_pDds->szStatus); - } - } - } - return err; -} - - - - - - -//-------------------------------------------------- -// Program main function -//-------------------------------------------------- -int main(int argc, char** argv) -{ - int err = ERR_OK; - time_t t1, t2; - char buf1[250]; - - if(argc <= 1) { - printUsage(); - exit(0); - } - // init DigiDoc library - initDigiDocLib(); - -#ifdef WIN32 - // find out program home if invoked with a long command line - memset(buf1, 0, sizeof(buf1)); - getFileNamePath(argv[0], buf1); - if(strlen(buf1)) { - strcat(buf1, "digidoc.ini"); - err = initConfigStore(buf1); - } else - err = initConfigStore(NULL); -#else - // read in config file - err = initConfigStore(NULL); -#endif - // clear all errors that were encountered by not finding config files - err = checkProgArguments(argc, argv); - time(&t1); - // register program name and version - setGUIVersion(g_szProgNameVer); - ddocDebugTruncateLog(); - // use command line argument if required - if(p_szConfigFile) - err = readConfigFile(p_szConfigFile, ITEM_TYPE_PRIVATE); - // read flags from config file - readConfigParams(); - // connect to DDS service - err = ddocDdsConnect(&g_pDds); - - // display programm name and version - if(g_cgiMode) { - if(ConfigItem_lookup_bool("DIGIDOC_CGI_PRINT_HEADER", 1)) - fprintf(stdout, "%s%s%s", getLibName(), g_szOutputSeparator, getLibVersion()); - } else { - fprintf(stdout, "%s - %s", getLibName(), getLibVersion()); - } - - // execute command now - if(!err) // copy old session code if available - err = runSessioncodeCmds(argc, argv); - // start session with existing digidoc file - if(!err) // copy old session code if available - err = runStartSessionWithDigidocCmds(argc, argv); - // start session with new data file - if(!err) - err = runStartSessionWithFileCmds(argc, argv); - // start session - if(!err) - err = runStartSessionCmds(argc, argv); - // create signed doc - if(!err) - err = runCreateSignedDocCmds(argc, argv); - // add data files - if(!err) - err = runAddDataFileCmds(argc, argv); - // remove data files - if(!err) - err = runRemoveDataFileCmds(argc, argv); - // remove signature - if(!err) - err = runRemoveSignatureCmds(argc, argv); - // mobile signature - if(!err) - err = runMobileSignatureCmds(argc, argv); - // mobile authenticate - if(!err) - err = runMobileAuthenticateCmds(argc, argv); - // mobile sign 2 - if(!err) - err = runMobileSignature2Cmds(argc, argv); - - // get signed doc - if(!err) - err = runGetDdocCmds(argc, argv); - // get datafile - if(!err) - err = runGetDataFileCmds(argc, argv); - // get signers certificate - if(!err) - err = runGetSignerCertCmds(argc, argv); - // get notarys certificate - if(!err) - err = runGetNotaryCertCmds(argc, argv); - // get notarys OCSP confirmation - if(!err) - err = runGetNotaryCmds(argc, argv); - - // display info - if(!err) - err = runInfoCmds(argc, argv); - // close session - if(!err) - err = runCloseSessionCmds(argc, argv); - - time(&t2); - // disconnect from DDS service - if(g_pDds) - err = ddocDdsDisconnect(g_pDds); - - // display programm error code and elapsed time - if(g_cgiMode) { - if(ConfigItem_lookup_bool("DIGIDOC_CGI_PRINT_TRAILER", 1)) - fprintf(stdout, "\n%s%s%d%s%ld", getLibName(), g_szOutputSeparator, err, g_szOutputSeparator, (long)(t2-t1)); - - - } else { - fprintf(stdout, "\n%s - RC: %d - time: %ld [sek]", getLibName(), err, (long)(t2-t1)); - } - // list all errors - while(hasUnreadErrors()) { - ErrorInfo* pErr = getErrorInfo(); - char* pErrStr = getErrorString(pErr->code); - if(g_cgiMode) { - fprintf(stdout, "\nERROR%s%d%s%s%s%s%s%d%s%s%s%s", - g_szOutputSeparator, pErr->code, - g_szOutputSeparator, pErrStr, - g_szOutputSeparator, pErr->fileName, - g_szOutputSeparator, pErr->line, - g_szOutputSeparator, pErr->assertion, - g_szOutputSeparator, errorClass[getErrorClass(pErr->code)]); - } else { - fprintf(stdout, "\nERROR: %d - %s - %s", - pErr->code, pErrStr, pErr->assertion); - } - } - fprintf(stdout, "\n"); - - // cleanup - if(g_szOutputSeparator) - free(g_szOutputSeparator); - // cleanup - cleanupConfigStore(NULL); - finalizeDigiDocLib(); - - return err; -} diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/genstubs.bat libdigidoc-3.7.0.875/DigiDocServiceClient/genstubs.bat --- libdigidoc-2.7.0/DigiDocServiceClient/genstubs.bat 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/genstubs.bat 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -REM generate soap stubs -del ddsC.c ddsClient.c ddsClientLib.c ddsH.h ddsDtub.h *.nsmap *.wsdl *.xsd -c:\Toolkits\gsoap-win32-2.7\bin\soapcpp2.exe -pdds -C -1 -x -c DigiDocService.h -del ddsClientLib.c \ No newline at end of file diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/mss.xsd libdigidoc-3.7.0.875/DigiDocServiceClient/mss.xsd --- libdigidoc-2.7.0/DigiDocServiceClient/mss.xsd 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/mss.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ - - - - - - - diff -Nru libdigidoc-2.7.0/DigiDocServiceClient/soapdefs.h libdigidoc-3.7.0.875/DigiDocServiceClient/soapdefs.h --- libdigidoc-2.7.0/DigiDocServiceClient/soapdefs.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/DigiDocServiceClient/soapdefs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -// Contents of soapdefs.h -//#include -#define SOAP BUFLEN 20480 // use large send/recv buffer -#define WITH_OPENSSL -#define HAVE_OPENSSL_SSL_H -//#define HAVE_CONFIG_H -#ifdef WIN32 -#define SOAP_FMAC1 __declspec(dllexport) -#define SOAP_FMAC3 __declspec(dllexport) -#endif diff -Nru libdigidoc-2.7.0/LICENSE.LGPL libdigidoc-3.7.0.875/LICENSE.LGPL --- libdigidoc-2.7.0/LICENSE.LGPL 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/LICENSE.LGPL 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff -Nru libdigidoc-2.7.0/NEWS libdigidoc-3.7.0.875/NEWS --- libdigidoc-2.7.0/NEWS 2010-09-29 20:47:04.000000000 +0000 +++ libdigidoc-3.7.0.875/NEWS 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -libdigidoc 2.7.0 (2010-09-29) -============================= - -- Imported libdigidoc 2.6.0.17 library from openxades.org -- Ported build system from autoconf to CMake -- Changed default save format to 1.3, 1.4 should not be widely used. -- Use FILENAME_MAX for maximum file name length -- Release pkcs11 lib on error and failed pin -- Fixed Windows and Mac OS X builds -- Install public headers in include/digidoc -- Fixed default pkcs11 module path -- Fixed a number of crashes -- Fixed a lot of compiler warnings -- Optionally link against libdl in unix -- Marked extern functions as extern "C" -- Fixed openssl-1.0.0 compatibility -- Removed reference to SK's internal service from digidoc.conf -- Updated config and certificates to match with the names in libdigidocpp -- added "ESTEID-SK 2007 OCSP 2010" and "EID-SK 2007 OCSP 2010" certificates - -Many thanks to all the contributors: -Raul Metsma, Antti Andreimann, Janek Priimann, Kalev Lember diff -Nru libdigidoc-2.7.0/README libdigidoc-3.7.0.875/README --- libdigidoc-2.7.0/README 2010-09-29 20:52:41.000000000 +0000 +++ libdigidoc-3.7.0.875/README 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -libDigiDoc -========== - -libDigiDoc is a library implementing a subset of the XAdES digital -signature standard on top of Estonian specific .ddoc container format. -It allows to create, sign, verify, and modify digidoc XML containers. - -The library dates back to times when there were no proper XML to -code binding generators and is thus a complete mess of printf-s. -It is only used by the libdigidocpp library for handling .ddoc -files in order to ensure a bug-by-bug compatibility with old software. - -THIS LIBRARY IS OBSOLETE. PLEASE DO NOT USE IT FOR NEW DEVELOPMENTS. - - -Dependencies -============ - -cmake >= 2.6.0 -libxml2 -openssl >= 0.9.8a -zlib -pkcs11 library (e.g. opensc) - - -BUILD INSTRUCTIONS -================== - -1. Run build with cmake - mkdir build - cd build - cmake -DCMAKE_INSTALL_PREFIX=/usr -DSYSCONF_INSTALL_DIR=/etc .. - make -j4 -2. Install the library to a system wide directory - make install - - -History -======= - -You can find more information about DigiDoc from www.openxades.org -The project was initiated by AS Sertifitseerimiskeskus (www.sk.ee) -and implemented by Veiko Sinivee (veiko.sinive@seb.se) -The sources of the library were released from several websites, -mainly www.sk.ee and openxades.org. -Openxades.org still maintains a source download to make sure the -certificates included with the library are current. -There is no active development. diff -Nru libdigidoc-2.7.0/RELEASE-NOTES.txt libdigidoc-3.7.0.875/RELEASE-NOTES.txt --- libdigidoc-2.7.0/RELEASE-NOTES.txt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/RELEASE-NOTES.txt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,17 @@ +DigiDoc C library 3.6 release notes +----------------------------------- + +Changes compared to ver 2.6.0.18 +- Changes according ETSI Plug test results +- Changes according Cross library (jdigidoc & libdigidoc & libdigidocpp) test results (DDOC, CDOC) +- Removed DETACHED, HASHCODE, DDOC 1.4, BDOC support +- CDOC padding improvements +- Updated documentation in doc folder SK-CDD-PRG-GUIDE +- Support for software based private keys +- DDOC/CDOC security updates +- Versioning switched to same schema (3.5, 3.6 ...) as other middleware components +- Added Mobiil-ID signing support for cdigidoc utility +- API change in functions dencOrigContent_findByIndex, dencMetaInfo_GetLibVersion, dencMetaInfo_GetFormatVersion + + + diff -Nru libdigidoc-2.7.0/THIS_IS_OBSOLETE libdigidoc-3.7.0.875/THIS_IS_OBSOLETE --- libdigidoc-2.7.0/THIS_IS_OBSOLETE 2010-09-29 20:27:28.000000000 +0000 +++ libdigidoc-3.7.0.875/THIS_IS_OBSOLETE 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -DO NOT USE FOR NEW SOFTWARE!!! diff -Nru libdigidoc-2.7.0/authors libdigidoc-3.7.0.875/authors --- libdigidoc-2.7.0/authors 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/authors 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,4 @@ +Veiko Sinivee + The main project leader and author of DigiDoc library. +Martin Paljak + Integrator, fixer, packaging maintainer. diff -Nru libdigidoc-2.7.0/cmake/modules/COPYING-CMAKE-SCRIPTS libdigidoc-3.7.0.875/cmake/modules/COPYING-CMAKE-SCRIPTS --- libdigidoc-2.7.0/cmake/modules/COPYING-CMAKE-SCRIPTS 2010-06-21 15:41:48.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/COPYING-CMAKE-SCRIPTS 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff -Nru libdigidoc-2.7.0/cmake/modules/FindICU.cmake libdigidoc-3.7.0.875/cmake/modules/FindICU.cmake --- libdigidoc-2.7.0/cmake/modules/FindICU.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindICU.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,20 @@ +IF (ICU_INCLUDE_DIR) + # Already in cache, be silent + SET(ICU_FIND_QUIETLY TRUE) +ENDIF (ICU_INCLUDE_DIR) + +FIND_PATH(ICU_INCLUDE_DIR unicode/ucnv.h) + +SET(ICU_NAMES icuuc) +FIND_LIBRARY(ICU_LIBRARY NAMES ${ICU_NAMES} ) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU DEFAULT_MSG ICU_LIBRARY) + +IF(ICU_FOUND) + SET( ICU_LIBRARIES ${ICU_LIBRARY} ) +ELSE(ICU_FOUND) + SET( ICU_LIBRARIES ) +ENDIF(ICU_FOUND) + +MARK_AS_ADVANCED( ICU_LIBRARY ICU_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindIconv.cmake libdigidoc-3.7.0.875/cmake/modules/FindIconv.cmake --- libdigidoc-2.7.0/cmake/modules/FindIconv.cmake 2009-05-20 10:32:06.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindIconv.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -1,58 +1,58 @@ -# /kde/kdesupport/strigi/cmake -# - Try to find Iconv -# Once done this will define -# -# ICONV_FOUND - system has Iconv -# ICONV_INCLUDE_DIR - the Iconv include directory -# ICONV_LIBRARIES - Link these to use Iconv -# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const -# -include(CheckCXXSourceCompiles) - -IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - # Already in cache, be silent - SET(ICONV_FIND_QUIETLY TRUE) -ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - -FIND_PATH(ICONV_INCLUDE_DIR iconv.h) - -FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) - -IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - SET(ICONV_FOUND TRUE) -ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) - -set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) -set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) -IF(ICONV_FOUND) - check_cxx_source_compiles(" - #include - int main(){ - iconv_t conv = 0; - const char* in = 0; - size_t ilen = 0; - char* out = 0; - size_t olen = 0; - iconv(conv, &in, &ilen, &out, &olen); - return 0; - } -" ICONV_SECOND_ARGUMENT_IS_CONST ) -ENDIF(ICONV_FOUND) -set(CMAKE_REQUIRED_INCLUDES) -set(CMAKE_REQUIRED_LIBRARIES) - -IF(ICONV_FOUND) - IF(NOT ICONV_FIND_QUIETLY) - MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") - ENDIF(NOT ICONV_FIND_QUIETLY) -ELSE(ICONV_FOUND) - IF(Iconv_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find Iconv") - ENDIF(Iconv_FIND_REQUIRED) -ENDIF(ICONV_FOUND) - -MARK_AS_ADVANCED( - ICONV_INCLUDE_DIR - ICONV_LIBRARIES - ICONV_SECOND_ARGUMENT_IS_CONST -) +# /kde/kdesupport/strigi/cmake +# - Try to find Iconv +# Once done this will define +# +# ICONV_FOUND - system has Iconv +# ICONV_INCLUDE_DIR - the Iconv include directory +# ICONV_LIBRARIES - Link these to use Iconv +# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const +# +include(CheckCSourceCompiles) + +IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + SET(ICONV_FIND_QUIETLY TRUE) +ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + +FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2 c) + +IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + SET(ICONV_FOUND TRUE) +ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +IF(ICONV_FOUND) + check_c_source_compiles(" + #include + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) +ENDIF(ICONV_FOUND) +set(CMAKE_REQUIRED_INCLUDES) +set(CMAKE_REQUIRED_LIBRARIES) + +IF(ICONV_FOUND) + IF(NOT ICONV_FIND_QUIETLY) + MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}") + ENDIF(NOT ICONV_FIND_QUIETLY) +ELSE(ICONV_FOUND) + IF(Iconv_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find Iconv") + ENDIF(Iconv_FIND_REQUIRED) +ENDIF(ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_SECOND_ARGUMENT_IS_CONST +) diff -Nru libdigidoc-2.7.0/cmake/modules/FindLdap.cmake libdigidoc-3.7.0.875/cmake/modules/FindLdap.cmake --- libdigidoc-2.7.0/cmake/modules/FindLdap.cmake 2009-12-02 16:26:10.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLdap.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -9,40 +9,27 @@ if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) # Already in cache, be silent set(Ldap_FIND_QUIETLY TRUE) -endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) +endif() -if(UNIX) - FIND_PATH(LDAP_INCLUDE_DIR ldap.h) - if(APPLE) - FIND_LIBRARY(LDAP_LIBRARIES NAMES LDAP - PATHS - /System/Library/Frameworks - /Library/Frameworks - ) - else(APPLE) - FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap) - FIND_LIBRARY(LBER_LIBRARIES NAMES lber) - endif(APPLE) -else(UNIX) - FIND_PATH(LDAP_INCLUDE_DIR winldap.h) - FIND_LIBRARY(LDAP_LIBRARIES NAMES wldap32) -endif(UNIX) +FIND_PATH(LDAP_INCLUDE_DIR ldap.h) +FIND_LIBRARY(LDAP_LIBRARIES NAMES ldap) +FIND_LIBRARY(LBER_LIBRARIES NAMES lber) if(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) set(LDAP_FOUND TRUE) if(LBER_LIBRARIES) set(LDAP_LIBRARIES ${LDAP_LIBRARIES} ${LBER_LIBRARIES}) - endif(LBER_LIBRARIES) -endif(LDAP_INCLUDE_DIR AND LDAP_LIBRARIES) + endif() +endif() if(LDAP_FOUND) if(NOT Ldap_FIND_QUIETLY) message(STATUS "Found ldap: ${LDAP_LIBRARIES}") - endif(NOT Ldap_FIND_QUIETLY) -else(LDAP_FOUND) - if (Ldap_FIND_REQUIRED) + endif() +else() + if(Ldap_FIND_REQUIRED) message(FATAL_ERROR "Could NOT find ldap") - endif (Ldap_FIND_REQUIRED) -endif(LDAP_FOUND) + endif() +endif() MARK_AS_ADVANCED(LDAP_INCLUDE_DIR LDAP_LIBRARIES LBER_LIBRARIES) diff -Nru libdigidoc-2.7.0/cmake/modules/FindLibDL.cmake libdigidoc-3.7.0.875/cmake/modules/FindLibDL.cmake --- libdigidoc-2.7.0/cmake/modules/FindLibDL.cmake 2009-10-21 17:09:24.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLibDL.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# - Find libdl -# Find the native LIBDL includes and library -# -# LIBDL_INCLUDE_DIR - where to find dlfcn.h, etc. -# LIBDL_LIBRARIES - List of libraries when using libdl. -# LIBDL_FOUND - True if libdl found. - - -IF (LIBDL_INCLUDE_DIR) - # Already in cache, be silent - SET(LIBDL_FIND_QUIETLY TRUE) -ENDIF (LIBDL_INCLUDE_DIR) - -FIND_PATH(LIBDL_INCLUDE_DIR dlfcn.h) - -SET(LIBDL_NAMES dl libdl ltdl libltdl) -FIND_LIBRARY(LIBDL_LIBRARY NAMES ${LIBDL_NAMES} ) - -# handle the QUIETLY and REQUIRED arguments and set LIBDL_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibDL DEFAULT_MSG LIBDL_LIBRARY LIBDL_INCLUDE_DIR) - -IF(LIBDL_FOUND) - SET( LIBDL_LIBRARIES ${LIBDL_LIBRARY} ) -ELSE(LIBDL_FOUND) - SET( LIBDL_LIBRARIES ) -ENDIF(LIBDL_FOUND) - -MARK_AS_ADVANCED( LIBDL_LIBRARY LIBDL_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindLibDigiDoc.cmake libdigidoc-3.7.0.875/cmake/modules/FindLibDigiDoc.cmake --- libdigidoc-2.7.0/cmake/modules/FindLibDigiDoc.cmake 2009-06-08 11:36:43.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLibDigiDoc.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -11,8 +11,8 @@ SET(LIBDIGIDOC_FIND_QUIETLY TRUE) ENDIF (LIBDIGIDOC_INCLUDE_DIR) -FIND_PATH(LIBDIGIDOC_INCLUDE_DIR libdigidoc/DigiDocDefs.h) -FIND_LIBRARY(LIBDIGIDOC_LIBRARY NAMES digidoc) +FIND_PATH(LIBDIGIDOC_INCLUDE_DIR libdigidoc/DigiDocDefs.h HINTS /Library/EstonianIDCard PATH_SUFFIXES include) +FIND_LIBRARY(LIBDIGIDOC_LIBRARY NAMES digidoc HINTS /Library/EstonianIDCard/lib) # handle the QUIETLY and REQUIRED arguments and set LIBDIGIDOC_FOUND to TRUE if # all listed variables are TRUE diff -Nru libdigidoc-2.7.0/cmake/modules/FindLibDigiDocpp.cmake libdigidoc-3.7.0.875/cmake/modules/FindLibDigiDocpp.cmake --- libdigidoc-2.7.0/cmake/modules/FindLibDigiDocpp.cmake 2009-10-21 16:56:37.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLibDigiDocpp.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -12,9 +12,9 @@ SET(LIBDIGIDOCPP_FIND_QUIETLY TRUE) ENDIF (LIBDIGIDOCPP_INCLUDE_DIR) -FIND_PATH(LIBDIGIDOCPP_INCLUDE_DIR digidocpp/BDoc.h /usr/include /usr/local/include) +FIND_PATH(LIBDIGIDOCPP_INCLUDE_DIR digidocpp/BDoc.h HINTS /Library/EstonianIDCard PATH_SUFFIXES include) FIND_FILE(LIBDIGIDOCPP_CONF digidocpp.conf /etc/digidocpp /usr/local/etc/digidocpp) -FIND_LIBRARY(LIBDIGIDOCPP_LIBRARY NAMES digidocpp) +FIND_LIBRARY(LIBDIGIDOCPP_LIBRARY NAMES digidocpp HINTS /Library/EstonianIDCard/lib) # handle the QUIETLY and REQUIRED arguments and set LIBDIGIDOCPP_FOUND to TRUE if # all listed variables are TRUE diff -Nru libdigidoc-2.7.0/cmake/modules/FindLibP11.cmake libdigidoc-3.7.0.875/cmake/modules/FindLibP11.cmake --- libdigidoc-2.7.0/cmake/modules/FindLibP11.cmake 2009-03-13 13:06:53.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLibP11.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -# - Find libp11 -# Find the native LIBP11 includes and library -# -# LIBP11_INCLUDE_DIR - where to find libp11.h, etc. -# LIBP11_LIBRARIES - List of libraries when using libp11. -# LIBP11_FOUND - True if libp11 found. - - -IF (LIBP11_INCLUDE_DIR) - # Already in cache, be silent - SET(LIBP11_FIND_QUIETLY TRUE) -ENDIF (LIBP11_INCLUDE_DIR) - -FIND_PATH(LIBP11_INCLUDE_DIR libp11.h) - -SET(LIBP11_NAMES p11 libp11) -FIND_LIBRARY(LIBP11_LIBRARY NAMES ${LIBP11_NAMES} ) - -# handle the QUIETLY and REQUIRED arguments and set LIBP11_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibP11 DEFAULT_MSG LIBP11_LIBRARY LIBP11_INCLUDE_DIR) - -IF(LIBP11_FOUND) - SET( LIBP11_LIBRARIES ${LIBP11_LIBRARY} ) -ELSE(LIBP11_FOUND) - SET( LIBP11_LIBRARIES ) -ENDIF(LIBP11_FOUND) - -MARK_AS_ADVANCED( LIBP11_LIBRARY LIBP11_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindLibPython.py libdigidoc-3.7.0.875/cmake/modules/FindLibPython.py --- libdigidoc-2.7.0/cmake/modules/FindLibPython.py 2010-06-21 15:31:45.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindLibPython.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -import sys -import distutils.sysconfig - -print("exec_prefix:%s" % sys.exec_prefix) -print("short_version:%s" % sys.version[:3]) -print("long_version:%s" % sys.version.split()[0]) -print("py_inc_dir:%s" % distutils.sysconfig.get_python_inc()) -print("site_packages_dir:%s" % distutils.sysconfig.get_python_lib(plat_specific=1)) diff -Nru libdigidoc-2.7.0/cmake/modules/FindOOoSDK.cmake libdigidoc-3.7.0.875/cmake/modules/FindOOoSDK.cmake --- libdigidoc-2.7.0/cmake/modules/FindOOoSDK.cmake 2009-11-04 22:48:59.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindOOoSDK.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -# - Find OOo SDK - -set(OO_SDK_HOME "$ENV{OO_SDK_HOME}") -set(OO_SDK_HOME_LIB_DIR "$ENV{OO_SDK_HOME}/lib") -set(OO_SDK_URE_HOME "$ENV{OO_SDK_URE_HOME}") -set(OFFICE_BASE_PROGRAM_PATH "$ENV{OFFICE_BASE_PROGRAM_PATH}") -set(OO_SDK_URE_LIB_DIR "$ENV{OO_SDK_URE_LIB_DIR}") -set(SDK_GXX_INCLUDE_PATH "$ENV{SDK_GXX_INCLUDE_PATH}") -set(OOSDK_INCLUDE_DIR "$ENV{OO_SDK_INC_SUSE}") - -if(OOSDK_INCLUDE_DIR) - message(STATUS "Using SUSE include dir: ${OOSDK_INCLUDE_DIR}") -else(OOSDK_INCLUDE_DIR) - set(OOSDK_INCLUDE_DIR "${OO_SDK_HOME}/include") -endif(OOSDK_INCLUDE_DIR) - -if(NOT OO_SDK_HOME) - message(FATAL_ERROR "Run setsdkenv to set environment variables.") -endif(NOT OO_SDK_HOME) - -message(STATUS "Searching for OpenOffice.org libraries in: ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR}") - -if(APPLE) - set(ENV_LIB_VAR DYLD_LIBRARY_PATH) -else(APPLE) - set(ENV_LIB_VAR LD_LIBRARY_PATH) -endif(APPLE) - - -IF(CPPUMAKER) - # Already in cache, be silent. - SET(CPPUMAKER_FIND_QUIETLY TRUE) -ENDIF(CPPUMAKER) - -FIND_PROGRAM(CPPUMAKER NAMES cppumaker PATHS "${OO_SDK_HOME}/bin") -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppuMaker DEFAULT_MSG CPPUMAKER) -MARK_AS_ADVANCED(CPPUMAKER) - - -IF(CPPU_LIBRARY) - # Already in cache, be silent. - SET(CPPU_FIND_QUIETLY TRUE) -ENDIF(CPPU_LIBRARY) - -SET(CPPU_NAMES icppu uno_cppu cppu) -FIND_LIBRARY(CPPU_LIBRARY NAMES ${CPPU_NAMES} PATHS ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR} ENV ${ENV_LIB_VAR}) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cppu DEFAULT_MSG CPPU_LIBRARY) - - -IF(CPPUHELPER_LIBRARY) - # Already in cache, be silent. - SET(CPPUHELPER_FIND_QUIETLY TRUE) -ENDIF(CPPUHELPER_LIBRARY) - -SET(CPPUHELPER_NAMES uno_cppuhelpergcc3 icppuhelper cppuhelper) -FIND_LIBRARY(CPPUHELPER_LIBRARY NAMES ${CPPUHELPER_NAMES} PATHS ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR} ENV ${ENV_LIB_VAR}) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CppuHelper DEFAULT_MSG CPPUHELPER_LIBRARY) - - -IF(SAL_LIBRARY) - # Already in cache, be silent. - SET(SAL_FIND_QUIETLY TRUE) -ENDIF(SAL_LIBRARY) - -SET(SAL_NAMES isal uno_sal sal) -FIND_LIBRARY(SAL_LIBRARY NAMES ${SAL_NAMES} PATHS ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR} ENV ${ENV_LIB_VAR}) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sal DEFAULT_MSG SAL_LIBRARY) - - -IF(SALHELPER_LIBRARY) - # Already in cache, be silent. - SET(SALHELPER_FIND_QUIETLY TRUE) -ENDIF(SALHELPER_LIBRARY) - -SET(SALHELPER_NAMES isalhelper uno_salhelpergcc3 salhelper) -FIND_LIBRARY(SALHELPER_LIBRARY NAMES ${SALHELPER_NAMES} PATHS ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR} ENV ${ENV_LIB_VAR}) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(SalHelper DEFAULT_MSG SALHELPER_LIBRARY) - - -IF(STLPORT_LIBRARY) - # Already in cache, be silent. - SET(STLPORT_FIND_QUIETLY TRUE) -ENDIF(STLPORT_LIBRARY) - -SET(STLPORT_NAMES istlport_vc71 stlport_gcc stlport_vc71 stlport) -FIND_LIBRARY(STLPORT_LIBRARY NAMES ${STLPORT_NAMES} PATHS ${OO_SDK_URE_LIB_DIR} ${OO_SDK_HOME_LIB_DIR} ENV ${ENV_LIB_VAR}) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(STLPort DEFAULT_MSG STLPORT_LIBRARY) diff -Nru libdigidoc-2.7.0/cmake/modules/FindOpenSC.cmake libdigidoc-3.7.0.875/cmake/modules/FindOpenSC.cmake --- libdigidoc-2.7.0/cmake/modules/FindOpenSC.cmake 2009-10-21 17:09:24.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindOpenSC.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -# - Find opensc -# Find the native OPENSC includes -# -# OPENSC_INCLUDE_DIR - where to find pkcs11.h -# OPENSC_FOUND - True if opensc found. - - -IF (OPENSC_INCLUDE_DIR) - # Already in cache, be silent - SET(OPENSC_FIND_QUIETLY TRUE) -ENDIF (OPENSC_INCLUDE_DIR) - -FIND_PATH(OPENSC_INCLUDE_DIR opensc/pkcs11.h) - -IF(WIN32 AND MSVC) - SET(OPENSC_NAMES libpkcs11MD libpkcs11) -ELSE(WIN32 AND MSVC) - SET(OPENSC_NAMES libpkcs11 libpkcs11MD) -ENDIF(WIN32 AND MSVC) - -FIND_LIBRARY(OPENSC_LIBRARY NAMES ${OPENSC_NAMES} ) - -# handle the QUIETLY and REQUIRED arguments and set OPENSCSC_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSc DEFAULT_MSG OPENSC_LIBRARY OPENSC_INCLUDE_DIR) - -IF(OPENSC_FOUND) - SET( OPENSC_LIBRARIES ${OPENSC_LIBRARY} ) -ELSE(OPENSC_FOUND) - SET( OPENSC_LIBRARIES ) -ENDIF(OPENSC_FOUND) - -MARK_AS_ADVANCED( OPENSC_LIBRARY OPENSC_INCLUDE_DIR ) - diff -Nru libdigidoc-2.7.0/cmake/modules/FindOpenSSLCrypto.cmake libdigidoc-3.7.0.875/cmake/modules/FindOpenSSLCrypto.cmake --- libdigidoc-2.7.0/cmake/modules/FindOpenSSLCrypto.cmake 2009-03-13 13:06:53.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindOpenSSLCrypto.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -# - Find OpenSSL crypto library -# Find OpenSSL crypto includes and library -# -# OPENSSLCRYPTO_INCLUDE_DIR - OpenSSL include directory -# OPENSSLCRYPTO_LIBRARIES - OpenSSL crypto libraries -# OPENSSLCRYPTO_FOUND - True if OpenSSL crypto library was found - - -IF (OPENSSLCRYPTO_LIBRARIES) - # Already in cache, be silent. - SET(OPENSSLCRYPTO_FIND_QUIETLY TRUE) -ENDIF (OPENSSLCRYPTO_LIBRARIES) - -FIND_PATH(OPENSSLCRYPTO_INCLUDE_DIR openssl/ssl.h) - -IF(WIN32 AND MSVC) - SET(OPENSSLCRYPTO_NAMES libeay32MD eay libeay32) -ELSE(WIN32 AND MSVC) - SET(OPENSSLCRYPTO_NAMES crypto eay libeay32 libeay32MD) -ENDIF(WIN32 AND MSVC) - -FIND_LIBRARY(OPENSSLCRYPTO_LIBRARY NAMES ${OPENSSLCRYPTO_NAMES} ) - -# Handle the QUIETLY and REQUIRED arguments and set OPENSSLCRYPTO_FOUND to -# TRUE if all listed variables are TRUE. -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSSLCrypto DEFAULT_MSG OPENSSLCRYPTO_LIBRARY OPENSSLCRYPTO_INCLUDE_DIR) - -IF(OPENSSLCRYPTO_FOUND) - SET( OPENSSLCRYPTO_LIBRARIES ${OPENSSLCRYPTO_LIBRARY} ) -ELSE(OPENSSLCRYPTO_FOUND) - SET( OPENSSLCRYPTO_LIBRARIES ) -ENDIF(OPENSSLCRYPTO_FOUND) - -MARK_AS_ADVANCED( OPENSSLCRYPTO_LIBRARY OPENSSLCRYPTO_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindPCSCLite.cmake libdigidoc-3.7.0.875/cmake/modules/FindPCSCLite.cmake --- libdigidoc-2.7.0/cmake/modules/FindPCSCLite.cmake 2009-10-21 16:47:02.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindPCSCLite.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -1,43 +1,43 @@ -# - Find PCSC-Lite -# Find the native PCSC-Lite includes and library -# -# PCSCLITE_INCLUDE_DIR - where to find winscard.h, wintypes.h, etc. -# PCSCLITE_LIBRARIES - List of libraries when using PCSC-Lite. -# PCSCLITE_FOUND - True if PCSC-Lite found. - - -IF (PCSCLITE_INCLUDE_DIR AND PCSCLITE_LIBRARIES) - # Already in cache, be silent - SET(PCSCLITE_FIND_QUIETLY TRUE) -ENDIF (PCSCLITE_INCLUDE_DIR AND PCSCLITE_LIBRARIES) - -IF (NOT WIN32) - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_PCSCLITE libpcsclite) -ENDIF (NOT WIN32) - -FIND_PATH(PCSCLITE_INCLUDE_DIR winscard.h - HINTS - ${PC_PCSCLITE_INCLUDEDIR} - ${PC_PCSCLITE_INCLUDE_DIRS} - ${PC_PCSCLITE_INCLUDE_DIRS}/PCSC - ) - -FIND_LIBRARY(PCSCLITE_LIBRARY NAMES pcsclite libpcsclite PCSC - HINTS - ${PC_PCSCLITE_LIBDIR} - ${PC_PCSCLITE_LIBRARY_DIRS} - ) - -# handle the QUIETLY and REQUIRED arguments and set PCSCLITE_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC-Lite DEFAULT_MSG PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR) - -IF(PCSCLITE_FOUND) - SET( PCSCLITE_LIBRARIES ${PCSCLITE_LIBRARY} ) -ELSE(PCSCLITE_FOUND) - SET( PCSCLITE_LIBRARIES ) -ENDIF(PCSCLITE_FOUND) - -MARK_AS_ADVANCED( PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR ) +# - Find PCSC-Lite +# Find the native PCSC-Lite includes and library +# +# PCSCLITE_INCLUDE_DIR - where to find winscard.h, wintypes.h, etc. +# PCSCLITE_LIBRARIES - List of libraries when using PCSC-Lite. +# PCSCLITE_FOUND - True if PCSC-Lite found. + + +IF (PCSCLITE_INCLUDE_DIR AND PCSCLITE_LIBRARIES) + # Already in cache, be silent + SET(PCSCLITE_FIND_QUIETLY TRUE) +ENDIF (PCSCLITE_INCLUDE_DIR AND PCSCLITE_LIBRARIES) + +IF (NOT WIN32) + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_PCSCLITE libpcsclite) +ENDIF (NOT WIN32) + +FIND_PATH(PCSCLITE_INCLUDE_DIR winscard.h + HINTS + ${PC_PCSCLITE_INCLUDEDIR} + ${PC_PCSCLITE_INCLUDE_DIRS} + ${PC_PCSCLITE_INCLUDE_DIRS}/PCSC + ) + +FIND_LIBRARY(PCSCLITE_LIBRARY NAMES pcsclite libpcsclite PCSC + HINTS + ${PC_PCSCLITE_LIBDIR} + ${PC_PCSCLITE_LIBRARY_DIRS} + ) + +# handle the QUIETLY and REQUIRED arguments and set PCSCLITE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCSC-Lite DEFAULT_MSG PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR) + +IF(PCSCLITE_FOUND) + SET( PCSCLITE_LIBRARIES ${PCSCLITE_LIBRARY} ) +ELSE(PCSCLITE_FOUND) + SET( PCSCLITE_LIBRARIES ) +ENDIF(PCSCLITE_FOUND) + +MARK_AS_ADVANCED( PCSCLITE_LIBRARY PCSCLITE_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindPHPLibs.cmake libdigidoc-3.7.0.875/cmake/modules/FindPHPLibs.cmake --- libdigidoc-2.7.0/cmake/modules/FindPHPLibs.cmake 2010-06-21 15:32:18.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindPHPLibs.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -# - FindPHPLibs -# Find PHP interpreter includes and library -# -# PHPLIBS_FOUND - True if PHP libs found -# PHP_VERSION_STRING - The version of PHP found (x.y.z) -# PHP_LIBRARIES - Libaries (standard variable) -# PHP_INCLUDE_DIRS - List of include directories -# PHP_INCLUDE_DIR - Main include directory prefix -# PHP_EXTENSION_DIR - Location of PHP extension DSO-s -# PHP_EXECUTABLE - PHP executable -# PHP_INSTALL_PREFIX - PHP install prefix, as reported - -INCLUDE(CMakeFindFrameworks) - -IF( NOT PHP_CONFIG_EXECUTABLE ) -FIND_PROGRAM(PHP_CONFIG_EXECUTABLE - NAMES php5-config php-config - ) -ENDIF( NOT PHP_CONFIG_EXECUTABLE ) - -MACRO(GET_FROM_PHP_CONFIG args variable) - EXECUTE_PROCESS(COMMAND ${PHP_CONFIG_EXECUTABLE} ${args} - OUTPUT_VARIABLE ${variable}) - STRING(REPLACE "\n" "" ${variable} "${${variable}}") -ENDMACRO(GET_FROM_PHP_CONFIG cmd variable) - -IF(PHP_CONFIG_EXECUTABLE) - GET_FROM_PHP_CONFIG("--version" PHP_VERSION_STRING) - GET_FROM_PHP_CONFIG("--php-binary" PHP_EXECUTABLE) - GET_FROM_PHP_CONFIG("--include-dir" PHP_INCLUDE_DIR) - GET_FROM_PHP_CONFIG("--extension-dir" PHP_EXTENSION_DIR) - GET_FROM_PHP_CONFIG("--includes" PHP_INCLUDE_DIRS) - GET_FROM_PHP_CONFIG("--prefix" PHP_INSTALL_PREFIX) - STRING(REPLACE "-I" "" PHP_INCLUDE_DIRS "${PHP_INCLUDE_DIRS}") - STRING(REPLACE " " ";" PHP_INCLUDE_DIRS "${PHP_INCLUDE_DIRS}") -ENDIF(PHP_CONFIG_EXECUTABLE) - -# FIXME: Maybe we need all this crap that php-config --libs puts out, -# however after building a few swig bindings without them, -# I seriously doubt it. -SET(PHP_LIBRARIES "") - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHPLibs DEFAULT_MSG PHP_INCLUDE_DIRS) - -MARK_AS_ADVANCED(PHP_LIBRARIES PHP_INCLUDE_DIRS) diff -Nru libdigidoc-2.7.0/cmake/modules/FindPKCS11.cmake libdigidoc-3.7.0.875/cmake/modules/FindPKCS11.cmake --- libdigidoc-2.7.0/cmake/modules/FindPKCS11.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindPKCS11.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,29 @@ +# - Find pkcs11 +# Find the PKCS11 module +# +# PKCS11_MODULE - pkcs11 module path and name +# PKCS11_MODULE_FOUND - True if pkcs11 module found. + + +if( PKCS11_MODULE ) # Already in cache, be silent + set( PKCS11_FIND_QUIETLY TRUE ) +endif( PKCS11_MODULE ) + +if( WIN32 ) + set( PKCS11_NAME "opensc-pkcs11.dll" ) +else( WIN32 ) + set( PKCS11_NAME "opensc-pkcs11.so" ) +endif( WIN32 ) + +find_library( PKCS11_MODULE NAMES ${PKCS11_NAME} HINTS /Library/OpenSC/lib ) + +# handle the QUIETLY and REQUIRED arguments and set PKCS11_MODULE_FOUND to TRUE if +# all listed variables are TRUE +include( FindPackageHandleStandardArgs ) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( PKCS11_Module DEFAULT_MSG PKCS11_MODULE ) + +if( NOT PKCS11_MODULE_FOUND ) + set( PKCS11_MODULE ${PKCS11_NAME} ) +endif( NOT PKCS11_MODULE_FOUND ) + +MARK_AS_ADVANCED( PKCS11_MODULE ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindPKCS11H.cmake libdigidoc-3.7.0.875/cmake/modules/FindPKCS11H.cmake --- libdigidoc-2.7.0/cmake/modules/FindPKCS11H.cmake 2009-06-22 20:49:35.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindPKCS11H.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -# - Find PKCS11-Helper -# Find the native PKCS11-Helper includes and library -# -# PKCS11H_INCLUDE_DIR - where to find pkcs11.h, etc. -# PKCS11H_LIBRARIES - List of libraries when using PKCS11-Helper. -# PKCS11H_FOUND - True if PKCS11-Helper found. - - -IF (PKCS11H_INCLUDE_DIR AND PKCS11H_LIBRARIES) - # Already in cache, be silent - SET(PKCS11H_FIND_QUIETLY TRUE) -ENDIF (PKCS11H_INCLUDE_DIR AND PKCS11H_LIBRARIES) - -IF (NOT WIN32) - FIND_PACKAGE(PkgConfig) - PKG_CHECK_MODULES(PC_PKCSH11 libpkcs11-helper-1) -ENDIF (NOT WIN32) - -FIND_PATH(PKCS11H_INCLUDE_DIR pkcs11.h - HINTS - ${PC_PKCSH11_INCLUDEDIR} - ${PC_PKCSH11_INCLUDEDIR}/pkcs11-helper-1.0 - ${PC_PKCSH11_INCLUDE_DIRS} - ${PC_PKCSH11_INCLUDE_DIRS}/pkcs11-helper-1.0 - ) - -FIND_LIBRARY(PKCS11H_LIBRARY NAMES pkcs11-helper libpkcs11-helper - HINTS - ${PC_PKCS11H_LIBDIR} - ${PC_PKCS11H_LIBRARY_DIRS} - ) - -# handle the QUIETLY and REQUIRED arguments and set PKCS11H_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PKCS11H DEFAULT_MSG PKCS11H_INCLUDE_DIR PKCS11H_LIBRARY) - -IF(PKCS11H_FOUND) - SET( PKCS11H_LIBRARIES ${PKCS11H_LIBRARY} ) -ELSE(PKCS11H_FOUND) - SET( PKCS11H_LIBRARIES ) -ENDIF(PKCS11H_FOUND) - -MARK_AS_ADVANCED( PKCS11H_LIBRARY PKCS11H_INCLUDE_DIR ) diff -Nru libdigidoc-2.7.0/cmake/modules/FindPythonLibrary.cmake libdigidoc-3.7.0.875/cmake/modules/FindPythonLibrary.cmake --- libdigidoc-2.7.0/cmake/modules/FindPythonLibrary.cmake 2010-06-21 15:31:45.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindPythonLibrary.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -# Find Python -# ~~~~~~~~~~~ -# Find the Python interpreter and related Python directories. -# -# This file defines the following variables: -# -# PYTHON_EXECUTABLE - The path and filename of the Python interpreter. -# -# PYTHON_SHORT_VERSION - The version of the Python interpreter found, -# excluding the patch version number. (e.g. 2.5 and not 2.5.1)) -# -# PYTHON_LONG_VERSION - The version of the Python interpreter found as a human -# readable string. -# -# PYTHON_SITE_PACKAGES_DIR - Location of the Python site-packages directory. -# -# PYTHON_INCLUDE_PATH - Directory holding the python.h include file. -# -# PYTHON_LIBRARY, PYTHON_LIBRARIES- Location of the Python library. - -# Copyright (c) 2007, Simon Edwards -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - - -INCLUDE(CMakeFindFrameworks) - -if(EXISTS PYTHON_LIBRARY) - # Already in cache, be silent - set(PYTHONLIBRARY_FOUND TRUE) -else(EXISTS PYTHON_LIBRARY) - - FIND_PACKAGE(PythonInterp) - - if(PYTHONINTERP_FOUND) - - FIND_FILE(_find_lib_python_py FindLibPython.py PATHS ${CMAKE_MODULE_PATH}) - - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_lib_python_py} OUTPUT_VARIABLE python_config) - if(python_config) - STRING(REGEX REPLACE ".*exec_prefix:([^\n]+).*$" "\\1" PYTHON_PREFIX ${python_config}) - STRING(REGEX REPLACE ".*\nshort_version:([^\n]+).*$" "\\1" PYTHON_SHORT_VERSION ${python_config}) - STRING(REGEX REPLACE ".*\nlong_version:([^\n]+).*$" "\\1" PYTHON_LONG_VERSION ${python_config}) - STRING(REGEX REPLACE ".*\npy_inc_dir:([^\n]+).*$" "\\1" PYTHON_INCLUDE_PATH ${python_config}) - if(NOT PYTHON_SITE_PACKAGES_DIR) - if(NOT PYTHON_LIBS_WITH_KDE_LIBS) - STRING(REGEX REPLACE ".*\nsite_packages_dir:([^\n]+).*$" "\\1" PYTHON_SITE_PACKAGES_DIR ${python_config}) - else(NOT PYTHON_LIBS_WITH_KDE_LIBS) - set(PYTHON_SITE_PACKAGES_DIR ${KDE4_LIB_INSTALL_DIR}/python${PYTHON_SHORT_VERSION}/site-packages) - endif(NOT PYTHON_LIBS_WITH_KDE_LIBS) - endif(NOT PYTHON_SITE_PACKAGES_DIR) - STRING(REGEX REPLACE "([0-9]+).([0-9]+)" "\\1\\2" PYTHON_SHORT_VERSION_NO_DOT ${PYTHON_SHORT_VERSION}) - set(PYTHON_LIBRARY_NAMES python${PYTHON_SHORT_VERSION} python${PYTHON_SHORT_VERSION_NO_DOT}) - if(WIN32) - STRING(REPLACE "\\" "/" PYTHON_SITE_PACKAGES_DIR ${PYTHON_SITE_PACKAGES_DIR}) - endif(WIN32) - FIND_LIBRARY(PYTHON_LIBRARY NAMES ${PYTHON_LIBRARY_NAMES} PATHS ${PYTHON_PREFIX}/lib ${PYTHON_PREFIX}/libs NO_DEFAULT_PATH) - set(PYTHONLIBRARY_FOUND TRUE) - endif(python_config) - - # adapted from cmake's builtin FindPythonLibs - if(APPLE) - CMAKE_FIND_FRAMEWORKS(Python) - set(PYTHON_FRAMEWORK_INCLUDES) - if(Python_FRAMEWORKS) - # If a framework has been selected for the include path, - # make sure "-framework" is used to link it. - if("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework") - set(PYTHON_LIBRARY "") - set(PYTHON_DEBUG_LIBRARY "") - endif("${PYTHON_INCLUDE_PATH}" MATCHES "Python\\.framework") - if(NOT PYTHON_LIBRARY) - set (PYTHON_LIBRARY "-framework Python" CACHE FILEPATH "Python Framework" FORCE) - endif(NOT PYTHON_LIBRARY) - set(PYTHONLIBRARY_FOUND TRUE) - endif(Python_FRAMEWORKS) - endif(APPLE) - endif(PYTHONINTERP_FOUND) - - if(PYTHONLIBRARY_FOUND) - set(PYTHON_LIBRARIES ${PYTHON_LIBRARY}) - if(NOT PYTHONLIBRARY_FIND_QUIETLY) - message(STATUS "Found Python executable: ${PYTHON_EXECUTABLE}") - message(STATUS "Found Python version: ${PYTHON_LONG_VERSION}") - message(STATUS "Found Python library: ${PYTHON_LIBRARY}") - endif(NOT PYTHONLIBRARY_FIND_QUIETLY) - else(PYTHONLIBRARY_FOUND) - if(PYTHONLIBRARY_FIND_REQUIRED) - message(FATAL_ERROR "Could not find Python") - endif(PYTHONLIBRARY_FIND_REQUIRED) - endif(PYTHONLIBRARY_FOUND) - -endif (EXISTS PYTHON_LIBRARY) diff -Nru libdigidoc-2.7.0/cmake/modules/FindXSD.cmake libdigidoc-3.7.0.875/cmake/modules/FindXSD.cmake --- libdigidoc-2.7.0/cmake/modules/FindXSD.cmake 2009-03-13 13:06:53.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindXSD.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -11,10 +11,10 @@ SET(XSD_FIND_QUIETLY TRUE) ENDIF (XSD_INCLUDE_DIR) -FIND_PATH(XSD_INCLUDE_DIR xsd/cxx/parser/elements.hxx) +FIND_PATH(XSD_INCLUDE_DIR xsd/cxx/parser/elements.hxx HINTS /Library/EstonianIDCard/include) SET(XSD_NAMES xsdcxx xsdgen xsd) -FIND_PROGRAM(XSD_EXECUTABLE NAMES ${XSD_NAMES} ) +FIND_PROGRAM(XSD_EXECUTABLE NAMES ${XSD_NAMES} HINTS /Library/EstonianIDCard/bin) # Handle the QUIETLY and REQUIRED arguments and set XSD_FOUND to # TRUE if all listed variables are TRUE. @@ -22,3 +22,25 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(XSD DEFAULT_MSG XSD_EXECUTABLE XSD_INCLUDE_DIR) MARK_AS_ADVANCED( XSD_EXECUTABLE XSD_INCLUDE_DIR ) + +macro( XSD_SCHEMA SOURCES HEADERS OUTPUT INPUT ) + get_filename_component( NAME "${INPUT}" NAME ) + get_filename_component( BASE "${NAME}" NAME_WE ) + list( APPEND ${SOURCES} ${OUTPUT}/${BASE}.cxx ) + list( APPEND ${HEADERS} ${OUTPUT}/${BASE}.hxx ) + add_custom_command( + OUTPUT ${OUTPUT}/${BASE}.cxx ${OUTPUT}/${BASE}.hxx + COMMAND ${CMAKE_COMMAND} -E make_directory ${OUTPUT} + COMMAND ${XSD_EXECUTABLE} cxx-tree + --type-naming ucc + --function-naming lcc + --generate-doxygen + --generate-intellisense + --root-element-first + --output-dir ${OUTPUT} + --generate-serialization + ${ARGN} + ${INPUT} + DEPENDS ${INPUT} + ) +endmacro() diff -Nru libdigidoc-2.7.0/cmake/modules/FindXercesC.cmake libdigidoc-3.7.0.875/cmake/modules/FindXercesC.cmake --- libdigidoc-2.7.0/cmake/modules/FindXercesC.cmake 2009-03-13 13:06:53.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindXercesC.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -11,10 +11,10 @@ SET(XERCESC_FIND_QUIETLY TRUE) ENDIF (XERCESC_INCLUDE_DIR) -FIND_PATH(XERCESC_INCLUDE_DIR xercesc/dom/DOM.hpp) +FIND_PATH(XERCESC_INCLUDE_DIR xercesc/dom/DOM.hpp HINTS /Library/EstonianIDCard/include) SET(XERCESC_NAMES xerces-c xerces-c_3 xerces-c_2) -FIND_LIBRARY(XERCESC_LIBRARY NAMES ${XERCESC_NAMES} ) +FIND_LIBRARY(XERCESC_LIBRARY NAMES ${XERCESC_NAMES} HINTS /Library/EstonianIDCard/lib) # Handle the QUIETLY and REQUIRED arguments and set XERCESC_FOUND to # TRUE if all listed variables are TRUE. diff -Nru libdigidoc-2.7.0/cmake/modules/FindXmlSecurityC.cmake libdigidoc-3.7.0.875/cmake/modules/FindXmlSecurityC.cmake --- libdigidoc-2.7.0/cmake/modules/FindXmlSecurityC.cmake 2009-03-13 13:06:53.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/FindXmlSecurityC.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -11,10 +11,10 @@ SET(XMLSECURITYC_FIND_QUIETLY TRUE) ENDIF (XMLSECURITYC_INCLUDE_DIR) -FIND_PATH(XMLSECURITYC_INCLUDE_DIR xsec/utils/XSECPlatformUtils.hpp) +FIND_PATH(XMLSECURITYC_INCLUDE_DIR xsec/utils/XSECPlatformUtils.hpp HINTS /Library/EstonianIDCard/include) SET(XMLSECURITYC_NAMES xml-security-c xsec_1) -FIND_LIBRARY(XMLSECURITYC_LIBRARY NAMES ${XMLSECURITYC_NAMES} ) +FIND_LIBRARY(XMLSECURITYC_LIBRARY NAMES ${XMLSECURITYC_NAMES} HINTS /Library/EstonianIDCard/lib) # Handle the QUIETLY and REQUIRED arguments and set XMLSECURITYC_FOUND to # TRUE if all listed variables are TRUE. diff -Nru libdigidoc-2.7.0/cmake/modules/InstallSettings.cmake libdigidoc-3.7.0.875/cmake/modules/InstallSettings.cmake --- libdigidoc-2.7.0/cmake/modules/InstallSettings.cmake 2009-06-16 08:02:30.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/InstallSettings.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -# Copyright (c) 2008 Kevin Krammer -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) - -if (WIN32) -# use relative install prefix to avoid hardcoded install paths in cmake_install.cmake files - - set(LIB_INSTALL_DIR "lib${LIB_SUFFIX}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}) - - set(EXEC_INSTALL_PREFIX "" ) # Base directory for executables and libraries - set(SHARE_INSTALL_PREFIX "share" ) # Base directory for files which go to share/ - set(BIN_INSTALL_DIR "bin" ) # The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin) - set(SBIN_INSTALL_DIR "sbin" ) # The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin) - - set(LIBEXEC_INSTALL_DIR "${BIN_INSTALL_DIR}" ) # The subdirectory relative to the install prefix where libraries will be installed (default is ${BIN_INSTALL_DIR}) - set(INCLUDE_INSTALL_DIR "include" ) # The subdirectory to the header prefix - - set(PLUGIN_INSTALL_DIR "lib${LIB_SUFFIX}/kde4" ) # "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4) - set(CONFIG_INSTALL_DIR "share/config" ) # The config file install dir - set(DATA_INSTALL_DIR "share/apps" ) # The parent directory where applications can install their data - set(HTML_INSTALL_DIR "share/doc/HTML" ) # The HTML install dir for documentation - set(ICON_INSTALL_DIR "share/icons" ) # The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/) - set(KCFG_INSTALL_DIR "share/config.kcfg" ) # The install dir for kconfig files - set(LOCALE_INSTALL_DIR "share/locale" ) # The install dir for translations - set(MIME_INSTALL_DIR "share/mimelnk" ) # The install dir for the mimetype desktop files - set(SERVICES_INSTALL_DIR "share/kde4/services" ) # The install dir for service (desktop, protocol, ...) files - set(SERVICETYPES_INSTALL_DIR "share/kde4/servicetypes" ) # The install dir for servicestypes desktop files - set(SOUND_INSTALL_DIR "share/sounds" ) # The install dir for sound files - set(TEMPLATES_INSTALL_DIR "share/templates" ) # The install dir for templates (Create new file...) - set(WALLPAPER_INSTALL_DIR "share/wallpapers" ) # The install dir for wallpapers - set(DEMO_INSTALL_DIR "share/demos" ) # The install dir for demos - set(KCONF_UPDATE_INSTALL_DIR "share/apps/kconf_update" ) # The kconf_update install dir - set(AUTOSTART_INSTALL_DIR "share/autostart" ) # The install dir for autostart files - - set(XDG_APPS_INSTALL_DIR "share/applications/kde4" ) # The XDG apps dir - set(XDG_DIRECTORY_INSTALL_DIR "share/desktop-directories" ) # The XDG directory - set(XDG_MIME_INSTALL_DIR "share/mime/packages" ) # The install dir for the xdg mimetypes - - set(SYSCONF_INSTALL_DIR "etc" ) # The kde sysconfig install dir (default /etc) - set(MAN_INSTALL_DIR "share/man" ) # The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/) - set(INFO_INSTALL_DIR "share/info" ) # The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - set(DBUS_INTERFACES_INSTALL_DIR "share/dbus-1/interfaces" ) # The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - set(DBUS_SERVICES_INSTALL_DIR "share/dbus-1/services" ) # The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -else (WIN32) - - # this macro implements some very special logic how to deal with the cache - # by default the various install locations inherit their value from theit "parent" variable - # so if you set CMAKE_INSTALL_PREFIX, then EXEC_INSTALL_PREFIX, PLUGIN_INSTALL_DIR will - # calculate their value by appending subdirs to CMAKE_INSTALL_PREFIX - # this would work completely without using the cache. - # but if somebody wants e.g. a different EXEC_INSTALL_PREFIX this value has to go into - # the cache, otherwise it will be forgotten on the next cmake run. - # Once a variable is in the cache, it doesn't depend on its "parent" variables - # anymore and you can only change it by editing it directly. - # this macro helps in this regard, because as long as you don't set one of the - # variables explicitely to some location, it will always calculate its value from its - # parents. So modifying CMAKE_INSTALL_PREFIX later on will have the desired effect. - # But once you decide to set e.g. EXEC_INSTALL_PREFIX to some special location - # this will go into the cache and it will no longer depend on CMAKE_INSTALL_PREFIX. - macro(_SET_FANCY _var _value _comment) - set(predefinedvalue "${_value}") - - if (NOT DEFINED ${_var}) - set(${_var} ${predefinedvalue}) - else (NOT DEFINED ${_var}) - set(${_var} "${${_var}}" CACHE PATH "${_comment}") - endif (NOT DEFINED ${_var}) - endmacro(_SET_FANCY) - - - _set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries") - _set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/") - _set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)") - _set_fancy(SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)") - _set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})") - _set_fancy(LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde4/libexec)") - _set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix") - - _set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)") - _set_fancy(CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir") - _set_fancy(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data") - _set_fancy(HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/HTML" "The HTML install dir for documentation") - _set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)") - _set_fancy(KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files") - _set_fancy(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations") - _set_fancy(MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files") - _set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/services" "The install dir for service (desktop, protocol, ...) files") - _set_fancy(SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/servicetypes" "The install dir for servicestypes desktop files") - _set_fancy(SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files") - _set_fancy(TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)") - _set_fancy(WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers") - _set_fancy(DEMO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/demos" "The install dir for demos") - _set_fancy(KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir") - _set_fancy(AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files") - - _set_fancy(XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde4" "The XDG apps dir") - _set_fancy(XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory") - _set_fancy(XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes") - - _set_fancy(SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The kde sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)") - _set_fancy(MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The kde man install dir (default ${SHARE_INSTALL_PREFIX}/man/)") - _set_fancy(INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The kde info install dir (default ${SHARE_INSTALL_PREFIX}/info)") - _set_fancy(DBUS_INTERFACES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The kde dbus interfaces install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)") - _set_fancy(DBUS_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/services" "The kde dbus services install dir (default ${SHARE_INSTALL_PREFIX}/dbus-1/services)") - -endif (WIN32) - -# The INSTALL_TARGETS_DEFAULT_ARGS variable should be used when libraries are installed. -# The arguments are also ok for regular executables, i.e. executables which don't go -# into sbin/ or libexec/, but for installing executables the basic syntax -# INSTALL(TARGETS kate DESTINATION "${BIN_INSTALL_DIR}") -# is enough, so using this variable there doesn't help a lot. -# The variable must not be used for installing plugins. -# Usage is like this: -# install(TARGETS kdecore kdeui ${INSTALL_TARGETS_DEFAULT_ARGS} ) -# -# This will install libraries correctly under UNIX, OSX and Windows (i.e. dll's go -# into bin/. -# Later on it will be possible to extend this for installing OSX frameworks -# The COMPONENT Devel argument has the effect that static libraries belong to the -# "Devel" install component. If we use this also for all install() commands -# for header files, it will be possible to install -# -everything: make install OR cmake -P cmake_install.cmake -# -only the development files: cmake -DCOMPONENT=Devel -P cmake_install.cmake -# -everything except the development files: cmake -DCOMPONENT=Unspecified -P cmake_install.cmake -# This can then also be used for packaging with cpack. - -set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}" - LIBRARY DESTINATION "${LIB_INSTALL_DIR}" - ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel ) - - diff -Nru libdigidoc-2.7.0/cmake/modules/MacOSXBundleInfo.plist.in libdigidoc-3.7.0.875/cmake/modules/MacOSXBundleInfo.plist.in --- libdigidoc-2.7.0/cmake/modules/MacOSXBundleInfo.plist.in 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/MacOSXBundleInfo.plist.in 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + LSHasLocalizedDisplayName + + LSApplicationCategoryType + public.app-category.utilities + ForAppStore + yes + + diff -Nru libdigidoc-2.7.0/cmake/modules/PythonCompile.py libdigidoc-3.7.0.875/cmake/modules/PythonCompile.py --- libdigidoc-2.7.0/cmake/modules/PythonCompile.py 2010-06-21 15:31:45.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/PythonCompile.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -# By Simon Edwards -# This file is in the public domain. -import py_compile -py_compile.main() diff -Nru libdigidoc-2.7.0/cmake/modules/PythonMacros.cmake libdigidoc-3.7.0.875/cmake/modules/PythonMacros.cmake --- libdigidoc-2.7.0/cmake/modules/PythonMacros.cmake 2010-06-21 15:31:45.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/PythonMacros.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -# Python macros -# ~~~~~~~~~~~~~ -# Copyright (c) 2007, Simon Edwards -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# -# This file defines the following macros: -# -# PYTHON_INSTALL (SOURCE_FILE DESINATION_DIR) -# Install the SOURCE_FILE, which is a Python .py file, into the -# destination directory during install. The file will be byte compiled -# and both the .py file and .pyc file will be installed. - -GET_FILENAME_COMPONENT(PYTHON_MACROS_MODULE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH) - -MACRO(PYTHON_INSTALL SOURCE_FILE DESINATION_DIR) - - FIND_FILE(_python_compile_py PythonCompile.py PATHS ${CMAKE_MODULE_PATH}) - - ADD_CUSTOM_TARGET(compile_python_files ALL) - - # Install the source file. - INSTALL(FILES ${SOURCE_FILE} DESTINATION ${DESINATION_DIR}) - - # Byte compile and install the .pyc file. - GET_FILENAME_COMPONENT(_absfilename ${SOURCE_FILE} ABSOLUTE) - GET_FILENAME_COMPONENT(_filename ${SOURCE_FILE} NAME) - GET_FILENAME_COMPONENT(_filenamebase ${SOURCE_FILE} NAME_WE) - GET_FILENAME_COMPONENT(_basepath ${SOURCE_FILE} PATH) - - if(WIN32) - string(REGEX REPLACE ".:/" "/" _basepath "${_basepath}") - endif(WIN32) - - SET(_bin_py ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filename}) - SET(_bin_pyc ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc) - - FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath}) - - SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}") - - GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE) - IF(_abs_bin_py STREQUAL ${_absfilename}) # Don't copy the file onto itself. - ADD_CUSTOM_COMMAND( - TARGET compile_python_files - COMMAND ${CMAKE_COMMAND} -E echo ${message} - COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} - DEPENDS ${_absfilename} - ) - ELSE(_abs_bin_py STREQUAL ${_absfilename}) - ADD_CUSTOM_COMMAND( - TARGET compile_python_files - COMMAND ${CMAKE_COMMAND} -E echo ${message} - COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py} - COMMAND ${PYTHON_EXECUTABLE} ${_python_compile_py} ${_bin_py} - DEPENDS ${_absfilename} - ) - ENDIF(_abs_bin_py STREQUAL ${_absfilename}) - - INSTALL(FILES ${_bin_pyc} DESTINATION ${DESINATION_DIR}) -ENDMACRO(PYTHON_INSTALL) diff -Nru libdigidoc-2.7.0/cmake/modules/VersionInfo.cmake libdigidoc-3.7.0.875/cmake/modules/VersionInfo.cmake --- libdigidoc-2.7.0/cmake/modules/VersionInfo.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/cmake/modules/VersionInfo.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,62 @@ +set( MAJOR_VER 3 ) +set( MINOR_VER 7 ) +set( RELEASE_VER 0 ) +set( BUILD_VER 0 ) + +if( BUILD_VER EQUAL 0 ) + if( $ENV{BUILD_NUMBER} ) + set( BUILD_VER $ENV{BUILD_NUMBER} ) + else() + find_package( Subversion ) + if( Subversion_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.svn ) + Subversion_WC_INFO( ${PROJECT_SOURCE_DIR} PROJECT ) + message( STATUS "Current SVN revision is ${PROJECT_WC_REVISION}" ) + set( BUILD_VER ${PROJECT_WC_REVISION} ) + endif() + endif() +endif() + +if( WIN32 ) + execute_process( COMMAND "cmd.exe" "/C date /T" OUTPUT_VARIABLE BUILD_DATE ) + string( REGEX REPLACE ".*([0-3][0-9]).([0-1][0-9]).([0-9][0-9][0-9][0-9]).*" "\\1.\\2.\\3" BUILD_DATE ${BUILD_DATE} ) +elseif( UNIX ) + execute_process( COMMAND "date" "+%d.%m.%Y" OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) +else() + message( SEND_ERROR "date not implemented") + set( BUILD_DATE "00.00.0000" ) +endif() + +set( VERSION ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER}.${BUILD_VER} ) +add_definitions( + -DMAJOR_VER=${MAJOR_VER} + -DMINOR_VER=${MINOR_VER} + -DRELEASE_VER=${RELEASE_VER} + -DBUILD_VER=${BUILD_VER} + -DBUILD_DATE=\"${BUILD_DATE}\" + -DDOMAINURL=\"ria.ee\" + -DORG=\"RIA\" +) + +set( MACOSX_BUNDLE_COPYRIGHT "(C) 2010-2012 Estonian Information System's Authority" ) +set( MACOSX_BUNDLE_SHORT_VERSION_STRING ${MAJOR_VER}.${MINOR_VER} ) +set( MACOSX_BUNDLE_BUNDLE_VERSION ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER} ) +set( MACOSX_BUNDLE_ICON_FILE Icon.icns ) +set( MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MAJOR_VER}.${MINOR_VER} ) +set( MACOSX_FRAMEWORK_BUNDLE_VERSION ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER} ) + +macro( SET_APP_NAME OUTPUT NAME ) + set( ${OUTPUT} "${NAME}" ) + add_definitions( -DAPP=\"${NAME}\" ) + set( MACOSX_BUNDLE_BUNDLE_NAME ${NAME} ) + set( MACOSX_BUNDLE_GUI_IDENTIFIER "ee.ria.${NAME}" ) + if( APPLE ) + file( GLOB_RECURSE RESOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/mac/Resources/*.icns + ${CMAKE_CURRENT_SOURCE_DIR}/mac/Resources/*.strings ) + foreach( _file ${RESOURCE_FILES} ) + get_filename_component( _file_dir ${_file} PATH ) + file( RELATIVE_PATH _file_dir ${CMAKE_CURRENT_SOURCE_DIR}/mac ${_file_dir} ) + set_source_files_properties( ${_file} PROPERTIES MACOSX_PACKAGE_LOCATION ${_file_dir} ) + endforeach( _file ) + endif( APPLE ) +endmacro() diff -Nru libdigidoc-2.7.0/config.h.cmake libdigidoc-3.7.0.875/config.h.cmake --- libdigidoc-2.7.0/config.h.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/config.h.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,7 @@ +/* default config file for libdigidoc */ +#define SYSCONFDIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@" + +/* Version number of package */ +#define VERSION "@VERSION@" +#define DIGIDOC_VERSION "@VERSION@" +#define VERSION_COMMA @MAJOR_VER@,@MINOR_VER@,@RELEASE_VER@,@BUILD_VER@ diff -Nru libdigidoc-2.7.0/debian/changelog libdigidoc-3.7.0.875/debian/changelog --- libdigidoc-2.7.0/debian/changelog 2012-03-07 01:06:39.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/changelog 2012-12-17 15:11:04.000000000 +0000 @@ -1,33 +1,5 @@ -libdigidoc (2.7.0-0ubuntu4) precise; urgency=low +libdigidoc (3.7.0.875-0ubuntu1~q.1) quantal; urgency=low - * 0001_new_EstEID_root_CA.patch: - + Add the latest EstEID root CA issued by Sertifitseerimiskeskus. + * Generated automatically @udukogu - -- Martin-Éric Racine Wed, 07 Mar 2012 03:05:33 +0200 - -libdigidoc (2.7.0-0ubuntu3) precise; urgency=high - - * Urgency=high; this library is stalling 5 other packages in dep-wait. - * Reintroduce CDBS list-missing only for common-binary-post-install-arch. - - -- Martin-Éric Racine Fri, 27 Jan 2012 17:45:25 +0200 - -libdigidoc (2.7.0-0ubuntu2) precise; urgency=low - - * Moved /usr/bin/cdigidoc to libdigidoc-dev. - * Split architecture-independent content into libdigidoc-common. - Thanks to Colin Watson for the suggestion. - * Replace CDBS utils.mk list-missing with dh_install --fail-missing. - - Removed: include /usr/share/cdbs/1/rules/utils.mk, - common-binary-post-install-arch common-binary-post-install-indep:: - + Added: DEB_DH_INSTALL_ARGS += --fail-missing --list-missing - - -- Martin-Éric Racine Thu, 26 Jan 2012 21:38:59 +0200 - -libdigidoc (2.7.0-0ubuntu1) precise; urgency=low - - * Initial release for Ubuntu (LP: #916343). - Based upon initial packaging by Kalev Lember, with further improvements - by Guido Tabbernuk, then packaging review by Martin-Éric Racine. - - -- Martin-Éric Racine Sat, 14 Jan 2012 02:42:44 +0200 + -- Märt Põder Mon, 17 Dec 2012 17:11:04 +0200 diff -Nru libdigidoc-2.7.0/debian/control libdigidoc-3.7.0.875/debian/control --- libdigidoc-2.7.0/debian/control 2012-01-26 19:48:18.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/control 2012-12-17 00:12:33.000000000 +0000 @@ -1,63 +1,29 @@ Source: libdigidoc Section: libs -Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Guido Tabbernuk , Martin-Éric Racine -Build-Depends: cdbs, debhelper (>= 7), cmake, pkg-config, libssl-dev, libxml2-dev -Standards-Version: 3.9.2 -Homepage: http://code.google.com/p/esteid/ - -Package: libdigidoc-common -Section: misc -Architecture: all -Depends: ${misc:Depends}, ${shlibs:Depends} -Description: libdigidoc architecture-independent files - libDigiDoc is a library implementing a subset of the XAdES digital - signature standard on top of Estonian specific .ddoc container format. - It allows one to create, sign, verify, and modify digidoc XML containers. - . - This package provides the architecture-independent files. +Priority: extra +Maintainer: ria +Build-Depends: cdbs, debhelper (>= 7.0.50~), cmake, opensc, libssl-dev, libxml2-dev +Standards-Version: 3.9.4 +Homepage: http://www.ria.ee -Package: libdigidoc-dev -Section: libdevel +Package: libdigidoc2 +Replaces: libdigidoc +Breaks: libdigidoc Architecture: any -Replaces: libdigidoc2-dev (<< 2.6.1) -Breaks: libdigidoc2-dev (<< 2.6.1) -Depends: libdigidoc2 (= ${binary:Version}), libxml2-dev, libssl-dev, ${misc:Depends}, ${shlibs:Depends} -Description: libdigidoc development files - libDigiDoc is a library implementing a subset of the XAdES digital - signature standard on top of Estonian specific .ddoc container format. - It allows one to create, sign, verify, and modify digidoc XML containers. - . - This package provides the development files. +Depends: esteidcerts, opensc (>=0.11), ${shlibs:Depends}, ${misc:Depends} +Description: DigiDoc library + Library for creating DigiDoc signature files -Package: libdigidoc2-dbg -Section: debug -Priority: extra +Package: libdigidoc-dbg Architecture: any -Depends: libdigidoc2 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} -Description: libdigidoc debugging symbols - libDigiDoc is a library implementing a subset of the XAdES digital - signature standard on top of Estonian specific .ddoc container format. - It allows one to create, sign, verify, and modify digidoc XML containers. - . - This package provides the debugging symbols. +Section: debug +Depends: libssl1.0.0-dbg|libssl0.9.8-dbg, libxml2-dbg, libdigidoc2 (= ${binary:Version}), ${misc:Depends} +Description: DigiDoc library debug symbols + Debug symbols for DigiDoc library -Package: libdigidoc2 +Package: libdigidoc-dev Architecture: any -Depends: libdigidoc-common, ${misc:Depends}, ${shlibs:Depends} -Description: legacy C++ library for processing DDOC digital signatures - libDigiDoc is a library implementing a subset of the XAdES digital - signature standard on top of an Estonian-specific DDOC container format. - It allows one to create, sign, verify and modify DigiDoc XML containers. - . - This library was initially developed more than 10 years ago, back - when there was no adequate standard XML library to implement these - features. Nowadays, it only remains in use by libdigidocpp to provide a - bug-for-bug backward-compatibility with older DigiDoc software that is - widely deployed and essential for accessing public services in Estonia. - . - For any other purpose, this library shall be considered as deprecated - and is best avoided whenever developing new DigiDoc software. - . - This package provides the shared libraries. +Section: libdevel +Depends: esteidcerts-dev, libssl-dev, libxml2-dev, libdigidoc2 (= ${binary:Version}), ${misc:Depends} +Description: DigiDoc library devel files + Devel files for DigiDoc library diff -Nru libdigidoc-2.7.0/debian/copyright libdigidoc-3.7.0.875/debian/copyright --- libdigidoc-2.7.0/debian/copyright 2012-01-24 20:28:30.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/copyright 2012-12-17 00:12:33.000000000 +0000 @@ -1,29 +1,15 @@ -libdigidoc -- C++ library for processing .ddoc digital signatures +Copyright 2012 Estonian Information System's Authority -This package was debianized by Guido Tabbernuk on -Thu, 12 Jan 2012 15:13:46 +0200 - -It was downloaded from - -Copyrights: - - libdigidoc: - © 2010-2011 Veiko Sinivee - © 2010-2011 Martin Paljak - © 2010-2011 Raul Metsma - © 2010-2011 Kalev Lember - © 2010-2011 Antti Andreimann - debian/*: - © 2012 Martin-Éric Racine - © 2011 Guido Tabbernuk - © 2010 Kalev Lember - -License: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - -On Debian systems, the complete text of the GNU Lesser General Public -License can be found in . +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License with your system, in /usr/share/common-licenses/LGPL-2.1 +If not, see . diff -Nru libdigidoc-2.7.0/debian/libdigidoc-common.install libdigidoc-3.7.0.875/debian/libdigidoc-common.install --- libdigidoc-2.7.0/debian/libdigidoc-common.install 2012-01-26 17:50:58.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/libdigidoc-common.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -debian/tmp/etc -debian/tmp/usr/share diff -Nru libdigidoc-2.7.0/debian/libdigidoc-dev.install libdigidoc-3.7.0.875/debian/libdigidoc-dev.install --- libdigidoc-2.7.0/debian/libdigidoc-dev.install 2012-01-26 19:30:58.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/libdigidoc-dev.install 2012-12-17 00:12:33.000000000 +0000 @@ -1,4 +1,3 @@ -debian/tmp/usr/bin -debian/tmp/usr/include -debian/tmp/usr/lib/lib*.so -debian/tmp/usr/lib/pkgconfig +usr/include +usr/lib/pkgconfig +usr/lib/lib*.so diff -Nru libdigidoc-2.7.0/debian/libdigidoc2.install libdigidoc-3.7.0.875/debian/libdigidoc2.install --- libdigidoc-2.7.0/debian/libdigidoc2.install 2012-01-26 17:35:25.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/libdigidoc2.install 2012-12-17 00:12:33.000000000 +0000 @@ -1 +1,4 @@ -debian/tmp/usr/lib/*.so.* +debian/tmp/etc +usr/bin +usr/lib/lib*.so.* +usr/share/man diff -Nru libdigidoc-2.7.0/debian/patches/0001_new_EstEID_root_CA.patch libdigidoc-3.7.0.875/debian/patches/0001_new_EstEID_root_CA.patch --- libdigidoc-2.7.0/debian/patches/0001_new_EstEID_root_CA.patch 2012-03-07 01:05:21.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/patches/0001_new_EstEID_root_CA.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,178 +0,0 @@ -Description: new EstEID root CA certificate. -Author: Guido Tabbernuk ---- libdigidoc-2.7.0.orig/etc/digidoc.conf.cmake -+++ libdigidoc-2.7.0/etc/digidoc.conf.cmake -@@ -5,7 +5,7 @@ - - [ca] - CA_CERT_PATH=@DIGIDOC_DATA_DIR@/certs --CA_CERTS=8 -+CA_CERTS=11 - CA_CERT_1=JUUR-SK.crt - CA_CERT_1_CN=Juur-SK - CA_CERT_2=ESTEID-SK.crt -@@ -22,6 +22,12 @@ CA_CERT_7=EID-SK 2007.crt - CA_CERT_7_CN=EID-SK 2007 - CA_CERT_8=KLASS3-SK 2010.crt - CA_CERT_8_CN=KLASS3-SK 2010 -+CA_CERT_9=EECCRCA.crt -+CA_CERT_9_CN=EE Certification Centre Root CA -+CA_CERT_10=EID-SK 2011.crt -+CA_CERT_10_CN=EID-SK 2011 -+CA_CERT_11=ESTEID-SK 2011.crt -+CA_CERT_11_CN=ESTEID-SK 2011 - - - DIGIDOC_FORMAT=DIGIDOC-XML -@@ -37,7 +43,7 @@ DIGIDOC_SIGNATURE_SLOT=1 - SIGN_OCSP=0 - USE_PROXY=0 - --DIGIDOC_OCSP_RESPONDER_CERTS=11 -+DIGIDOC_OCSP_RESPONDER_CERTS=14 - - DIGIDOC_OCSP_RESPONDER_CERT_1=TEST-SK OCSP 2005.crt - DIGIDOC_OCSP_RESPONDER_CERT_1_CN=TEST-SK OCSP RESPONDER 2005 -@@ -96,5 +102,20 @@ DIGIDOC_OCSP_RESPONDER_CERT_11_CN=KLASS3 - DIGIDOC_OCSP_RESPONDER_CERT_11_CA=KLASS3-SK 2010 - DIGIDOC_OCSP_RESPONDER_CERT_11_URL=http://ocsp.sk.ee - -+DIGIDOC_OCSP_RESPONDER_CERT_12=SK OCSP 2011.crt -+DIGIDOC_OCSP_RESPONDER_CERT_12_CN=SK OCSP RESPONDER 2011 -+DIGIDOC_OCSP_RESPONDER_CERT_12_CA=EE Certification Centre Root CA -+DIGIDOC_OCSP_RESPONDER_CERT_12_URL=http://ocsp.sk.ee -+ -+DIGIDOC_OCSP_RESPONDER_CERT_13=SK OCSP 2011.crt -+DIGIDOC_OCSP_RESPONDER_CERT_13_CN=SK OCSP RESPONDER 2011 -+DIGIDOC_OCSP_RESPONDER_CERT_13_CA=ESTEID-SK 2011 -+DIGIDOC_OCSP_RESPONDER_CERT_13_URL=http://ocsp.sk.ee -+ -+DIGIDOC_OCSP_RESPONDER_CERT_14=SK OCSP 2011.crt -+DIGIDOC_OCSP_RESPONDER_CERT_14_CN=SK OCSP RESPONDER 2011 -+DIGIDOC_OCSP_RESPONDER_CERT_14_CA=EID-SK 2011 -+DIGIDOC_OCSP_RESPONDER_CERT_14_URL=http://ocsp.sk.ee -+ - #DIGIDOC_OCSP_URL=http://www.openxades.org/cgi-bin/ocsp.cgi - DIGIDOC_OCSP_URL=http://ocsp.sk.ee ---- /dev/null -+++ libdigidoc-2.7.0/etc/certs/SK OCSP 2011.crt -@@ -0,0 +1,28 @@ -+-----BEGIN CERTIFICATE----- -+MIIEvDCCA6SgAwIBAgIQcpyVmdruRVxNgzI3N/NZQTANBgkqhkiG9w0BAQUFADB1 -+MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -+czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -+CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMjE0M1oXDTI0MDMxODEw -+MjE0M1owgZ0xCzAJBgNVBAYTAkVFMQ4wDAYDVQQIEwVIYXJqdTEQMA4GA1UEBxMH -+VGFsbGlubjEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czENMAsG -+A1UECxMET0NTUDEfMB0GA1UEAxMWU0sgT0NTUCBSRVNQT05ERVIgMjAxMTEYMBYG -+CSqGSIb3DQEJARYJcGtpQHNrLmVlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -+CgKCAQEAihvGyhMVrgReHluKln1za6gvCE/mlSREmWjJFpL9llvuEUZoPFIypYA8 -+g5u1VfgkeW5gDq25jAOq4FyXeDGIa+pJn2h0o2Wc2aeppVG/emfGm/jA8jjeyMrw -+H8fAJrqVQ7c9X2xSwJEch/P2d8CfMZt5YF6gqLtPvG1b+n6otBZA5wjIFfJ/inJB -+MUvqHSz3+PLfxO2/T3Wyk/c8M9HIMqTelqyiMGRgWehiU1OsL9armv3dQrHs1wm6 -+vHaxfpfWB9YAFpeo9aYqhPCxVt/zo2NQB6vxyZS0hsOrXL7SxRToOJaqsnvlbf0e -+rPPFtRHUvbojYYgl+fzlz0Jt6QJoNwIDAQABo4IBHTCCARkwEwYDVR0lBAwwCgYI -+KwYBBQUHAwkwHQYDVR0OBBYEFKWhSGFt537NmJ50nCm7vYrecgxZMIGCBgNVHSAE -+ezB5MHcGCisGAQQBzh8EAQIwaTA+BggrBgEFBQcCAjAyHjAAUwBLACAAdABpAG0A -+ZQAgAHMAdABhAG0AcABpAG4AZwAgAHAAbwBsAGkAYwB5AC4wJwYIKwYBBQUHAgEW -+G2h0dHBzOi8vd3d3LnNrLmVlL2FqYXRlbXBlbDAfBgNVHSMEGDAWgBQS8lo+6lYc -+v80GrPHxJcmpS9QUmTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vd3d3LnNrLmVl -+L3JlcG9zaXRvcnkvY3Jscy9lZWNjcmNhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEA -+w2sKwvTHtYGtD8Jw9mNUuj/mWiBSBEBeY2LhW8V6tjBPAPp3s6iWOh0FbVR2LUyr -+qRwgT3fyWiGsiDm/6cIqM+IblLp/8ztfRQjquhW6XCD9SK02OQ9ZSdBwcmoAApZL -+GXQC34wdgmV/hLTTNxONnDACBKz9U+Dy9a4ZT4tpNkbH8jq/BMne8FzbvRt1bjpX -+BP7gjLX+zdx8/hp0Wq4tD+f9NVX0+vm9ahEKuzx4QzPnSB7hhWM9OnLZT7noRQa+ -+KWk5c+e5VoR5R2t7MjVl8Cd+2llxiSxqMSbU5/23BzAKgN+NQdrBZAzpZ7lfaAuL -+FaICP+bAm6uW2JUrM6abOw== -+-----END CERTIFICATE----- ---- /dev/null -+++ libdigidoc-2.7.0/etc/certs/ESTEID-SK 2011.crt -@@ -0,0 +1,29 @@ -+-----BEGIN CERTIFICATE----- -+MIIFBTCCA+2gAwIBAgIQKVKTqv2MxtRNgzCjwmRRDTANBgkqhkiG9w0BAQUFADB1 -+MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -+czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -+CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMTQ1OVoXDTI0MDMxODEw -+MTQ1OVowZDELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2Vlcmlt -+aXNrZXNrdXMxFzAVBgNVBAMMDkVTVEVJRC1TSyAyMDExMRgwFgYJKoZIhvcNAQkB -+Fglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCz6Xxs -+Zh6r/aXcNe3kSpNMOqmQoAXUpzzcr4ZSaGZh/7JHIiplvNi6tbW/lK7sAiRsb65K -+zMWROEauld66ggbDPga6kU97C+AXGu7+DROXstjUOv6VlrHZVAnLmIOkycpWaxjM -++EfQPZuDxEbkw96B3/fG69Zbp3s9y6WEhwU5Y9IiQl8YTkGnNUxidQbON1BGQm+H -+VEsgTf22J6r6G3FsE07rnMNskNC3DjuLSCUKF4kH0rVGVK9BdiCdFaZjHEykjwjI -+GzqnyxyRKe4YbJ6B9ABm95eSFgMBHtZEYU+q0VUIQGhAGAurOTXjWi1TssA42mnL -+GQZEI5GXMXtabp51AgMBAAGjggGgMIIBnDASBgNVHRMBAf8ECDAGAQH/AgEAMA4G -+A1UdDwEB/wQEAwIBBjCB9gYDVR0gBIHuMIHrMIHoBgsrBgEEAc4fZAEBATCB2DCB -+sgYIKwYBBQUHAgIwgaUegaIASwBhAHMAdQB0AGEAdABhAGsAcwBlACAAaQBzAGkA -+awB1AHQAdAD1AGUAbgBkAGEAdgBhAGwAZQAgAGQAbwBrAHUAbQBlAG4AZABpAGwA -+ZQAgAGsAYQBuAHQAYQB2AGEAdABlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0AGkA -+ZABlACAAdgDkAGwAagBhAHMAdABhAG0AaQBzAGUAawBzAC4wIQYIKwYBBQUHAgEW -+FWh0dHBzOi8vd3d3LnNrLmVlL0NQUzAdBgNVHQ4EFgQUe2ryVVBcuNl6CIdBrvqi -+Kz1bV3YwHwYDVR0jBBgwFoAUEvJaPupWHL/NBqzx8SXJqUvUFJkwPQYDVR0fBDYw -+NDAyoDCgLoYsaHR0cDovL3d3dy5zay5lZS9yZXBvc2l0b3J5L2NybHMvZWVjY3Jj -+YS5jcmwwDQYJKoZIhvcNAQEFBQADggEBAKC4IN3FC2gVDIH05TNMgFrQOCGSnXhz -+oJclRLoQ81BCOXTZI4qn7N74FHEnrAy6uNG7SS5qANqSaPIL8dp63jg/L4qn4iWa -+B5q5GGJOV07SnTHS7gUrqChGClnUeHxiZbL13PkP37Lnc+TKl1SKfgtn5FbH5cqr -+hvbA/VF3Yzlimu+L7EVohW9HKxZ//z8kDn6ieiPFfZdTOov/0eXVLlxqklybUuS6 -+LYRRDiqQupgBKQBTwNbC8x0UHX00HokW+dCVcQvsUbv4xLhRq/MvyTthE+RdbkrV -+0JuzbfZvADfj75nA3+ZAzFYS5ZpMOjZ9p4rQVKpzQTklrF0m6mkdcEo= -+-----END CERTIFICATE----- ---- /dev/null -+++ libdigidoc-2.7.0/etc/certs/EID-SK 2011.crt -@@ -0,0 +1,29 @@ -+-----BEGIN CERTIFICATE----- -+MIIFADCCA+igAwIBAgIQQyvUTmJDa0ZNgy+/fS0vWjANBgkqhkiG9w0BAQUFADB1 -+MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -+czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -+CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMTExMVoXDTI0MDMxODEw -+MTExMVowYTELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2Vlcmlt -+aXNrZXNrdXMxFDASBgNVBAMMC0VJRC1TSyAyMDExMRgwFgYJKoZIhvcNAQkBFglw -+a2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2Q1zKMt7D -+ytbntSLoYAAVkEwV+5djSr0vSIG/Zm9seKyx+2PY8sVzXRoUD1CMIYnstDhBSKMj -+n2/+HpA7pOipAIAMrk6uKnpSTTdFbQ+0fzJVPokBgsdsQ6R5TZFPB1nu5zgRRlQm -+WIFxOpDiNHTt0LObUhWLXzUb31vc1Wmao2IYcDx1TCs/1E9+camiCl2B5lXrPEU3 -+wBq4waD54izS20DK05+6+hHRg+TqoIg5YSmwbjStEyd/8AQeokwVloyyH49bnpel -+uADcZJgxxE9ZUvVWHoxYfmg1IeRU72jHTcIjNf1cQN2+9/FtHQMnGzDBgmAPpghw -+Wr3JtW0JWvMXAgMBAAGjggGeMIIBmjASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1Ud -+DwEB/wQEAwIBBjCB9AYDVR0gBIHsMIHpMIHmBgsrBgEEAc4fZAEBATCB1jCBsAYI -+KwYBBQUHAgIwgaMegaAASwBhAHMAdQB0AGEAdABhAGsAcwBlACAAZgD8APwAcwBp -+AGwAaQBzAHQAZQBsAGUAIABpAHMAaQBrAHUAdABlAGwAZQAgAHMAZQByAHQAaQBm -+AGkAawBhAGEAdABpAGQAZQAgAHYA5ABsAGoAYQBzAHQAYQBtAGkAcwBlAGsAcwAg -+AGsAbwBtAG0AZQByAHQAcwBhAGwAdQBzAGUAbAAuMCEGCCsGAQUFBwIBFhVodHRw -+czovL3d3dy5zay5lZS9DUFMwHQYDVR0OBBYEFLEQlwL63YbGeEGkwzKI+/4f58AF -+MB8GA1UdIwQYMBaAFBLyWj7qVhy/zQas8fElyalL1BSZMD0GA1UdHwQ2MDQwMqAw -+oC6GLGh0dHA6Ly93d3cuc2suZWUvcmVwb3NpdG9yeS9jcmxzL2VlY2NyY2EuY3Js -+MA0GCSqGSIb3DQEBBQUAA4IBAQAxau3ohdFkpvaiVUR7arNovQUZRCG9Ge3udqHY -+emovyU7N60Hgomc/ZG+uunScATTUhBcv9a5zkQxb1dQ1LYDRfNr9CqI0QvSEE4t9 -+Sfu3fOhyLrlmb3s8xhhYLJBJ325uDvtO/qFeXLlcRXMF5nU8FE2IyaZP1CHYKVh5 -+QNPPQiGZGSox5oOkCvmt4lUl4lZUwVie75us/WtrD6DJeREBTEDHORIfg8E9RA1y -+/7t2gT9vrU8tabeSZlD03qwXe0nJ9RscI/P0HT8vuo1PGzCfbH9xFqfoZ2jdJ0Hz -+xrFM8VsL/AtCw0dmrxRHLlZzqSw0G7b0W40mwOQauO2gbMfn -+-----END CERTIFICATE----- ---- /dev/null -+++ libdigidoc-2.7.0/etc/certs/EECCRCA.crt -@@ -0,0 +1,24 @@ -+-----BEGIN CERTIFICATE----- -+MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1 -+MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 -+czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG -+CSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIwMTAxMDMwMTAxMDMwWhgPMjAzMDEy -+MTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNl -+ZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBS -+b290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEB -+AQUAA4IBDwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUy -+euuOF0+W2Ap7kaJjbMeMTC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvO -+bntl8jixwKIy72KyaOBhU8E2lf/slLo2rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIw -+WFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw93X2PaRka9ZP585ArQ/d -+MtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtNP2MbRMNE -+1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYD -+VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/ -+zQas8fElyalL1BSZMEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYB -+BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEF -+BQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+RjxY6hUFaTlrg4wCQiZrxTFGGV -+v9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqMlIpPnTX/dqQG -+E5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u -+uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIW -+iAYLtqZLICjU3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/v -+GVCJYMzpJJUPwssd8m92kMfMdcGWxZ0= -+-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/debian/patches/series libdigidoc-3.7.0.875/debian/patches/series --- libdigidoc-2.7.0/debian/patches/series 2012-03-07 01:03:46.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -0001_new_EstEID_root_CA.patch diff -Nru libdigidoc-2.7.0/debian/rules libdigidoc-3.7.0.875/debian/rules --- libdigidoc-2.7.0/debian/rules 2012-01-27 15:37:24.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/rules 2012-12-17 00:12:33.000000000 +0000 @@ -1,20 +1,4 @@ #!/usr/bin/make -f -# [debian/rules] for libdigidoc -# -# COPYRIGHT © 2012 Guido Tabbernuk -# -# LICENSE -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# include /usr/share/cdbs/1/rules/debhelper.mk -include /usr/share/cdbs/1/rules/utils.mk include /usr/share/cdbs/1/class/cmake.mk - -DEB_CMAKE_EXTRA_FLAGS += -DSYSCONF_INSTALL_DIR=/etc - -common-binary-post-install-arch:: list-missing - -#EOF +DEB_CMAKE_EXTRA_FLAGS = -DCMAKE_INSTALL_SYSCONFDIR="/etc" -DCMAKE_INSTALL_LIBDIR="lib" diff -Nru libdigidoc-2.7.0/debian/source/format libdigidoc-3.7.0.875/debian/source/format --- libdigidoc-2.7.0/debian/source/format 2012-12-21 05:12:38.996166547 +0000 +++ libdigidoc-3.7.0.875/debian/source/format 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -3.0 (quilt) diff -Nru libdigidoc-2.7.0/debian/watch libdigidoc-3.7.0.875/debian/watch --- libdigidoc-2.7.0/debian/watch 2012-01-12 07:12:50.000000000 +0000 +++ libdigidoc-3.7.0.875/debian/watch 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -version=3 -http://esteid.googlecode.com/files/libdigidoc-([\d\.]+)\.tar\.bz2 \ - debian uupdate --no-symlink - diff -Nru libdigidoc-2.7.0/digidoccom/CMakeLists.txt libdigidoc-3.7.0.875/digidoccom/CMakeLists.txt --- libdigidoc-2.7.0/digidoccom/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/CMakeLists.txt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,16 @@ +add_definitions( + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_WARNINGS + -D_UNICODE -DUNICODE +) + +add_executable( digidoccom digidoccom.cpp ) +target_link_libraries( digidoccom digidoc comsuppw ) + +install( TARGETS digidoccom + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff -Nru libdigidoc-2.7.0/digidoccom/Resource.h libdigidoc-3.7.0.875/digidoccom/Resource.h --- libdigidoc-2.7.0/digidoccom/Resource.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/Resource.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by DigiDocLibCOM.rc +// +#define IDS_PROJNAME 100 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 123 +#endif +#endif diff -Nru libdigidoc-2.7.0/digidoccom/digidoccom.cpp libdigidoc-3.7.0.875/digidoccom/digidoccom.cpp --- libdigidoc-2.7.0/digidoccom/digidoccom.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/digidoccom.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,1524 @@ +// digidoccom.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +#include "stdio.h" +#include "comutil.h" +#include "libdigidoccom\DigiDocLibCOM_h.h" +#include "config.h" +#include +#include +//#include +#include +#include +#include +#include +#include +#include + +//==========< global constants >==================== +char* p_szInFile = 0; +char* p_szOutFile = 0; +char* g_szProgNameVer = "digidoccom|"DIGIDOC_VERSION; +boolean g_bDdocExists = FALSE; +CLSID g_clsid; +IDispatch *g_pDis = NULL; +IComDigiDocLib *g_pLib = NULL; +IComSignedDoc *g_pSigDoc = NULL; + +//==========< helper functions for argument handling >==================== + +//-------------------------------------------------- +// Converts input data to UTF-8 +// src - input data +// returns converted string or NULL. Caller must free it. +//-------------------------------------------------- +int convertInput(const char* src, char** dest) +{ + int l1, err = 0; + + *dest = 0; + l1 = strlen(src) * 2 + 3; + *dest = (char*)malloc(l1); + if(*dest) { + memset(*dest, 0, l1); + err = oem2utf8(src, *dest, l1); + //strncpy(*dest, src, l1); + } + return err; +} + +//-------------------------------------------------- +// Handles one argument +//-------------------------------------------------- +int checkArguments(int argc, _TCHAR* argv[], int* pCounter, char** dest) +{ + int nLen = 0; + + CW2A pszA(argv[(*pCounter)+1]); + if(argc > (*pCounter)+1 && pszA[0] != '-') { + nLen = strlen(pszA) * 2; + convertInput(pszA, dest); + (*pCounter)++; + } + return nLen; +} + +//-------------------------------------------------- +// checks the existence of one command line argument +//-------------------------------------------------- +int hasCmdLineArg(int argc, _TCHAR* argv[], const char* argName) +{ + int i; + + for(i = 1; i < argc; i++) { + CW2A pszA(argv[i]); + if(pszA != NULL && pszA[0] == '-' && + !strcmp(pszA, argName)) { + return i; + } + } + return 0; +} + +//-------------------------------------------------- +// Returns the value of one command line argument +//-------------------------------------------------- +int checkCmdLineArg(int argc, _TCHAR* argv[], const char* argName, char** dest) +{ + int i; + + *dest = 0; // mark as not found + for(i = 1; i < argc; i++) { + CW2A pszA(argv[i]); + if(pszA != NULL && pszA[0] == '-' && + !strcmp(pszA, argName)) { + if(i + 1 < argc) { + CW2A pszB(argv[i+1]); + if(pszB[0] != '-') { + convertInput(pszB, dest); + return 0; + } + } + else + return -1; + } + } + return 0; // not found but no error +} + +//-------------------------------------------------- +// prints usage statement +//-------------------------------------------------- +void printUsage() +{ + fprintf(stderr, "USAGE: digidoccom [-in ] [-out ]\n"); + fprintf(stderr, "COMMANDS:\n"); + fprintf(stderr, "\t[-new] [format] [version]\n"); + //fprintf(stderr, "\t-check-cert <-cerificate-file-name (PEM format)>\n"); + fprintf(stderr, "\t-add []\n"); + fprintf(stderr, "\t-verify \n"); + fprintf(stderr, "\t-list \n"); + fprintf(stderr, "\t-sign [ [[[] [ ]]]\n"); + fprintf(stderr, "\t-extract \n"); + fprintf(stderr, "\t-list-certs \n"); + /*fprintf(stderr, "\t-encrypt \n"); + fprintf(stderr, "\t-encrypt-sk \n"); + fprintf(stderr, "\t-encrecv [] [] []\n"); + fprintf(stderr, "\t-decrypt [pkcs12-file] [slot(0)]\n"); + fprintf(stderr, "\t-decrypt-sk [pkcs12-file] [slot(0)]\n"); + fprintf(stderr, "\t-denc-list \n"); + fprintf(stderr, "\t-encrypt-file []\n"); + fprintf(stderr, "\t-decrypt-file [pkcs12-file]\n"); + */ +} + +//-------------------------------------------------- +// Checks program runtime arguments +//-------------------------------------------------- +int checkProgArguments(int argc, _TCHAR* argv[]) +{ + int err = 0; + + // -?, -help -> print usage + if(!err && (hasCmdLineArg(argc, argv, "-?") || + hasCmdLineArg(argc, argv, "-help"))) + printUsage(); + // -in + if(!err) + if((err = checkCmdLineArg(argc, argv, "-in", &p_szInFile)) != 0) { + printf("Missing or invalid input file name\n"); + err = -1; + } + // -out + if(!err) + if((err = checkCmdLineArg(argc, argv, "-out", &p_szOutFile)) != 0) { + printf("Missing or invalid output file name\n"); + err = -1; + } + // -encrypt + /*if(!err && hasCmdLineArg(argc, argv, "-encrypt")) + if((err = checkCmdLineArg(argc, argv, "-encrypt", &p_szInEncFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid encrypt input file name"); + // -encrypt-sk + if(!err && hasCmdLineArg(argc, argv, "-encrypt-sk")) + if((err = checkCmdLineArg(argc, argv, "-encrypt-sk", &p_szInEncFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid encrypt input file name"); + // -config + if(!err) + if((err = checkCmdLineArg(argc, argv, "-config", &p_szConfigFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid configuration file name");*/ + return err; +} + +//==========< COM handlers >==================== + +int comConnect() +{ + HRESULT hr = CoInitialize(NULL); + if(FAILED(hr)) { + printf("Failed to init com system %d\n", hr); + return -1; + } + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComDigiDocLib"), &g_clsid); + //printf("clsid hr %d\n", hr); + if(FAILED(hr)) { + printf("Failed to find clsid of digidoccom %d\n", hr); + return -1; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComDigiDocLib), (LPVOID *)&g_pLib); + if(FAILED(hr)) { + printf("Failed to connect to CComDigiDocLib %d\n", hr); + return -1; + } + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComSignedDoc"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comsigneddoc %d\n", hr); + return -1; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComSignedDoc), (LPVOID *)&g_pSigDoc); + if(FAILED(hr)) { + printf("Failed to connect to CComSignedDoc %d\n", hr); + return -1; + } + return 0; +} + +int comDisconnect() +{ + // cleanup + if(g_pSigDoc) + g_pSigDoc->Release(); + if(g_pLib) + g_pLib->Release(); + CoUninitialize(); + return 0; +} + +int comGetLibName(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR libName; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pLib->getLibName(&libName); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(libName); + ::SysFreeString(libName); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetLibVer(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR libVer; + char *p1 = 0, *p2 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pLib->getLibVersion(&libVer); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(libVer); + ::SysFreeString(libVer); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetComVer(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR comVer; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pLib->getComVersion(&comVer); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(comVer); + ::SysFreeString(comVer); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comSetClientNameVer(char* pBuf) +{ + HRESULT hr = 0; + BSTR bstr = _com_util::ConvertStringToBSTR(pBuf); + hr = g_pLib->SetClientNameVersion(bstr); + ::SysFreeString(bstr); + if(FAILED(hr)) return -2; + return 0; +} + +int comSetDebugFilePath(char* pBuf) +{ + HRESULT hr = 0; + BSTR bstr = _com_util::ConvertStringToBSTR(pBuf); + hr = g_pLib->put_DebugFilePath(bstr); + ::SysFreeString(bstr); + if(FAILED(hr)) return -2; + return 0; +} + +int comSetDebugLevel(long l) +{ + HRESULT hr = 0; + hr = g_pLib->put_DebugLevel(l); + if(FAILED(hr)) return -2; + return 0; +} + +int comReadSignedDoc(char* szFileName) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR fname = _com_util::ConvertStringToBSTR(szFileName); + hr = g_pSigDoc->readSignedDoc(fname, 0, 0, &lErr); + ::SysFreeString(fname); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comWriteSignedDoc(char* szOldFile, char* szNewFile) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR oname = _com_util::ConvertStringToBSTR(szOldFile); + BSTR nname = _com_util::ConvertStringToBSTR(szNewFile); + //printf("Writing %s - %s sigdoc: %ld\n", szOldFile, szNewFile, g_pSigDoc); + hr = g_pSigDoc->createSignedDoc(nname, oname, &lErr); + //printf("Wrote\n"); + ::SysFreeString(oname); + ::SysFreeString(nname); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comExtractDataFile(char* szFileName, char* sDocId, char* szDataFileName) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR fname = _com_util::ConvertStringToBSTR(szFileName); + BSTR docId = _com_util::ConvertStringToBSTR(sDocId); + BSTR docName = _com_util::ConvertStringToBSTR(szDataFileName); + BSTR charset = _com_util::ConvertStringToBSTR("UTF-8"); + hr = g_pLib->extractDataFile(g_pSigDoc, fname, docName, docId,charset,&lErr); + ::SysFreeString(fname); + ::SysFreeString(docId); + ::SysFreeString(docName); + ::SysFreeString(charset); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comNewSignedDoc(char* szFormat, char* szVer) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR format = _com_util::ConvertStringToBSTR(szFormat); + BSTR ver = _com_util::ConvertStringToBSTR(szVer); + hr = g_pSigDoc->initialize(format, ver); + ::SysFreeString(format); + ::SysFreeString(ver); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comGetSigDocFormat(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pSigDoc->get_szFormat(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetSigDocVer(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pSigDoc->get_szFormatVer(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetErrors(char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = g_pLib->CollectErrors(); + hr = g_pLib->DigiDocErrors(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comCleanErrors() +{ + HRESULT hr = 0; + hr = g_pLib->ClearDigiDocErrors(); + return (int)hr; +} + +int comVerifySignedDoc(char* szDataFileName) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR fname = _com_util::ConvertStringToBSTR(szDataFileName); + hr = g_pSigDoc->verifySigDoc(fname, &lErr); + ::SysFreeString(fname); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comVerifySignature(IComSignatureInfo *pSigInfo, char* szDataFileName) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR fname = _com_util::ConvertStringToBSTR(szDataFileName); + hr = g_pSigDoc->verifySignatureInfo(pSigInfo, fname, &lErr); + ::SysFreeString(fname); + if(FAILED(hr)) return -2; + return (int)lErr; +} + +int comCountDataFiles() +{ + HRESULT hr = 0; + long l = 0; + hr = g_pSigDoc->get_nDataFiles(&l); + if(FAILED(hr)) return -2; + return (int)l; +} + +IComDataFile* comGetDataFile(int nIdx) +{ + IComDataFile* pDf = NULL; + HRESULT hr = 0; + long l = 0; + + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComDataFile"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comdatafile %d\n", hr); + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComDataFile), (LPVOID *)&pDf); + if(FAILED(hr)) { + printf("Failed to connect to CComDataFile %d\n", hr); + return NULL; + } + hr = g_pSigDoc->getDataFile(nIdx, pDf); + if(FAILED(hr)) { + printf("Failed to get CComDataFile %d - %d\n", nIdx, hr); + return NULL; + } + if(FAILED(hr)) return NULL; + return pDf; +} + +IComDataFile* comAddDataFile(char* szFileName, char* szMimeType, char* szContentType) +{ + IComDataFile* pDf = NULL; + HRESULT hr = 0; + long l = 0; + VARIANT vDig; + + BSTR fname = _com_util::ConvertStringToBSTR(szFileName); + BSTR mime = _com_util::ConvertStringToBSTR(szMimeType); + BSTR content = _com_util::ConvertStringToBSTR(szContentType); + BSTR dType = _com_util::ConvertStringToBSTR(""); + BSTR charset = _com_util::ConvertStringToBSTR("UTF-8"); + V_VT(&vDig)= VT_EMPTY; + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComDataFile"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comdatafile %d\n", hr); + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComDataFile), (LPVOID *)&pDf); + if(FAILED(hr)) { + printf("Failed to connect to CComDataFile %d\n", hr); + return NULL; + } + // convert fname to UTF-8 + //printf("Original filename: %s, len: %s\n", szFileName, strlen(szFileName)); + hr = g_pSigDoc->createDataFile(fname, content, mime, 0, vDig, 0, dType,charset,pDf); + ::SysFreeString(fname); + ::SysFreeString(content); + ::SysFreeString(mime); + ::SysFreeString(dType); + ::SysFreeString(charset); + if(FAILED(hr)) { + printf("Failed to create CComDataFile %s / %s / %s - %d\n", szFileName, szMimeType, szContentType, hr); + return NULL; + } + if(FAILED(hr)) return NULL; + return pDf; +} + +int comCalcDataFileSizeAndDigest(char* szId, char* szFileName) +{ + HRESULT hr = 0; + long lErr = 0; + BSTR fname = _com_util::ConvertStringToBSTR(szFileName); + BSTR id = _com_util::ConvertStringToBSTR(szId); + hr = g_pSigDoc->calculateDataFileSizeAndDigest(id, fname, 0, &lErr); + ::SysFreeString(fname); + ::SysFreeString(id); + if(FAILED(hr)) { + printf("Failed to calc CComDataFile %s / %s - %d\n", szId, szFileName, hr); + return NULL; + } + return (int)lErr; +} + +int comGetDataFileId(IComDataFile* pDf, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pDf->get_szId(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetDataFileFileName(IComDataFile* pDf, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pDf->get_szFileName(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetDataFileMimeType(IComDataFile* pDf, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pDf->get_szMimeType(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetDataFileContentType(IComDataFile* pDf, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pDf->get_szContentType(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetDataFileSize(IComDataFile* pDf, long *pL) +{ + HRESULT hr = 0; + if(!pL) return -1; + hr = pDf->get_nSize(pL); + if(FAILED(hr)) return -2; + return 0; +} + + +int comCountSignatures() +{ + HRESULT hr = 0; + long l = 0; + hr = g_pSigDoc->get_nSignatures(&l); + if(FAILED(hr)) return -2; + return (int)l; +} + + +IComSignatureInfo* comGetSignature(int nIdx) +{ + IComSignatureInfo* pSig = NULL; + HRESULT hr = 0; + long l = 0; + + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComSignatureInfo"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comsignature %d\n", hr); + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComSignatureInfo), (LPVOID *)&pSig); + if(FAILED(hr)) { + printf("Failed to connect to CComSignatureInfo %d\n", hr); + return NULL; + } + hr = g_pSigDoc->getSignature(nIdx, pSig); + if(FAILED(hr)) { + printf("Failed to get CComSignatureInfo %d - %d\n", nIdx, hr); + return NULL; + } + return pSig; +} + +int comGetSignatureId(IComSignatureInfo* pSig, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pSig->get_szId(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetSignatureTime(IComSignatureInfo* pSig, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf) return -1; + memset(pBuf, 0, nLen); + hr = pSig->get_szTimeStamp(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetSignatureCertHandle(IComSignatureInfo* pSig, long *pL) +{ + HRESULT hr = 0; + if(!pL) return -1; + hr = pSig->getSignCertData(pL); + if(FAILED(hr)) return -2; + return 0; +} + +int comGetCertNotAfter(long hCert, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + long lRet = 0; + char *p1 = 0; + if(!pBuf || !hCert) return -1; + hr = g_pLib->getCertNotAfter(g_pSigDoc, hCert, &bstr, &lRet); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetCertNotBefore(long hCert, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + long lRet = 0; + char *p1 = 0; + if(!pBuf || !hCert) return -1; + hr = g_pLib->getCertNotBefore(g_pSigDoc, hCert, &bstr, &lRet); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetCertSubject(long hCert, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + long lRet = 0; + char *p1 = 0; + if(!pBuf || !hCert) return -1; + hr = g_pLib->getCertSubjectName(hCert, &bstr, &lRet); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetCertIssuer(long hCert, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + long lRet = 0; + char *p1 = 0; + if(!pBuf || !hCert) return -1; + hr = g_pLib->getCertIssuerName(hCert, &bstr, &lRet); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetCertSerial(long hCert, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + long lRet = 0; + char *p1 = 0; + if(!pBuf || !hCert) return -1; + hr = g_pLib->getCertSerialNumber(hCert, &bstr, &lRet); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + + + + +int comCountNotaries() +{ + HRESULT hr = 0; + long l = 0; + hr = g_pSigDoc->get_nNotaries(&l); + if(FAILED(hr)) return -2; + return (int)l; +} + +IComNotaryInfo* comGetNotary(int nIdx) +{ + IComNotaryInfo* pNot = NULL; + HRESULT hr = 0; + long l = 0; + + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComNotaryInfo"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comnotary %d\n", hr); + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComNotaryInfo), (LPVOID *)&pNot); + if(FAILED(hr)) { + printf("Failed to connect to CComNotaryInfo %d\n", hr); + return NULL; + } + hr = g_pSigDoc->getNotaryInfo(nIdx, pNot); + if(FAILED(hr)) { + printf("Failed to get CComNotaryInfo %d - %d\n", nIdx, hr); + return NULL; + } + return pNot; +} + +IComNotaryInfo* comGetNotaryWithSigId(const char* szSigId) +{ + IComNotaryInfo* pNot = NULL; + HRESULT hr = 0; + long l = 0; + BSTR bstr = _com_util::ConvertStringToBSTR(szSigId); + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComNotaryInfo"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comnotary %d\n", hr); + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComNotaryInfo), (LPVOID *)&pNot); + if(FAILED(hr)) { + printf("Failed to connect to CComNotaryInfo %d\n", hr); + return NULL; + } + hr = g_pSigDoc->getNotaryWithSigId(bstr, pNot); + ::SysFreeString(bstr); + if(FAILED(hr)) { + printf("Failed to get CComNotaryInfo for sig %S - %d\n", szSigId, hr); + return NULL; + } + return pNot; +} + +int comGetNotaryId(IComNotaryInfo* pNot, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf || !pNot) return -1; + hr = pNot->get_szId(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetNotaryResponderIdType(IComNotaryInfo* pNot, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf || !pNot) return -1; + hr = pNot->get_szRespIdType(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetNotaryResponderIdName(IComNotaryInfo* pNot, char* pBuf, int* pLen) +{ + HRESULT hr = 0; + VARIANT vt; + if(!pBuf || !pNot || !pLen) return -1; + int n = *pLen; + memset(pBuf, 0, *pLen); + hr = pNot->get_baRespId(&vt); + if(FAILED(hr)) return -2; + SAFEARRAY* pArr = V_ARRAY(&vt); + byte HUGEP* pData = 0; + if(vt.vt == 8209) { + *pLen = pArr->rgsabound->cElements; + if (*pLen > 0 && *pLen < n) { + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + memcpy(pBuf, pData, *pLen); + SafeArrayUnaccessData(pArr); + } + } + return 0; +} + +int comGetNotaryTimeProduced(IComNotaryInfo* pNot, char* pBuf, int nLen) +{ + HRESULT hr = 0; + BSTR bstr; + char *p1 = 0; + if(!pBuf || !pNot) return -1; + hr = pNot->get_timeProduced(&bstr); + if(FAILED(hr)) return -2; + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + strncpy(pBuf, p1, nLen); + delete [] p1; + return 0; +} + +int comGetNotaryCertHandle(IComNotaryInfo* pNot, long *pL) +{ + HRESULT hr = 0; + if(!pL) return -1; + hr = pNot->getNotCertData(pL); + if(FAILED(hr)) return -2; + return 0; +} + +IComSignatureInfo* comSign(const char* pin, const char* manifest, + const char* city, const char* state, const char* zip, const char* country, + const char* p12file, const char* p12pswd, const char* ocspUrl, + const char* proxyHost, const char* proxyPort, int *pErr) +{ + IComSignatureInfo* pSig = NULL; + HRESULT hr = 0; + long l = 0; + + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComSignatureInfo"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comsignature %d\n", hr); + *pErr = -1; + return NULL; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComSignatureInfo), (LPVOID *)&pSig); + if(FAILED(hr)) { + printf("Failed to connect to CComSignatureInfo %d\n", hr); + *pErr = -1; + return NULL; + } + hr = g_pSigDoc->createSignatureInfo(pSig); + if(FAILED(hr)) { + printf("Failed to create CComSignatureInfo %d\n", hr); + *pErr = -1; + return NULL; + } + g_pSigDoc->addAllDocInfos(pSig); + // add manifest + if(manifest) { + VARIANT tfCertified, tfEncode; + BSTR bRole = _com_util::ConvertStringToBSTR(manifest); + V_BOOL(&tfCertified) = FALSE; + V_BOOL(&tfEncode) = FALSE; + *pErr = pSig->addSignerRole(tfCertified, bRole, tfEncode); + ::SysFreeString(bRole); + } + // add address + if(city || state || zip || country) { + BSTR bCity = _com_util::ConvertStringToBSTR(city); + BSTR bState = _com_util::ConvertStringToBSTR(state); + BSTR bZip = _com_util::ConvertStringToBSTR(zip); + BSTR bCountry = _com_util::ConvertStringToBSTR(country); + *pErr = pSig->setSignatureProductionPlace(bCity, bState, bZip, bCountry); + ::SysFreeString(bCity); + ::SysFreeString(bState); + ::SysFreeString(bZip); + ::SysFreeString(bCountry); + } + + // sign with CSP + BSTR bPin = _com_util::ConvertStringToBSTR(pin); + pSig->calculateSignatureWithCSPEstID(g_pSigDoc, 0, bPin, &l); + ::SysFreeString(bPin); + *pErr = (int)l; + // get confirmation + if(pSig && !(*pErr)) { + BSTR bPkcs12 = _com_util::ConvertStringToBSTR(p12file); + BSTR bP12Passwd = _com_util::ConvertStringToBSTR(p12pswd); + BSTR bUrl = _com_util::ConvertStringToBSTR(ocspUrl); + BSTR bProxyHost = _com_util::ConvertStringToBSTR(proxyHost); + BSTR bProxyPort = _com_util::ConvertStringToBSTR(proxyPort); + g_pSigDoc->getConfirmation(pSig, bPkcs12, bP12Passwd, bUrl, bProxyHost, bProxyPort, &l); + *pErr = (int)l; + ::SysFreeString(bPkcs12); + ::SysFreeString(bP12Passwd); + ::SysFreeString(bUrl); + ::SysFreeString(bProxyHost); + ::SysFreeString(bProxyPort); + } + return pSig; +} + +int comSearchStore() +{ + IComCertArray* pCertArr = NULL; + IComCertSearch* pCertSearch = NULL; + IComCertSearchStore *pCertSearchStore = NULL; + IComCertificate* pCert = NULL; + HRESULT hr = 0; + VARIANT vt1, vt2; + BSTR bstr; + long l = 0, n = 0; + char *p1 = 0; + + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComCertSearch"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comcertsearch %d\n", hr); + return -1; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComCertSearch), (LPVOID *)&pCertSearch); + if(FAILED(hr)) { + printf("Failed to connect to CComCertSearch %d\n", hr); + return -1; + } + hr = pCertSearch->put_nCertSearchBy(COM_CERT_SEARCH_BY_STORE); + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComCertSearchStore"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comcertsearchstore %d\n", hr); + return -1; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComCertSearchStore), (LPVOID *)&pCertSearchStore); + if(FAILED(hr)) { + printf("Failed to connect to CComCertSearchStore %d\n", hr); + return -1; + } + hr = pCertSearch->getCertSearchStore(pCertSearchStore); + if(FAILED(hr)) { + printf("Failed to get adr of CComCertSearchStore %d\n", hr); + return -1; + } + hr = pCertSearchStore->addSearchType(COM_CERT_STORE_SEARCH_BY_ISSUER_DN); + if(FAILED(hr)) { + printf("Failed to add search type %d\n", hr); + return -2; + } + VariantInit(&vt1); + SAFEARRAY* pArr = SafeArrayCreateVector(VT_BSTR, 0, 2); + V_ARRAY(&vt1) = pArr; + V_VT(&vt1) = (VT_ARRAY | VT_BSTR); + BSTR HUGEP* pData = 0; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + USES_CONVERSION; + pData[0] = SysAllocString(A2OLE("C=EE")); + pData[1] = SysAllocString(A2OLE("O=AS Sertifitseerimiskeskus")); + SafeArrayUnaccessData(pArr); + hr = pCertSearchStore->put_saIssuerDNCriterias(vt1); + if(FAILED(hr)) { + printf("Failed to set issuer dn %d\n", hr); + return -2; + } + hr = pCertSearchStore->addSearchType(COM_CERT_STORE_SEARCH_BY_SUBJECT_DN); + if(FAILED(hr)) { + printf("Failed to add search type %d\n", hr); + return -2; + } + VariantInit(&vt2); + SAFEARRAY* pArr2 = SafeArrayCreateVector(VT_BSTR, 0, 3); + V_ARRAY(&vt2) = pArr2; + V_VT(&vt2) = (VT_ARRAY | VT_BSTR); + BSTR HUGEP* pData2 = 0; + SafeArrayAccessData(pArr2, (void HUGEP**)&pData2); + pData2[0] = SysAllocString(A2OLE("C=EE")); + pData2[1] = SysAllocString(A2OLE("O=ESTEID")); + pData2[2] = SysAllocString(A2OLE("OU=authentication")); + SafeArrayUnaccessData(pArr2); + hr = pCertSearchStore->put_saSubDNCriterias(vt2); + if(FAILED(hr)) { + printf("Failed to set subject dn %d\n", hr); + return -2; + } + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComCertArray"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comcertarray %d\n", hr); + return -1; + } + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComCertArray), (LPVOID *)&pCertArr); + if(FAILED(hr)) { + printf("Failed to connect to CComCertArray %d\n", hr); + return -1; + } + l = 0; + hr = pCertArr->searchBySearchStore(pCertSearchStore, &l); + if(FAILED(hr) || l) { + printf("Failed to search certs %d err: %d\n", hr, l); + return -3; + } + hr = pCertArr->get_nCerts(&n); + if(FAILED(hr)) { + printf("Failed to get number of found certs %d\n", hr); + return -3; + } + printf("Found %d certs\n", n); + hr = CLSIDFromProgID(OLESTR("DigiDocLibCOM.ComCertificate"), &g_clsid); + if(FAILED(hr)) { + printf("Failed to find clsid of comcertificate %d\n", hr); + return -1; + } + for(int j = 0; j < n; j++) { + hr = CoCreateInstance(g_clsid, NULL, CLSCTX_INPROC_SERVER, __uuidof(IComCertificate), (LPVOID *)&pCert); + if(FAILED(hr)) { + printf("Failed to connect to CComCertificate %d\n", hr); + return -1; + } + hr = pCertArr->getCertByIndex(j, pCert); + if(FAILED(hr)) { + printf("Failed to read cert %d - %d\n", j, hr); + return -3; + } + hr = pCert->get_szPropSubjectName(&bstr); + p1= _com_util::ConvertBSTRToString(bstr); + ::SysFreeString(bstr); + printf("Cert: %d - %s\n", j, p1); + delete [] p1; + p1 = 0; + pCert->Release(); + } + pCertArr->Release(); + pCertSearchStore->Release(); + pCertSearch->Release(); + return 0; +} + + +//==========< command handlers >==================== + +//-------------------------------------------------- +// Creates a new signed doc +//-------------------------------------------------- +int cmdNew(char* pFormat, char* pVersion) +{ + int err = 0; + char* format = pFormat, *version = pVersion; + + if(!p_szOutFile) { + err = -2; + printf("No output file specified"); + return err; + } + if(!format || !strlen(format)) + format = "DIGIDOC-XML"; + if(!version || !strlen(version)) + version = "1.3"; + if(format && version) { + //printf("new: %s %s\n", format, version); + err = comNewSignedDoc(format, version); + g_bDdocExists = true; + } else { + err = -3; + printf("Error finding new document format or version"); + } + return err; +} + + + +//-------------------------------------------------- +// Adds a DataFile to signed doc +//-------------------------------------------------- +int cmdAddDataFile( char* file, + char* mime, char* content) +{ + int err = 0, l1; + IComDataFile* pDf = NULL; + char *p1 = 0, *p2 = 0, buf1[300]; + + // if there was no new command then implicitly create a new document + if(!g_bDdocExists) { + err = cmdNew(NULL, NULL); + if(err) return err; + } + // add a file + ddocConvertInput((const char*)file, &p1); + ddocConvertInput((const char*)mime, &p2); + pDf = comAddDataFile(p1, p2, content); + //freeLibMem(p1); + if(pDf) { + err = comGetDataFileId(pDf, buf1, sizeof(buf1)); + if(!err) + err = comCalcDataFileSizeAndDigest(buf1, p1); + printf("DF calc: %d\n", err); + pDf->Release(); + } + return err; +} + +char* getArg(int argc, _TCHAR* argv[], int nArg, boolean bCmd) +{ + char *p = NULL; + if(nArg >= 0 && nArg < argc) { + CW2A a(argv[nArg]); + p = strdup(a); + if(p && ((!bCmd && p[0] == '-') || (bCmd && p[0] != '-'))) { + free(p); + p = NULL; + } + } + return p; +} + +//-------------------------------------------------- +// Create digidoc and adds datafiles +//-------------------------------------------------- +int runNewCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i; + char *p1 = NULL, *p2 = NULL, *p3 = NULL; + + for(i = 1; (err == 0) && (i < argc); i++) { + p1 = getArg(argc, argv, i, true); + if(p1 && !strcmp(p1, "-new")) { + p2 = getArg(argc, argv, i+1, false); + if(p2) + p3 = getArg(argc, argv, i+2, false); + err = cmdNew(p2, p3); + free(p2); + free(p3); + if(!err) return err; + } + free(p1); + } + return err; +} + +//-------------------------------------------------- +// Create digidoc and adds datafiles +//-------------------------------------------------- +int runAddCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i; + char *p1 = NULL, *p2 = NULL, *p3 = NULL; + + for(i = 1; (err == 0) && (i < argc); i++) { + p1 = getArg(argc, argv, i, true); + if(p1 && !strcmp(p1, "-add") && argc > i+2) { // all commands and options must start with - + p2 = getArg(argc, argv, i+1, false); + if(p2) + p3 = getArg(argc, argv, i+2, false); + //printf("add: %s %s\n", p2, p3); + err = cmdAddDataFile(p2, p3, "EMBEDDED_BASE64"); + free(p2); + free(p3); + i += 2; + } + free(p1); + } + return err; +} + + +void printCertData(long hCert) +{ + int err = 0; + char buf1[300]; + + err = comGetCertSerial(hCert, buf1, sizeof(buf1)); + printf("X509Certificate|%s", buf1); + err = comGetCertIssuer(hCert, buf1, sizeof(buf1)); + printf("|%s", buf1); + err = comGetCertSubject(hCert, buf1, sizeof(buf1)); + printf("|%s", buf1); + err = comGetCertNotBefore(hCert, buf1, sizeof(buf1)); + printf("|%s", buf1); + err = comGetCertNotAfter(hCert, buf1, sizeof(buf1)); + printf("|%s\n", buf1); +} + +//-------------------------------------------------- +// Verifys sigantures and notaries +//-------------------------------------------------- +int cmdVerify() +{ + int err = 0, d, l, n, err2 = 0; + char buf1[300], id[100]; + long l1, lCert1 = 0, lCert2 = 0; + + //printf("verify\n"); + printf("SignedDoc|"); + comGetSigDocFormat(buf1, sizeof(buf1)); + printf("%s|", buf1); + comGetSigDocVer(buf1, sizeof(buf1)); + printf("%s|", buf1); + comCleanErrors(); + err2 = comVerifySignedDoc(NULL); + printf("%d\n", err2); + //comGetErrors(buf1, sizeof(buf1)); + //printf("%s\n", buf1); + d = comCountDataFiles(); + for(l = 0; l < d; l++) { + IComDataFile* pDf = comGetDataFile(l); + comGetDataFileId(pDf, buf1, sizeof(buf1)); + printf("DataFile|%s", buf1); + comGetDataFileFileName(pDf, buf1, sizeof(buf1)); + comGetDataFileSize(pDf, &l1); + printf("|%s|%d", buf1, l1); + comGetDataFileMimeType(pDf, buf1, sizeof(buf1)); + printf("|%s", buf1); + comGetDataFileContentType(pDf, buf1, sizeof(buf1)); + printf("|%s\n", buf1); + pDf->Release(); + } + d = comCountSignatures(); + for(l = 0; l < d; l++) { + IComSignatureInfo* pSig = comGetSignature(l); + comGetSignatureId(pSig, buf1, sizeof(buf1)); + strncpy(id, buf1, sizeof(id)); + printf("Signature|%s", buf1); + err = comGetSignatureCertHandle(pSig, &lCert1); + if(lCert1) { + comGetCertSubject(lCert1, buf1, sizeof(buf1)); + printf("|%s", buf1); + } + n = comVerifySignature(pSig, NULL); + comGetErrors(buf1, sizeof(buf1)); + printf("|%d|%s\n", n, buf1); + if(lCert1) + printCertData(lCert1); + + // show notary + IComNotaryInfo* pNot = comGetNotaryWithSigId(id); + comGetNotaryId(pNot, buf1, sizeof(buf1)); + strncpy(id, buf1, sizeof(id)); + printf("RevocationValues|%s", buf1); + n = sizeof(buf1); + comGetNotaryResponderIdName(pNot, buf1, &n); + printf("|%s", buf1); + comGetNotaryTimeProduced(pNot, buf1, sizeof(buf1)); + printf("|%s\n", buf1); + comGetNotaryCertHandle(pNot, &lCert2); + if(lCert2) + printCertData(lCert2); + if(pNot) + pNot->Release(); + pSig->Release(); + } + return err2; +} + + +//-------------------------------------------------- +// Create digidoc and adds datafiles +//-------------------------------------------------- +int runExtractCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i; + char *p1 = NULL, *p2 = NULL, *p3 = NULL, *p2u = 0, *p3u = 0; + + for(i = 1; (err == 0) && (i < argc); i++) { + p1 = getArg(argc, argv, i, true); + if(p1 && !strcmp(p1, "-extract") && (argc > i+2)) { + p2 = getArg(argc, argv, i+1, false); + if(p2) { + ddocConvertInput((const char*)p2, &p2u); + p3 = getArg(argc, argv, i+2, false); + } + if(p3) + ddocConvertInput((const char*)p3, &p3u); + err = comExtractDataFile(p_szInFile, p2u, p3u); + printf("\nDataFile|%s|%s|%d", p2, p3, err); + free(p2); + free(p3); + i += 2; + } + free(p1); + } + return err; +} + + +//-------------------------------------------------- +// Verfys sigantures and notaries +//-------------------------------------------------- +int runVerifyCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i, n; + + for(i = 1; !err && (i < argc); i++) { + if(argv[i][0] == '-') { // all commands and options must start with - + CW2A pszA(argv[i]); + // create new digidoc + if(!strcmp(pszA, "-verify")) { + err = cmdVerify(); + } + } + } + return err; +} + + +//-------------------------------------------------- +// Handles signature commands +//-------------------------------------------------- +int runSignCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i; + IComSignatureInfo* pSig = NULL; + char *p1 = NULL, *p2 = NULL, *p3 = NULL, *p4 = NULL, *p5 = NULL, *p6 = NULL, *p7 = NULL; + char *p3u = NULL, *p4u = NULL, *p5u = NULL, *p6u = NULL, *p7u = NULL; + + for(i = 1; !err && (i < argc); i++) { + p1 = getArg(argc, argv, i, true); + if(p1 && p1[0] == '-') { // all commands and options must start with - + // create new digidoc + if(!strcmp(p1, "-sign")) { + p2 = getArg(argc, argv, i+1, false); + if(p2) + p3 = getArg(argc, argv, i+2, false); + if(p3) { + ddocConvertInput((const char*)p3, &p3u); + p4 = getArg(argc, argv, i+3, false); + } + if(p4) { + ddocConvertInput((const char*)p4, &p4u); + p5 = getArg(argc, argv, i+4, false); + } + if(p5) { + ddocConvertInput((const char*)p5, &p5u); + p6 = getArg(argc, argv, i+5, false); + } + if(p6) { + ddocConvertInput((const char*)p6, &p6u); + p7 = getArg(argc, argv, i+6, false); + } + if(p7) + ddocConvertInput((const char*)p7, &p7u); + pSig = comSign((const char*)p2, + (const char*)p3u, (const char*)p4u, (const char*)p5u, (const char*)p6u, (const char*)p7u, + NULL, NULL, NULL, NULL, NULL, &err); + free(p2); + free(p3); + free(p4); + free(p5); + free(p6); + free(p7); + if(pSig) + pSig->Release(); + } + } + free(p1); + } + return err; +} + +//-------------------------------------------------- +// Handles list commands +//-------------------------------------------------- +int runListCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i, nFound = 0; + + for(i = 1; !err && (i < argc); i++) { + CW2A pszA(argv[i]); + if(pszA[0] == '-') { // all commands and options must start with - + // create new digidoc + if(!strcmp(pszA, "-list")) { + nFound = 1; + } + } + } + if(nFound) { + err = cmdVerify(); + } + return err; +} + +//-------------------------------------------------- +// Handles list commands +//-------------------------------------------------- +int runListCertsCmds(int argc, _TCHAR* argv[]) +{ + int err = 0, i, nFound = 0; + + for(i = 1; !err && (i < argc); i++) { + CW2A pszA(argv[i]); + if(pszA[0] == '-') { // all commands and options must start with - + // create new digidoc + if(!strcmp(pszA, "-list-certs")) { + nFound = 1; + } + } + } + if(nFound) { + err = comSearchStore(); + } + return err; +} + + +int _tmain(int argc, _TCHAR* argv[]) +{ + time_t t1 = 0, t2 = 0; + int err = 0, l1 = 0; + char buf1[3000]; + + // check program arguments + if(argc <= 1) { + printUsage(); + exit(0); + } + err = checkProgArguments(argc, argv); + // connect to com + err = comConnect(); + printf("%s", g_szProgNameVer); + err = comGetLibName(buf1, sizeof(buf1)); + printf("|LIB|%s", buf1); + err = comGetLibVer(buf1, sizeof(buf1)); + printf("|%s", buf1); + err = comGetComVer(buf1, sizeof(buf1)); + printf("|COM| %s\n", buf1); + comSetClientNameVer(g_szProgNameVer); + //comSetDebugFilePath("z:\\digidoccom.log"); + //scomSetDebugLevel(3); + time(&t1); + // read input file if necessary + if(p_szInFile && !err) { + err = comReadSignedDoc(p_szInFile); + g_bDdocExists = true; + } + // new digidocs + if(!err) + err = runNewCmds(argc, argv); + // add data files + if(!err) + err = runAddCmds(argc, argv); + // run signature commands + if(!err) + err = runSignCmds(argc, argv); + // verify signatures + if(!err) + err = runVerifyCmds(argc, argv); + // extract datafiles + if(!err) + err = runExtractCmds(argc, argv); + // write output file + if(p_szOutFile && !err) { + //printf("write: %s to %s\n", p_szInFile, p_szOutFile); + err = comWriteSignedDoc(p_szInFile, p_szOutFile); + //printf("Wrote err: %d\n", err); + } + // list digidoc or encrypted documents + if(!err) + err = runListCmds(argc, argv); + if(!err) + err = runListCertsCmds(argc, argv); + //printf("End work err: %d\n", err); + time(&t2); + // list all errors + if(err) { + //printf("Get errs\n"); + comGetErrors(buf1, sizeof(buf1)); + printf("ERRORS: %s\n", buf1); + } + printf("\n%s - time: %ld sec result: %s\n", g_szProgNameVer, (long)(t2-t1), (err ? "failure" : "success")); + + //cmdLibNameAndVer(pLib); + + + // cleanup + comDisconnect(); + return 0; +} + diff -Nru libdigidoc-2.7.0/digidoccom/digidoccom.rc libdigidoc-3.7.0.875/digidoccom/digidoccom.rc --- libdigidoc-2.7.0/digidoccom/digidoccom.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/digidoccom.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,132 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" +#include "..\config.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE MOVEABLE PURE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE MOVEABLE PURE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE MOVEABLE PURE +BEGIN + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "digidoccom" +END + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Unknown language: 0x25, 0x1 resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ETI) +#ifdef _WIN32 +LANGUAGE 0x25, 0x1 +#pragma code_page(1257) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_COMMA + PRODUCTVERSION VERSION_COMMA + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "042504b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "AS Sertifitseerimiskeskus\0" + VALUE "FileDescription", "digidoccom\0" + VALUE "FileVersion", "VERSION_COMMA\0" + VALUE "InternalName", "digidoccom\0" + VALUE "LegalCopyright", "Copyright © 2010\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "digidoccom.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "AS Sertifitseerimiskeskus digidoccom\0" + VALUE "ProductVersion", "VERSION_COMMA\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x425, 1200 + END +END + +#endif // !_MAC + +#endif // Unknown language: 0x25, 0x1 resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -Nru libdigidoc-2.7.0/digidoccom/stdafx.cpp libdigidoc-3.7.0.875/digidoccom/stdafx.cpp --- libdigidoc-2.7.0/digidoccom/stdafx.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/stdafx.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// digidoccom.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff -Nru libdigidoc-2.7.0/digidoccom/stdafx.h libdigidoc-3.7.0.875/digidoccom/stdafx.h --- libdigidoc-2.7.0/digidoccom/stdafx.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/stdafx.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,19 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +#include +#include + +// TODO: reference additional headers your program requires here diff -Nru libdigidoc-2.7.0/digidoccom/targetver.h libdigidoc-3.7.0.875/digidoccom/targetver.h --- libdigidoc-2.7.0/digidoccom/targetver.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/targetver.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff -Nru libdigidoc-2.7.0/digidoccom/version.rc2 libdigidoc-3.7.0.875/digidoccom/version.rc2 --- libdigidoc-2.7.0/digidoccom/version.rc2 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/digidoccom/version.rc2 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,66 @@ + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +// +// Version +// +#include "..\config.h" +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_COMMA + PRODUCTVERSION VERSION_COMMA + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "DigiDoc COM utility for DigiDoc library\0" + VALUE "CompanyName", "AS Sertifitseerimiskeskus\0" + VALUE "FileDescription", "digidoccom utility\0" + VALUE "FileVersion", VERSION_COMMA"\0" + VALUE "InternalName", "digidoccom\0" + VALUE "LegalCopyright", "Copyright (C) AS Sertifitseerimiskeskus\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "digidoccom.exe\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "digidoccom utility\0" + VALUE "ProductVersion", DIGIDOC_VERSION + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoc-format-1.4-eng.odt and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoc-format-1.4-eng.odt differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoc-format-1.4-eng.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoc-format-1.4-eng.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDocLib-2.2.5_eng.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDocLib-2.2.5_eng.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDocLib-2.2.5_eng.sxw and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDocLib-2.2.5_eng.sxw differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDocLib-2.2.5_est.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDocLib-2.2.5_est.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDocLib-2.2.5_est.sxw and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDocLib-2.2.5_est.sxw differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoci-vorming-1.3.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoci-vorming-1.3.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoci-vorming-1.3.sxw and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoci-vorming-1.3.sxw differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoci-vorming-1.4.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoci-vorming-1.4.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/DigiDoci-vorming-1.4.sxw and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/DigiDoci-vorming-1.4.sxw differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/SK-CDD-PRG-GUIDE.docx and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/SK-CDD-PRG-GUIDE.docx differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/SK-CDD-PRG-GUIDE.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/SK-CDD-PRG-GUIDE.pdf differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/SK-COM-PRG-GUIDE.docx and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/SK-COM-PRG-GUIDE.docx differ Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/doc/SK-COM-PRG-GUIDE.pdf and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/doc/SK-COM-PRG-GUIDE.pdf differ diff -Nru libdigidoc-2.7.0/doc/digidoc_1.3.xsd libdigidoc-3.7.0.875/doc/digidoc_1.3.xsd --- libdigidoc-2.7.0/doc/digidoc_1.3.xsd 2009-05-13 18:27:28.000000000 +0000 +++ libdigidoc-3.7.0.875/doc/digidoc_1.3.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff -Nru libdigidoc-2.7.0/doc/digidoc_1.4.xsd libdigidoc-3.7.0.875/doc/digidoc_1.4.xsd --- libdigidoc-2.7.0/doc/digidoc_1.4.xsd 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/doc/digidoc_1.4.xsd 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru libdigidoc-2.7.0/etc/CMakeLists.txt libdigidoc-3.7.0.875/etc/CMakeLists.txt --- libdigidoc-2.7.0/etc/CMakeLists.txt 2009-11-14 12:07:39.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/digidoc.conf.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${DIGIDOC_CONF_NAME} - @ONLY -) -install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${DIGIDOC_CONF_NAME} DESTINATION ${SYSCONF_INSTALL_DIR} ) - -install(DIRECTORY - certs - DESTINATION ${DIGIDOC_DATA_DIR} - REGEX "\\.svn$|_svn$" EXCLUDE -) diff -Nru libdigidoc-2.7.0/etc/certs/EECCRCA.crt libdigidoc-3.7.0.875/etc/certs/EECCRCA.crt --- libdigidoc-2.7.0/etc/certs/EECCRCA.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/EECCRCA.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG +CSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIwMTAxMDMwMTAxMDMwWhgPMjAzMDEy +MTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlBUyBTZXJ0aWZpdHNl +ZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBS +b290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUy +euuOF0+W2Ap7kaJjbMeMTC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvO +bntl8jixwKIy72KyaOBhU8E2lf/slLo2rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIw +WFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw93X2PaRka9ZP585ArQ/d +MtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtNP2MbRMNE +1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYD +VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/ +zQas8fElyalL1BSZMEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYB +BQUHAwMGCCsGAQUFBwMEBggrBgEFBQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEF +BQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+RjxY6hUFaTlrg4wCQiZrxTFGGV +v9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqMlIpPnTX/dqQG +E5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u +uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIW +iAYLtqZLICjU3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/v +GVCJYMzpJJUPwssd8m92kMfMdcGWxZ0= +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/EID-SK 2011.crt libdigidoc-3.7.0.875/etc/certs/EID-SK 2011.crt --- libdigidoc-2.7.0/etc/certs/EID-SK 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/EID-SK 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIFADCCA+igAwIBAgIQQyvUTmJDa0ZNgy+/fS0vWjANBgkqhkiG9w0BAQUFADB1 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG +CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMTExMVoXDTI0MDMxODEw +MTExMVowYTELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2Vlcmlt +aXNrZXNrdXMxFDASBgNVBAMMC0VJRC1TSyAyMDExMRgwFgYJKoZIhvcNAQkBFglw +a2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC2Q1zKMt7D +ytbntSLoYAAVkEwV+5djSr0vSIG/Zm9seKyx+2PY8sVzXRoUD1CMIYnstDhBSKMj +n2/+HpA7pOipAIAMrk6uKnpSTTdFbQ+0fzJVPokBgsdsQ6R5TZFPB1nu5zgRRlQm +WIFxOpDiNHTt0LObUhWLXzUb31vc1Wmao2IYcDx1TCs/1E9+camiCl2B5lXrPEU3 +wBq4waD54izS20DK05+6+hHRg+TqoIg5YSmwbjStEyd/8AQeokwVloyyH49bnpel +uADcZJgxxE9ZUvVWHoxYfmg1IeRU72jHTcIjNf1cQN2+9/FtHQMnGzDBgmAPpghw +Wr3JtW0JWvMXAgMBAAGjggGeMIIBmjASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1Ud +DwEB/wQEAwIBBjCB9AYDVR0gBIHsMIHpMIHmBgsrBgEEAc4fZAEBATCB1jCBsAYI +KwYBBQUHAgIwgaMegaAASwBhAHMAdQB0AGEAdABhAGsAcwBlACAAZgD8APwAcwBp +AGwAaQBzAHQAZQBsAGUAIABpAHMAaQBrAHUAdABlAGwAZQAgAHMAZQByAHQAaQBm +AGkAawBhAGEAdABpAGQAZQAgAHYA5ABsAGoAYQBzAHQAYQBtAGkAcwBlAGsAcwAg +AGsAbwBtAG0AZQByAHQAcwBhAGwAdQBzAGUAbAAuMCEGCCsGAQUFBwIBFhVodHRw +czovL3d3dy5zay5lZS9DUFMwHQYDVR0OBBYEFLEQlwL63YbGeEGkwzKI+/4f58AF +MB8GA1UdIwQYMBaAFBLyWj7qVhy/zQas8fElyalL1BSZMD0GA1UdHwQ2MDQwMqAw +oC6GLGh0dHA6Ly93d3cuc2suZWUvcmVwb3NpdG9yeS9jcmxzL2VlY2NyY2EuY3Js +MA0GCSqGSIb3DQEBBQUAA4IBAQAxau3ohdFkpvaiVUR7arNovQUZRCG9Ge3udqHY +emovyU7N60Hgomc/ZG+uunScATTUhBcv9a5zkQxb1dQ1LYDRfNr9CqI0QvSEE4t9 +Sfu3fOhyLrlmb3s8xhhYLJBJ325uDvtO/qFeXLlcRXMF5nU8FE2IyaZP1CHYKVh5 +QNPPQiGZGSox5oOkCvmt4lUl4lZUwVie75us/WtrD6DJeREBTEDHORIfg8E9RA1y +/7t2gT9vrU8tabeSZlD03qwXe0nJ9RscI/P0HT8vuo1PGzCfbH9xFqfoZ2jdJ0Hz +xrFM8VsL/AtCw0dmrxRHLlZzqSw0G7b0W40mwOQauO2gbMfn +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/ESTEID-SK 2011.crt libdigidoc-3.7.0.875/etc/certs/ESTEID-SK 2011.crt --- libdigidoc-2.7.0/etc/certs/ESTEID-SK 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/ESTEID-SK 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE----- +MIIFBTCCA+2gAwIBAgIQKVKTqv2MxtRNgzCjwmRRDTANBgkqhkiG9w0BAQUFADB1 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG +CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMTQ1OVoXDTI0MDMxODEw +MTQ1OVowZDELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRpZml0c2Vlcmlt +aXNrZXNrdXMxFzAVBgNVBAMMDkVTVEVJRC1TSyAyMDExMRgwFgYJKoZIhvcNAQkB +Fglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCz6Xxs +Zh6r/aXcNe3kSpNMOqmQoAXUpzzcr4ZSaGZh/7JHIiplvNi6tbW/lK7sAiRsb65K +zMWROEauld66ggbDPga6kU97C+AXGu7+DROXstjUOv6VlrHZVAnLmIOkycpWaxjM ++EfQPZuDxEbkw96B3/fG69Zbp3s9y6WEhwU5Y9IiQl8YTkGnNUxidQbON1BGQm+H +VEsgTf22J6r6G3FsE07rnMNskNC3DjuLSCUKF4kH0rVGVK9BdiCdFaZjHEykjwjI +GzqnyxyRKe4YbJ6B9ABm95eSFgMBHtZEYU+q0VUIQGhAGAurOTXjWi1TssA42mnL +GQZEI5GXMXtabp51AgMBAAGjggGgMIIBnDASBgNVHRMBAf8ECDAGAQH/AgEAMA4G +A1UdDwEB/wQEAwIBBjCB9gYDVR0gBIHuMIHrMIHoBgsrBgEEAc4fZAEBATCB2DCB +sgYIKwYBBQUHAgIwgaUegaIASwBhAHMAdQB0AGEAdABhAGsAcwBlACAAaQBzAGkA +awB1AHQAdAD1AGUAbgBkAGEAdgBhAGwAZQAgAGQAbwBrAHUAbQBlAG4AZABpAGwA +ZQAgAGsAYQBuAHQAYQB2AGEAdABlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0AGkA +ZABlACAAdgDkAGwAagBhAHMAdABhAG0AaQBzAGUAawBzAC4wIQYIKwYBBQUHAgEW +FWh0dHBzOi8vd3d3LnNrLmVlL0NQUzAdBgNVHQ4EFgQUe2ryVVBcuNl6CIdBrvqi +Kz1bV3YwHwYDVR0jBBgwFoAUEvJaPupWHL/NBqzx8SXJqUvUFJkwPQYDVR0fBDYw +NDAyoDCgLoYsaHR0cDovL3d3dy5zay5lZS9yZXBvc2l0b3J5L2NybHMvZWVjY3Jj +YS5jcmwwDQYJKoZIhvcNAQEFBQADggEBAKC4IN3FC2gVDIH05TNMgFrQOCGSnXhz +oJclRLoQ81BCOXTZI4qn7N74FHEnrAy6uNG7SS5qANqSaPIL8dp63jg/L4qn4iWa +B5q5GGJOV07SnTHS7gUrqChGClnUeHxiZbL13PkP37Lnc+TKl1SKfgtn5FbH5cqr +hvbA/VF3Yzlimu+L7EVohW9HKxZ//z8kDn6ieiPFfZdTOov/0eXVLlxqklybUuS6 +LYRRDiqQupgBKQBTwNbC8x0UHX00HokW+dCVcQvsUbv4xLhRq/MvyTthE+RdbkrV +0JuzbfZvADfj75nA3+ZAzFYS5ZpMOjZ9p4rQVKpzQTklrF0m6mkdcEo= +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/KLASS3-SK 2010 OCSP.crt libdigidoc-3.7.0.875/etc/certs/KLASS3-SK 2010 OCSP.crt --- libdigidoc-2.7.0/etc/certs/KLASS3-SK 2010 OCSP.crt 2010-06-21 15:53:05.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/KLASS3-SK 2010 OCSP.crt 2012-12-13 22:05:47.000000000 +0000 @@ -1,25 +1,25 @@ ------BEGIN CERTIFICATE----- -MIIELzCCAxegAwIBAgICAMswDQYJKoZIhvcNAQEFBQAwbTELMAkGA1UEBhMCRUUx -IjAgBgNVBAoTGUFTIFNlcnRpZml0c2VlcmltaXNrZXNrdXMxITAfBgNVBAsTGFNl -cnRpZml0c2VlcmltaXN0ZWVudXNlZDEXMBUGA1UEAxMOS0xBU1MzLVNLIDIwMTAw -HhcNMTAwNDA4MDgwMTMxWhcNMTYwODI1MjIwMDAwWjCBgjEYMBYGCSqGSIb3DQEJ -ARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRz -ZWVyaW1pc2tlc2t1czENMAsGA1UECxMET0NTUDEmMCQGA1UEAxMdS0xBU1MzLVNL -IDIwMTAgT0NTUCBSRVNQT05ERVIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK -AoIBAQDhWwGpngF0sdGCgOgiyT12A/Vdm9sMPr/cUwZhU7DA5C8rU1yJhbrh28fM -pv0eas6/+IC1oDxI24zjfWIKfHwpBmhUTFsmvmKRIu4a1F6VwNwYEdoAZrQDpzZS -ve6H6R/+0Uy0BAolebdhPUK22pKd8V1CBY3de886Ray8uUJu09MAU8j+xsoUNOzy -xiWdAVp1YTXRhhUt+EQVYJ22RBZ6+b9fPQvgb9aWgE/WwqUh7OrgTnrGZVzgO46p -rfE7zkALG0FYZCzQTCMH8aIqqte0E3HwSVlKh9qwbRPB9WTDCtCqajh4qgGRTXvW -T4vATlHvx8GpJ3roZkp5AlQno3hTAgMBAAGjgcIwgb8waAYDVR0gBGEwXzBdBgor -BgEEAc4fBAECME8wJQYIKwYBBQUHAgIwGRoXU0sgdGltZSBzdGFtcGluZyBwb2xp -Y3kwJgYIKwYBBQUHAgEWGmh0dHA6Ly93d3cuc2suZWUvYWphdGVtcGVsMBMGA1Ud -JQQMMAoGCCsGAQUFBwMJMB8GA1UdIwQYMBaAFF11FBGM9KWOQo97skBEo+7Wejty -MB0GA1UdDgQWBBQ3MJkXG2Go/6j4bem465aue3P5qjANBgkqhkiG9w0BAQUFAAOC -AQEAKhoVTII1ECecFkyt9Ogr0XW3WEFprrqTDE4IycMlx+LNjWk30aknMldEtzIC -5nCDX27NCWkpbN1o/3ddBv0cKMa05ZK8sHQxU6A5Oev8DCp72/LFEChq5IDqgqW2 -BiHhyfPfr93JIuV03b/Wgq3fpRyBd21VE9254W4A90xeNxDvdpqxlrD2Lonzm/V/ -oomzEHsp4kKxXkPmRU4vGtTnxxAnxYp9OuLkvpUCLNoAWMbYqb4cbYzaZ9tQIkBy -3nJ352Rs5obYDb3R/ZVWuYLLSocWL7b2QwlDP7LA8VNDqmQvioHt8GcyKXQ5/eWM -vj2ePt58waVhwfSdd4nANKtq1g== ------END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIELzCCAxegAwIBAgICAMswDQYJKoZIhvcNAQEFBQAwbTELMAkGA1UEBhMCRUUx +IjAgBgNVBAoTGUFTIFNlcnRpZml0c2VlcmltaXNrZXNrdXMxITAfBgNVBAsTGFNl +cnRpZml0c2VlcmltaXN0ZWVudXNlZDEXMBUGA1UEAxMOS0xBU1MzLVNLIDIwMTAw +HhcNMTAwNDA4MDgwMTMxWhcNMTYwODI1MjIwMDAwWjCBgjEYMBYGCSqGSIb3DQEJ +ARYJcGtpQHNrLmVlMQswCQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRz +ZWVyaW1pc2tlc2t1czENMAsGA1UECxMET0NTUDEmMCQGA1UEAxMdS0xBU1MzLVNL +IDIwMTAgT0NTUCBSRVNQT05ERVIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQDhWwGpngF0sdGCgOgiyT12A/Vdm9sMPr/cUwZhU7DA5C8rU1yJhbrh28fM +pv0eas6/+IC1oDxI24zjfWIKfHwpBmhUTFsmvmKRIu4a1F6VwNwYEdoAZrQDpzZS +ve6H6R/+0Uy0BAolebdhPUK22pKd8V1CBY3de886Ray8uUJu09MAU8j+xsoUNOzy +xiWdAVp1YTXRhhUt+EQVYJ22RBZ6+b9fPQvgb9aWgE/WwqUh7OrgTnrGZVzgO46p +rfE7zkALG0FYZCzQTCMH8aIqqte0E3HwSVlKh9qwbRPB9WTDCtCqajh4qgGRTXvW +T4vATlHvx8GpJ3roZkp5AlQno3hTAgMBAAGjgcIwgb8waAYDVR0gBGEwXzBdBgor +BgEEAc4fBAECME8wJQYIKwYBBQUHAgIwGRoXU0sgdGltZSBzdGFtcGluZyBwb2xp +Y3kwJgYIKwYBBQUHAgEWGmh0dHA6Ly93d3cuc2suZWUvYWphdGVtcGVsMBMGA1Ud +JQQMMAoGCCsGAQUFBwMJMB8GA1UdIwQYMBaAFF11FBGM9KWOQo97skBEo+7Wejty +MB0GA1UdDgQWBBQ3MJkXG2Go/6j4bem465aue3P5qjANBgkqhkiG9w0BAQUFAAOC +AQEAKhoVTII1ECecFkyt9Ogr0XW3WEFprrqTDE4IycMlx+LNjWk30aknMldEtzIC +5nCDX27NCWkpbN1o/3ddBv0cKMa05ZK8sHQxU6A5Oev8DCp72/LFEChq5IDqgqW2 +BiHhyfPfr93JIuV03b/Wgq3fpRyBd21VE9254W4A90xeNxDvdpqxlrD2Lonzm/V/ +oomzEHsp4kKxXkPmRU4vGtTnxxAnxYp9OuLkvpUCLNoAWMbYqb4cbYzaZ9tQIkBy +3nJ352Rs5obYDb3R/ZVWuYLLSocWL7b2QwlDP7LA8VNDqmQvioHt8GcyKXQ5/eWM +vj2ePt58waVhwfSdd4nANKtq1g== +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/KLASS3-SK 2010.crt libdigidoc-3.7.0.875/etc/certs/KLASS3-SK 2010.crt --- libdigidoc-2.7.0/etc/certs/KLASS3-SK 2010.crt 2010-06-21 15:53:05.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/KLASS3-SK 2010.crt 2012-12-13 22:05:47.000000000 +0000 @@ -1,23 +1,23 @@ ------BEGIN CERTIFICATE----- -MIID5TCCAs2gAwIBAgIES7MTKDANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN -AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp -dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTEwMDMzMTA5MTcy -OFoXDTE2MDgyNjE0MjMwMVowbTELMAkGA1UEBhMCRUUxIjAgBgNVBAoTGUFTIFNl -cnRpZml0c2VlcmltaXNrZXNrdXMxITAfBgNVBAsTGFNlcnRpZml0c2VlcmltaXN0 -ZWVudXNlZDEXMBUGA1UEAxMOS0xBU1MzLVNLIDIwMTAwggEiMA0GCSqGSIb3DQEB -AQUAA4IBDwAwggEKAoIBAQCrlaYRX2v89k8Hd0ADaOfnUcIn7iM6aOXkAR+jp582 -7ZhDqDyNddF9ZUoBgPghGNIrkHbH7qwex39YnI0ka24lCjcwEMvQMPbyPnX/a4Ry -J+wEZttmjBl++FfrZK54L+vD7Dyy4YYB0Og9ktB4qptsDBj+giiv/MGPeGeNs3Ta -cJdNb7+3splTPtPKlDfrufvq4H6jNOv9S9bC+j2VVY9uCFXUro8AA3hoOEKJdSjl -pYCa51N8KGLVJYRuc/K81xqi054Jz+Cy/HY/AcXkk2JkxlpJoEXmcuTkxjO/QE/X -bd+mRJHnq6+HurOiKcxKwZCPAa+d+dvRPkbyq9ohMXH9AgMBAAGjgZwwgZkwEgYD -VR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAcYwMwYDVR0fBCwwKjAooCag -JIYiaHR0cDovL3d3dy5zay5lZS9jcmxzL2p1dXIvY3JsLmNybDAfBgNVHSMEGDAW -gBQEqnpHo+SJrxrPCkCnGD9v7+l9vjAdBgNVHQ4EFgQUXXUUEYz0pY5Cj3uyQESj -7tZ6O3IwDQYJKoZIhvcNAQEFBQADggEBADFuAGtSoO8PsWRw/QxFzc5EZtbq2KXC -9yZ8YQPWBLY4Mh3OVLFJqWyKC+8JHy9D5tJTG49F5UHyDJPufD/XvC2rjRlkqvS/ -W7sy3MqGh7e+6bg+aD4mo+98Oalnqi12UD+ki+N8JKPXjHNJ31AvH6E/xDsCsvtz -ubylxI+FU8R0XODIUFbBqRtatRI1/zVaKRhD6LNGPt3rz/3IJKmuEv6b29mzL+p4 -oNULqpPr6aTmheZme8ZHuEIh3Zp5kdoX3i2D4hsmgClpevZifo196zeKRLk0Qs6n -mRjoMxyk6jYIric3/VnV81oyhXSBY1GZnbM4qP1w2S5kSA2bb1pkwFo= ------END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIID5TCCAs2gAwIBAgIES7MTKDANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN +AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp +dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTEwMDMzMTA5MTcy +OFoXDTE2MDgyNjE0MjMwMVowbTELMAkGA1UEBhMCRUUxIjAgBgNVBAoTGUFTIFNl +cnRpZml0c2VlcmltaXNrZXNrdXMxITAfBgNVBAsTGFNlcnRpZml0c2VlcmltaXN0 +ZWVudXNlZDEXMBUGA1UEAxMOS0xBU1MzLVNLIDIwMTAwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCrlaYRX2v89k8Hd0ADaOfnUcIn7iM6aOXkAR+jp582 +7ZhDqDyNddF9ZUoBgPghGNIrkHbH7qwex39YnI0ka24lCjcwEMvQMPbyPnX/a4Ry +J+wEZttmjBl++FfrZK54L+vD7Dyy4YYB0Og9ktB4qptsDBj+giiv/MGPeGeNs3Ta +cJdNb7+3splTPtPKlDfrufvq4H6jNOv9S9bC+j2VVY9uCFXUro8AA3hoOEKJdSjl +pYCa51N8KGLVJYRuc/K81xqi054Jz+Cy/HY/AcXkk2JkxlpJoEXmcuTkxjO/QE/X +bd+mRJHnq6+HurOiKcxKwZCPAa+d+dvRPkbyq9ohMXH9AgMBAAGjgZwwgZkwEgYD +VR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAcYwMwYDVR0fBCwwKjAooCag +JIYiaHR0cDovL3d3dy5zay5lZS9jcmxzL2p1dXIvY3JsLmNybDAfBgNVHSMEGDAW +gBQEqnpHo+SJrxrPCkCnGD9v7+l9vjAdBgNVHQ4EFgQUXXUUEYz0pY5Cj3uyQESj +7tZ6O3IwDQYJKoZIhvcNAQEFBQADggEBADFuAGtSoO8PsWRw/QxFzc5EZtbq2KXC +9yZ8YQPWBLY4Mh3OVLFJqWyKC+8JHy9D5tJTG49F5UHyDJPufD/XvC2rjRlkqvS/ +W7sy3MqGh7e+6bg+aD4mo+98Oalnqi12UD+ki+N8JKPXjHNJ31AvH6E/xDsCsvtz +ubylxI+FU8R0XODIUFbBqRtatRI1/zVaKRhD6LNGPt3rz/3IJKmuEv6b29mzL+p4 +oNULqpPr6aTmheZme8ZHuEIh3Zp5kdoX3i2D4hsmgClpevZifo196zeKRLk0Qs6n +mRjoMxyk6jYIric3/VnV81oyhXSBY1GZnbM4qP1w2S5kSA2bb1pkwFo= +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/SK OCSP 2011.crt libdigidoc-3.7.0.875/etc/certs/SK OCSP 2011.crt --- libdigidoc-2.7.0/etc/certs/SK OCSP 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/SK OCSP 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEvDCCA6SgAwIBAgIQcpyVmdruRVxNgzI3N/NZQTANBgkqhkiG9w0BAQUFADB1 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEoMCYGA1UEAwwfRUUgQ2VydGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYG +CSqGSIb3DQEJARYJcGtpQHNrLmVlMB4XDTExMDMxODEwMjE0M1oXDTI0MDMxODEw +MjE0M1owgZ0xCzAJBgNVBAYTAkVFMQ4wDAYDVQQIEwVIYXJqdTEQMA4GA1UEBxMH +VGFsbGlubjEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czENMAsG +A1UECxMET0NTUDEfMB0GA1UEAxMWU0sgT0NTUCBSRVNQT05ERVIgMjAxMTEYMBYG +CSqGSIb3DQEJARYJcGtpQHNrLmVlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAihvGyhMVrgReHluKln1za6gvCE/mlSREmWjJFpL9llvuEUZoPFIypYA8 +g5u1VfgkeW5gDq25jAOq4FyXeDGIa+pJn2h0o2Wc2aeppVG/emfGm/jA8jjeyMrw +H8fAJrqVQ7c9X2xSwJEch/P2d8CfMZt5YF6gqLtPvG1b+n6otBZA5wjIFfJ/inJB +MUvqHSz3+PLfxO2/T3Wyk/c8M9HIMqTelqyiMGRgWehiU1OsL9armv3dQrHs1wm6 +vHaxfpfWB9YAFpeo9aYqhPCxVt/zo2NQB6vxyZS0hsOrXL7SxRToOJaqsnvlbf0e +rPPFtRHUvbojYYgl+fzlz0Jt6QJoNwIDAQABo4IBHTCCARkwEwYDVR0lBAwwCgYI +KwYBBQUHAwkwHQYDVR0OBBYEFKWhSGFt537NmJ50nCm7vYrecgxZMIGCBgNVHSAE +ezB5MHcGCisGAQQBzh8EAQIwaTA+BggrBgEFBQcCAjAyHjAAUwBLACAAdABpAG0A +ZQAgAHMAdABhAG0AcABpAG4AZwAgAHAAbwBsAGkAYwB5AC4wJwYIKwYBBQUHAgEW +G2h0dHBzOi8vd3d3LnNrLmVlL2FqYXRlbXBlbDAfBgNVHSMEGDAWgBQS8lo+6lYc +v80GrPHxJcmpS9QUmTA9BgNVHR8ENjA0MDKgMKAuhixodHRwOi8vd3d3LnNrLmVl +L3JlcG9zaXRvcnkvY3Jscy9lZWNjcmNhLmNybDANBgkqhkiG9w0BAQUFAAOCAQEA +w2sKwvTHtYGtD8Jw9mNUuj/mWiBSBEBeY2LhW8V6tjBPAPp3s6iWOh0FbVR2LUyr +qRwgT3fyWiGsiDm/6cIqM+IblLp/8ztfRQjquhW6XCD9SK02OQ9ZSdBwcmoAApZL +GXQC34wdgmV/hLTTNxONnDACBKz9U+Dy9a4ZT4tpNkbH8jq/BMne8FzbvRt1bjpX +BP7gjLX+zdx8/hp0Wq4tD+f9NVX0+vm9ahEKuzx4QzPnSB7hhWM9OnLZT7noRQa+ +KWk5c+e5VoR5R2t7MjVl8Cd+2llxiSxqMSbU5/23BzAKgN+NQdrBZAzpZ7lfaAuL +FaICP+bAm6uW2JUrM6abOw== +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST EECCRCA.crt libdigidoc-3.7.0.875/etc/certs/TEST EECCRCA.crt --- libdigidoc-2.7.0/etc/certs/TEST EECCRCA.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST EECCRCA.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEEzCCAvugAwIBAgIQc/jtqiMEFERMtVvsSsH7sjANBgkqhkiG9w0BAQUFADB9 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEwMC4GA1UEAwwnVEVTVCBvZiBFRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290 +IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwIhgPMjAxMDEwMDcxMjM0NTZa +GA8yMDMwMTIxNzIzNTk1OVowfTELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNl +cnRpZml0c2VlcmltaXNrZXNrdXMxMDAuBgNVBAMMJ1RFU1Qgb2YgRUUgQ2VydGlm +aWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVl +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1gGpqCtDmNNEHUjC8LXq +xRdC1kpjDgkzOTxQynzDxw/xCjy5hhyG3xX4RPrW9Z6k5ZNTNS+xzrZgQ9m5U6uM +ywYpx3F3DVgbdQLd8DsLmuVOz02k/TwoRt1uP6xtV9qG0HsGvN81q3HvPR/zKtA7 +MmNZuwuDFQwsguKgDR2Jfk44eKmLfyzvh+Xe6Cr5+zRnsVYwMA9bgBaOZMv1TwTT +VNi9H1ltK32Z+IhUX8W5f2qVP33R1wWCKapK1qTX/baXFsBJj++F8I8R6+gSyC3D +kV5N/pOlWPzZYx+kHRkRe/oddURA9InJwojbnsH+zJOa2VrNKakNv2HnuYCIonzu +pwIDAQABo4GKMIGHMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0G +A1UdDgQWBBS1NAqdpS8QxechDr7EsWVHGwN2/jBFBgNVHSUEPjA8BggrBgEFBQcD +AgYIKwYBBQUHAwEGCCsGAQUFBwMDBggrBgEFBQcDBAYIKwYBBQUHAwgGCCsGAQUF +BwMJMA0GCSqGSIb3DQEBBQUAA4IBAQAj72VtxIw6p5lqeNmWoQ48j8HnUBM+6mI0 +I+VkQr0EfQhfmQ5KFaZwnIqxWrEPaxRjYwV0xKa1AixVpFOb1j+XuVmgf7khxXTy +Bmd8JRLwl7teCkD1SDnU/yHmwY7MV9FbFBd+5XK4teHVvEVRsJ1oFwgcxVhyoviR +SnbIPaOvk+0nxKClrlS6NW5TWZ+yG55z8OCESHaL6JcimkLFjRjSsQDWIEtDvP4S +tH3vIMUPPiKdiNkGjVLSdChwkW3z+m0EvAjyD9rnGCmjeEm5diLFu7VMNVqupsbZ +SfDzzBLc5+6TqgQTOG7GaZk2diMkn03iLdHGFrh8ML+mXG9SjEPI +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST EID-SK 2011.crt libdigidoc-3.7.0.875/etc/certs/TEST EID-SK 2011.crt --- libdigidoc-2.7.0/etc/certs/TEST EID-SK 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST EID-SK 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEuDCCA6CgAwIBAgIQWwOHv2K/GORNdNgZblP5YDANBgkqhkiG9w0BAQUFADB9 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEwMC4GA1UEAwwnVEVTVCBvZiBFRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290 +IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwHhcNMTEwMzA3MTMwNTI5WhcN +MjMwOTA3MTIwNTI5WjBpMQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlm +aXRzZWVyaW1pc2tlc2t1czEcMBoGA1UEAwwTVEVTVCBvZiBFSUQtU0sgMjAxMTEY +MBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A +MIIBCgKCAQEAr5TNCQvKX1IApzLX5KLWSIOhyueYlpc5WKsFLdMWWG40QwJpHm0c +dudK51IIvdoDX5/uJlyf6/wd4NNSOF5rCogfkzD696NFuiplvXBYKZdshXqsxRhM +9mcp+9NqND5AGK4BtuUK2S83cxIRUiOxf7O43QxX3py5MDJRNa+kUOHBic8ekvR+ +MsdVpF+3A5V6WE6DNzxecBP6TF1+l/3B7L1Hz8hsaJ6QTsc6/O011WXG9y23dMpb +ho+JMyy9y3fe791sP87rqWhaFNT5kTnH3JOHK9fxgx0TDP66dde4nvnykRCadEmq +bOGLEar0xmnirAJgO/yrGrQ/A7gmDdhomwIDAQABo4IBRjCCAUIwDwYDVR0TAQH/ +BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgZkGA1UdIASBkTCBjjCBiwYKKwYBBAHO +HwMBATB9MFgGCCsGAQUFBwICMEweSgBBAGkAbgB1AGwAdAAgAHQAZQBzAHQAaQBt +AGkAcwBlAGsAcwAuACAATwBuAGwAeQAgAGYAbwByACAAdABlAHMAdABpAG4AZwAu +MCEGCCsGAQUFBwIBFhVodHRwczovL3d3dy5zay5lZS9DUFMwHQYDVR0OBBYEFNQi +siFrcquz1GPk1pe0bVcUzgEuMB8GA1UdIwQYMBaAFLU0Cp2lLxDF5yEOvsSxZUcb +A3b+MEMGA1UdHwQ8MDowOKA2oDSGMmh0dHBzOi8vd3d3LnNrLmVlL3JlcG9zaXRv +cnkvY3Jscy90ZXN0X2VlY2NyY2EuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQA8uY6L +qaZKfLx6iKpoAEGxbuFwzrT4BVGqEzpZJNVkM2hhoS9qrttzUrC2hLmfWBbbsScV +GvcWNV7GIcHLYBioZV+ostku/jXXxzhNVhVvX5B8X10uKQDtcrkGbjUpF1JSes8T +9EsUBSIh5MmpNKc1IP8FfvL3qMU2mxU30KQdQy4IjM4Pv7T+MAWMqjrn6txfOZDu +5k6Sak/NBn4cozX0HenY/7301snxAT3BaWhwMKqleCyM7w3wfnFGevEs/4C7qn3S +QncgCEZlvL3lYxSIJ697LyZo0Lsc3s8+gXPT4Q/V8UqjmecgzZWHvyxCrf02iAqU +YRawXmDuuoGMwwlJ +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST ESTEID-SK 2011.crt libdigidoc-3.7.0.875/etc/certs/TEST ESTEID-SK 2011.crt --- libdigidoc-2.7.0/etc/certs/TEST ESTEID-SK 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST ESTEID-SK 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEuzCCA6OgAwIBAgIQSxRID7FoIaNNdNhBeucLvDANBgkqhkiG9w0BAQUFADB9 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEwMC4GA1UEAwwnVEVTVCBvZiBFRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290 +IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwHhcNMTEwMzA3MTMwNjA5WhcN +MjMwOTA3MTIwNjA5WjBsMQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlm +aXRzZWVyaW1pc2tlc2t1czEfMB0GA1UEAwwWVEVTVCBvZiBFU1RFSUQtU0sgMjAx +MTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMIIBIjANBgkqhkiG9w0BAQEFAAOC +AQ8AMIIBCgKCAQEA0SMr+A2QGMJuNpu60MgqKG0yLL7JfvjNtgs2hqWADDn1AQeD +79o+8r4SRYp9kowSFA8E1v38XXTHRq3nSZeToOC5DMAWjsKlm4x8hwwp31BXCs/H +rl9VmikIgAlaHvv3Z+MzS6qeLdzyYi/glPVrY42A6/kBApOJlOVLvAFdySNmFkY+ +Ky7MZ9jbBr+Nx4py/V7xm9VD62Oe1lku4S4qd+VYcQ5jftbr4OFjBp9Nn58/5svQ +xrLjv3B67i19d7sNh7UPnMiO6BeBb6yb3P1lqdHofE1lElStIPViJlzjPOh4puxW +adHDvVYUCJgW2aM58mTfjFhZbVfcrVn5OyIiTQIDAQABo4IBRjCCAUIwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwgZkGA1UdIASBkTCBjjCBiwYKKwYB +BAHOHwMBATB9MFgGCCsGAQUFBwICMEweSgBBAGkAbgB1AGwAdAAgAHQAZQBzAHQA +aQBtAGkAcwBlAGsAcwAuACAATwBuAGwAeQAgAGYAbwByACAAdABlAHMAdABpAG4A +ZwAuMCEGCCsGAQUFBwIBFhVodHRwczovL3d3dy5zay5lZS9DUFMwHQYDVR0OBBYE +FEG2/sWxsbRTE4z6+mLQNG1tIjQKMB8GA1UdIwQYMBaAFLU0Cp2lLxDF5yEOvsSx +ZUcbA3b+MEMGA1UdHwQ8MDowOKA2oDSGMmh0dHBzOi8vd3d3LnNrLmVlL3JlcG9z +aXRvcnkvY3Jscy90ZXN0X2VlY2NyY2EuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQBd +h5R23K7qkrO78j51xN6CR2qwxUcK/cgcTLWv0obPmJ7jRax3PX0pFhaUE6EhAR0d +gS4u6XZrjPgVrt/mwq1h8lJP1MF2ueAHKyS0SGj7aFLkcC+ULwu1k6yiortFJ0Ds +49ZGA+ioGzYWPQ+g1Zl4wSDIz52ot0cHUijnf39Szq7E2z7MDfZkYg8HZeHrO493 +EFghXcnSH7J7z47cgP3GWFNUKv1V2c0eVE4OxRulZ3KmBLPWbJKZ0TyGa/Aooc+T +orEjxz//WzcF/Sklp4FeD0MU39UURIlg7LfEcm832bPzZzVGFd4drBd5Dy0Uquu6 +3kW7RDqr+wQFSxKr9DIH +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST Juur-SK.crt libdigidoc-3.7.0.875/etc/certs/TEST Juur-SK.crt --- libdigidoc-2.7.0/etc/certs/TEST Juur-SK.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST Juur-SK.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,23 @@ +-----BEGIN CERTIFICATE----- +MIID5TCCAs2gAwIBAgIEO43dLzANBgkqhkiG9w0BAQUFADBiMRgwFgYJKoZIhvcN +AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp +dHNlZXJpbWlza2Vza3VzMRUwEwYDVQQDEwxURVNUIEp1dXItU0swHhcNMDEwODMw +MDYyOTA0WhcNMTYwODI3MDUyOTA0WjBiMRgwFgYJKoZIhvcNAQkBFglwa2lAc2su +ZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vz +a3VzMRUwEwYDVQQDEwxURVNUIEp1dXItU0swggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDJIyr2hhDhkZgOJnsFv8VHQJGGK+vld0kGRvpl9Bx81/ZFvEwO +LDfiReuHlTXCOin2FU3f+UJ2TriA+7K4jMCrkXW4oL9vmy99JmZY3esOSzMoAGvJ +XTkSN3/U99LajIzZ718e1kslmxgjVrlmlWI2VR/dPNkZN2KVuT4s9zYHzM3frPsa +DqFd7yMnuqF4YP4yt6DHtqaF+R4vgP/mPRsusoN4NJBiEin6Sm/8me3MS0y8o0qY +fOw+wYgFM2o/XTsu3B7drY/9AoTCVTSp5Lo6xw33yxgVrtKqOSPeV6YBy8lgs8kl +75BaEt+zJ06b/aD8JB81Mtn65Tfq1rMK/HrnAgMBAAGjgaIwgZ8wDwYDVR0TAQH/ +BAUwAwEB/zA8BgNVHR8ENTAzMDGgL6AthitodHRwOi8vd3d3LnNrLmVlL2NybHMv +dGVzdC90ZXN0LWp1dXItc2suY3JsMB0GA1UdDgQWBBSBwuAMBRryEG40E0wsjD7c +iCkyeDAfBgNVHSMEGDAWgBSBwuAMBRryEG40E0wsjD7ciCkyeDAOBgNVHQ8BAf8E +BAMCAeYwDQYJKoZIhvcNAQEFBQADggEBAAvvh+xwmeD8wk2Fq0SycwqMXcVw8lFf +osXCIhw/CKpnIzJUrYLyoonNatT7XLt/nmduewUrl3GzKSdTovJA2k1d4srJvU9s +9AEyMJysgD/hwxBYfAThrxMsYV4NwLdQAv5AAgL3NNH/qpFZacDpGonJXH0jLE/M +9r/rHI52nlkLQEfnwx5Abjq+xowzf9o1NiFUhYP8u4Fmie5EvnFnEn9S/X1aPNBU +nH1C2jC3rLqca0qv4fj52w3iYRSwrg30saZA6/VFDXVNV7sCsdWDDQU6AYvonXf0 +mqWg61UrLBc0E0GtCW4vijVXotjpf517Au/9SIhdtDZ3cY+rfsU1sqw= +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST KLASS3 2010.crt libdigidoc-3.7.0.875/etc/certs/TEST KLASS3 2010.crt --- libdigidoc-2.7.0/etc/certs/TEST KLASS3 2010.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST KLASS3 2010.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIExzCCA6+gAwIBAgIQIrzOHDuBOQRPabRVIaWqEzANBgkqhkiG9w0BAQUFADB9 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEwMC4GA1UEAwwnVEVTVCBvZiBFRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290 +IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwHhcNMTIwMzIxMTA1ODI5WhcN +MjUwMzIxMTA1ODI5WjB1MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlm +aXRzZWVyaW1pc2tlc2t1czEhMB8GA1UECwwYU2VydGlmaXRzZWVyaW1pc3RlZW51 +c2VkMR8wHQYDVQQDDBZURVNUIG9mIEtMQVNTMy1TSyAyMDEwMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7Ua/6IAAqXvy2COvRLW9yCSeImQ23XRAzf/x +HmJ6fYiSs0LaR8c19IOSOkOarAgUrt0XDG5KWBdE5qwuVc0gQN9ZjYwmDg3dq4LV +o89FdvATKk2Tao01Iu1N+2eGSEifgGBH5iWfYqu1hGJ2nJPHIG9bKXZXfw+ET2gy +mO5bHnt8iOJmq+YynMXEvxtUTl2hKh0o6m28i3YKXru0jm5qe5/YCJ9HFw9yKn8e +LnI2/9Jfruxe5F1AMOkVXhVtA57yeQARv18a8uEQZV0CS/WDmCPi+hl6GqSwhWZB +dB9igOMsnZdNS1s7kr2/46doZQVPa2X3vJyYMTl/oaWB++VfAQIDAQABo4IBSTCC +AUUwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAcYwgZkGA1UdIASB +kTCBjjCBiwYKKwYBBAHOHwMBATB9MCEGCCsGAQUFBwIBFhVodHRwczovL3d3dy5z +ay5lZS9jcHMwWAYIKwYBBQUHAgIwTB5KAEEAaQBuAHUAbAB0ACAAdABlAHMAdABp +AG0AaQBzAGUAawBzAC4AIABPAG4AbAB5ACAAZgBvAHIAIAB0AGUAcwB0AGkAbgBn +AC4wHQYDVR0OBBYEFNFoQ5JN1Wc5Ii9tzYgGEg662Wp2MB8GA1UdIwQYMBaAFLU0 +Cp2lLxDF5yEOvsSxZUcbA3b+MEMGA1UdHwQ8MDowOKA2oDSGMmh0dHBzOi8vd3d3 +LnNrLmVlL3JlcG9zaXRvcnkvY3Jscy90ZXN0X2VlY2NyY2EuY3JsMA0GCSqGSIb3 +DQEBBQUAA4IBAQCiE8G8gwZpeeHm0PoqHd54/KbfH2cAklqO5rcg2m9fhhvPNtMQ +9Wc19JWauE2YuNsnJNKetglUAnA/yd64DhQKBf+2JUgYJas4dTscRgXXlz8huuve +nNUpfPd3iispVc2WNBQ2qjBEZXdqhbkG0/RgM42Hb28+1v23HsoLhCGY2YjHhYyn +mOk/8BULI/ArsgA7FJflXi5Xp/cdC8BJQ87vtPlAnxm0axZMvASNXMUvvQTUjCTg +0yczX3d8+I3EBNBlzfPMsyU1LCn6Opbs2/DGF/4enhRGk/49L6ltfOyOA73buSog +S2JkvCweSx6Y2cs1fXVyFszm2HJmQgwbZYfR +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST SK OCSP 2011.crt libdigidoc-3.7.0.875/etc/certs/TEST SK OCSP 2011.crt --- libdigidoc-2.7.0/etc/certs/TEST SK OCSP 2011.crt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST SK OCSP 2011.crt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,27 @@ +-----BEGIN CERTIFICATE----- +MIIEijCCA3KgAwIBAgIQaI8x6BnacYdNdNwlYnn/mzANBgkqhkiG9w0BAQUFADB9 +MQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1 +czEwMC4GA1UEAwwnVEVTVCBvZiBFRSBDZXJ0aWZpY2F0aW9uIENlbnRyZSBSb290 +IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwHhcNMTEwMzA3MTMyMjQ1WhcN +MjQwOTA3MTIyMjQ1WjCBgzELMAkGA1UEBhMCRUUxIjAgBgNVBAoMGUFTIFNlcnRp +Zml0c2VlcmltaXNrZXNrdXMxDTALBgNVBAsMBE9DU1AxJzAlBgNVBAMMHlRFU1Qg +b2YgU0sgT0NTUCBSRVNQT05ERVIgMjAxMTEYMBYGCSqGSIb3DQEJARYJcGtpQHNr +LmVlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0cw6Cja17BbYbHi6 +frwccDI4BIQLk/fiCE8L45os0xhPgEGR+EHE8LPCIqofPgf4gwN1vDE6cQNUlK0O +d+Ush39i9Z45esnfpGq+2HsDJaFmFr5+uC1MEz5Kn1TazEvKbRjkGnSQ9BertlGe +r2BlU/kqOk5qA5RtJfhT0psc1ixKdPipv59wnf+nHx1+T+fPWndXVZLoDg4t3w8l +IvIE/KhOSMlErvBIHIAKV7yH1hOxyeGLghqzMiAn3UeTEOgoOS9URv0C/T5C3mH+ +Y/uakMSxjNuz41PneimCzbEJZJRiEaMIj8qPAubcbL8GtY03MWmfNtX6/wh6u6TM +fW8S2wIDAQABo4H+MIH7MBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMJMB0GA1UdDgQW +BBR9/5CuRokEgGiqSzYuZGYAogl8TzCBoAYDVR0gBIGYMIGVMIGSBgorBgEEAc4f +AwEBMIGDMFgGCCsGAQUFBwICMEweSgBBAGkAbgB1AGwAdAAgAHQAZQBzAHQAaQBt +AGkAcwBlAGsAcwAuACAATwBuAGwAeQAgAGYAbwByACAAdABlAHMAdABpAG4AZwAu +MCcGCCsGAQUFBwIBFhtodHRwOi8vd3d3LnNrLmVlL2FqYXRlbXBlbC8wHwYDVR0j +BBgwFoAUtTQKnaUvEMXnIQ6+xLFlRxsDdv4wDQYJKoZIhvcNAQEFBQADggEBAAba +j7kTruTAPHqToye9ZtBdaJ3FZjiKug9/5RjsMwDpOeqFDqCorLd+DBI4tgdu0g4l +haI3aVnKdRBkGV18kqp84uU97JRFWQEf6H8hpJ9k/LzAACkP3tD+0ym+md532mV+ +nRz1Jj+RPLAUk9xYMV7KPczZN1xnl2wZDJwBbQpcSVH1DjlZv3tFLHBLIYTS6qOK +4SxStcgRq7KdRczfW6mfXzTCRWM3G9nmDei5Q3+XTED41j8szRWglzYf6zOv4djk +ja64WYraQ5zb4x8Xh7qTCk6UupZ7je+0oRfuz0h/3zyRdjcRPkjloSpQp/NG8Rmr +cnr874p8d9fdwCrRI7U= +-----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/certs/TEST-SK.crt libdigidoc-3.7.0.875/etc/certs/TEST-SK.crt --- libdigidoc-2.7.0/etc/certs/TEST-SK.crt 2009-11-07 20:15:03.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/certs/TEST-SK.crt 2012-12-13 22:05:47.000000000 +0000 @@ -1,29 +1,21 @@ -----BEGIN CERTIFICATE----- -MIIFDDCCA/SgAwIBAgIEPLQlGTANBgkqhkiG9w0BAQUFADBdMRgwFgYJKoZIhvcN -AQkBFglwa2lAc2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZp -dHNlZXJpbWlza2Vza3VzMRAwDgYDVQQDEwdKdXVyLVNLMB4XDTAyMDQxMDExNDIx -N1oXDTEyMDQwNzExNDIxN1owXzELMAkGA1UEBhMCRUUxIjAgBgNVBAoTGUFTIFNl -cnRpZml0c2VlcmltaXNrZXNrdXMxGjAYBgNVBAsTEVRlc3RzZXJ0aWZpa2FhZGlk -MRAwDgYDVQQDEwdURVNULVNLMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC -AQEAqRBRliE/OtzE35NjaEVEWYj+NAEgBHMquQqJURZCtPJnSe7mrjt56/b/GnNd -fywiT6xV2++ZFbe710bEftcDNo2CiFnrsFAfOAcnzzhqiTLNp1/pibfhWyiKUyEt -Tyi9UVisNZTsynbev2k3bzGzaOCDxzL9Cq/8mGjspufoX2AYIfbS0NZ44DmyUy0b -hUnOyhN6BzirAdA8UXizLQ7xcjCzNjG7eyn/EiMViWI81XNk8QNn4ZZw5X8qWZny -Wml3Or43wm1W1IhDC/gFWlWwRQAZiM036rOViyleaK7y2XL2a/jcQHUyyvjGnLVB -J2DXevsfpPEz9fXSB8rXBYhDRQIDAQABo4IB0DCCAcwwDAYDVR0TBAUwAwEB/zAO -BgNVHQ8BAf8EBAMCAf4wJQYIKwYBBQUHAQEEGTAXMBUGCCsGAQUFBzACgQlwa2lA -c2suZWUwKwYDVR0fBCQwIjAgoB6gHIYaaHR0cDovL3d3dy5zay5lZS9qdXVyL2Ny -bC8wggEWBgNVHSAEggENMIIBCTCCAQUGCisGAQQBzh8BAQEwgfYwgdAGCCsGAQUF -BwICMIHDHoHAAFMAZQBlACAAcwBlAHIAdABpAGYAaQBrAGEAYQB0ACAAbwBuACAA -dgDkAGwAagBhAHMAdABhAHQAdQBkACAAQQBTAC0AaQBzACAAUwBlAHIAdABpAGYA -aQB0AHMAZQBlAHIAaQBtAGkAcwBrAGUAcwBrAHUAcwAgAGEAbABhAG0ALQBTAEsA -IABzAGUAcgB0AGkAZgBpAGsAYQBhAHQAaQBkAGUAIABrAGkAbgBuAGkAdABhAG0A -aQBzAGUAawBzMCEGCCsGAQUFBwIBFhVodHRwOi8vd3d3LnNrLmVlL2Nwcy8wHwYD -VR0jBBgwFoAUBKp6R6Pkia8azwpApxg/b+/pfb4wHQYDVR0OBBYEFAIFJ92ocoe3 -gsBbOSp/4zjy+lIJMA0GCSqGSIb3DQEBBQUAA4IBAQB3J6VyP1vBjbW3jvUVk53a -2CyGLIobRSO4Voom+AaWyNJ32Q1LM2qpJkLEwC2/9Akp8t4A/iCRLcVhJWnDWPRG -Dm3YAuDEktvcU6DMSBiEw3iA7s/9Hq3QzRLLPNLT1LCE2dkzg5Y1J33pkrq3fFUy -nS9VWRwnujOhBC+njEnb3cD+sgCSphEBvRVMuqDQXGFJxuFbTZ7ydr2diOucJG1n -uxjwnDR2iigE3pucGjX0EH6P/8itFtL41mRniT9SesDb2v5mt5y/yrdJNrEGtV+s -LAr5QPBjoqvoY5L9H966SmbXiGjX5zqWHM4pYZAQ6dKbf4Dviqa1oKbcQx6ERCHA +MIIECTCCAvGgAwIBAgIEPLKVuDANBgkqhkiG9w0BAQUFADBiMRgwFgYJKoZIhvcNAQkBFglwa2lA +c2suZWUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKExlBUyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMRUw +EwYDVQQDEwxURVNUIEp1dXItU0swHhcNMDIwNDA5MDcxODE2WhcNMTYwODI2MDYxODE2WjBfMQsw +CQYDVQQGEwJFRTEiMCAGA1UEChMZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEaMBgGA1UECxMR +VGVzdHNlcnRpZmlrYWFkaWQxEDAOBgNVBAMTB1RFU1QtU0swggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQCpEFGWIT863MTfk2NoRURZiP40ASAEcyq5ColRFkK08mdJ7uauO3nr9v8ac11/ +LCJPrFXb75kVt7vXRsR+1wM2jYKIWeuwUB84ByfPOGqJMs2nX+mJt+FbKIpTIS1PKL1RWKw1lOzK +dt6/aTdvMbNo4IPHMv0Kr/yYaOym5+hfYBgh9tLQ1njgObJTLRuFSc7KE3oHOKsB0DxReLMtDvFy +MLM2Mbt7Kf8SIxWJYjzVc2TxA2fhlnDlfypZmfJaaXc6vjfCbVbUiEML+AVaVbBFABmIzTfqs5WL +KV5orvLZcvZr+NxAdTLK+MactUEnYNd6+x+k8TP19dIHytcFiENFAgMBAAGjgckwgcYwDwYDVR0T +AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAf4wJQYIKwYBBQUHAQEEGTAXMBUGCCsGAQUFBzACgQlw +a2lAc2suZWUwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL3d3dy5zay5lZS9jcmxzL3Rlc3QvdGVz +dC1qdXVyLXNrLmNybDAfBgNVHSMEGDAWgBSBwuAMBRryEG40E0wsjD7ciCkyeDAdBgNVHQ4EFgQU +AgUn3ahyh7eCwFs5Kn/jOPL6UgkwDQYJKoZIhvcNAQEFBQADggEBALk6ALjx0wJpvFdtCadHxYx2 +11YcThJqtywxfIl9yXVCDfu8JzrLnVowJJj+gBIkBrz7QyOYpxqnRRxRXSP3SXCdOCnNLRuX9nvT +yJsMqhSql8Zw1roB8xYb133ztLAqVRoyo4e/c1VUZCVsXmmh5HGUepDU7QKQWQYKbq3tjrKvwXMZ +QbXbp0L4eiuIbRzN00EOfnrIxBvsHfqZyc2gYqSHfM9YldlboGqNFGO5NQo2wOZ7jByi2aLaRkkN +1Sx2EJX4Mudpb9RD08txailOBAcjl1j37ey1tU2AnGiyeYYPkXG88K6+L05ggIstR6kBU94wat8L +qk3z5V5ScVGXOiw= -----END CERTIFICATE----- diff -Nru libdigidoc-2.7.0/etc/digidoc.conf.cmake libdigidoc-3.7.0.875/etc/digidoc.conf.cmake --- libdigidoc-2.7.0/etc/digidoc.conf.cmake 2010-06-21 15:53:05.000000000 +0000 +++ libdigidoc-3.7.0.875/etc/digidoc.conf.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -4,25 +4,44 @@ #-------------------------------------------------- [ca] -CA_CERT_PATH=@DIGIDOC_DATA_DIR@/certs -CA_CERTS=8 +CA_CERT_PATH=@DIGIDOC_CERT_LOCATION@/certs +CA_CERTS=16 + CA_CERT_1=JUUR-SK.crt CA_CERT_1_CN=Juur-SK CA_CERT_2=ESTEID-SK.crt CA_CERT_2_CN=ESTEID-SK -CA_CERT_3=TEST-SK.crt -CA_CERT_3_CN=TEST-SK +CA_CERT_3=ESTEID-SK 2007.crt +CA_CERT_3_CN=ESTEID-SK 2007 CA_CERT_4=KLASS3-SK.crt CA_CERT_4_CN=KLASS3-SK -CA_CERT_5=EID-SK.crt -CA_CERT_5_CN=EID-SK -CA_CERT_6=ESTEID-SK 2007.crt -CA_CERT_6_CN=ESTEID-SK 2007 +CA_CERT_5=KLASS3-SK 2010.crt +CA_CERT_5_CN=KLASS3-SK 2010 +CA_CERT_6=EID-SK.crt +CA_CERT_6_CN=EID-SK CA_CERT_7=EID-SK 2007.crt CA_CERT_7_CN=EID-SK 2007 -CA_CERT_8=KLASS3-SK 2010.crt -CA_CERT_8_CN=KLASS3-SK 2010 +CA_CERT_8=EECCRCA.crt +CA_CERT_8_CN=EE Certification Centre Root CA +CA_CERT_9=ESTEID-SK 2011.crt +CA_CERT_9_CN=ESTEID-SK 2011 +CA_CERT_10=EID-SK 2011.crt +CA_CERT_10_CN=EID-SK 2011 + +CA_CERT_11=TEST Juur-SK.crt +CA_CERT_11_CN=TEST Juur-SK +CA_CERT_12=TEST-SK.crt +CA_CERT_12_CN=TEST-SK + +CA_CERT_13=TEST EECCRCA.crt +CA_CERT_13_CN=TEST of EE Certification Centre Root CA +CA_CERT_14=TEST ESTEID-SK 2011.crt +CA_CERT_14_CN=TEST of ESTEID-SK 2011 +CA_CERT_15=TEST EID-SK 2011.crt +CA_CERT_15_CN=TEST of EID-SK 2011 +CA_CERT_16=TEST KLASS3 2010.crt +CA_CERT_16_CN=TEST of KLASS3-SK 2010 DIGIDOC_FORMAT=DIGIDOC-XML DIGIDOC_VERSION=1.3 @@ -33,11 +52,14 @@ DIGIDOC_DRIVER_1_DESC=OpenSC projects PKCS#11 driver DIGIDOC_DRIVER_1_FILE=@PKCS11_MODULE@ DIGIDOC_SIGNATURE_SLOT=1 +CHECK_OCSP_NONCE=0 +CHECK_SIGNATURE_VALUE_ASN1=1 SIGN_OCSP=0 USE_PROXY=0 +DIGIDOC_OCSP_URL=http://ocsp.sk.ee -DIGIDOC_OCSP_RESPONDER_CERTS=11 +DIGIDOC_OCSP_RESPONDER_CERTS=18 DIGIDOC_OCSP_RESPONDER_CERT_1=TEST-SK OCSP 2005.crt DIGIDOC_OCSP_RESPONDER_CERT_1_CN=TEST-SK OCSP RESPONDER 2005 @@ -47,54 +69,73 @@ DIGIDOC_OCSP_RESPONDER_CERT_2=KLASS3-SK OCSP 2009.crt DIGIDOC_OCSP_RESPONDER_CERT_2_CN=KLASS3-SK OCSP RESPONDER 2009 DIGIDOC_OCSP_RESPONDER_CERT_2_CA=KLASS3-SK -DIGIDOC_OCSP_RESPONDER_CERT_2_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_3=ESTEID-SK OCSP 2005.crt DIGIDOC_OCSP_RESPONDER_CERT_3_CN=ESTEID-SK OCSP RESPONDER 2005 DIGIDOC_OCSP_RESPONDER_CERT_3_CA=ESTEID-SK -DIGIDOC_OCSP_RESPONDER_CERT_3_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_4=ESTEID-SK 2007 OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_4_CN=ESTEID-SK 2007 OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_4_CA=ESTEID-SK 2007 -DIGIDOC_OCSP_RESPONDER_CERT_4_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_5=EID-SK 2007 OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_5_CN=EID-SK 2007 OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_5_CA=EID-SK 2007 -DIGIDOC_OCSP_RESPONDER_CERT_5_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_6=EID-SK OCSP 2006.crt DIGIDOC_OCSP_RESPONDER_CERT_6_1=EID-SK OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_6_CN=EID-SK OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_6_CA=EID-SK -DIGIDOC_OCSP_RESPONDER_CERT_6_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_7=ESTEID-SK OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_7_CN=ESTEID-SK OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_7_CA=ESTEID-SK -DIGIDOC_OCSP_RESPONDER_CERT_7_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_8=KLASS3-SK OCSP 2006.crt DIGIDOC_OCSP_RESPONDER_CERT_8_1=KLASS3-SK OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_8_CN=KLASS3-SK OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_8_CA=KLASS3-SK -DIGIDOC_OCSP_RESPONDER_CERT_8_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_9=EID-SK 2007 OCSP 2010.crt DIGIDOC_OCSP_RESPONDER_CERT_9_CN=EID-SK 2007 OCSP RESPONDER 2010 DIGIDOC_OCSP_RESPONDER_CERT_9_CA=EID-SK 2007 -DIGIDOC_OCSP_RESPONDER_CERT_9_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_10=ESTEID-SK 2007 OCSP 2010.crt DIGIDOC_OCSP_RESPONDER_CERT_10_CN=ESTEID-SK 2007 OCSP RESPONDER 2010 DIGIDOC_OCSP_RESPONDER_CERT_10_CA=ESTEID-SK 2007 -DIGIDOC_OCSP_RESPONDER_CERT_10_URL=http://ocsp.sk.ee DIGIDOC_OCSP_RESPONDER_CERT_11=KLASS3-SK 2010 OCSP.crt DIGIDOC_OCSP_RESPONDER_CERT_11_CN=KLASS3-SK 2010 OCSP RESPONDER DIGIDOC_OCSP_RESPONDER_CERT_11_CA=KLASS3-SK 2010 -DIGIDOC_OCSP_RESPONDER_CERT_11_URL=http://ocsp.sk.ee -#DIGIDOC_OCSP_URL=http://www.openxades.org/cgi-bin/ocsp.cgi -DIGIDOC_OCSP_URL=http://ocsp.sk.ee +DIGIDOC_OCSP_RESPONDER_CERT_12=SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_12_CN=SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_12_CA=EE Certification Centre Root CA + +DIGIDOC_OCSP_RESPONDER_CERT_13=SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_13_CN=SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_13_CA=ESTEID-SK 2011 + +DIGIDOC_OCSP_RESPONDER_CERT_14=SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_14_CN=SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_14_CA=EID-SK 2011 + +DIGIDOC_OCSP_RESPONDER_CERT_15=TEST SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_15_CN=TEST of SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_15_CA=TEST of EE Certification Centre Root CA +DIGIDOC_OCSP_RESPONDER_CERT_15_URL=http://www.openxades.org/cgi-bin/ocsp.cgi + +DIGIDOC_OCSP_RESPONDER_CERT_16=TEST SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_16_CN=TEST of SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_16_CA=TEST of ESTEID-SK 2011 +DIGIDOC_OCSP_RESPONDER_CERT_16_URL=http://www.openxades.org/cgi-bin/ocsp.cgi + +DIGIDOC_OCSP_RESPONDER_CERT_17=TEST SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_17_CN=TEST of SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_17_CA=TEST of EID-SK 2011 +DIGIDOC_OCSP_RESPONDER_CERT_17_URL=http://www.openxades.org/cgi-bin/ocsp.cgi + +DIGIDOC_OCSP_RESPONDER_CERT_18=TEST SK OCSP 2011.crt +DIGIDOC_OCSP_RESPONDER_CERT_18_CN=TEST of SK OCSP RESPONDER 2011 +DIGIDOC_OCSP_RESPONDER_CERT_18_CA=TEST of KLASS3-SK 2010 +DIGIDOC_OCSP_RESPONDER_CERT_18_URL=http://www.openxades.org/cgi-bin/ocsp.cgi diff -Nru libdigidoc-2.7.0/libdigidoc/CMakeLists.txt libdigidoc-3.7.0.875/libdigidoc/CMakeLists.txt --- libdigidoc-2.7.0/libdigidoc/CMakeLists.txt 2009-06-16 12:57:02.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/CMakeLists.txt 2012-12-13 22:05:47.000000000 +0000 @@ -1,35 +1,41 @@ -add_subdirectory( mssp ) -add_subdirectory( pkcs11 ) -add_subdirectory( ts ) - -set( libdigidoc_SRCS - DigiDocConfig.c - DigiDocLib.c - DigiDocObj.c - DigiDocPKCS11.c - DigiDocError.c - DigiDocParser.c - DigiDocDebug.c - DigiDocSAXParser.c - DigiDocMem.c - DigiDocStack.c - DigiDocEnc.c - DigiDocEncGen.c - DigiDocEncSAXParser.c - DigiDocCert.c - DigiDocConvert.c - DigiDocGen.c - DigiDocVerify.c - DigiDocOCSP.c - DigiDocDfExtract.c +configure_file( + ${CMAKE_SOURCE_DIR}/etc/digidoc.conf.cmake + ${CMAKE_CURRENT_BINARY_DIR}/${DIGIDOC_CONF_NAME} + @ONLY +) +FILE( GLOB CERTS ${CMAKE_SOURCE_DIR}/etc/certs/*.crt ) + +set( PUBLIC_HEADER + DigiDocCert.h + DigiDocConfig.h + DigiDocConvert.h + DigiDocDebug.h + DigiDocDefs.h + DigiDocDfExtract.h + DigiDocEncGen.h + DigiDocEnc.h + DigiDocEncSAXParser.h + DigiDocError.h + DigiDocGen.h + DigiDocLib.h + DigiDocMem.h + DigiDocObj.h + DigiDocOCSP.h + DigiDocParser.h +# DigiDocPKCS11.h + DigiDocSAXParser.h + DigiDocStack.h + DigiDocVerify.h + DigiDocHTTP.h + DigiDocService.h ) -add_definitions( -DSYSCONFDIR="${SYSCONF_INSTALL_DIR}" ) -add_definitions( -DDIGIDOC_VERSION="${DIGIDOC_VERSION}" ) -add_definitions( -DWITH_SOAPDEFS_H ) if( WIN32 ) - add_definitions( -DBUILDINGDLL ) -endif( WIN32 ) + list( APPEND libdigidoc_SRCS DigiDocGlobals.c DigiDocCSP.c DigiCrypt.c DlgUnit.c DlgUnitS.c ) + set( EXT_LIBRARIES Crypt32 Comctl32 ) +endif() + +add_definitions( -DWITH_SOAPDEFS_H ) if( MSVC ) add_definitions( -D_CRT_NONSTDC_NO_DEPRECATE @@ -37,44 +43,97 @@ -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS ) -endif( MSVC ) +endif() + +add_library( digidoc SHARED + ${PUBLIC_HEADER} + ${CMAKE_CURRENT_BINARY_DIR}/${DIGIDOC_CONF_NAME} + ${libdigidoc_SRCS} + ${CERTS} + libdigidoc.rc + DigiDocConfig.c + DigiDocLib.c + DigiDocObj.c + DigiDocPKCS11.c + DigiDocError.c + DigiDocParser.c + DigiDocDebug.c + DigiDocSAXParser.c + DigiDocMem.c + DigiDocStack.c + DigiDocEnc.c + DigiDocEncGen.c + DigiDocEncSAXParser.c + DigiDocCert.c + DigiDocConvert.c + DigiDocGen.c + DigiDocVerify.c + DigiDocOCSP.c + DigiDocDfExtract.c + DigiDocHTTP.c + DigiDocService.c +) -add_library( digidoc SHARED ${libdigidoc_SRCS} ) target_link_libraries( digidoc - ${LIBDL_LIBRARIES} + ${CMAKE_DL_LIBS} ${LIBXML2_LIBRARIES} ${OPENSSL_LIBRARIES} - ${OPENSSLCRYPTO_LIBRARIES} ${ZLIB_LIBRARIES} + ${EXT_LIBRARIES} ) -set_target_properties( digidoc PROPERTIES VERSION ${DIGIDOC_VERSION} SOVERSION 2 ) -install( TARGETS digidoc DESTINATION ${INSTALL_TARGETS_DEFAULT_ARGS} ) -add_executable( cdigidoc cdigidoc.c ) +add_executable( cdigidoc cdigidoc.c cdigidoc.rc ) target_link_libraries( cdigidoc digidoc ) -install( TARGETS cdigidoc DESTINATION ${BIN_INSTALL_DIR} ) -# Include files -install( FILES - DigiDocCert.h - DigiDocConfig.h - DigiDocConvert.h - DigiDocDebug.h - DigiDocDefs.h - DigiDocDfExtract.h - DigiDocEncGen.h - DigiDocEnc.h - DigiDocEncSAXParser.h - DigiDocError.h - DigiDocGen.h - DigiDocLib.h - DigiDocMem.h - DigiDocObj.h - DigiDocOCSP.h - DigiDocParser.h - DigiDocPKCS11.h - DigiDocSAXParser.h - DigiDocStack.h - DigiDocVerify.h - DESTINATION ${DIGIDOC_INCLUDE_DIR} +if( CMAKE_COMPILER_IS_GNUCC OR __COMPILER_GNU ) + set_target_properties( digidoc PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" ) + set_target_properties( cdigidoc PROPERTIES COMPILE_FLAGS "-fvisibility=hidden" ) +endif() + +set_target_properties( digidoc PROPERTIES + VERSION ${MAJOR_VER}.${MINOR_VER}.${RELEASE_VER} + SOVERSION 2 + PUBLIC_HEADER "${PUBLIC_HEADER}" + RESOURCE ${CMAKE_CURRENT_BINARY_DIR}/${DIGIDOC_CONF_NAME} + FRAMEWORK_VERSION 2 + FRAMEWORK ${FRAMEWORK} + MACOSX_FRAMEWORK_IDENTIFIER "ee.ria.libdigidoc" +) + +install( TARGETS digidoc + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RESOURCE DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdigidoc + FRAMEWORK DESTINATION /Library/Frameworks ) + +if( FRAMEWORK ) + set_target_properties( digidoc PROPERTIES + OUTPUT_NAME "libdigidoc" + COMPILE_DEFINITIONS "FRAMEWORK;MAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6" + LINK_FLAGS "-framework CoreFoundation -framework Security" ) + set_source_files_properties( ${CERTS} PROPERTIES MACOSX_PACKAGE_LOCATION Resources ) + install( TARGETS cdigidoc DESTINATION /Library/Frameworks/libdigidoc.framework/Resources ) +else() + install( TARGETS cdigidoc DESTINATION ${CMAKE_INSTALL_BINDIR} ) + configure_file( libdigidoc.pc.cmake libdigidoc.pc @ONLY ) + configure_file( cdigidoc.1.cmake cdigidoc.1 ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libdigidoc.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) + install( FILES ${CMAKE_CURRENT_BINARY_DIR}/cdigidoc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) +endif() + +#install( FILES +# mssp/DigiDocMsspGw.h +# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdigidoc/mssp +#) + +#install( FILES +# pkcs11/pkcs11.h +# pkcs11/pkcs11f.h +# pkcs11/pkcs11t.h +# pkcs11/unix.h +# pkcs11/cryptoki.h +# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libdigidoc/pkcs11 +#) diff -Nru libdigidoc-2.7.0/libdigidoc/DigiCrypt.c libdigidoc-3.7.0.875/libdigidoc/DigiCrypt.c --- libdigidoc-2.7.0/libdigidoc/DigiCrypt.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiCrypt.c 2012-12-13 22:05:47.000000000 +0000 @@ -12,6 +12,7 @@ // #include "DigiCrypt.h" #include "DigiDocDefs.h" +#include "DigiDocConfig.h" #include #include @@ -112,7 +113,7 @@ BYTE *pbData = NULL; HCRYPTKEY hKey; DWORD cbData = 0; -DWORD dwKeyType=0; +DWORD dwKeyType=0, dwKeySpec = AT_SIGNATURE; DWORD dwErrCode=0; DWORD cspType=0; DWORD cspFlag=CRYPT_SILENT; @@ -148,7 +149,10 @@ if (fRes == FALSE) return(pCertContext); -fRes=CryptGetUserKey(hCryptProv, AT_SIGNATURE, &hKey); +// VS: use alsu auth keys if KEY_USAGE_CHECK=false +dwKeySpec = ConfigItem_lookup_int("KEY_USAGE_CHECK", 1) ? AT_SIGNATURE : 0; + +fRes=CryptGetUserKey(hCryptProv, dwKeySpec, &hKey); if (fRes == TRUE) { fRes=CryptGetKeyParam(hKey, KP_CERTIFICATE, NULL, &cbData, 0); @@ -750,8 +754,13 @@ { BOOL fIsValid = FALSE; BOOL fRes = FALSE; +BOOL fKuCheck = TRUE; BYTE bKeyUsageBits = CERT_NON_REPUDIATION_KEY_USAGE; DWORD dwKeyUsageBytes = 1; +// VS use auth certs if key_usage_check = 0 +fKuCheck = (BOOL)ConfigItem_lookup_int("KEY_USAGE_CHECK", 1); +bKeyUsageBits = fKuCheck ? CERT_NON_REPUDIATION_KEY_USAGE : 0; +//LOG("KEY_USAGE_CHECK: %d ku: %d", fKuCheck, bKeyUsageBits); //Old version //FILETIME oCurrentTime; if (pCertContext != NULL && pCertContext->pCertInfo != NULL) @@ -763,9 +772,10 @@ // fRes = FALSE; if (fRes == TRUE) { - if(bKeyUsageBits & CERT_NON_REPUDIATION_KEY_USAGE) + //LOG("KU non-repu: %d", (bKeyUsageBits & CERT_NON_REPUDIATION_KEY_USAGE)); + if(!fKuCheck || (bKeyUsageBits & CERT_NON_REPUDIATION_KEY_USAGE)) fIsValid = TRUE; - if(bKeyUsageBits & CERT_KEY_CERT_SIGN_KEY_USAGE) // don't display CA certs + if(bKeyUsageBits & CERT_KEY_CERT_SIGN_KEY_USAGE) // don't display CA certs fIsValid = FALSE; } if (fIsValid == TRUE && fTimeCheck == TRUE) @@ -926,6 +936,7 @@ if(iLogCheck == -1) { iLogCheck = 0; dwRes = GetModuleFileName(NULL, sLogFile, 255); + //strcpy(sLogFile, "z:\\digicrypt.log"); dwRes=1;iLogCheck = 1; //MessageBox(NULL,sLogFile,"LogFile=",MB_OK|MB_SYSTEMMODAL|MB_ICONERROR); while (dwRes > 1) { cVal = sLogFile[dwRes-1]; diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocCert.c libdigidoc-3.7.0.875/libdigidoc/DigiDocCert.c --- libdigidoc-2.7.0/libdigidoc/DigiDocCert.c 2009-12-15 13:42:51.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocCert.c 2012-12-13 22:05:47.000000000 +0000 @@ -88,13 +88,14 @@ //memset(debugBuf,0,sizeof(debugBuf)); RETURN_IF_NULL_PARAM(pkcs12file); - bio=BIO_new(BIO_s_file()); + bio=BIO_new_file(pkcs12file, "rb"); RETURN_IF_NULL(bio); - BIO_read_filename(bio, pkcs12file); p12 = d2i_PKCS12_bio(bio, NULL); BIO_free(bio); RETURN_IF_NOT(p12, ERR_OCSP_PKCS12_CONTAINER); PKCS12_parse(p12, passwd, pkey, x509, NULL); + // Hack: clear PKCS12_parse error "ERROR: 185073780 - error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch + ERR_get_error(); PKCS12_free(p12); RETURN_IF_NOT(*x509, ERR_OCSP_PKCS12_CONTAINER); @@ -151,9 +152,9 @@ err = ERR_BUF_LEN; SET_LAST_ERROR(ERR_BUF_LEN); } - //AM 28.05.08 bn should be freed too + //AM 28.05.08 bn should be freed too if(bn) - BN_free(bn); + BN_free(bn); OPENSSL_free(str); checkErrors(); return err; @@ -266,7 +267,7 @@ break; case FILE_FORMAT_PEM: PEM_write_bio_PrivateKey(out, pkey, (passwd ? EVP_des_ede3_cbc() : NULL), - (char*)passwd, strlen(passwd), pemkey_callback, (void*)passwd) ; + (unsigned char*)passwd, strlen(passwd), pemkey_callback, (void*)passwd) ; break; } BIO_free(out); @@ -294,7 +295,7 @@ if((out = BIO_new_file(keyfile, "wb")) != NULL) { PEM_write_bio_X509(out, pCert); PEM_write_bio_PrivateKey(out, privKey, (passwd ? EVP_des_ede3_cbc() : NULL), - (char*)passwd, (passwd ? strlen(passwd) : 0), pemkey_callback, (void*)passwd); + (unsigned char*)passwd, (passwd ? strlen(passwd) : 0), pemkey_callback, (void*)passwd); BIO_free(out); } else @@ -778,7 +779,7 @@ err = ddocCertGetSubjectCN((X509*)caCert, &mbuf1); err = ddocCertGetSubjectCN((X509*)cert, &mbuf2); err = ddocCertGetIssuerCN((X509*)cert, &mbuf3); - ddocDebug(4, "isCertSignedByCERT", + ddocDebug(3, "isCertSignedByCERT", "Issuer: %s, Subject: %s, Subjects-issuer: %s", (const char*)mbuf1.pMem, (const char*)mbuf2.pMem, (const char*)mbuf3.pMem); @@ -788,13 +789,15 @@ err = GetPublicKey(&pubkey, caCert); if(err == ERR_OK) { err = X509_verify((X509*)cert, pubkey); - ddocDebug(4, "isCertSignedByCERT", - "verify: %d", err); + ddocDebug(3, "isCertSignedByCERT", "verify: %d", err); if(err == ERR_LIB_NONE) err = ERR_OK; else err = ERR_CERT_ISSUER; - checkErrors(); + if(err != ERR_OK) { + ddocDebug(3, "isCertSignedByCERT", "Cert not issued by ca verify: %d", err); + checkErrors(); + } EVP_PKEY_free(pubkey); } else @@ -819,6 +822,28 @@ }*/ //-------------------------------------------------------- +// Checks if the desired key-usage bit is set on a given cert +// pCert - certificate +// nBit - flag index +// return 1 if bit is set +//-------------------------------------------------------- +EXP_OPTION int ddocCertCheckKeyUsage(X509 *pCert, int nBit) +{ + int crit = -1, extIdx = -1; + ASN1_BIT_STRING *keyUsage; + + if(pCert && nBit >= 0 && nBit < 8) { + keyUsage = (ASN1_BIT_STRING *)X509_get_ext_d2i(pCert, NID_key_usage, &crit, &extIdx); + if(keyUsage) { + ddocDebug(3, "ddocCertCheckKeyUsage", "Bit: %d set: %d", nBit, ASN1_BIT_STRING_get_bit(keyUsage, nBit)); + return ASN1_BIT_STRING_get_bit(keyUsage, nBit); + } + } + return 0; +} + + +//-------------------------------------------------------- // Finds and copies a substring from source string that is // prefixed by szLabel and terminated by szTerminator // szSrc - source string @@ -926,7 +951,8 @@ POLICYQUALINFO* pQual; X509_EXTENSION* pExt = X509_get_ext(pX509, pos); // X509V3_EXT_METHOD *method = X509V3_EXT_get(pExt); - pPols = X509V3_EXT_d2i(pExt); + //pPols = (STACK*)X509V3_EXT_d2i(pExt); + pPols = X509V3_EXT_d2i(pExt); for(i = 0; i < sk_POLICYINFO_num(pPols); i++) { pol = sk_POLICYINFO_value(pPols, i); if(*pPolicies && *nPols) { @@ -1018,8 +1044,9 @@ } } } + sk_POLICYINFO_pop_free(pPols, POLICYINFO_free); } - + ddocDebug(4, "readCertPolicies", "End"); return err; } @@ -1042,6 +1069,76 @@ free(pPolicies); } +//-------------------------------------------------- +// Reads certificates extension value +// pCert - certificate +// pMemBuf - memory buffer to return data +// nExt - extension code +//-------------------------------------------------- +EXP_OPTION int readCertExtData(X509* pCert, DigiDocMemBuf* pMemBuf, int nExt, int nOff) +{ + int err = ERR_OK, pos; + X509_EXTENSION* pExt; +/* char buf1[300]; + int l1;*/ + + RETURN_IF_NULL_PARAM(pCert); + RETURN_IF_NULL_PARAM(pMemBuf); + pMemBuf->pMem = 0; + pMemBuf->nLen = 0; + pos = X509_get_ext_by_NID(pCert, nExt, -1); + if(pos >= 0) { + pExt = X509_get_ext(pCert, pos); + if(pExt && pExt->value && pExt->value->data) { + /* memset(buf1, 0, sizeof(buf1)); + l1 = sizeof(buf1); + bin2hex(pExt->value->data, pExt->value->length, buf1, &l1); + ddocDebug(3, "readCertExtData", "Ext: %d len: %d data: %s", nExt, pExt->value->length, buf1);*/ + if(pExt->value->length > 20 && nOff) + //ddocMemAssignData(pMemBuf, ((char*)pExt->value->data) + (pExt->value->length - 20), 20); + ddocMemAssignData(pMemBuf, ((char*)pExt->value->data) + nOff, 20); + else + ddocMemAssignData(pMemBuf, ((char*)pExt->value->data), pExt->value->length); + } + } + return err; +} + +//-------------------------------------------------- +// Reads certificates authority key identifier +// pCert - certificate +// pMemBuf - memory buffer to return data +//-------------------------------------------------- +EXP_OPTION int readAuthorityKeyIdentifier(X509* pCert, DigiDocMemBuf* pMemBuf) +{ + int err = ERR_OK; + int crit = 0, l1; + char *p = 0; + + AUTHORITY_KEYID *pAkid = X509_get_ext_d2i(pCert, NID_authority_key_identifier, &crit, NULL); + if(pAkid) { + l1 = i2d_ASN1_OCTET_STRING(pAkid->keyid, (unsigned char **)&p); + if(l1 > 20) + ddocMemAssignData(pMemBuf, p + (l1 - 20), 20); + else + ddocMemAssignData(pMemBuf, (char*)p, l1); + OPENSSL_free(p); + AUTHORITY_KEYID_free(pAkid); + } + return err; + //return readCertExtData(pCert, pMemBuf, NID_authority_key_identifier, 5); +} + +//-------------------------------------------------- +// Reads certificates subject key identifier +// pCert - certificate +// pMemBuf - memory buffer to return data +//-------------------------------------------------- +EXP_OPTION int readSubjectKeyIdentifier(X509* pCert, DigiDocMemBuf* pMemBuf) +{ + return readCertExtData(pCert, pMemBuf, NID_subject_key_identifier, 2); +} + //-------------------------------------------------- // Checks if this is a company CPS policy @@ -1076,7 +1173,6 @@ err = ddocMemSetLength(pMemBuf, l1); X509_digest(pCert, EVP_sha1(), (unsigned char*)pMemBuf->pMem, &l1); pMemBuf->nLen = l1; - return err; } @@ -1099,10 +1195,56 @@ err = ddocMemSetLength(pMemBuf, l1); X509_pubkey_digest(pCert, EVP_sha1(), (unsigned char*)pMemBuf->pMem, &l1); pMemBuf->nLen = l1; - return err; } +//-------------------------------------------------- +// Returns the certificates subject name sha1 hash. +// pCert - certificate data +// pMemBuf - memory buffer object for storing DN +// returns error code or ERR_OK +//-------------------------------------------------- +int ddocCertGetSubjectNameDigest(X509* pCert, DigiDocMemBuf* pMemBuf) +{ + int err = ERR_OK; + unsigned int l1; + X509_NAME *iname; + + RETURN_IF_NULL_PARAM(pCert); + RETURN_IF_NULL_PARAM(pMemBuf); + pMemBuf->pMem = 0; + pMemBuf->nLen = 0; + l1 = 30; + err = ddocMemSetLength(pMemBuf, l1); + iname = X509_get_subject_name(pCert); + X509_NAME_digest(iname, EVP_sha1(), (unsigned char*)pMemBuf->pMem, &l1); + pMemBuf->nLen = l1; + return err; +} + +//-------------------------------------------------- +// Returns the certificates issuer name sha1 hash. +// pCert - certificate data +// pMemBuf - memory buffer object for storing DN +// returns error code or ERR_OK +//-------------------------------------------------- +int ddocCertGetIssuerNameDigest(X509* pCert, DigiDocMemBuf* pMemBuf) +{ + int err = ERR_OK; + unsigned int l1; + X509_NAME *iname; + + RETURN_IF_NULL_PARAM(pCert); + RETURN_IF_NULL_PARAM(pMemBuf); + pMemBuf->pMem = 0; + pMemBuf->nLen = 0; + l1 = 30; + err = ddocMemSetLength(pMemBuf, l1); + iname = X509_get_issuer_name(pCert); + X509_NAME_digest(iname, EVP_sha1(), (unsigned char*)pMemBuf->pMem, &l1); + pMemBuf->nLen = l1; + return err; +} //-------------------------------------------------- // Returns the certificates DN. Internal function. @@ -1135,6 +1277,7 @@ pName = X509_get_issuer_name(pCert); else pName = X509_get_subject_name(pCert); + RETURN_IF_NULL(pName) for(i = 0; (err == ERR_OK) && (i < sk_X509_NAME_ENTRY_num(pName->entries)); i++) { pNe = sk_X509_NAME_ENTRY_value(pName->entries, i); n = OBJ_obj2nid(pNe->object); @@ -1262,7 +1405,6 @@ return err; } - //-------------------------------------------------- // Returns the certificates subject name and returns // the desired item from it. @@ -1428,6 +1570,77 @@ { return ddocCertGetDNPart(pCert, pMemBuf, NID_organizationUnit, 0); } +//AM 06.03.08 +//-------------------------------------------------- +// Returns the certificates DN. Internal function. +// Do not call directly, subject to change +// pCert - certificate data +// pMemBuf - memory buffer object for storing DN +// bIssuer - 1=issuer, 0=subject +// returns error code or ERR_OK +//-------------------------------------------------- +int bdocCertGetDN(X509* pCert, DigiDocMemBuf* pMemBuf, int bIssuer) +{ + int err = ERR_OK; + X509_NAME *pName = 0; + X509_NAME_ENTRY *pNe = 0; + int i, n, l, t, b = 0; + const char *s; + unsigned char* p; + + RETURN_IF_NULL_PARAM(pCert); + RETURN_IF_NULL_PARAM(pMemBuf); + + // initialize + if(pMemBuf->pMem) + err = ddocMemBuf_free(pMemBuf); + pMemBuf->pMem = 0; + pMemBuf->nLen = 0; + + // iterate over name entries + if(bIssuer) + pName = X509_get_issuer_name(pCert); + else + pName = X509_get_subject_name(pCert); + for(i = 0; (err == ERR_OK) && (i < sk_X509_NAME_ENTRY_num(pName->entries)); i++) { + pNe = sk_X509_NAME_ENTRY_value(pName->entries, i); + n = OBJ_obj2nid(pNe->object); + s = OBJ_nid2sn(n); + t = pNe->value->type; + // mostly we find here: + // V_ASN1_PRINTABLESTRING, V_ASN1_TELETEXSTRING or V_ASN1_BMPSTRING + // that we convert to UTF, but V_ASN1_UTF8STRING allready is in UTF8 + // handle only the enry types we know + if(n != NID_undef && s != NULL) { + // convert to UTF8 only + p = 0; + if(t == V_ASN1_UTF8STRING) { + p = pNe->value->data; + l = pNe->value->length; + } else + l = ASN1_STRING_to_UTF8(&p, pNe->value); + ddocDebug(5, "ddocCertGetDN", + "NameEntry nid: %d type: %d len: %d item: %s value: \'%s\'", + n, t, l, s, (p ? (const char*)p : "NULL")); + // append separator if necessary + if(b) + err = ddocMemAppendData(pMemBuf, ",", -1); + else + b = 1; + // print the entry + err = ddocMemAppendData(pMemBuf, s, -1); + err = ddocMemAppendData(pMemBuf, "=", -1); + err = ddocMemAppendData(pMemBuf, (const char*)p, l); + // cleanup + if(p && t != V_ASN1_UTF8STRING) + OPENSSL_free(p); + } + ddocDebug(5, "ddocCertGetDN", "Subject: \'%s\' len: %d", + (const char*)pMemBuf->pMem, pMemBuf->nLen); + } // for + + return err; +} //================< deprecated functions> ================================= diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocCert.h libdigidoc-3.7.0.875/libdigidoc/DigiDocCert.h --- libdigidoc-2.7.0/libdigidoc/DigiDocCert.h 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocCert.h 2012-12-13 22:05:47.000000000 +0000 @@ -176,7 +176,49 @@ //-------------------------------------------------- EXP_OPTION int ddocCertGetSubjectDN(X509* pCert, DigiDocMemBuf* pMemBuf); - EXP_OPTION int ddocCertGetDNFromName(X509_NAME* pName, DigiDocMemBuf* pMemBuf); + //-------------------------------------------------- + // Returns the certificates subject name sha1 hash. + // pCert - certificate data + // pMemBuf - memory buffer object for storing DN + // returns error code or ERR_OK + //-------------------------------------------------- + int ddocCertGetSubjectNameDigest(X509* pCert, DigiDocMemBuf* pMemBuf); + + //-------------------------------------------------- + // Returns the certificates issuer name sha1 hash. + // pCert - certificate data + // pMemBuf - memory buffer object for storing DN + // returns error code or ERR_OK + //-------------------------------------------------- + int ddocCertGetIssuerNameDigest(X509* pCert, DigiDocMemBuf* pMemBuf); + + //-------------------------------------------------- + // Returns the certificates DN. + // Do not call directly, subject to change + // pName - certificate X509 name + // pMemBuf - memory buffer object for storing DN + // bIssuer - 1=issuer, 0=subject + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int ddocCertGetDNFromName(X509_NAME* pName, DigiDocMemBuf* pMemBuf); + +#define KUIDX_DIGITAL_SIGNATURE 0 +#define KUIDX_NON_REPUDIATION 1 +#define KUIDX_KEY_ENCIPHERMENT 2 +#define KUIDX_DATA_ENCIPHERMENT 3 +#define KUIDX_KEY_AGREEMENT 4 +#define KUIDX_KEY_CERT_SIGN 5 +#define KUIDX_CRL_SIGN 6 +#define KUIDX_ENCIPHERMENT_ONLY 7 +#define KUIDX_DECIPHERMENT_ONLY 8 + + //-------------------------------------------------------- + // Checks if the desired key-usage bit is set on a given cert + // pCert - certificate + // nBit - flag index + // return 1 if bit is set + //-------------------------------------------------------- + EXP_OPTION int ddocCertCheckKeyUsage(X509 *pCert, int nBit); //-------------------------------------------------- // Returns the certificates subject CN @@ -242,6 +284,19 @@ //-------------------------------------------------- EXP_OPTION int ddocCertGetSubjectOrganizationUnit(X509* pCert, DigiDocMemBuf* pMemBuf); + //-------------------------------------------------- + // Reads certificates authority key identifier + // pCert - certificate + // pMemBuf - memory buffer to return data + //-------------------------------------------------- + EXP_OPTION int readAuthorityKeyIdentifier(X509* pCert, DigiDocMemBuf* pMemBuf); + + //-------------------------------------------------- + // Reads certificates subject key identifier + // pCert - certificate + // pMemBuf - memory buffer to return data + //-------------------------------------------------- + EXP_OPTION int readSubjectKeyIdentifier(X509* pCert, DigiDocMemBuf* pMemBuf); //================< deprecated functions> ================================= // these functions are deprecated. Use the replacements in DigiDocCert.h diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocConfig.c libdigidoc-3.7.0.875/libdigidoc/DigiDocConfig.c --- libdigidoc-2.7.0/libdigidoc/DigiDocConfig.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocConfig.c 2012-12-13 22:05:47.000000000 +0000 @@ -29,17 +29,14 @@ //================================================== // config data comes from there -#ifndef WIN32 - #if HAVE_CONFIG_H - #include - #endif -#endif - +#include //AA 04/01/26 #ifdef WIN32 #include #define snprintf _snprintf +#elif defined(__APPLE__) +#include #endif #include @@ -49,17 +46,19 @@ #include #include #include -#ifdef WITH_TS - #include +#ifdef WIN32 +#include #endif #include #include #include #include +#include -#ifdef WIN32 -#else +#ifndef _MAX_PATH + #define _MAX_PATH 200 #endif + #ifdef WIN32 #define DIGIDOC_CONF_NAME "digidoc.ini" #define HOME_ENV "USERPROFILE" @@ -69,14 +68,15 @@ #define DIGIDOC_CONF_NAME "digidoc.conf" #define HOME_ENV "HOME" #define DIGIDOC_CONF_FMT "%s/.%s" - char g_szGlobalConfigFile[] = SYSCONFDIR "/" DIGIDOC_CONF_NAME; + char g_szGlobalConfigFile[_MAX_PATH] = SYSCONFDIR "/" DIGIDOC_CONF_NAME; +# ifdef FRAMEWORK + char g_frameworkResources[_MAX_PATH]; +# endif #endif -#ifndef _MAX_PATH - #define _MAX_PATH 200 -#endif char g_szPrivateConfigFile[_MAX_PATH]; +#define NUM_SEARCH_CAS 10 //==========< private types and functions >==================== @@ -92,7 +92,7 @@ // currently I see the need only for one common configuration store // Distinction can be made by item type -ConfigurationStore g_configStore; +ConfigurationStore g_configStore = {0, 0}; //==========< win32 specific functions >=================== @@ -260,6 +260,14 @@ //==========< item handling functions >==================== //-------------------------------------------------- +// Returns true (not 0) if config store structure has been inited +//-------------------------------------------------- +EXP_OPTION int isConfigInited() +{ + return g_configStore.pItems && g_configStore.nItems; +} + +//-------------------------------------------------- // Initializes configuration store // szConfigFile - name of config file. Use NULL for default //-------------------------------------------------- @@ -267,21 +275,42 @@ { int err = ERR_OK, at_least_one_conf = 0; - g_configStore.nItems = 0; - g_configStore.pItems = 0; + //g_configStore.nItems = 0; + //g_configStore.pItems = 0; if (szConfigFile && checkFileExists(szConfigFile)) { err = readConfigFile(szConfigFile, ITEM_TYPE_GLOBAL); + //printf("config file: %s rc: %d", szConfigFile, err); return err; } -#ifdef WIN32 - if(!*g_szGlobalConfigFile && getenv("SystemRoot")) { +#ifdef WIN32 + snprintf(g_szGlobalConfigFile, sizeof(g_szGlobalConfigFile), "%s\\%s", getenv("SystemRoot"), DIGIDOC_CONF_NAME); + /*if(!*g_szGlobalConfigFile && getenv("SystemRoot")) { strncpy(g_szGlobalConfigFile, getenv("SystemRoot"), sizeof(g_szGlobalConfigFile)); + printf("Init win32 2: %s\n", g_szGlobalConfigFile); if(!g_szGlobalConfigFile[strlen(g_szGlobalConfigFile)-1] == '\\') strncat(g_szGlobalConfigFile, "\\", sizeof(g_szGlobalConfigFile) - strlen(g_szGlobalConfigFile)); + printf("Init win32 3: %s\n", g_szGlobalConfigFile); strncat(g_szGlobalConfigFile, DIGIDOC_CONF_NAME, sizeof(g_szGlobalConfigFile) - strlen(g_szGlobalConfigFile)); + }*/ +#endif +#ifdef FRAMEWORK + CFStringRef identifier = CFStringCreateWithCString(0, "ee.ria.libdigidoc", kCFStringEncodingUTF8); + CFBundleRef bundle = CFBundleGetBundleWithIdentifier(identifier); + if(bundle) + { + CFURLRef url = CFBundleCopyResourcesDirectoryURL(bundle); + if(url) + { + if(CFURLGetFileSystemRepresentation(url, TRUE, (UInt8 *)g_frameworkResources, _MAX_PATH)) + snprintf(g_szGlobalConfigFile, _MAX_PATH, "%s/%s", g_frameworkResources, DIGIDOC_CONF_NAME); + CFRelease(url); + } + CFRelease(bundle); } -#endif + CFRelease(identifier); +#endif + //printf( "Reading global config file: %s\n", g_szGlobalConfigFile); ddocDebug(3, "initConfigStore", "Reading global config file: %s", g_szGlobalConfigFile); if(checkFileExists(g_szGlobalConfigFile)) err = readConfigFile(g_szGlobalConfigFile, ITEM_TYPE_GLOBAL); // MEMLEAK: ??? @@ -291,9 +320,11 @@ at_least_one_conf = 1; if(err) return err; - + setPrivateConfigFile(NULL); // set default private conf file - ddocDebug(3, "initConfigStore", "Reading private config file: %s", g_szPrivateConfigFile); + if(g_szPrivateConfigFile[0]) { + //printf( "Reading private config file: %s\n", g_szPrivateConfigFile); + ddocDebug(3, "initConfigStore", "Reading private config file: %s", (g_szPrivateConfigFile ? g_szPrivateConfigFile : "NULL")); if(checkFileExists(g_szPrivateConfigFile)) err = readConfigFile(g_szPrivateConfigFile, ITEM_TYPE_PRIVATE); if(err == ERR_CONF_FILE) @@ -302,8 +333,10 @@ at_least_one_conf = 1; if(err) return err; - - ddocDebug(2, "initConfigStore", "Reading config file: %s", DIGIDOC_CONF_NAME); + } + if(DIGIDOC_CONF_NAME) { + //printf( "Reading config file: %s\n", DIGIDOC_CONF_NAME); + ddocDebug(2, "initConfigStore", "Reading config file: %s", (DIGIDOC_CONF_NAME ? DIGIDOC_CONF_NAME: "NULL")); if(checkFileExists(DIGIDOC_CONF_NAME)) err = readConfigFile(DIGIDOC_CONF_NAME, ITEM_TYPE_PRIVATE); if(err == ERR_CONF_FILE) @@ -312,7 +345,7 @@ at_least_one_conf = 1; if(err) return err; - + } #ifdef WIN32 err = readConfigFromRegistry(); if(err == ERR_CONF_FILE) @@ -437,7 +470,7 @@ #ifdef WIN32 char keyName[500]; #endif - + ddocDebug(3, "createOrReplacePrivateConfigItem", "%s = %s", (key ? key : "NULL"), (value ? value : "NULL")); if(!pConfStore) pConfStore = &g_configStore; // first try to find a private config item @@ -540,6 +573,10 @@ //-------------------------------------------------- EXP_OPTION const char* ConfigItem_lookup(const char* key) { +#ifdef FRAMEWORK + if(strcmp(key, "CA_CERT_PATH") == 0) + return g_frameworkResources; +#endif int i; // first try to find a private item for(i = 0; (i < g_configStore.nItems) && g_configStore.pItems && g_configStore.pItems[i]; i++) { @@ -588,6 +625,20 @@ } //-------------------------------------------------- +// Finds a new configration items value by key +// key - items key +// returns value of config item or NULL if not found +//-------------------------------------------------- +EXP_OPTION const char* ConfigItem_lookup_str(const char* key, const char* defValue) +{ + const char* p = ConfigItem_lookup(key); + if (p) + return p; + else + return defValue; +} + +//-------------------------------------------------- // Finds a bolean configration items value by key // key - items key // defValue - default value to be returned @@ -621,6 +672,7 @@ int err = ERR_OK; if((hFile = fopen(fileName, "rt")) != NULL) { + ddocDebug(2, "readConfigFile", "Reading config file: %s", fileName); while(fgets(buf, sizeof(buf), hFile) != NULL && !err) { // trim line separators and spaces while(strlen(buf) && (buf[strlen(buf)-1] == '\n' || @@ -640,8 +692,10 @@ } fclose(hFile); return err; - } else + } else { + ddocDebug(1, "readConfigFile", "Error opening config file: %s", fileName); SET_LAST_ERROR_RETURN_CODE(ERR_CONF_FILE); // MEMLEAK: ??? + } } @@ -721,6 +775,7 @@ for(i = 1; (i <= n) && !(*idx); i++) { snprintf(buf1, sizeof(buf1), "CA_CERT_%d_CN", i); p = ConfigItem_lookup(buf1); + ddocDebug(1, "findCAindexByCN", "ERR112 Unknown CA: %s", buf1); RETURN_IF_NOT(p != NULL, ERR_UNKNOWN_CA); if(!strcmp(p, cn)) { // found it *idx = i; @@ -784,43 +839,100 @@ // Finds CA certificate by CN // ppCA - address of found CA // szCN - CA certs common name +// pHash - authority-key-identifier to search for CA // return error code or 0 for success //-------------------------------------------------- -EXP_OPTION int findCAForCN(X509** ppCA, const char* szCN) +EXP_OPTION int findCAForCN(X509** ppCA, const char* szCN, DigiDocMemBuf *pHash) { - int err = ERR_OK, i; - char buf[300]; + int err = ERR_OK, i, n; + char buf2[300], buf1[30], buf3[50]; const char *p1, *p2; X509 *x509 = NULL; - + DigiDocMemBuf mbuf2, mbuf3, mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + ddocEncodeBase64(pHash, &mbuf3); + ddocBin2Hex(pHash, &mbuf2); + ddocDebug(3, "findCAForCN", "Find CN: %s subj-hash: %s subj-hash-hex: %s", szCN, (char*)mbuf3.pMem, (char*)mbuf2.pMem); + ddocMemBuf_free(&mbuf3); + ddocMemBuf_free(&mbuf2); // initialize *ppCA = NULL; - err = findCAindexByCN(&i, szCN); - ddocDebug(3, "findCAForCN", "Find CA: %s idx: %d rc: %d", szCN, i, err); - RETURN_IF_NOT(err == ERR_OK, ERR_CERT_READ); - snprintf(buf, sizeof(buf), "CA_CERT_%d", i); - p1 = ConfigItem_lookup(buf); - if(!p1) - ddocDebug(3, "findCAForCN", "Failed to read cert for CA: %s rc: %d", buf); - RETURN_IF_NOT(p1 != NULL, ERR_UNKNOWN_CA); - if(checkFileExists(p1)) { - err = ReadCertificate(&x509, p1); - ddocDebug(4, "findCAForCN", "Read cert: %s rc: %d", p1, err); - } else { - p2 = ConfigItem_lookup("CA_CERT_PATH"); - RETURN_IF_NOT(p2 != NULL, ERR_CONF_LINE); + p1 = ConfigItem_lookup("CA_CERTS"); + RETURN_IF_NOT(p1 != NULL, ERR_CONF_LINE); + n = atoi(p1); + for(i = 1; (i <= n) && !(*ppCA); i++) { + snprintf(buf1, sizeof(buf1), "CA_CERT_%d_CN", i); + p1 = ConfigItem_lookup(buf1); + x509 = NULL; + ddocDebug(3, "findCAForCN", "CA: %s -> %s", buf1, p1); + if(p1 && !strcmp(p1, szCN)) { // found CN, try read cert + snprintf(buf1, sizeof(buf1), "CA_CERT_%d", i); + p1 = ConfigItem_lookup(buf1); + if(p1) { + if(checkFileExists(p1)) { + err = ReadCertificate(&x509, p1); + ddocDebug(4, "findCAForCN", "Read cert: %s rc: %d", p1, err); + } else { + p2 = ConfigItem_lookup("CA_CERT_PATH"); + RETURN_IF_NOT(p2 != NULL, ERR_CONF_LINE); #ifdef WIN32 - snprintf(buf, sizeof(buf), "%s\\%s", p2, p1); + snprintf(buf2, sizeof(buf2), "%s\\%s", p2, p1); #else - snprintf(buf, sizeof(buf), "%s/%s", p2, p1); + snprintf(buf2, sizeof(buf2), "%s/%s", p2, p1); #endif - err = ReadCertificate(&x509, buf); - ddocDebug(4, "findCAForCN", "Read cert: %s rc: %d\n", buf, err); + err = ReadCertificate(&x509, buf2); + ddocDebug(4, "findCAForCN", "Read cert: %s rc: %d\n", buf2, err); + if(err == ERR_FILE_READ) err = ERR_UNKNOWN_CA; + } + if(pHash && pHash->pMem && x509) { + memset(buf3, 0, sizeof(buf3)); + ReadCertSerialNumber(buf3, sizeof(buf3), x509); + readSubjectKeyIdentifier(x509, &mbuf2); + ddocEncodeBase64(&mbuf2, &mbuf3); + ddocBin2Hex(&mbuf2, &mbuf1); + if(!ddocMemCompareMemBufs(pHash, &mbuf2)) { + *ppCA = x509; + err = ERR_OK; + ddocDebug(4, "findCAForCN", "Found cert: %s with nr: %s", szCN, buf3); + } else { + ddocDebug(4, "findCAForCN", "Release cert: %s with nr: %s", szCN, buf3); + X509_free(x509); // release wrong cert + *ppCA = NULL; + err = ERR_UNKNOWN_CA; + } + ddocDebug(3, "findCAForCN", "Compare CA: %s subj-hash: %s hex: %s err: %d", buf1, (char*)mbuf3.pMem, (char*)mbuf1.pMem, err); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + ddocMemBuf_free(&mbuf1); + } else { // plain CN match is enough + if(x509) { + *ppCA = x509; + err = ERR_OK; + ddocDebug(4, "findCAForCN", "Found cert: %s with cn", szCN); + } + } + + } else { + ddocDebug(3, "findCAForCN", "No cert file for: %s", buf1); + } + } + } + RETURN_IF_NOT(err == ERR_OK, err); + //*ppCA = x509; + if(*ppCA) { + ddocCertGetSubjectDN(*ppCA, &mbuf2); + ddocDebug(4, "findCAForCN", "Found cert: %s with cn %s", (char*)mbuf2.pMem, szCN); + ddocMemBuf_free(&mbuf2); } - RETURN_IF_NOT(err == ERR_OK, ERR_CERT_READ); - *ppCA = x509; return err; -} +} + //-------------------------------------------------- // Finds Responders certificate by CN @@ -963,17 +1075,20 @@ //-------------------------------------------------- EXP_OPTION int findResponderCA(char* caCN, int len, const char* szCN, const char* hash) { - int err = ERR_OK, i; + int err = ERR_OK, i=0; char buf[50]; const char* p; // initialize RETURN_IF_NULL_PARAM(caCN); caCN[0] = 0; + ddocDebug(3, "findResponderCA", "CA cn: %s, cn-l: %d", caCN, len); err = findResponderIndex(&i, szCN, hash, NULL); + ddocDebug(3, "findResponderCA", "Resp idx: %d", i); RETURN_IF_NOT(err == ERR_OK, err); snprintf(buf, sizeof(buf), "DIGIDOC_OCSP_RESPONDER_CERT_%d_CA", i); p = ConfigItem_lookup(buf); + ddocDebug(3, "findResponderCA", "Lookup: %s found: %s len: %d", buf, p, len); RETURN_IF_NOT(p != NULL, ERR_OCSP_RESP_NOT_TRUSTED); strncpy(caCN, p, len); return ERR_OK; @@ -988,15 +1103,21 @@ EXP_OPTION int findCAForCertificate(X509** ppCA, const X509* pCert) { int err = ERR_OK; - DigiDocMemBuf mbuf; + DigiDocMemBuf mbuf1, mbuf2; - mbuf.pMem = 0; - mbuf.nLen = 0; + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; // read cert issuers CN - err = ddocCertGetIssuerCN((X509*)pCert, &mbuf); + err = ddocCertGetIssuerCN((X509*)pCert, &mbuf1); RETURN_IF_NOT(err == ERR_OK, ERR_PKCS_CERT_DECODE); - err = findCAForCN(ppCA, (const char*)mbuf.pMem); - ddocMemBuf_free(&mbuf); + RETURN_IF_NOT(mbuf1.pMem, ERR_PKCS_CERT_DECODE); // PR. fix crash + err = readAuthorityKeyIdentifier((X509*)pCert, &mbuf2); + RETURN_IF_NOT(err == ERR_OK, err); + err = findCAForCN(ppCA, (const char*)mbuf1.pMem, &mbuf2); + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); RETURN_IF_NOT(err == ERR_OK, err); return err; } @@ -1004,42 +1125,63 @@ //-------------------------------------------------- // Finds CA chain // ppChain - address of cert pointer array -// nMaxChain - cert pointer arrary length +// nMaxChain - index of last cert in returned array - 0 based // szCN - CN of the first CA cert (not the child cert!) +// pCert - certificate to search ca-s for // return error code or 0 for success //-------------------------------------------------- -EXP_OPTION int findCAChainForCN(X509** ppChain, int* nMaxChain, const char* szCN) +EXP_OPTION int findCAChainForCN(X509** ppChain, int* nMaxChain, const char* szCN, X509* pCert) { int err = ERR_OK, i; - char oldcn[300]; - X509 * caCerts[10]; - DigiDocMemBuf mbuf1; + char oldcn[300], buf3[100]; + X509 * caCerts[NUM_SEARCH_CAS]; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; mbuf1.pMem = 0; mbuf1.nLen = 0; - + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; RETURN_IF_NULL_PARAM(ppChain); RETURN_IF_NULL_PARAM(nMaxChain); RETURN_IF_NULL_PARAM(szCN); // initialize - for(i = 0; i < 10; i++) + for(i = 0; i < NUM_SEARCH_CAS; i++) caCerts[i] = 0; - for(i = 0; i < *nMaxChain; i++) + for(i = 0; i < NUM_SEARCH_CAS; i++) ppChain[i] = NULL; i = 0; + memset(oldcn, 0, sizeof(oldcn)); strncpy(oldcn, szCN, sizeof(oldcn)); + if(pCert != NULL) { + err = readAuthorityKeyIdentifier(pCert, &mbuf2); + ddocEncodeBase64(&mbuf2, &mbuf3); + memset(buf3, 0, sizeof(buf3)); + ReadCertSerialNumber(buf3, sizeof(buf3), pCert); + ddocDebug(3, "findCAChainForCN", "Subj cert nr: %s, auth-key: %s", buf3, (char*)mbuf3.pMem); + ddocMemBuf_free(&mbuf3); + } do { - err = findCAForCN(&caCerts[i], oldcn); + if(caCerts[i]) { // for first ca it is null + err = readAuthorityKeyIdentifier(caCerts[i], &mbuf2); + ddocEncodeBase64(&mbuf2, &mbuf3); + ddocDebug(3, "findCAChainForCN", "CA cert: %d, auth-key: %s", i, (char*)mbuf3.pMem); + ddocMemBuf_free(&mbuf3); + if(err) + return err; + } + err = findCAForCN(&caCerts[i], oldcn, &mbuf2); + ddocMemBuf_free(&mbuf2); ddocDebug(3, "findCAChainForCN", "Read CA for CN: %s idx: %d rc: %d", oldcn, i, err); SET_LAST_ERROR_IF_NOT(err == ERR_OK, err); if (caCerts[i] && !err) { err = ddocCertGetIssuerCN(caCerts[i], &mbuf1); - ddocDebug(3, "findCAChainForCN", "Issuer: %s old was: %s, rc: %d", (const char*)mbuf1.pMem, oldcn, err); SET_LAST_ERROR_IF_NOT(err == ERR_OK, err); } - if(!err && strcmp((const char*)mbuf1.pMem, oldcn)) { + if(!err && mbuf1.pMem && strcmp((const char*)mbuf1.pMem, oldcn)) { i++; if (!err) strncpy(oldcn, (const char*)mbuf1.pMem, sizeof(oldcn) ); @@ -1051,9 +1193,9 @@ } while (err == ERR_OK); *nMaxChain = i; ddocDebug(3, "findCAChainForCN", "Found: %d certs", (*nMaxChain) + 1); - // now reverse the chain such that the root CA is at the top - is it necessary??? + // now reverse the chain such that the root CA is at the top - is it necessary??? // PR fix index for(i = 0; i <= *nMaxChain; i++) - ppChain[i] = caCerts[(*nMaxChain)-i]; + ppChain[i] = caCerts[(*nMaxChain) - i]; return err; } @@ -1086,7 +1228,7 @@ ddocDebug(3, "ddocSelectOcspUrl", "signers CA: %s", (issuerDN ? issuerDN : "NULL")); if(issuerDN) { buf1[0] = 0; - findCN(issuerDN, buf1); + findCN(issuerDN, buf1, sizeof(buf1)); ddocDebug(3, "ddocSelectOcspUrl", "signers CA CN: %s", buf1); findResponderIndex(&i, NULL, NULL, buf1); if(i > 0) { @@ -1100,8 +1242,11 @@ buf1[0] = 0; } if(!(*ppOcspUrl)) { + ddocDebug(1, "ddocSelectOcspUrl", "ERR112 ocsp url: %s", (*ppOcspUrl ? *ppOcspUrl : "NULL")); SET_LAST_ERROR(ERR_UNKNOWN_CA); err = ERR_UNKNOWN_CA; + } else { + ddocDebug(3, "ddocSelectOcspUrl", "Selected OCSP URL: %s", *ppOcspUrl); } return err; } @@ -1111,27 +1256,32 @@ char* szCA, int caLen) { int err = ERR_OK, i; - DigiDocMemBuf mbuf1; + DigiDocMemBuf mbuf1, mbuf2; RETURN_IF_NULL_PARAM(caCerts); RETURN_IF_NULL_PARAM(nCerts); RETURN_IF_NULL_PARAM(szCA); mbuf1.pMem = 0; mbuf1.nLen = 0; - for(i = 0; i <= (*nCerts); i++) + mbuf2.pMem = 0; + mbuf2.nLen = 0; + for(i = 0; i < NUM_SEARCH_CAS; i++) caCerts[i] = 0; szCA[0] = 0; err = ddocCertGetIssuerDN(pCert, &mbuf1); - ddocDebug(3, "ddocFindCaChainForCert", "Find chain for: %s", (char*)mbuf1.pMem); + err = ddocCertGetSubjectDN(pCert, &mbuf2); + ddocDebug(3, "ddocFindCaChainForCert", "Find chain for: %s issuer: %s", + (char*)mbuf2.pMem, (char*)mbuf1.pMem); if(!err) { - err = findCN((char*)mbuf1.pMem, szCA); + err = findCN((char*)mbuf1.pMem, szCA, caLen); ddocDebug(3, "ddocFindCaChainForCert", "Find chain for CN: %s", szCA); if(!err) { - err = findCAChainForCN(caCerts, nCerts, szCA); + err = findCAChainForCN(caCerts, nCerts, szCA, pCert); ddocDebug(3, "ddocFindCaChainForCert", "Chain length: %d, err: %d", *nCerts, err); } } ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); return err; } @@ -1151,14 +1301,14 @@ RETURN_IF_NULL_PARAM(szCA); mbuf1.pMem = 0; mbuf1.nLen = 0; - for(i = 0; i <= (*nCerts); i++) + for(i = 0; i <= NUM_SEARCH_CAS; i++) caCerts[i] = 0; szCN[0] = szCA[0] = 0; // find responder id type and value ddocDebug(3, "ddocFindOcspCnCaAndCerts", "OCSP: %s", (pResp ? "OK" : "NO")); err = ddocGetOcspRespIdTypeAndValue(pResp, nType, &mbuf1); if((*nType) == RESPID_NAME_TYPE) { - err = findCN((char*)mbuf1.pMem, szCN); + err = findCN((char*)mbuf1.pMem, szCN, cnLen); if (!err) err = findResponderCA(szCA, caLen, szCN, NULL); } @@ -1175,7 +1325,7 @@ ddocDebug(3, "ddocFindOcspCnCaAndCerts", "Responder CN: %s CA: %s, RC: %d", szCN, szCA, err); // find CA chain if(err == ERR_OK) - err = findCAChainForCN(caCerts, nCerts, szCA); + err = findCAChainForCN(caCerts, nCerts, szCA, NULL); ddocDebug(3, "ddocFindOcspCnCaAndCerts", "Chain length: %d, err: %d", *nCerts, err); // cleanup ddocMemBuf_free(&mbuf1); @@ -1192,16 +1342,18 @@ EXP_OPTION int notarizeSignatureWithIp(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, unsigned long ip) { NotaryInfo* pNotInfo; - int err = ERR_OK, nCAs = 10, i, j, err2 = 0, nType; - X509* caCerts[10]; - X509* pNotCert; - //AM 24.09.08 szCA size from 30 to 100 for Portuguese ID card + int err = ERR_OK, nCAs = NUM_SEARCH_CAS, i, j, err2 = 0, nType; + X509* caCerts[NUM_SEARCH_CAS]; + X509* pNotCert, *pSigCert = 0, *pSigCa = 0; + //AM 24.09.08 szCA size from 30 to 100 for Portuguese ID card char szCN[200], szCA[100]; char *pkcs12file, *pkcs12passwd, *ocspUrl; - char *proxyHost, *proxyPort; + char *proxyHost, *proxyPort, *proxyUser, *proxyPass; OCSP_RESPONSE *pResp = 0; + CertValue *pCertValue = 0; - for(i = 0; i <= nCAs; i++) + // PR. index fix + for(i = 0; i < NUM_SEARCH_CAS; i++) caCerts[i] = 0; if(ConfigItem_lookup_bool("SIGN_OCSP", 1)) { pkcs12file = (char*)ConfigItem_lookup("DIGIDOC_PKCS_FILE"); @@ -1216,17 +1368,32 @@ RETURN_IF_NOT(proxyHost, ERR_WRONG_URL_OR_PROXY); proxyPort = (char*)ConfigItem_lookup("DIGIDOC_PROXY_PORT"); RETURN_IF_NOT(proxyPort, ERR_WRONG_URL_OR_PROXY); + proxyUser = (char*)ConfigItem_lookup("DIGIDOC_PROXY_USER"); + proxyPass = (char*)ConfigItem_lookup("DIGIDOC_PROXY_PASS"); ddocDebug(4, "notarizeSignature", "proxy: %s port : %s", proxyHost, proxyPort); } else { - proxyHost = proxyPort = NULL; + proxyHost = proxyPort = proxyUser = proxyPass = NULL; } err = ddocSelectOcspUrl((char*)ddocSigInfo_GetSignersCert_IssuerName(pSigInfo), &ocspUrl); RETURN_IF_NOT(err == ERR_OK, err); + // get signers ca certs + pSigCert = ddocSigInfo_GetSignersCert(pSigInfo); + err = ddocFindCaChainForCert(pSigCert, caCerts, &nCAs, szCA, sizeof(szCA)); + pSigCa = caCerts[nCAs]; // get OCSP confirmation ddocDebug(3, "notarizeSignatureWithIp", "Getting OCSP confirmation"); - err = getConfirmationWithIp(pSigDoc, pSigInfo, NULL, NULL, + err = getConfirmationWithIpEx(pSigDoc, pSigInfo, (const X509 **)caCerts, NULL, pkcs12file, pkcs12passwd, ocspUrl, - proxyHost, proxyPort, ip); + proxyHost, proxyPort, proxyUser, proxyPass, ip); + // release ca certs + nCAs=10; + for(i = 0; i < NUM_SEARCH_CAS; i++) { + if(caCerts[i] && caCerts[i] != pSigCa) { + X509_free(caCerts[i]); + caCerts[i] = 0; + } + } + // continue with the rest RETURN_IF_NOT(err == ERR_OK, err); pNotInfo = getNotaryWithSigId(pSigDoc, pSigInfo->szId); RETURN_IF_NOT(pNotInfo != NULL, ERR_NOTARY_SIG_MATCH); @@ -1248,25 +1415,39 @@ else if(nType == RESPID_KEY_TYPE) findResponderByCNAndHashAndIndex(&pNotCert, NULL, szCN, j); ddocDebug(1, "notarizeSignatureWithIp", "Find notary: %s idx: %d cert: %s", szCN, j, (pNotCert ? "OK" : "NULL")); - if(pNotCert) - err2 = finalizeAndVerifyNotary(pSigDoc, pSigInfo, - pNotInfo, (const X509**)&caCerts, (const X509*)pNotCert); - ddocDebug(1, "notarizeSignatureWithIp", "Verifying notary: %d", err); - j++; - if(err2 && pNotCert) + if(pNotCert) { + err2 = finalizeAndVerifyNotary2(pSigDoc, pSigInfo, + pNotInfo, (const X509**)&caCerts, (const X509*)pNotCert, (const X509*)pSigCa); + ddocDebug(1, "notarizeSignatureWithIp", "Verifying notary: %d", err); + j++; + if(err2) { + // VS: release ownership before deletion + pCertValue = ddocSigInfo_GetOrCreateCertValueOfType(pSigInfo, CERTID_VALUE_RESPONDERS_CERT); + if(pCertValue && pCertValue->pCert == pNotCert) { + ddocDebug(1, "notarizeSignatureWithIp", "Release notary cert err2: %d", err2); + pCertValue->pCert = NULL; + } X509_free(pNotCert); + } + } } while(pNotCert && err2 != ERR_OK); } + if(pSigCa) + X509_free(pSigCa); if(err2) err = err2; else - clearErrors(); - for(i = 0; i <= nCAs; i++) + clearErrors(); + for(i = 0; i < NUM_SEARCH_CAS; i++) if(caCerts[i]) X509_free(caCerts[i]); if(pResp) OCSP_RESPONSE_free(pResp); - // please not that we cannot free pNotCert here because we gave ownership to pNotInf! + // test if not cert is ok + pCertValue = ddocSigInfo_GetOrCreateCertValueOfType(pSigInfo, CERTID_VALUE_RESPONDERS_CERT); + ddocDebug(3, "notarizeSignatureWithIp", "End Notary: cert-val: %s cert: %s", + ((pCertValue && pCertValue->pCert) ? "OK" : "NULL"), (pNotCert ? "OK" : "NULL")); + // please note that we cannot free pNotCert here because we gave ownership to pNotInf! return err; } @@ -1282,19 +1463,63 @@ // country - signers country (NULL) //-------------------------------------------------- EXP_OPTION int signDocument(SignedDoc* pSigDoc, SignatureInfo** ppSigInfo, + const char* pin, const char* manifest, + const char* city, const char* state, + const char* zip, const char* country) +{ + return signDocumentWithSlot(pSigDoc, ppSigInfo, pin, manifest, + city, state, zip, country, + ConfigItem_lookup_int("DIGIDOC_SIGNATURE_SLOT", 0), 1, 1); +} + +//-------------------------------------------------- +// Signs the document and gets configrmation +// pSigDoc - signed document pointer +// ppSigInfo - address of new signature pointer +// pin - smart card PIN +// manifest - manifest / resolution (NULL) +// city - signers city (NULL) +// state - signers state (NULL) +// zip - signers postal code (NULL) +// country - signers country (NULL) +//-------------------------------------------------- +EXP_OPTION int signDocumentWithSlot(SignedDoc* pSigDoc, SignatureInfo** ppSigInfo, + const char* pin, const char* manifest, + const char* city, const char* state, + const char* zip, const char* country, + int nSlot, int nOcsp, int nSigner) +{ + return signDocumentWithSlotAndSigner(pSigDoc, ppSigInfo, pin, manifest, + city, state, zip, country, nSlot, nOcsp, nSigner, NULL); +} + +//-------------------------------------------------- +// Signs the document and gets configrmation +// pSigDoc - signed document pointer +// ppSigInfo - address of new signature pointer +// pin - smart card PIN +// manifest - manifest / resolution (NULL) +// city - signers city (NULL) +// state - signers state (NULL) +// zip - signers postal code (NULL) +// country - signers country (NULL) +// nSigner - 1=PKCS11, 2=CNG (Microsoft CAPI) +// szPkcs12FileName - PKCS#12 file name to be used for signing (required if nSigner=3) +//-------------------------------------------------- +EXP_OPTION int signDocumentWithSlotAndSigner(SignedDoc* pSigDoc, SignatureInfo** ppSigInfo, const char* pin, const char* manifest, const char* city, const char* state, - const char* zip, const char* country) + const char* zip, const char* country, + int nSlot, int nOcsp, int nSigner, + const char* szPkcs12FileName) { int err = ERR_OK; SignatureInfo* pSigInfo = NULL; -#ifdef WITH_TS - X509* pTsaCert = NULL; - char buf1[300]; -#endif RETURN_IF_NULL_PARAM(pSigDoc); RETURN_IF_NULL_PARAM(ppSigInfo); + if(nSigner == 3) + RETURN_IF_NULL_PARAM(szPkcs12FileName) clearErrors(); ddocDebug(1, "signDocument", "Creating new digital signature"); @@ -1311,50 +1536,20 @@ if (manifest) err = addSignerRole(*ppSigInfo, 0, manifest, -1, 0); // now sign the doc - err = calculateSignatureWithEstID(pSigDoc, *ppSigInfo, - ConfigItem_lookup_int("DIGIDOC_SIGNATURE_SLOT", 0), pin); - RETURN_IF_NOT(err == ERR_OK, ERR_PKCS_SIGN_DATA); - -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - if(ConfigItem_lookup("TSA_CERT")) { + if(nSigner == 1 || !nSigner) + err = calculateSignatureWithEstID(pSigDoc, *ppSigInfo, nSlot, pin); #ifdef WIN32 - snprintf(buf1, sizeof(buf1), "%s\\%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CERT")); -#else - snprintf(buf1, sizeof(buf1), "%s/%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CERT")); -#endif - err = ReadCertificate(&pTsaCert, buf1); - if(err) return err; - } - err = ddocGetSignatureTimeStamp(*ppSigInfo, &pTsaCert, ConfigItem_lookup("TSA_POLICY"), - ConfigItem_lookup("TSA_URL"), - ConfigItem_lookup("DIGIDOC_PROXY_HOST"), - ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - if(pTsaCert) - X509_free(pTsaCert); - RETURN_IF_NOT(err == ERR_OK, err); - } + if(nSigner == 2) + err = calculateSigInfoSignatureWithCSPEstID(pSigDoc, *ppSigInfo, 0, pin); #endif - err = notarizeSignature(pSigDoc, *ppSigInfo); + if(nSigner == 3) + err = calculateSignatureWithPkcs12(pSigDoc, *ppSigInfo, szPkcs12FileName, pin); + if(err == ERR_PKCS_LOGIN) return err; + RETURN_IF_NOT(err == ERR_OK, ERR_PKCS_SIGN_DATA); + + if(nOcsp) + err = notarizeSignature(pSigDoc, *ppSigInfo); RETURN_IF_NOT(err == ERR_OK, err); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - if(ConfigItem_lookup("TSA_CERT")) { -#ifdef WIN32 - snprintf(buf1, sizeof(buf1), "%s\\%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CERT")); -#else - snprintf(buf1, sizeof(buf1), "%s/%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CERT")); -#endif - err = ReadCertificate(&pTsaCert, buf1); - if(err) return err; - } - err = ddocGetSigAndRefsTimeStamp(pSigDoc, *ppSigInfo, &pTsaCert, ConfigItem_lookup("TSA_POLICY"), - ConfigItem_lookup("TSA_URL"), - ConfigItem_lookup("DIGIDOC_PROXY_HOST"), - ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - RETURN_IF_NOT(err == ERR_OK, err); - } -#endif return ERR_OK; } @@ -1366,24 +1561,14 @@ //-------------------------------------------------- int verifyNotary(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, NotaryInfo* pNotInfo) { - int err = ERR_OK, nCAs = 10, i; - X509 * caCerts[10]; - X509* pNotCert = 0; + int err = ERR_OK, nCAs = NUM_SEARCH_CAS, i, err2 = 0; + X509 * caCerts[NUM_SEARCH_CAS]; + X509* pNotCert = 0, *pCaCert = 0; const DigiDocMemBuf *pMBuf = 0; char buf1[300], buf2[300], szNotSerial[100]; -#ifdef WITH_TS - char szTsaSerial[100]; - X509* pTsaCert = NULL; - TimestampInfo *pTS; - DigiDocMemBuf mbuf1; - time_t t1 = 0, t2 = 0, t0 = 0; - int nMaxTimeErrSecs = 0; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; -#endif + int mustFreeNotaryCert = 0; - for (i = 0; i < 10; i++) + for (i = 0; i < NUM_SEARCH_CAS; i++) caCerts[i] = 0; // get responder certs serial nr szNotSerial[0] = 0; @@ -1393,8 +1578,9 @@ // find responder cert and it's CA cert pMBuf = ddocNotInfo_GetResponderId(pNotInfo); RETURN_IF_NULL(pMBuf); + memset(buf2, 0, sizeof(buf2)); if(pNotInfo->nRespIdType == RESPID_NAME_TYPE) { - err = findCN((char*)pMBuf->pMem, buf1); + err = findCN((char*)pMBuf->pMem, buf1, sizeof(buf1)); ddocDebug(3, "verifyNotary", "Responder text: %s", buf1); if (!err) { err = findResponderCA(buf2, sizeof(buf2), buf1, NULL); @@ -1424,28 +1610,42 @@ SET_LAST_ERROR(ERR_OCSP_WRONG_RESPID); err = ERR_OCSP_WRONG_RESPID; } - if (!err) - err = findCAChainForCN((X509**)caCerts, &nCAs, buf2); - + if (!err) { + ddocDebug(3, "verifyNotary", "Find ca chain for: %s", buf2); + err = findCAChainForCN((X509**)caCerts, &nCAs, buf2, pNotCert); + ddocDebug(3, "verifyNotary", "CA chain for: %s, ca-s: %d, rc: %d", buf2, nCAs+1, err); + } // use specific error code for responders cert not found! if(err) { SET_LAST_ERROR(ERR_OCSP_RESP_NOT_TRUSTED); err = ERR_OCSP_RESP_NOT_TRUSTED; } - ddocDebug(3, "verifyNotary", "Chain length: %d, err: %d", nCAs, err); + ddocDebug(3, "verifyNotary", "Chain length: %d, err: %d", nCAs+1, err); if(pNotCert && !ddocSigInfo_GetOCSPRespondersCert(pSigInfo)) { err = ddocSigInfo_SetOCSPRespondersCert(pSigInfo, pNotCert); ddocDebug(3, "verifyNotary", "assigned notary cert because it was missing"); + } else { + mustFreeNotaryCert = 1; + } if (!err) { - err = verifyNotaryInfoCERT(pSigDoc, pSigInfo, pNotInfo, + ddocDebug(3, "verifyNotary", "Verifying Notary %s - cert: %s CA-s: %d", pNotInfo->szId, ((pNotCert) ? "OK" : "NULL"),nCAs+1); + err = findCAForCertificate(&pCaCert, ddocSigInfo_GetSignersCert(pSigInfo)); + err = verifyNotaryInfoCERT2(pSigDoc, pSigInfo, pNotInfo, (const X509**)caCerts, ConfigItem_lookup("CA_CERT_PATH"), - pNotCert); - //TODO: assign CA to Notary? + pNotCert, pCaCert); ddocDebug(3, "verifyNotary", "Verifying Notary %s - %s", pNotInfo->szId, ((!err) ? "OK" : "ERROR")); } + if (mustFreeNotaryCert) { + ddocDebug(3, "verifyNotary", "freed notary cert, hopefully all is OK"); + X509_free(pNotCert); + } if (!err) { err = isCertSignedByCERT(ddocSigInfo_GetOCSPRespondersCert(pSigInfo), caCerts[nCAs]); + if(err) { + err2 = isCertSignedByCERT(ddocSigInfo_GetOCSPRespondersCert(pSigInfo), caCerts[nCAs - 1]); + if(!err2) clearErrors(); else err = err2; + } ddocDebug(3, "verifyNotary", "\tCertificate trusted - %s", ((!err) ? "OK" : "ERROR")); } // verify notary digest @@ -1453,78 +1653,12 @@ err = verifyNotaryDigest(pSigDoc, pNotInfo); ddocDebug(3, "verifyNotary", "\tNotary digest - %s", ((!err) ? "OK" : "ERROR")); } - for (i = 0; i < 10; i++) { + for (i = 0; i < NUM_SEARCH_CAS; i++) { if(caCerts[i]) { X509_free(caCerts[i]); caCerts[i] = 0; } } -#ifdef WITH_TS - nMaxTimeErrSecs = ConfigItem_lookup_int("MAX_TSA_TIME_ERR_SECS", 1); - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocNotInfo_GetThisUpdate_timet(pNotInfo, &t0); -#ifdef WIN32 - snprintf(buf1, sizeof(buf1), "%s\\%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CA_CERT")); -#else - snprintf(buf1, sizeof(buf1), "%s/%s", ConfigItem_lookup("CA_CERT_PATH"), ConfigItem_lookup("TSA_CA_CERT")); -#endif - ddocDebug(3, "verifyNotary", "TSA CA cert: %s", buf1); - err = ReadCertificate(&(caCerts[0]), buf1); - nCAs = 1; - if(err) return err; - // verify SignatureTimeStamp - pTS = ddocSigInfo_GetTypestampOfType(pSigInfo, TS_TYPE_SIGNATURE); - if(pTS) { - err = ddocVerifyTimestampInfo(pTS, - caCerts, (char*)ConfigItem_lookup("CA_CERT_PATH"), &t1, &pTsaCert); - // TODO: verfy existence - szTsaSerial[0] = 0; - ReadCertSerialNumber(szTsaSerial, sizeof(szTsaSerial), pTsaCert); - - if(pTsaCert) - X509_free(pTsaCert); - pTsaCert = NULL; - if(err) - SET_LAST_ERROR(err); - } - // verify SigAndRefsTimeStamp - pTS = ddocSigInfo_GetTypestampOfType(pSigInfo, TS_TYPE_SIG_AND_REFS); - if(pTS) { - err = ddocVerifyTimestampInfo(pTS, - caCerts, (char*)ConfigItem_lookup("CA_CERT_PATH"), &t2, &pTsaCert); - // TODO: verfy existence - - if(pTsaCert) - X509_free(pTsaCert); - pTsaCert = NULL; - if(err) - SET_LAST_ERROR(err); - } - // cleanup - for (i = 0; i < nCAs; i++) { - if(caCerts[i]) { - X509_free(caCerts[i]); - caCerts[i] = 0; - } - } - // check timestamp dates - if(t1 > t2) { // SignatureTimeStamp must be before SigAndRefsTimeStamp - ddocDebug(1, "verifyNotary", "SigAndRefsTimeStamp: %ld was before SignatureTimeStamp: %ld", t2, t1); - err = ERR_TS_VERIFY; - } - time_t2str(t0, buf1, sizeof(buf1)); - ddocDebug(3, "verifyNotary", "Responder time: %s", buf1); - time_t2str(t1, buf2, sizeof(buf2)); - ddocDebug(3, "verifyNotary", "SignatureTimeStamp time: %s", buf2); - time_t2str(t2, szNotSerial, sizeof(szNotSerial)); - ddocDebug(3, "verifyNotary", "SigAndRefsTimeStamp time: %s", szNotSerial); - if(t0 < (t1-nMaxTimeErrSecs) || t1 > (t2+nMaxTimeErrSecs)) { // OCSP timestamp must be between SignatureTimeStamp and SigAndRefsTimeStamp - ddocDebug(1, "verifyNotary", "SignatureTimeStamp: %s OCSP: %s SigAndRefsTimeStamp: %s", buf2, buf1, szNotSerial); - err = ERR_TS_VERIFY; - } - - } -#endif if (err != ERR_OK) SET_LAST_ERROR(err); return err; } @@ -1539,49 +1673,76 @@ //-------------------------------------------------- EXP_OPTION int verifySignatureAndNotary(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, const char* szFileName) { - int err = ERR_OK; + int err1 = ERR_OK, err2 = ERR_OK; X509* pCA = 0; NotaryInfo* pNotInfo; - err = findCAForCertificate(&pCA, ddocSigInfo_GetSignersCert(pSigInfo)); - RETURN_IF_NOT(err == ERR_OK, err); - err = verifySignatureInfoCERT(pSigDoc, pSigInfo, pCA, szFileName, 1, NULL, 0); - if (err == ERR_OK) { + err1 = findCAForCertificate(&pCA, ddocSigInfo_GetSignersCert(pSigInfo)); + ddocDebug(3, "verifySignatureAndNotary", "find ca: %d, CA: %s", err1, (pCA ? "OK" : "NULL")); + //RETURN_IF_NOT(err == ERR_OK, err); + //RETURN_IF_NOT(pCA, ERR_SIGNERS_CERT_NOT_TRUSTED); + if(!pCA) { + err1 = ERR_SIGNERS_CERT_NOT_TRUSTED; + SET_LAST_ERROR(err1); + } + if(pCA) + err2 = verifySignatureInfoCERT(pSigDoc, pSigInfo, pCA, szFileName, 1); + if(err2) { + SET_LAST_ERROR(err2); + err1 = err2; + } + //if (err2 == ERR_OK) { pNotInfo = getNotaryWithSigId(pSigDoc, pSigInfo->szId); - if (pNotInfo) - err = verifyNotary(pSigDoc, pSigInfo, pNotInfo); - else { + if (pNotInfo) { + err2 = verifyNotary(pSigDoc, pSigInfo, pNotInfo); + if(err2) { + SET_LAST_ERROR(err2); + if(!err1) err1 = err2; + } + ddocDebug(3, "verifySignatureAndNotary", "verify notary: %d", err2); + } else { ddocDebug(3, "verifySignatureAndNotary", "\tSignature has no OCSP confirmation!\n"); SET_LAST_ERROR(ERR_NO_OCSP); - err = ERR_NO_OCSP; + err2 = ERR_NO_OCSP; + if(!err1) err1 = err2; } - } else - SET_LAST_ERROR(err); + //} else + // SET_LAST_ERROR(err2); if (pCA) X509_free(pCA); - return err; + return err1; } //-------------------------------------------------- // Extract common name from cert DN or responder id // src - DN // dest - buffer for CN +// destLen - size of output buffer in bytes //-------------------------------------------------- -int findCN(char* src, char* dest) +int findCN(char* src, char* dest, int destLen) { char* p1, *p2; + int n; p1 = strstr(src, "CN="); if(p1) { - p1 += 3; - p2 = strchr(p1, ','); - if(!p2) - p2 = strchr(p1, '/'); - if(!p2) + p1 += 3; // start of CN field + // find start of next field + p2 = strchr(p1, '='); + if(!p2) // if not found then this was the last field p2 = strchr(p1, 0); + // if we have found = of next field then move back until before field name + if(p2 && *p2 == '=') + while(p2 > p1 && isalpha(*(p2-1))) p2--; + // remove possible field separators + while(p2 > p1 && + (*(p2-1) == ' ' || *(p2-1) == ',' || *(p2-1) == '/')) + p2--; if(p2) { - strncpy(dest, p1, (int)(p2-p1)); - dest[(int)(p2-p1)] = 0; + n = (int)(p2-p1); + if(n >= destLen) n = destLen - 1; + strncpy(dest, p1, n); + dest[n] = 0; return ERR_OK; } } @@ -1609,8 +1770,8 @@ //------------------------------------------ EXP_OPTION int ddocVerifyCertByOCSPWithIp(X509* pCert, OCSP_RESPONSE **ppResp, unsigned long ip) { - int err = ERR_OK, nCAs = 10, i, j, err2, nType; - X509 * caCerts[10]; + int err = ERR_OK, nCAs = NUM_SEARCH_CAS, i, j, err2 = ERR_OK, nType; + X509 * caCerts[NUM_SEARCH_CAS]; X509 *pNotCert = 0; char *pkcs12file, *pkcs12passwd; char *proxyHost, *proxyPort; @@ -1650,11 +1811,11 @@ // if possible find OCSP URL by signers CA ddocDebug(3, "ddocVerifyCertByOCSPWithIp", "OCSP URL: %s CA: %s chain: %d", (ocspUrl ? ocspUrl : "NULL"), szCA, nCAs); - err = verifyCertificateByOCSPWithIp(pCert, NULL, NULL, ocspUrl, + err = verifyCertificateByOCSPWithIp(pCert, (const X509 **)caCerts, NULL, ocspUrl, proxyHost, proxyPort, pkcs12file, pkcs12passwd, &pResp, ip); ddocDebug(3, "ddocVerifyCertByOCSPWithIp", "OCSP verification - RC: %d, resp: %s", err, (pResp ? "OK" : "NULL")); - // release cert CA chain - for(i = 0; i <= nCAs; i++) { + // release cert CA chain, PR. index fix + for(i = 0; i < NUM_SEARCH_CAS; i++) { if(caCerts[i]) { X509_free(caCerts[i]); caCerts[i] = 0; @@ -1690,7 +1851,7 @@ err = err2; else clearErrors(); - for(i = 0; i <= nCAs; i++) + for(i = 0; i < NUM_SEARCH_CAS; i++) if(caCerts[i]) X509_free(caCerts[i]); // return OCSP response if requested @@ -1715,12 +1876,22 @@ long l1; FILE *hFile; char buf1[2050]; +#ifdef WIN32 + wchar_t *convFileName = 0; + int i= 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "ddocReadFile", "file: %s, conv-file: %s len: %d", szFileName, convFileName, i); +#endif RETURN_IF_NULL_PARAM(szFileName); RETURN_IF_NULL_PARAM(pData); pData->pMem = 0; pData->nLen = 0; +#ifdef WIN32 + hFile = _wfopen(convFileName, L"rb"); +#else hFile = fopen(szFileName, "rb"); +#endif RETURN_IF_NOT(hFile, ERR_FILE_READ); do { l1 = fread(buf1, 1, 2048, hFile); @@ -1730,6 +1901,37 @@ return err; } +//------------------------------------------ +// Writes an arbitrary file into memory buffer +// szFileName - file name and path +// pData - memory buffer object +// returns error code +//------------------------------------------ +EXP_OPTION int ddocWriteFile(const char* szFileName, DigiDocMemBuf* pData) +{ + int err = ERR_OK; + FILE *hFile; +#ifdef WIN32 + wchar_t *convFileName = 0; + int i= 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "ddocReadFile", "file: %s, conv-file: %s len: %d", szFileName, convFileName, i); +#endif + + RETURN_IF_NULL_PARAM(szFileName); + RETURN_IF_NULL_PARAM(pData); +#ifdef WIN32 + hFile = _wfopen(convFileName, L"wb"); +#else + hFile = fopen(szFileName, "wb"); +#endif + RETURN_IF_NOT(hFile, ERR_FILE_WRITE); + if(hFile) + fwrite(pData->pMem, 1, pData->nLen, hFile); + fclose(hFile); + return err; +} + #ifdef WITH_MSSP //------------------------------------------ @@ -1849,7 +2051,7 @@ err = ddocGetSignedHash(pSigInfo, buf1, &l1, 0, 1); RETURN_IF_NOT(err == ERR_OK, err); if(pMBufHash && l1 >= 35) - ddocMemAssignData(pMBufHash, (const char*)buf1 + 15, 20); + ddocMemAssignData(pMBufHash, (const char*)buf1 + 15, 20); // debug output l2 = sizeof(buf2); encode((const byte*)buf1, l1, (byte*)buf2, &l2); @@ -1919,6 +2121,3 @@ } #endif // WITH_MSSP - - - diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocConfig.h libdigidoc-3.7.0.875/libdigidoc/DigiDocConfig.h --- libdigidoc-2.7.0/libdigidoc/DigiDocConfig.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocConfig.h 2012-12-13 22:05:47.000000000 +0000 @@ -65,6 +65,10 @@ ConfigItem** pItems; } ConfigurationStore; + //-------------------------------------------------- + // Returns true (not 0) if config store structure has been inited + //-------------------------------------------------- + EXP_OPTION int isConfigInited(); //-------------------------------------------------- // Initializes configuration store @@ -150,7 +154,7 @@ // key - items key // returns value of config item or NULL if not found //-------------------------------------------------- - //EXP_OPTION const char* ConfigItem_lookup_str(const char* key, const char* defValue); + EXP_OPTION const char* ConfigItem_lookup_str(const char* key, const char* defValue); //-------------------------------------------------- // Reads and parses configuration file @@ -190,21 +194,23 @@ EXP_OPTION int findCAForCertificate(X509** ppCA, const X509* pCert); //-------------------------------------------------- - // Finds CA certificate by CN - // ppCA - address of found CA - // szCN - CA certs common name - // return error code or 0 for success - //-------------------------------------------------- - EXP_OPTION int findCAForCN(X509** ppCA, const char* szCN); - - //-------------------------------------------------- - // Finds CA chain - // ppChain - address of cert pointer array - // nMaxChain - cert pointer arrary length - // szCN - CN of the first CA cert (not the child cert!) - // return error code or 0 for success - //-------------------------------------------------- - EXP_OPTION int findCAChainForCN(X509** ppChain, int* nMaxChain, const char* szCN); +// Finds CA certificate by CN +// ppCA - address of found CA +// szCN - CA certs common name +// pHash - authority-key-identifier to search for CA +// return error code or 0 for success +//-------------------------------------------------- +EXP_OPTION int findCAForCN(X509** ppCA, const char* szCN, DigiDocMemBuf *pHash); + + //-------------------------------------------------- + // Finds CA chain + // ppChain - address of cert pointer array + // nMaxChain - index of last cert in returned array - 0 based + // szCN - CN of the first CA cert (not the child cert!) + // pCert - certificate to search ca-s for + // return error code or 0 for success + //-------------------------------------------------- + EXP_OPTION int findCAChainForCN(X509** ppChain, int* nMaxChain, const char* szCN, X509* pCert); //-------------------------------------------------- // Finds Responders certificate by CN @@ -272,6 +278,44 @@ const char* zip, const char* country); //-------------------------------------------------- + // Signs the document and gets configrmation + // pSigDoc - signed document pointer + // ppSigInfo - address of new signature pointer + // pin - smart card PIN + // manifest - manifest / resolution (NULL) + // city - signers city (NULL) + // state - signers state (NULL) + // zip - signers postal code (NULL) + // country - signers country (NULL) + // signs with PKCS11 + //-------------------------------------------------- + EXP_OPTION int signDocumentWithSlot(SignedDoc* pSigDoc, SignatureInfo** ppSigInfo, + const char* pin, const char* manifest, + const char* city, const char* state, + const char* zip, const char* country, + int nSlot, int nOcsp, int nSigner); + + //-------------------------------------------------- + // Signs the document and gets configrmation + // pSigDoc - signed document pointer + // ppSigInfo - address of new signature pointer + // pin - smart card PIN + // manifest - manifest / resolution (NULL) + // city - signers city (NULL) + // state - signers state (NULL) + // zip - signers postal code (NULL) + // country - signers country (NULL) + // nSigner - 1=PKCS11, 2=CNG (Microsoft CAPI), 3=PKCS#12 + // szPkcs12FileName - PKCS#12 file name to be used for signing (required if nSigner=3) + //-------------------------------------------------- + EXP_OPTION int signDocumentWithSlotAndSigner(SignedDoc* pSigDoc, SignatureInfo** ppSigInfo, + const char* pin, const char* manifest, + const char* city, const char* state, + const char* zip, const char* country, + int nSlot, int nOcsp, int nSigner, + const char* szPkcs12FileName); + + //-------------------------------------------------- // Verify this notary // pSigDoc - signed document pointer // pNotInfo - notary to verify @@ -292,8 +336,9 @@ // Extract common name from cert DN or responder id // src - DN // dest - buffer for CN + // destLen - size of output buffer in bytes //-------------------------------------------------- - int findCN(char* src, char* dest); + int findCN(char* src, char* dest, int destLen); //------------------------------------------ // Verify certificate by OCSP @@ -321,6 +366,15 @@ //------------------------------------------ EXP_OPTION int ddocReadFile(const char* szFileName, DigiDocMemBuf* pData); + //------------------------------------------ + // Writes an arbitrary file into memory buffer + // szFileName - file name and path + // pData - memory buffer object + // returns error code + //------------------------------------------ + EXP_OPTION int ddocWriteFile(const char* szFileName, DigiDocMemBuf* pData); + + #ifdef WITH_MSSP //------------------------------------------ // Gets MSSP session status and returns status code diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocConvert.c libdigidoc-3.7.0.875/libdigidoc/DigiDocConvert.c --- libdigidoc-2.7.0/libdigidoc/DigiDocConvert.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocConvert.c 2012-12-13 22:05:47.000000000 +0000 @@ -280,12 +280,13 @@ char* escape; } xmlsym; -int g_xmlsyms = 5; +int g_xmlsyms = 6; xmlsym g_xmlsym[] = { { '\n', " " }, { '\r', " " }, { '<', "<" }, { '>', ">" }, + { '"', """ }, { '&', "&" } // VS: test if really necessary! }; @@ -303,6 +304,8 @@ return 0; } + + //-------------------------------------------------- // Converts xml symbols to corresponding escapes // src - string with xml special sybols @@ -334,6 +337,7 @@ return dest; } + char g_hexChars[] = "0123456789ABCDEF"; //-------------------------------------------------- @@ -412,6 +416,30 @@ *len = i / 2; } +//============================================================ +// Encodes input data in hex format. +// pMBufSrc - input data +// pMBufDest - destination buffer +//============================================================ +EXP_OPTION int ddocBin2Hex(const DigiDocMemBuf* pMBufSrc, DigiDocMemBuf* pMBufDest) +{ + int err = ERR_OK, n; + + RETURN_IF_NULL(pMBufSrc); + RETURN_IF_NULL(pMBufDest); + pMBufDest->pMem = 0; + pMBufDest->nLen = 0; + // alloc mem for result + if(pMBufSrc->pMem && pMBufSrc->nLen) { + err = ddocMemSetLength(pMBufDest, pMBufSrc->nLen * 2 + 10); + n = pMBufSrc->nLen * 2 + 10; + if(err) return err; + bin2hex((const byte*)pMBufSrc->pMem, pMBufSrc->nLen, (char*)pMBufDest->pMem, &n); + pMBufDest->nLen = n; + } + return err; +} + //-------------------------------------------------- // Converts correct filename to incorrect encoding // used in formats 1.0, 1.1 and 1.2 @@ -541,6 +569,7 @@ int err = ERR_OK, len1, len2; char *pTmp1 = 0, *pTmp2 = 0; + ddocDebug(5, "oem2utf8", "oem2utf8"); // Kaido: 2.1.13 - initialize return value *utf8 = 0; // convert oem to unicode @@ -583,6 +612,7 @@ RETURN_IF_BAD_ALLOC(*unicode); memset(*unicode, 0, len); *outlen = MultiByteToWideChar(CP_UTF8, 0, utf8, -1, (LPWSTR)(*unicode), len); + ddocDebug(5, "utf82unicode", "Converted: \'%s\' to \'%s\' len: %d", utf8, *unicode, *outlen); if(!(*outlen)) { SET_LAST_ERROR(ERR_CHARSET_CONVERT); return ERR_CHARSET_CONVERT; @@ -639,6 +669,7 @@ // convert utf8 to unicode if(!utf8 || !strlen(utf8)) return ERR_OK; + memset(oem, 0, len); err = utf82unicode(utf8, &pTmp1, &len1); if(err) return err; // now convert unicode to OEM @@ -665,14 +696,15 @@ EXP_OPTION int getDataFileFileName(SignedDoc* pSigDoc, DataFile* pDf, char* outFileName, int len) { int err = ERR_OK; - RETURN_IF_NULL_PARAM(pSigDoc); RETURN_IF_NULL_PARAM(pDf); RETURN_IF_NULL_PARAM(outFileName); // Kaido: 2.1.13 - initialize return value *outFileName = 0; - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { + if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ) { + //utf82oem(pDf->szFileName, buf1, 300); + //convFNameToWin(buf1, outFileName, len); strncpy(outFileName, pDf->szFileName, len); } else { convWinToFName(pDf->szFileName, outFileName, len); @@ -739,7 +771,7 @@ #ifdef WIN32 err = utf82oem(src, dest, destlen); #else - SET_LAST_ERROR_IF_NOT(strlen(src) < destlen, ERR_BUF_LEN); + SET_LAST_ERROR_IF_NOT((int)strlen(src) < destlen, ERR_BUF_LEN); strncpy(dest, src, destlen); #endif return err; @@ -768,8 +800,13 @@ EVP_EncodeUpdate(&ectx, buf, buflen, (byte*)raw, rawlen); EVP_EncodeFinal(&ectx, (unsigned char*)strchr((const char*)buf, 0), buflen); *buflen = strlen((const char*)buf); - while(buf[*buflen-1] == '\n' || buf[*buflen-1] == '\r') + while(buf[*buflen-1] == '\n' || buf[*buflen-1] == '\r' || buf[*buflen-1] == '-') { + if(buf[*buflen-1] == '-') + ddocDebug(1, "encode", "Found - at the end of base64 code: %s", buf); + buf[*buflen-1] = 0; + *buflen = *buflen - 1; + } *buflen = strlen((const char*)buf); } @@ -1105,7 +1142,8 @@ if(tm->type == V_ASN1_GENERALIZEDTIME) err = decodeGeneralizedTime(tm, &tm1.tm_year, &tm1.tm_mon, &tm1.tm_mday, &tm1.tm_hour, &tm1.tm_min, &tm1.tm_sec); - //tm1.tm_year -= 1900; + if(tm1.tm_year > 1900) + tm1.tm_year -= 1900; tm1.tm_mon -= 1; tm1.tm_isdst = _daylight; (*pT) = mktime(&tm1); @@ -1123,7 +1161,6 @@ return err; } - //========================================================== // converts ASN1 time to string //========================================================== @@ -1148,17 +1185,13 @@ // V 1.76 - in format 1.3 we use CCYY-MM-DDTHH:MM:SSZ if(!pSigDoc || (pSigDoc && - (!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ))) { + !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) )) { snprintf(buf, len, "%04d-%02d-%02dT%02d:%02d:%02dZ", year + tm1.tm_year, tm1.tm_mon, tm1.tm_mday, tm1.tm_hour, tm1.tm_min, tm1.tm_sec); } else // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(pSigDoc && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(pSigDoc && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { tm1.tm_year -= 1900 - year; tm1.tm_mon -= 1; tm1.tm_isdst = _daylight; @@ -1218,7 +1251,7 @@ _tzset(); memset(&tm1, 0, sizeof(tm1)); // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { sscanf(str, "%04d.%02d.%04dT%02d:%02d:%02d%3d:00", &(tm1.tm_year), &(tm1.tm_mon), &(tm1.tm_mday), &(tm1.tm_hour), &(tm1.tm_min), &(tm1.tm_sec), &dmz); @@ -1262,3 +1295,32 @@ tm1.tm_mday, tm1.tm_hour, tm1.tm_min, tm1.tm_sec); return ERR_OK; } + +//=================================================================== +// converts string to time_t +// szTimestamp - input buffer +// pT - address time_t output value +// returns error code or ERR_OK +//=================================================================== +EXP_OPTION int str2time_t(char* szTimestamp, time_t* pT) +{ + struct tm tm1; + time_t t1 = 0; + //int dmz = 0; + + RETURN_IF_NULL_PARAM(szTimestamp); + RETURN_IF_NULL_PARAM(pT); + _tzset(); + memset(&tm1, 0, sizeof(tm1)); + sscanf(szTimestamp, "%04d.%02d.%04dT%02d:%02d:%02dZ", + &(tm1.tm_year), &(tm1.tm_mon), &(tm1.tm_mday), + &(tm1.tm_hour), &(tm1.tm_min), &(tm1.tm_sec) /*, &dmz*/); + tm1.tm_year -= 1900; + tm1.tm_mon -= 1; + tm1.tm_isdst = _daylight; + t1 = mktime(&tm1); + //t1 -= (dmz * 3600); + (*pT) = t1; + return ERR_OK; +} + diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocConvert.h libdigidoc-3.7.0.875/libdigidoc/DigiDocConvert.h --- libdigidoc-2.7.0/libdigidoc/DigiDocConvert.h 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocConvert.h 2012-12-13 22:05:47.000000000 +0000 @@ -69,6 +69,13 @@ // Converts a binary value to hex string EXP_OPTION void bin2hex(const byte* bin, int blen, char* hex, int* len); +//============================================================ +// Encodes input data in hex format. +// pMBufSrc - input data +// pMBufDest - destination buffer +//============================================================ +EXP_OPTION int ddocBin2Hex(const DigiDocMemBuf* pMBufSrc, DigiDocMemBuf* pMBufDest); + // Helper function that converts ISO Latin1 to UTF8 EXP_OPTION char* ascii2utf8(const char* ascii, char* utf8out, int* outlen); @@ -82,6 +89,10 @@ // replaces xml special symbols with escapes int escapeXMLSymbols(const char* src, int srclen, char** dest); + +char* escape2xmlsym(const char* src); + + int hasUmlauts(const char* str); int str2asn1time(const SignedDoc* pSigDoc, const char* str, ASN1_GENERALIZEDTIME* asn1tm); @@ -185,6 +196,14 @@ //=================================================================== EXP_OPTION int time_t2str(time_t t, char* szTimestamp, int len); +//=================================================================== +// converts string to time_t +// szTimestamp - input buffer +// pT - address time_t output value +// returns error code or ERR_OK +//=================================================================== +EXP_OPTION int str2time_t(char* szTimestamp, time_t* pT); + //-------------------------------------------------- // Converts a filename according to platform rules // dest - destination buffer @@ -262,6 +281,8 @@ //-------------------------------------------------- EXP_OPTION int getDataFileFileName(SignedDoc* pSigDoc, DataFile* pDf, char* outFileName, int len); +#endif // WIN32 + //-------------------------------------------------- // Releases mem-block allocated by lib. In win32 // this must be done since the mem was allocated by dll @@ -270,7 +291,6 @@ //-------------------------------------------------- EXP_OPTION void freeLibMem(void* p); -#endif // WIN32 #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocCsp.c libdigidoc-3.7.0.875/libdigidoc/DigiDocCsp.c --- libdigidoc-2.7.0/libdigidoc/DigiDocCsp.c 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocCsp.c 2012-12-13 22:05:47.000000000 +0000 @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -44,7 +45,6 @@ #include #include #include -#include #include #include @@ -90,9 +90,6 @@ CSProvider * cCSProvider; CSProvider * knownCSProviders[3]; -#ifdef WITH_TS -#include -#endif //AARE01102003 typedef struct StoreHandle_st { @@ -110,7 +107,7 @@ char *Digi_GetName(X509_NAME *pName); BOOL Digi_CheckEnhancedKeyUsage(PCCERT_CONTEXT pCert, char *psValue); X509 *Digi_FindCertByResponse(StoreHandle *hStore, OCSP_RESPONSE *poResponse); -PCCERT_CONTEXT Digi_FindCertBySubject(StoreHandle *hStore,char *psCN, BOOL bCheckValid, const char* szSerialNr); +PCCERT_CONTEXT Digi_FindCertBySubject(StoreHandle *hStore,char *psCN, BOOL bCheckValid, const char* szSerialNr, BOOL bCA); BOOL Digi_CompareCN(char *psSub1, char *psSub2); X509 **Digi_MakeCertList(X509 *poX509Main, StoreHandle *hStore); X509 **Digi_MakeCertListLow(X509 *poX509Main, StoreHandle *hStore); @@ -131,24 +128,24 @@ // verifies this one signature int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const char* szDataFile, FilePath* pPaths, int nPaths); + const char* szDataFile); // verifies the whole document (returns on first err) -int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile, - FilePath* pPaths, int nPaths); -int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile, FilePath* pPaths, int nPaths); +int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile); +int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile); int Digi_verifyNotaryInfoCERT(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo, const X509** caCerts, - const X509* notCert); + const X509* notCert, + const X509* pSigCA); //int Digi_initializeNotaryInfoWithOCSP(SignedDoc* pSigDoc, NotaryInfo* pNotary, // OCSP_RESPONSE* resp, X509* notCert, int initDigest); // verifies signed doc -int verifySigDoc_ByCertStore(const SignedDoc* pSigDoc, const char* szDataFile,FilePath* pPaths, int nPaths); +int verifySigDoc_ByCertStore(const SignedDoc* pSigDoc, const char* szDataFile); // Verifies this signature int verifySignatureInfo_ByCertStore(const SignedDoc* pSigDoc, - const SignatureInfo* pSigInfo, const char* szDataFile,FilePath* pPaths, int nPaths); + const SignatureInfo* pSigInfo, const char* szDataFile); // Verfies NotaryInfo signature int verifyNotaryInfo_ByCertStore(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo); @@ -170,10 +167,12 @@ //extern CERT_PUBLIC_KEY_INFO * getCardKeyInfo(const char * ppContainerName); extern int GetCertificateFromStore(const CertSearchStore *sS, X509 **x509); extern int GetSignedHashWithEstIdCSPkey(const char * dataToBeSigned,unsigned long dataLen,unsigned char *pbKeyBlob, unsigned long *pbKeyBlobLen,unsigned char *hash, unsigned long *hashLen, unsigned char * hashedSignature,unsigned long * sigLen); -extern int GetSignedHashWithKeyAndCSP(char *psKeyName, char *psCSPName, const char * dataToBeSigned,unsigned long dataLen,unsigned char *pbKeyBlob, unsigned long *pbKeyBlobLen,unsigned char *hash, unsigned long *hashLen, unsigned char * hashedSignature,unsigned long * sigLen); +extern int GetSignedHashWithKeyAndCSP(char *psKeyName, char *psCSPName, const char * dataToBeSigned,unsigned long dataLen,unsigned char *pbKeyBlob, unsigned long *pbKeyBlobLen,unsigned char *hash, unsigned long *hashLen, unsigned char * hashedSignature,unsigned long * sigLen, const char* szPin); extern X509 * findIssuerCertificatefromStore(X509 *x509); X509* Digi_FindDirectCA(X509 *poX509Main, StoreHandle *hStore); +X509* Digi_FindCertBySubjectAndHash(StoreHandle *hStore, char *psCN, BOOL bCheckValid, const char* szSerialNr, BOOL bCA, DigiDocMemBuf *pHash); + //==========< macros >==================== #define SET_LAST_ERROR(code) (addError((code), __FILE__, __LINE__, "")) @@ -193,9 +192,6 @@ BOOL Digi_OpenStore(StoreHandle *hStore) { BOOL fRes = FALSE; -#ifdef WITH_TS - TSAProfile_init(); -#endif if (hStore != NULL) { memset(hStore,0,sizeof(StoreHandle)); hStore->hHandle = CertOpenStore(CERT_STORE_PROV_SYSTEM,0,(HCRYPTPROV)NULL, @@ -426,7 +422,7 @@ } iLen = X509_NAME_get_text_by_NID(rid->value.byName,NID_commonName,sCN,sizeof(sCN)); if (iLen > 0) //VS: 18.03.2006 - use only currently valid cert for new notary - pCert = Digi_FindCertBySubject(hStore, sCN, TRUE, 0); + pCert = Digi_FindCertBySubject(hStore, sCN, TRUE, 0, TRUE); if(pCert != NULL) //AA100204 ddocDecodeX509Data(&poX509,pCert->pbCertEncoded,pCert->cbCertEncoded); @@ -435,48 +431,6 @@ return(poX509); } -#ifdef WITH_TS - -/*X509 *Digi_FindTSACert(StoreHandle *hStore) -{ - X509 *poX509 = NULL; - PCCERT_CONTEXT pCert = NULL; - TSAProfile *pProfile = TSAProfile_init(); - if(pProfile) { - pCert = Digi_FindCertBySubject(hStore, pProfile->g_szTsaCN, TRUE, 0); - if(pCert != NULL) - ddocDecodeX509Data(&poX509,pCert->pbCertEncoded,pCert->cbCertEncoded); - } - return(poX509); -}*/ - -X509 *Digi_FindTSACACert(StoreHandle *hStore, TimestampInfo *pTS) -{ - X509 *poX509 = NULL; - PCCERT_CONTEXT pCert = NULL; - TS_RESP* pResp = NULL; - DigiDocMemBuf mbuf1; - char cn[200]; - const DigiDocMemBuf *pMBuf = NULL; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - pMBuf = ddocTimestampInfo_GetTS(pTS); - if(pMBuf) - ddocTsReadTsResp(&pResp, (DigiDocMemBuf*)pMBuf); - if(pResp) { - ddocTsResp_GetSignerCertIssuer(pResp, &mbuf1); - findCN((char*)mbuf1.pMem, cn); - pCert = Digi_FindCertBySubject(hStore, cn, TRUE, 0); - if(pCert != NULL) - ddocDecodeX509Data(&poX509,pCert->pbCertEncoded,pCert->cbCertEncoded); - TS_RESP_free(pResp); - } - ddocMemBuf_free(&mbuf1); - return(poX509); -} - -#endif // WITH_TS //Added by AA 09/10/2003 @@ -511,20 +465,23 @@ } //VS: 18.03.2006 - use only currently valid cert for new notary -PCCERT_CONTEXT Digi_FindCertBySubject(StoreHandle *hStore, char *psCN, BOOL bCheckValid, const char* szSerialNr) +PCCERT_CONTEXT Digi_FindCertBySubject(StoreHandle *hStore, char *psCN, BOOL bCheckValid, const char* szSerialNr, BOOL bCA) { PCCERT_CONTEXT pCert = NULL; BOOL fFind = FALSE; X509 *poX509; - char sSubject[255], sSerial[255]; - int iLen; + char sSerial[255]; time_t tNow; + DigiDocMemBuf mbuf; + + mbuf.pMem = 0; + mbuf.nLen = 0; if (hStore == NULL || psCN == NULL) return(pCert); Digi_CloseStore(hStore); hStore->hHandle = CertOpenStore(CERT_STORE_PROV_SYSTEM,0,(HCRYPTPROV)NULL, - CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG,L"CA"); + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG, (bCA ? L"CA" : L"My")); if (hStore->hHandle == NULL) return(pCert); //get signer issuer @@ -534,9 +491,12 @@ ddocDecodeX509Data(&poX509, pCert->pbCertEncoded,pCert->cbCertEncoded); if (poX509 != NULL) { - iLen = X509_NAME_get_text_by_NID(X509_get_subject_name(poX509),NID_commonName, sSubject,255); - if(iLen > 0) { - fFind = Digi_CompareCN(sSubject, psCN); + //iLen = X509_NAME_get_text_by_NID(X509_get_subject_name(poX509),NID_commonName, sSubject,255); + + ddocCertGetSubjectCN(poX509, &mbuf); + + if(mbuf.nLen > 0) { + fFind = Digi_CompareCN((char*)mbuf.pMem, psCN); if(fFind) { if(szSerialNr) { //VS: 18.03.2006 - look for a cert with specific serial nr ReadCertSerialNumber(sSerial, sizeof(sSerial)-1, poX509); @@ -555,6 +515,92 @@ return(pCert); } +X509* Digi_FindCertBySubjectAndHash(StoreHandle *hStore, char *psCN, BOOL bCheckValid, const char* szSerialNr, BOOL bCA, DigiDocMemBuf *pHash) +{ + PCCERT_CONTEXT pCert = NULL; + BOOL fFind = FALSE; + X509 *poX509 = NULL, *pSCert = NULL; + char sSerial[255]; + time_t tNow; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; //, mbuf4, mbuf5; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + /*mbuf4.pMem = 0; + mbuf4.nLen = 0; + mbuf5.pMem = 0; + mbuf5.nLen = 0;*/ + if (hStore == NULL || psCN == NULL) + return NULL; + Digi_CloseStore(hStore); + hStore->hHandle = CertOpenStore(CERT_STORE_PROV_SYSTEM,0,(HCRYPTPROV)NULL, + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG, (bCA ? L"CA" : L"My")); + if (hStore->hHandle == NULL) + return NULL; + ddocEncodeBase64(pHash, &mbuf3); + ddocDebug(3, "Digi_FindCertBySubjectAndHash", "Find CN: %s serial: %s subj-hash: %s", psCN, szSerialNr, (char*)mbuf3.pMem); + ddocMemBuf_free(&mbuf3); + //get signer issuer + while (fFind == FALSE && (pCert = CertEnumCertificatesInStore(hStore->hHandle,pCert))) + { + //AA100204 + ddocDecodeX509Data(&poX509, pCert->pbCertEncoded,pCert->cbCertEncoded); + if (poX509 != NULL) + { + //iLen = X509_NAME_get_text_by_NID(X509_get_subject_name(poX509),NID_commonName, sSubject,255); + ddocCertGetSubjectCN(poX509, &mbuf1); + if(mbuf1.nLen > 0) { + fFind = Digi_CompareCN((char*)mbuf1.pMem, psCN); + if(fFind) { + if(szSerialNr) { //VS: 18.03.2006 - look for a cert with specific serial nr + ReadCertSerialNumber(sSerial, sizeof(sSerial)-1, poX509); + fFind = !strcmp(szSerialNr, sSerial); + } else if(bCheckValid) { //VS: 18.03.2006 - use only currently valid cert for new notary + time(&tNow); + fFind = !isCertValid(poX509, tNow); + } + } + if(fFind && pHash && poX509) { + readSubjectKeyIdentifier(poX509, &mbuf2); + ddocEncodeBase64(&mbuf2, &mbuf3); + //readAuthorityKeyIdentifier(poX509, &mbuf4); + //ddocEncodeBase64(&mbuf4, &mbuf5); + if(!ddocMemCompareMemBufs(pHash, &mbuf2)) { + pSCert = poX509; + fFind = TRUE; + //break; + } + else + fFind = FALSE; + } + } + //ddocDebug(3, "Digi_FindCertBySubjectAndHash", "Compare CN: %s serial: %s subj-hash: %s auth-hash: %s rc: %d", (char*)mbuf1.pMem, sSerial, (char*)mbuf3.pMem, (char*)mbuf5.pMem, fFind); + ddocDebug(3, "Digi_FindCertBySubjectAndHash", "Compare CN: %s serial: %s subj-hash: %s rc: %d", (char*)mbuf1.pMem, sSerial, (char*)mbuf3.pMem, fFind); + if(!pSCert) { + X509_free(poX509); + poX509 = NULL; + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + //ddocMemBuf_free(&mbuf4); + //ddocMemBuf_free(&mbuf5); + } + } + if(fFind == FALSE) + pCert = NULL; + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + //ddocMemBuf_free(&mbuf4); + //ddocMemBuf_free(&mbuf5); + return pSCert; +} + //---------------------------------------------------- // Returns a list of certificates based on the // search criteria @@ -567,12 +613,12 @@ const char* szSerialNr, DigiDocMemBuf* pMBuf) { int iMaxCerts = 512; - int iRes = 0; + int iRes = 0, l1, l2; X509 **caCerts = NULL; X509 *poX509; PCCERT_CONTEXT pCert = NULL; BOOL fAdd; - char buf1[255]; + char buf1[255], buf2[100]; DigiDocMemBuf mbuf1; mbuf1.pMem = 0; @@ -615,6 +661,11 @@ // check pubkey hash if(pMBuf) { ddocCertGetPubkeyDigest(poX509, &mbuf1); + l1 = sizeof(buf1); + l2 = sizeof(buf2); + bin2hex((const byte*)mbuf1.pMem, mbuf1.nLen, buf1, &l1); + bin2hex((const byte*)pMBuf->pMem, pMBuf->nLen, buf2, &l2); + ddocDebug(3, "Digi_FindCACerts", "Compare cert-hash: %s with searched-hash %s", buf1, buf2); fAdd = !ddocMemCompareMemBufs(&mbuf1, pMBuf); ddocMemBuf_free(&mbuf1); } @@ -792,46 +843,54 @@ char* pkcs12File, char *password, char* notaryURL, char* proxyHost, char* proxyPort) { - int err = ERR_OK, err2 = ERR_OK, i; + int err = ERR_OK, err2 = ERR_OK, i, l1; StoreHandle hStore; NotaryInfo* pNotInf = NULL; - X509 *pNotCert = NULL, *pNotCertFound = NULL; + X509 *pNotCert = NULL, *pNotCertFound = NULL, *pSigCa = 0; X509 **caCerts = NULL; X509 **respCerts = NULL; -#ifdef WITH_TS - X509 *pTsaCert = 0; - TSAProfile *pProfile = 0; -#endif const DigiDocMemBuf *pMBuf = 0; - char szCN[255]; + char szCN[255], buf1[100]; + // set default values from config file + if(ConfigItem_lookup_bool("SIGN_OCSP", 1)) { + if(!pkcs12File || !strlen(pkcs12File)) + pkcs12File = (char*)ConfigItem_lookup("DIGIDOC_PKCS_FILE"); + if(!password || !strlen(password)) + password = (char*)ConfigItem_lookup("DIGIDOC_PKCS_PASSWD"); + } + if(!notaryURL || !strlen(notaryURL)) + notaryURL = (char*)ConfigItem_lookup("DIGIDOC_OCSP_URL"); + if(ConfigItem_lookup_bool("USE_PROXY", 1)) { + proxyHost = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); + RETURN_IF_NOT(proxyHost, ERR_WRONG_URL_OR_PROXY); + proxyPort = (char*)ConfigItem_lookup("DIGIDOC_PROXY_PORT"); + RETURN_IF_NOT(proxyPort, ERR_WRONG_URL_OR_PROXY); + } if (Digi_OpenStore(&hStore) == FALSE) SET_LAST_ERROR_RETURN_CODE(ERR_CERT_STORE_READ); -#ifdef WITH_TS - pProfile = TSAProfile_init(); - RETURN_IF_NULL(pProfile); - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) && - pProfile->g_bAddSignatureTimeStamp) { - err = ddocGetSignatureTimeStamp(pSigInfo, &pTsaCert, - pProfile->g_szTsaPolicy, pProfile->g_szTsaUrl, - proxyHost, proxyPort); - - if(pTsaCert) - X509_free(pTsaCert); - RETURN_IF_NOT(err == ERR_OK, err); - } -#endif // we need to find some CA-s of signer before asking for // confirmation in order to be able to construct certid // we need this because of users direct CA respCerts = Digi_MakeCertListLow(ddocSigInfo_GetSignersCert(pSigInfo), &hStore); + if(respCerts) { + for(i = 0; respCerts[i]; i++) // find lowest (middle) ca - direct ca of signers cert + pSigCa = respCerts[i]; + } // VS: ver 1.5.33 - make this decision lower if confirmation can still be retrieved //if(!respCerts) SET_LAST_ERROR_RETURN_CODE(ERR_SIGNERS_CERT_NOT_TRUSTED); err = getConfirmation(pSigDoc, pSigInfo, respCerts, NULL, pkcs12File, password, notaryURL, proxyHost, proxyPort); - Digi_FreeCertList(respCerts); - + //Digi_FreeCertList(respCerts); + if(respCerts) { + for(i = 0; respCerts[i]; i++) { + if(respCerts[i] && respCerts[i] != pSigCa) { + X509_free(respCerts[i]); + respCerts[i] = 0; + } + } + } if(err) return err; pNotInf = pSigInfo->pNotary; pMBuf = ddocNotInfo_GetResponderId(pNotInf); @@ -839,17 +898,23 @@ if(pNotInf->nRespIdType == RESPID_NAME_TYPE) { szCN[0] = 0; if(pMBuf && pMBuf->pMem) - findCN((char*)pMBuf->pMem, szCN); + findCN((char*)pMBuf->pMem, szCN, sizeof(szCN)); pMBuf = NULL; // don't look for pubkey hash + ddocDebug(3, "Digi_getConfirmationWithCertSearch", "Find OCSP resp CA-s by key %s", szCN); } else if(pNotInf->nRespIdType == RESPID_KEY_TYPE) { // look for pubkey hash in Digi_FindCACerts + pMBuf = &(pNotInf->mbufRespId); + szCN[0] = 0; + l1 = sizeof(buf1); + bin2hex((const byte*)pNotInf->mbufRespId.pMem, pNotInf->mbufRespId.nLen, buf1, &l1); + ddocDebug(3, "Digi_getConfirmationWithCertSearch", "Find OCSP resp CA-s by hash %s", buf1); } RETURN_IF_NOT(pNotInf != NULL, ERR_NOTARY_SIG_MATCH); // find a list of potential responder certificates // search only by responder id = CN. Should I check also validity on current time ? - respCerts = Digi_FindCACerts(&hStore, szCN, 0, 0, (DigiDocMemBuf*)pMBuf); + respCerts = Digi_FindCACerts(&hStore, (szCN[0] ? szCN : NULL), 0, 0, (DigiDocMemBuf*)pMBuf); clearErrors(); if(!err && respCerts) { @@ -863,7 +928,7 @@ caCerts = Digi_MakeCertList(pNotCert, &hStore); if (caCerts != NULL) { - err2 = finalizeAndVerifyNotary(pSigDoc, pSigInfo, pNotInf, (const X509**)caCerts, (const X509*)pNotCert); + err2 = finalizeAndVerifyNotary2(pSigDoc, pSigInfo, pNotInf, (const X509**)caCerts, (const X509*)pNotCert, pSigCa); // if this didn't verify then free the cert and mark the slot as freed if(err2) { // remove certid and certvalue created for verification @@ -907,7 +972,7 @@ if(pNotCertFound) { Digi_CloseStore(&hStore); caCerts = Digi_MakeCertList(pNotCertFound, &hStore); - err = finalizeAndVerifyNotary(pSigDoc, pSigInfo, pNotInf, (const X509**)caCerts, (const X509*)pNotCertFound); + err = finalizeAndVerifyNotary2(pSigDoc, pSigInfo, pNotInf, (const X509**)caCerts, (const X509*)pNotCertFound, pSigCa); Digi_FreeCertList(caCerts); } else @@ -916,18 +981,6 @@ // reset original signature content if(pSigInfo->mbufOrigContent.pMem) ddocMemBuf_free(&(pSigInfo->mbufOrigContent)); -#ifdef WITH_TS - if (!err && !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) && - pProfile->g_bAddSigAndRefsTimeStamp) { - //pTsaCert = Digi_FindTSACert(&hStore); - err = ddocGetSigAndRefsTimeStamp(pSigDoc, pSigInfo, &pTsaCert, - pProfile->g_szTsaPolicy, pProfile->g_szTsaUrl, - proxyHost, proxyPort); - if(pTsaCert) - X509_free(pTsaCert); - RETURN_IF_NOT(err == ERR_OK, err); - } -#endif Digi_CloseStore(&hStore); if(err != ERR_OK) SET_LAST_ERROR(err); @@ -946,106 +999,48 @@ { X509** caCerts = NULL; X509* notCert = NULL; - X509* cert = NULL; + X509* cert = NULL, *pSigCA = NULL, *pSigCert = NULL; StoreHandle hStore; SignatureInfo *pSigInfo = NULL; int err = ERR_OK; -#ifdef WITH_TS - X509* pTsaCaCert = NULL, *pTsaCert = NULL; - X509 * tsaCaCerts[3]; - int nCAs; - time_t t1 = 0, t2 = 0, t0 = 0; - TimestampInfo *pTS; - TSAProfile *pProfile = 0; - char buf1[100], buf2[100], buf3[100]; - DigiDocMemBuf mbuf1; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; -#endif if(pNotInfo) pSigInfo = ddocGetSignatureForNotary(pSigDoc, pNotInfo); - if(pSigInfo != NULL) - cert = ddocSigInfo_GetOCSPRespondersCert(pSigInfo); + if(pSigInfo != NULL) { + cert = ddocSigInfo_GetOCSPRespondersCert(pSigInfo); + } caCerts = Digi_MakeCertList(cert,&hStore); if(caCerts == NULL) SET_LAST_ERROR_RETURN_CODE(ERR_CERT_STORE_READ); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - pProfile = TSAProfile_init(); - RETURN_IF_NULL(pProfile); - err = ddocNotInfo_GetProducedAt_timet(pNotInfo, &t0); - // verify SignatureTimeStamp - pTS = ddocSigInfo_GetTypestampOfType(pSigInfo, TS_TYPE_SIGNATURE); - if(pTS) { - pTsaCaCert = Digi_FindTSACACert(&hStore, pTS); - if(!pTsaCaCert) { - SET_LAST_ERROR(ERR_TSA_NOT_TRUSTED); - return ERR_TSA_NOT_TRUSTED; - } - nCAs = 1; - tsaCaCerts[0] = pTsaCaCert; - tsaCaCerts[1] = tsaCaCerts[2] = 0; - err = ddocVerifyTimestampInfo(pTS, tsaCaCerts, 0, &t1, &pTsaCert); - if(err) - SET_LAST_ERROR(err); - /*if(pTsaCert) - X509_free(pTsaCert);*/ - if(pTsaCaCert) - X509_free(pTsaCaCert); - } - // verify SigAndRefsTimeStamp - pTS = ddocSigInfo_GetTypestampOfType(pSigInfo, TS_TYPE_SIG_AND_REFS); - if(!err && pTS) { - pTsaCaCert = Digi_FindTSACACert(&hStore, pTS); - if(!pTsaCaCert) { - SET_LAST_ERROR(ERR_TSA_NOT_TRUSTED); - return ERR_TSA_NOT_TRUSTED; - } - nCAs = 1; - tsaCaCerts[0] = pTsaCaCert; - tsaCaCerts[1] = tsaCaCerts[2] = 0; - err = ddocVerifyTimestampInfo(pTS, tsaCaCerts, 0, &t2, &pTsaCert); - if(err) - SET_LAST_ERROR(err); - /*if(pTsaCert) - X509_free(pTsaCert);*/ - if(pTsaCaCert) - X509_free(pTsaCaCert); - } - // check times - // check timestamp dates - if(!err && t1 > t2) { // SignatureTimeStamp must be before SigAndRefsTimeStamp - ddocDebug(1, "Digi_verifyNotaryInfoWithCertSearch", "SignatureTimeStamp %ld must be before SigAndRefsTimeStamp %ld", (long)t1, (long)t2); - err = ERR_TS_VERIFY; - SET_LAST_ERROR(err); - } - // OCSP timestamp must be between SignatureTimeStamp and SigAndRefsTimeStamp - if(!err && (t0 < (t1 - pProfile->g_nTsaMaxTsInterval) - || t1 > (t2 + pProfile->g_nTsaMaxTsInterval))) { - time_t2str(t0, buf1, sizeof(buf1)); - time_t2str(t1 - pProfile->g_nTsaMaxTsInterval, buf2, sizeof(buf2)); - time_t2str(t2 + pProfile->g_nTsaMaxTsInterval, buf3, sizeof(buf3)); - ddocDebug(1, "Digi_verifyNotaryInfoWithCertSearch", "OCSP: %s SignatureTimeStamp %s must be before SigAndRefsTimeStamp %s", - buf1, buf2, buf3); - err = ERR_TS_VERIFY; - SET_LAST_ERROR(err); - } - } -#endif //siin leitakse responderi cert vastavalt kirjeldusele //notCert = Digi_FindResponderCert(&hStore,cert); //08.03.2005 leitakse responderi koopia win certstoorest if(!err) { notCert = Digi_FindX509CopyFromStore(&hStore,cert); + pSigCert = ddocSigInfo_GetSignersCert(pSigInfo); + pSigCA = Digi_FindDirectCA(pSigCert, &hStore); + if((!notCert || !pSigCA) && hStore.fRoot == 1) { // try also CA store + Digi_CloseStore(&hStore); + memset(&hStore,0,sizeof(StoreHandle)); + hStore.hHandle = CertOpenStore(CERT_STORE_PROV_SYSTEM,0,(HCRYPTPROV)NULL, + CERT_SYSTEM_STORE_CURRENT_USER | CERT_STORE_READONLY_FLAG,L"CA"); + if(!notCert) + notCert = Digi_FindX509CopyFromStore(&hStore,cert); + if(!pSigCA) + pSigCA = Digi_FindDirectCA(pSigCert, &hStore); + } if (notCert) - err = Digi_verifyNotaryInfoCERT(pSigDoc, pNotInfo, (const X509**)caCerts, notCert); + err = Digi_verifyNotaryInfoCERT(pSigDoc, pNotInfo, (const X509**)caCerts, notCert, pSigCA); else err = ERR_OCSP_CERT_NOTFOUND; } Digi_CloseStore(&hStore); Digi_FreeCertList(caCerts); + //AM 23.05.08 where notCert is freed? + if(notCert) + X509_free(notCert); + if(pSigCA) + X509_free(pSigCA); if (err != ERR_OK) SET_LAST_ERROR(err); return err; } @@ -1057,7 +1052,7 @@ // pSigDoc - signed doc data // //============================================================ -int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile, FilePath* pPaths, int nPaths) +int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile) { SignatureInfo* pSigInfo; @@ -1069,7 +1064,7 @@ d = getCountOfSignatures(pSigDoc); for(i = 0; i < d; i++) { pSigInfo = getSignature(pSigDoc, i); - err = Digi_verifySignatureInfo(pSigDoc, pSigInfo, szDataFile, pPaths, nPaths); + err = Digi_verifySignatureInfo(pSigDoc, pSigInfo, szDataFile); RETURN_IF_NOT(err == ERR_OK, err); pNotInfo = pSigInfo->pNotary; err = Digi_verifyNotaryInfoWithCertSearch(pSigDoc, pNotInfo); @@ -1087,8 +1082,14 @@ { int err = ERR_OK; EVP_PKEY *pkey; + // VS: 26.01.2010 - initialize + (*x509) = 0; + //AM 16.09.08 DigiDocClient calling it with empty strings even ocsp request signing is off + if(!strcmp(pkcs12file, "")) + return ERR_OK; err = ReadCertificateByPKCS12(x509,pkcs12file,passwd,&pkey); - //AM 22.05.08 pKey should be freed + //AM 22.05.08 pKey should be freed + if(err == 0 && pkey) EVP_PKEY_free(pkey); RETURN_IF_NOT(err == ERR_OK, err); return ERR_OK; @@ -1101,37 +1102,41 @@ // signerCA - direct signer CA certs filename // szDateFile - name of the digidoc file // bUseCA - use CA certs or not 1/0 -// pPaths - file name / path pairs for detatched files -// nPaths - number of file name / path pairs // from original file and use it for hash function. // This is usefull if the file has been generated by // another library and possibly formats these elements // differently. //============================================================ -int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const char* szDataFile, FilePath* pPaths, int nPaths) +int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, const char* szDataFile) { - PCCERT_CONTEXT pCert = NULL; char buf2[100], *p1 = 0; X509* pCaCert = 0; int err = ERR_OK; StoreHandle hStore; + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; + buf2[0] = 0; if(!Digi_OpenStore(&hStore)) return ERR_CERT_STORE_READ; - p1 = ddocSigInfo_GetSignersCert_IssuerName(pSigInfo); + //p1 = ddocSigInfo_GetSignersCert_IssuerName(pSigInfo); + p1 = ddocSigInfo_GetSignersCert_IssuerNameAndHash(pSigInfo, &mbuf1); //strncpy(buf1, ddocSigInfo_GetSignersCert_IssuerName(pSigInfo), sizeof(buf1)); - if(p1) { - findCN((char*)p1, buf2); - pCert = Digi_FindCertBySubject(&hStore, buf2, TRUE, 0); + if(p1) + findCN((char*)p1, buf2, sizeof(buf2)); + pCaCert = Digi_FindCertBySubjectAndHash(&hStore, buf2, FALSE, 0, TRUE, &mbuf1); + if(!pCaCert) { + ddocDebug(1, "Digi_verifySignatureInfo", "ERR112 cert: %s", buf2); + //AM 02.03.09 teadmata olek kui leia CA serti + return ERR_UNKNOWN_CA; } - if(pCert != NULL) - ddocDecodeX509Data(&pCaCert,pCert->pbCertEncoded,pCert->cbCertEncoded); err = verifySignatureInfoCERT(pSigDoc, pSigInfo, pCaCert, - szDataFile, (pCaCert != NULL), pPaths, nPaths); + szDataFile, (pCaCert != NULL)); if(pCaCert) X509_free(pCaCert); Digi_CloseStore(&hStore); + ddocMemBuf_free(&mbuf1); return err; } @@ -1144,7 +1149,7 @@ // //============================================================ -int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile, FilePath* pPaths, int nPaths) +int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile) { SignatureInfo* pSigInfo; @@ -1156,7 +1161,7 @@ d = getCountOfSignatures(pSigDoc); for(i = 0; i < d; i++) { pSigInfo = getSignature(pSigDoc, i); - err = Digi_verifySignatureInfo(pSigDoc, pSigInfo, szDataFile, pPaths, nPaths); + err = Digi_verifySignatureInfo(pSigDoc, pSigInfo, szDataFile); RETURN_IF_NOT(err == ERR_OK, err); } d = getCountOfNotaryInfos(pSigDoc); @@ -1180,12 +1185,13 @@ int Digi_verifyNotaryInfoCERT(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo, const X509** caCerts, - const X509* notCert) + const X509* notCert, + const X509* pSigCA) { SignatureInfo* pSigInfo = NULL; pSigInfo = ddocGetSignatureForNotary(pSigDoc, pNotInfo); RETURN_IF_NOT(pSigInfo != NULL, ERR_NOTARY_NO_SIGNATURE); - return verifyNotaryInfoCERT(pSigDoc, pSigInfo, pNotInfo, caCerts, 0, notCert); + return verifyNotaryInfoCERT2(pSigDoc, pSigInfo, pNotInfo, caCerts, 0, notCert, pSigCA); } @@ -1207,20 +1213,22 @@ // Uses EstEID card as CSP to sign the info // pSigInfo - signature info object //============================================================ -EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer) +EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer, const char* szPin) { int err = ERR_OK, l1; PCCERT_CONTEXT pCert; - char buf1[50]; + char buf1[300]; unsigned long sigLen; int digLen, len=0; - char sigDig[100],signature[2084], *p1; + char sigDig[300],signature[2084], *p1; char *psKeyName = NULL; char *psCSPName = NULL; //long tmpSerial; //HCRYPTPROV hProvider; DWORD dwRes; X509 *pX509; + //AM 26.03.08 + X509* ppCA; DigiDocMemBuf *pMBuf1; ddocDebug(3, "calculateSigInfoSignatureWithCSPEstID", "Sign id: %s", pSigInfo->szId); @@ -1241,16 +1249,11 @@ psCSPName = DigiCrypt_FindContext_GetCSPName(); //AA100204 ddocDecodeX509Data(&pX509,pCert->pbCertEncoded,pCert->cbCertEncoded); - // 1) we add certificate to digidoc - // set signers cert err = setSignatureCert(pSigInfo, pX509); RETURN_IF_NOT(err == ERR_OK, err); - //AA-Viimase minuti jama createTimestamp(pSigDoc, sigDig, sizeof(sigDig)); setString(&(pSigInfo->szTimeStamp), sigDig, -1); - - // Signed properties digest // now calculate signed properties digest err = calculateSignedPropertiesDigest(pSigDoc, pSigInfo); @@ -1263,15 +1266,14 @@ l1 = sizeof(buf1); err = calculateSignedInfoDigest(pSigDoc, pSigInfo, (byte*)buf1, &l1); err = ddocSigInfo_SetSigInfoRealDigest(pSigInfo, buf1, l1); - sigLen = sizeof(signature); memset(signature, 0, sizeof(signature)); - p1 = createXMLSignedInfo(pSigDoc, pSigInfo); + p1 = createXMLSignedInfo(pSigDoc, pSigInfo); len = strlen(p1); // sign the hash with CSP digLen = sizeof(sigDig); - err = GetSignedHashWithKeyAndCSP(psKeyName,psCSPName, p1, len, NULL, NULL, sigDig, &digLen,&signature[0],&sigLen); + err = GetSignedHashWithKeyAndCSP(psKeyName,psCSPName, p1, len, NULL, NULL, sigDig, &digLen,&signature[0],&sigLen,szPin); if(p1) free(p1); RETURN_IF_NOT(err == ERR_OK, err); @@ -1523,7 +1525,7 @@ char* storeName; char buf[4000]; char buf1[4000]; - long tmpSerial; + long tmpSerial; int err; DigiDocMemBuf mbuf1; mbuf1.pMem = 0; @@ -1611,6 +1613,7 @@ len=sizeof(buf); memset(buf,0,len); memset(buf1,0,sizeof(buf1)); + //AM 26.09.08 //X509_NAME_oneline(x509name,buf,len); err = ddocCertGetIssuerDN(x509, &mbuf1); @@ -1642,6 +1645,7 @@ len=sizeof(buf); memset(buf,0,len); memset(buf1,0,sizeof(buf1)); + //AM 26.09.08 //X509_NAME_oneline(x509name,buf,len); err = ddocCertGetSubjectDN(x509, &mbuf1); @@ -1753,7 +1757,6 @@ DigiDocMemBuf mbuf1; mbuf1.pMem = 0; mbuf1.nLen = 0; - //--------------------------------- // TODO: it's just a test - remove it //--------------------------------- @@ -1855,6 +1858,7 @@ len=sizeof(buf); memset(buf,0,len); memset(buf1,0,sizeof(buf1)); + //AM 26.09.08 //X509_NAME_oneline(x509name,buf,len); err = ddocCertGetIssuerDN(x509, &mbuf1); @@ -1886,6 +1890,7 @@ len=sizeof(buf); memset(buf,0,len); memset(buf1,0,sizeof(buf1)); + //AM 26.09.08 //X509_NAME_oneline(x509name,buf,len); err = ddocCertGetSubjectDN(x509, &mbuf1); @@ -1909,6 +1914,7 @@ continue; } }//if(useSubDN){ + ddocMemBuf_free(&mbuf1); // did we find ? if(certFound){ break; @@ -2040,12 +2046,15 @@ // OUT hashLen - data length in output buffer // OUT hashedSignature - output data buffer for hashed and signed data // OUT sigLen - data length in output buffer +// IN szPin - PIN2 [optional] //===================================================================== int GetSignedHashWithKeyAndCSP( char *psKeyName, char *psCSPName, const char * dataToBeSigned,unsigned long dataLen, unsigned char *pbKeyBlob, unsigned long *pbKeyBlobLen, unsigned char *hash, unsigned long *hashLen, - unsigned char * hashedSignature,unsigned long * sigLen){ + unsigned char * hashedSignature,unsigned long * sigLen, + const char* szPin) +{ int retCode=ERR_OK, l1; HCRYPTPROV hProv = 0; HCRYPTHASH sha1 = 0; @@ -2055,7 +2064,7 @@ DWORD dwRes; char *p1 = 0; - ddocDebug(3, "GetSignedHashWithKeyAndCSP", "key: %s csp: %s", psKeyName, psCSPName); + ddocDebug(3, "GetSignedHashWithKeyAndCSP", "key: %s csp: %s, pin-len: %d", psKeyName, psCSPName, (szPin ? strlen(szPin) : 0)); // debug ddocDebug(3, "GetSignedHashWithKeyAndCSP", "data to sign: \'%s\' len: %d tlen: %d", dataToBeSigned, dataLen, strlen(dataToBeSigned)); //////******************** start task ************************************* @@ -2107,7 +2116,11 @@ //use by standard way is not allways possible -- AT_SIGNATURE -- main thing is that cert is ok nor the keyspec //instead of that we should use CryptAcquireCertificatePrivateKey function. But then we must change basic context of this function. //workaround -- we try with both keyspecs - + // set PIN2 for signing if possible + if(szPin && strlen(szPin)) { + fRes = CryptSetProvParam(hProv, PP_SIGNATURE_PIN, (const BYTE*)szPin, 0 ); + ddocDebug(3, "GetSignedHashWithKeyAndCSP", "PIN setting: %d", fRes); + } fRes=CryptSignHash(sha1,AT_SIGNATURE ,NULL,0, hashedSignature,sigLen); if(fRes==FALSE) { diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocCsp.h libdigidoc-3.7.0.875/libdigidoc/DigiDocCsp.h --- libdigidoc-2.7.0/libdigidoc/DigiDocCsp.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocCsp.h 2012-12-13 22:05:47.000000000 +0000 @@ -85,10 +85,12 @@ -EXP_OPTION int calculateSigInfoSignatureWithEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, - int slot, const char* passwd); +//EXP_OPTION int calculateSigInfoSignatureWithEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, +// int slot, const char* passwd); + + //Added parameter iByKeyContainer by A.Amenberg 06062003 -EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer); +EXP_OPTION int calculateSigInfoSignatureWithCSPEstID(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, int iByKeyContainer, const char* szPin); EXP_OPTION X509 * findIssuerCertificatefromMsStore(X509 *x509); @@ -118,11 +120,10 @@ // verifies this one signature EXP_OPTION int Digi_verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const char* szDataFile, FilePath* pPaths, int nPaths); + const char* szDataFile); // verifies the whole document (returns on first err) -EXP_OPTION int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile, - FilePath* pPaths, int nPaths); -EXP_OPTION int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile, FilePath* pPaths, int nPaths); +EXP_OPTION int Digi_verifySigDoc(const SignedDoc* pSigDoc, const char* szDataFile); +EXP_OPTION int Digi_verifySigDocWithCertSearch(const SignedDoc* pSigDoc, const char* szDataFile); #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocDefs.h libdigidoc-3.7.0.875/libdigidoc/DigiDocDefs.h --- libdigidoc-2.7.0/libdigidoc/DigiDocDefs.h 2010-08-29 19:38:23.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocDefs.h 2012-12-13 22:05:47.000000000 +0000 @@ -23,31 +23,25 @@ #ifdef WIN32 + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif #include -#endif -#ifdef WIN32 - //#define WITH_TS // not automatically defined on win32 - #ifdef BUILDINGDLL - #ifdef _MSC_VER - #pragma warning( disable: 4100 4706 4204 4221 ) - #endif + #define WIN32_CSP + #ifdef _MSC_VER + #pragma warning( disable: 4100 4706 4204 4221 ) + #endif + #ifdef digidoc_EXPORTS #define EXP_OPTION __declspec(dllexport) #else #define EXP_OPTION __declspec(dllimport) #endif #else - #define EXP_OPTION -#endif - -#ifndef WIN32 - #if HAVE_CONFIG_H - #include <../config.h> - #define DIGIDOC_VERSION VERSION + #if __GNUC__ >= 4 + #define EXP_OPTION __attribute__ ((visibility("default"))) + #else + #define EXP_OPTION #endif -#endif // no win32 -// for win32 -#ifndef DIGIDOC_VERSION - #define DIGIDOC_VERSION "2.6.0.17" #endif #ifdef WIN32 @@ -65,10 +59,11 @@ #define _unlink unlink #define _tzset tzset #define _getcwd getcwd - #if defined(__FreeBSD__) || defined(__APPLE__) + #if defined(__FreeBSD__) #define _timezone tzone extern long int tzone; /* default for Estonia, but see initDigiDocLib() */ #define _daylight daylight + extern int daylight; /* default, but see initDigiDocLib() */ #else #define _timezone timezone #define _daylight daylight @@ -76,6 +71,8 @@ #endif #define WITH_BASE64_HASHING_HACK 1 +// VS: disabled ecdsa support for FC13 building +//#define WITH_ECDSA 1 //#define WITH_DEPRECATED_FUNCTIONS @@ -87,16 +84,20 @@ typedef unsigned char byte; #endif +#define WITH_SHA256 //==========< Digest types >======================= - +#ifdef WITH_SHA256 +#define SIGNATURE_LEN 144 +#else #define SIGNATURE_LEN 128 +#endif #define DIGEST_LEN 20 #define DIGEST_SHA1 0 +#define DIGEST_SHA256 1 +#define DIGEST_LEN256 32 #define CERT_DATA_LEN 4096 #define X509_NAME_LEN 256 #define SIGNATURE_RSA 0 -#define CONTENT_HASHCODE "HASHCODE" -#define CONTENT_DETATCHED "DETATCHED" #define CONTENT_EMBEDDED "EMBEDDED" #define CONTENT_EMBEDDED_BASE64 "EMBEDDED_BASE64" #define X509_NAME_BUF_LEN 500 @@ -110,13 +111,14 @@ #define DIGIDOC_XML_1_1_VER "1.1" #define DIGIDOC_XML_1_2_VER "1.2" #define DIGIDOC_XML_1_3_VER "1.3" -#ifdef WITH_TS - #define DIGIDOC_XML_1_4_VER "1.4" -#endif #define SK_NOT_VERSION "OCSP-1.0" #define DIGEST_SHA1_NAME "sha1" +#define DIGEST_SHA256_NAME "sha256" #define SIGN_RSA_NAME "RSA" +#ifdef WITH_ECDSA + #define SIGN_ECDSA_NAME "ECDSA" +#endif #define OCSP_NONCE_NAME "OCSP Nonce" #define RESPID_NAME_VALUE "NAME" #define RESPID_KEY_VALUE "KEY HASH" @@ -125,11 +127,13 @@ #define RESPID_KEY_TYPE 2 #define DIGEST_METHOD_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1" +#define DIGEST_METHOD_SHA256 "http://www.w3.org/2001/04/xmlenc#sha256" #define NAMESPACE_XML_DSIG "http://www.w3.org/2000/09/xmldsig#" #define NAMESPACE_XADES_111 "http://uri.etsi.org/01903/v1.1.1#" #define NAMESPACE_XADES_132 "http://uri.etsi.org/01903/v1.3.2#" #define NAMESPACE_XADES "http://uri.etsi.org/01903#" + //==========< Format types >======================= #define CHARSET_ISO_8859_1 "ISO-8859-1" @@ -140,11 +144,7 @@ #define DDOC_LANG_ENGLISH 0 #define DDOC_LANG_ESTONIAN 1 #define DDOC_NUM_LANGUAGES 2 -#ifdef WITH_TS - #define SUPPORTED_VERSION_COUNT 5 -#else - #define SUPPORTED_VERSION_COUNT 4 -#endif +#define SUPPORTED_VERSION_COUNT 5 //==========< file formats >======================= @@ -174,4 +174,3 @@ #define FILE_BUFSIZE 1024*16 #endif // __DIGIDOC_DEFS_H__ - diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocDfExtract.c libdigidoc-3.7.0.875/libdigidoc/DigiDocDfExtract.c --- libdigidoc-2.7.0/libdigidoc/DigiDocDfExtract.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocDfExtract.c 2012-12-13 22:05:47.000000000 +0000 @@ -35,6 +35,7 @@ #ifdef WIN32 #define snprintf _snprintf + #include #endif #define ST_START 0 @@ -51,6 +52,7 @@ #define ST_DF_END 11 #define ST_DF_END_END 12 + //-------------------------------------------------- // Reads in signed XML document and extracts the desired data file // pSigDoc - signed document object if exists. Can be NULL @@ -64,13 +66,20 @@ const char* szCharset) { FILE *fIn = 0, *fOut = 0; - int err = ERR_OK, i, nRead, lt, la, lc, j, ld, lb, l, eState = 0; + int err = ERR_OK, i, nRead, lt, la, lc, j, ld, lb, l, eState = 0, fs = 0; long len, lExtr = 0, lSize = 0; - char chars[1050], convFileName[250], convDataFileName[250], - tag[100], attr[100], con[1030], dec[70], b64line[70]; + char chars[1050], tag[100], attr[100], con[1030], dec[70], b64line[70]; unsigned char b64 = 0, nNc = 0, bFound = 0; void *pBuf; EVP_ENCODE_CTX ectx; +#ifdef WIN32 + wchar_t *convFileName = 0, *convDataFileName = 0; i= 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "ddocExtractDataFile", "file: %s, conv-file: %s len: %d", szFileName, convFileName, i); + i= 0; + err = utf82unicode((const char*)szDataFileName, (char**)&convDataFileName, &i); + ddocDebug(3, "ddocExtractDataFile", "dfile: %s, conv-dfile: %s len: %d", szDataFileName, convDataFileName, i); +#endif RETURN_IF_NULL_PARAM(szFileName); RETURN_IF_NULL_PARAM(szDataFileName); @@ -78,28 +87,33 @@ RETURN_IF_NULL_PARAM(szCharset); clearErrors(); ddocDebug(3, "ddocExtractDataFile", "SigDoc: %s, docid: %s, digidoc: %s, file: %s, charset: %s", (pSigDoc ? "OK" : "NULL"), szDocId, szFileName, szDataFileName, szCharset); - memset(convFileName, 0, sizeof(convFileName)); - memset(convDataFileName, 0, sizeof(convDataFileName)); - ddocConvertFileName(convDataFileName, sizeof(convDataFileName), szDataFileName); - ddocConvertFileName(convFileName, sizeof(convFileName), szFileName); - if(szCharset && !strcmp(szCharset, "NO-CHANGE")) + if(szCharset && !strcmp(szCharset, "NO-CHANGE")) nNc = 1; // try reading from memory if already cached? nRead = ddocGetDataFileCachedData(pSigDoc, szDocId, &pBuf, &len); if(pBuf) { // gotcha ddocDebug(3, "ddocSaxExtractDataFile", "Using cached data: %d bytes", len); - if((fOut = fopen(convDataFileName, "wb")) != NULL) { +#ifdef WIN32 + if((fOut = _wfopen(convDataFileName, L"wb")) != NULL) { +#else + if((fOut = fopen(szDataFileName, "wb")) != NULL) { +#endif fwrite(pBuf, 1, len, fOut); fclose(fOut); } else { - ddocDebug(1, "ddocSaxExtractDataFile", "Error writing file: %s", convDataFileName); + ddocDebug(1, "ddocSaxExtractDataFile", "Error writing file: %s", szDataFileName); SET_LAST_ERROR_RETURN_CODE(ERR_FILE_WRITE); } free(pBuf); return nRead; } // open ddoc file - if((fIn = fopen(convFileName, "r")) != NULL) { +#ifdef WIN32 + if((fIn = _wfopen(convFileName, L"rb")) != NULL) { +#else + if((fIn = fopen(szFileName, "rb")) != NULL) { +#endif + ddocDebug(3, "ddocExtractDataFile", "Opened ddoc-file: %s", szFileName); do { nRead = fread(chars, 1, 1024, fIn); chars[nRead] = 0; @@ -123,8 +137,13 @@ break; case ST_TAG_NM: // read tag name if(isalnum(chars[i]) || chars[i] == ':' || chars[i] == '/') { + if(lt < sizeof(tag)-1) { tag[lt] = chars[i]; tag[++lt] = 0; + } else { + ddocDebug(1, "ddocSaxExtractDataFile", "Invalid xml tag-len > %d", sizeof(tag)); + SET_LAST_ERROR_RETURN_CODE(ERR_FILE_READ); + } } else if(chars[i] == '>') { // tag ended - content eState = ST_CON; } else { // expecting atributes @@ -150,20 +169,36 @@ break; case ST_ATTR_NM: if(isalnum(chars[i])) { + if(la < (int)sizeof(attr)-1) { attr[la] = chars[i]; attr[++la] = 0; + } + else + ddocDebug(1, "ddocExtractDataFile", "Truncating attr name: %s", attr); break; - } else if(chars[i] == '\"') { - eState = ST_ATTR_CON; + //19.11.08 added support for ' + } else if(chars[i] == '\"'/*|| chars[i] == '\''*/) { + eState = ST_ATTR_CON; + lc = 0; + con[lc] = 0; + fs = 2; + } else if(chars[i] == '\'' && fs==0) { + eState = ST_ATTR_CON; lc = 0; con[lc] = 0; + fs = 1; } else { eState = ST_ATTR_WS; } break; case ST_ATTR_WS: - if(chars[i] == '\"') { - eState = ST_ATTR_CON; + //19.11.08 added support for ' + if(chars[i] == '\"'/*|| chars[i] == '\''*/) { + eState = ST_ATTR_CON; + lc = 0; + con[lc] = 0; + } else if(chars[i] == '\'' && fs==1) { + eState = ST_ATTR_CON; lc = 0; con[lc] = 0; } else { @@ -171,13 +206,24 @@ } break; case ST_ATTR_CON: - if(chars[i] != '\"') { - con[lc] = chars[i]; + //19.11.08 added support for ' + if(chars[i] != '\"' /*&& chars[i] != '\''*/) { + if(lc < (int)sizeof(con)-1) { + con[lc] = chars[i]; con[++lc] = 0; + } else + ddocDebug(1, "ddocExtractDataFile", "Truncating attr content: %s", attr); + } else if(chars[i] == '\'' && fs==1) { + if(lc < (int)sizeof(con)-1) { + con[lc] = chars[i]; + con[++lc] = 0; + } else + ddocDebug(1, "ddocExtractDataFile", "Truncating attr content: %s", attr); } else { eState = ST_TAG_WS; // attribute value complete if(!strcmp(tag, "DataFile")) { + // ddocDebug(3, "ddocSaxExtractDataFile", "DataFile start, attr: %s", attr); if(!strcmp(attr, "ContentType")) { b64 = (!strcmp(con, "EMBEDDED_BASE64")) ? 1 : 0; lb = 0; @@ -187,12 +233,20 @@ lSize = atol(con); } if(!strcmp(attr, "Id")) { + ddocDebug(3, "ddocSaxExtractDataFile", "Found Id: %s searching id: %s", con, szDocId); if(!strcmp(con, szDocId)) { bFound = 1; - fOut = fopen(convDataFileName, "wb"); +#ifdef WIN32 + fOut = _wfopen(convDataFileName, L"wb"); + ddocDebug(3, "ddocSaxExtractDataFile", "Opening file: %s handle: %s", convDataFileName, (fOut ? "OK" : "NULL")); +#else + fOut = fopen(szDataFileName, "wb"); + ddocDebug(3, "ddocSaxExtractDataFile", "Opening file: %s handle: %s", szDataFileName, (fOut ? "OK" : "NULL")); +#endif if(!fOut) { SET_LAST_ERROR(ERR_FILE_WRITE); err = ERR_FILE_WRITE; + return err; } } } @@ -224,10 +278,10 @@ lt = 0; tag[lt] = 0; } else { - if(lc > sizeof(con) - 1) { + if(lc < (int)sizeof(con) - 1) { if(b64 && !nNc) { for(l = 0; l < lc; ) { - while(lb < 64 && l < lc) { + while(lb < 64 && l < lc && l < sizeof(con)) { if(con[l] != '\n' && con[l] != '\r') b64line[lb++] = con[l]; l++; @@ -250,23 +304,32 @@ } lc = 0; } - con[lc] = chars[i]; - con[++lc] = 0; + if(lc < sizeof(con)-1) { + con[lc] = chars[i]; + con[++lc] = 0; + } } break; case ST_DF_TAG: if(/*isalnum(chars[i]) || chars[i] == ':' || chars[i] == '/' ||*/ chars[i] != '>') { - tag[lt] = chars[i]; - tag[++lt] = 0; + if(lt < sizeof(tag)-1) { + tag[lt] = chars[i]; + tag[++lt] = 0; + } else { + ddocDebug(1, "ddocSaxExtractDataFile", "Invalid xml tag-len > %d", sizeof(tag)); + SET_LAST_ERROR_RETURN_CODE(ERR_FILE_READ); + } } else { // DF intenal tag name ready if(!strcmp(tag, "/DataFile")) { // end of DF eState = ST_DF_END; } else { // wrong tag - this is content + if(lc < sizeof(con)-1) { con[lc] = '<'; for(j = 0; j < lt; j++) con[++lc] = tag[j]; con[++lc] = '>'; con[++lc] = 0; + } eState = ST_DF_CON; } } @@ -303,19 +366,19 @@ lExtr += lc; fwrite(con, 1, lc, fOut); lc = 0; + } } i = sizeof(chars); - //AM 24.09.08 RIK - eState = ST_DF_END_END; + //AM 24.09.08 RIK + eState = ST_DF_END_END; break; } } //AM 24.09.08 RIK ST_DF_END to ST_DF_END_END_END } while(nRead > 0 && !err && eState < ST_DF_END_END); - } else { - ddocDebug(1, "ddocExtractDataFile", "Error reading file: %s", convFileName); + ddocDebug(1, "ddocExtractDataFile", "Error reading file: %s", szFileName); SET_LAST_ERROR(ERR_FILE_READ); } if(fIn) @@ -327,6 +390,15 @@ //SET_LAST_ERROR(ERR_FILE_READ); //err = ERR_FILE_READ; } - ddocDebug(3, "ddocExtractDataFile", "Extracted DF: %s to %s size: %ld expected: %ld", szDocId, convDataFileName, lExtr, lSize); - return err; + if(!bFound) { + ddocDebug(1, "ddocExtractDataFile", "DF: %s not found", szDocId); + SET_LAST_ERROR(ERR_FILE_WRITE); + err = ERR_FILE_WRITE; + } + ddocDebug(3, "ddocExtractDataFile", "Extracted DF: %s to %s size: %ld expected: %ld", szDocId, szDataFileName, lExtr, lSize); +#ifdef WIN32 + free(convFileName); + free(convDataFileName); +#endif + return err; } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEnc.c libdigidoc-3.7.0.875/libdigidoc/DigiDocEnc.c --- libdigidoc-2.7.0/libdigidoc/DigiDocEnc.c 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEnc.c 2012-12-13 22:05:47.000000000 +0000 @@ -182,6 +182,7 @@ return err; } + //======================< DEncEncryptedData - accessors >=================== @@ -605,7 +606,7 @@ pEncData->arrEncryptedKeys[i] = pEncData->arrEncryptedKeys[i+1]; pEncData->arrEncryptedKeys[pEncData->nEncryptedKeys - 1] = 0; - pEncData->nEncryptedKeys--; + pEncData->nEncryptedKeys--; return err; } @@ -847,7 +848,7 @@ RAND_bytes((unsigned char*)indata, sizeof(indata)); RAND_bytes((unsigned char*)pEncData->initVector, sizeof(pEncData->initVector)); #else - if(l1 = RAND_load_file("/dev/urandom", 1024)) { + if((l1 = RAND_load_file("/dev/urandom", 1024)) > 0) { ddocDebug(4, "dencEncryptedData_initTransportKey", "rand load: %d", l1); RAND_bytes((unsigned char*)salt, sizeof(salt)); RAND_bytes((unsigned char*)indata, sizeof(indata)); @@ -935,7 +936,8 @@ { int err = ERR_OK, nKeys, l1; DEncEncryptedKey **pKeys, *pKey; - char tkey[130]; + //AM 14.10.08 from 130 to 300 + char tkey[300]; ddocDebug(3, "dencEncryptedKey_new", "cert: %s, method: %s, id: %s, recipient: %s, keyname: %s carriedkeyname: %s", (pCert ? "OK" : "NULL"), szEncMethod, szId, szRecipient, szKeyName, szCarriedKeyName); @@ -964,8 +966,15 @@ err = ddocMemAssignString((char**)&(pKey->szEncryptionMethod), szEncMethod); if(err) return err; } - if(pCert) + if(pCert) { + if(!ddocCertCheckKeyUsage(pCert, KUIDX_KEY_ENCIPHERMENT)) { + ddocDebug(1, "dencEncryptedKey_new", "ENC: cert has no key-encipherment key usage"); + SET_LAST_ERROR(ERR_CERT_INVALID); + return ERR_CERT_INVALID; + } else + ddocDebug(3, "dencEncryptedKey_new", "ENC: cert has key-encipherment key usage"); pKey->pCert = pCert; + } // set optional parameters if(szId) { err = ddocMemAssignString((char**)&(pKey->szId), szId); @@ -993,6 +1002,9 @@ err = dencEncryptWithCert(pCert, (const char*)pEncData->mbufTransportKey.pMem, pEncData->mbufTransportKey.nLen, tkey, &l1); if(err) return err; + //if(pKey)dencEncryptedKey_/free(&pKey); + //pKey = (DEncEncryptedKey*)malloc(sizeof(DEncEncryptedKey)); + //memset(pKey, 0, sizeof(DEncEncryptedKey)); err = ddocMemAssignData(&(pKey->mbufTransportKey), tkey, l1); } return err; @@ -1197,34 +1209,99 @@ //-------------------------------------------------- EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS11(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey) { - int err = ERR_OK, i, n; - X509 *pCert = 0; - DEncEncryptedKey *pEncKey = 0; - char buf1[100], buf2[100]; + return dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot(pEncData, ppEncKey, 0); +} - RETURN_IF_NULL_PARAM(pEncData) - RETURN_IF_NULL_PARAM(ppEncKey) - *ppEncKey = 0; // mark as not found yet - err = findUsersCertificate(0, &pCert); - if(err) return err; - memset(buf1, 0, sizeof(buf1)); - err = ReadCertSerialNumber(buf1, sizeof(buf1), pCert); - if(err) return err; - n = dencEncryptedData_GetEncryptedKeyCount(pEncData); - for(i = 0; i < n; i++) { - pEncKey = dencEncryptedData_GetEncryptedKey(pEncData, i); - memset(buf2, 0, sizeof(buf2)); - err = ReadCertSerialNumber(buf2, sizeof(buf2), pEncKey->pCert); - if(!err && !strcmp(buf1, buf2)) { - *ppEncKey = pEncKey; - break; +//-------------------------------------------------- +// Locates the correct EncryptedKey object by reading +// users certificate from smartcard and searching the +// right EncryptedKey object +// pEncData - pointer to DEncEncryptedData object [REQUIRED] +// ppEncKey - address of a buffer for EncryptedKey pointer [REQUIRED] +// nSlot - slot nr +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey, int nSlot) +{ + int err = ERR_OK, i, n; + X509 *pCert = 0; + DEncEncryptedKey *pEncKey = 0; + char buf1[100], buf2[100]; + + RETURN_IF_NULL_PARAM(pEncData) + RETURN_IF_NULL_PARAM(ppEncKey) + *ppEncKey = 0; // mark as not found yet + err = findUsersCertificate(nSlot, &pCert); + if(err) return err; + memset(buf1, 0, sizeof(buf1)); + err = ReadCertSerialNumber(buf1, sizeof(buf1), pCert); + if(err) return err; + ddocDebug(3, "dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot", "Users cert: %s", buf1); + n = dencEncryptedData_GetEncryptedKeyCount(pEncData); + for(i = 0; i < n; i++) { + pEncKey = dencEncryptedData_GetEncryptedKey(pEncData, i); + memset(buf2, 0, sizeof(buf2)); + err = ReadCertSerialNumber(buf2, sizeof(buf2), pEncKey->pCert); + ddocDebug(3, "dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot", "Key: %d cert: %s", i, buf2); + if(!err && !strcmp(buf1, buf2)) { + *ppEncKey = pEncKey; + ddocDebug(3, "dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot", "Using key: %d cert: %s", i, buf2); + break; + } + } + if(pCert) + X509_free(pCert); + if(!*ppEncKey) { + ddocDebug(3, "dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot", "No matching key found!"); + SET_LAST_ERROR_RETURN(ERR_DENC_NO_KEY_FOUND, ERR_DENC_NO_KEY_FOUND) } - } - if(pCert) - X509_free(pCert); - if(!*ppEncKey) - SET_LAST_ERROR_RETURN(ERR_DENC_NO_KEY_FOUND, ERR_DENC_NO_KEY_FOUND) - return err; + return err; +} + +//-------------------------------------------------- +// Locates the correct EncryptedKey object by reading +// users certificate and private key from pkcs12 file and searching the +// right EncryptedKey object +// pEncData - pointer to DEncEncryptedData object [REQUIRED] +// ppEncKey - address of a buffer for EncryptedKey pointer [REQUIRED] +// ppKey - address of private key pointer. Caller must free [REQUIRED] +// szPkcs12File - pkcs12 file name [REQUIRED] +// szPasswd - pkcs12 file password [REQUIRED]. Might be empty? +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS12(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey, + EVP_PKEY** ppKey, const char* szPkcs12File, const char* szPasswd) +{ + int err = ERR_OK, i, n; + X509 *pCert = 0; + DEncEncryptedKey *pEncKey = 0; + char buf1[100], buf2[100]; + + RETURN_IF_NULL_PARAM(pEncData) + RETURN_IF_NULL_PARAM(ppEncKey) + RETURN_IF_NULL_PARAM(ppKey) + *ppEncKey = 0; // mark as not found yet + *ppKey = 0; + err = ReadCertificateByPKCS12(&pCert, szPkcs12File, szPasswd, ppKey); + if(err) return err; + memset(buf1, 0, sizeof(buf1)); + err = ReadCertSerialNumber(buf1, sizeof(buf1), pCert); + if(err) return err; + n = dencEncryptedData_GetEncryptedKeyCount(pEncData); + for(i = 0; i < n; i++) { + pEncKey = dencEncryptedData_GetEncryptedKey(pEncData, i); + memset(buf2, 0, sizeof(buf2)); + err = ReadCertSerialNumber(buf2, sizeof(buf2), pEncKey->pCert); + if(!err && !strcmp(buf1, buf2)) { + *ppEncKey = pEncKey; + break; + } + } + if(pCert) + X509_free(pCert); + if(!*ppEncKey) + SET_LAST_ERROR_RETURN(ERR_DENC_NO_KEY_FOUND, ERR_DENC_NO_KEY_FOUND) + return err; } @@ -1257,15 +1334,15 @@ // and remove this data from data to be decrypted if(operation == DECRYPT) { memcpy((char*)iv, (const char*)pInData->pMem, 16); - //for(i = 0; i < 16; i++) - // ddocDebug(3, "encryptDecrypt", "IV pos: %d = %d", i, iv[i]); - //nInLen -= 16; + for(i = 0; i < 16; i++) + ddocDebug(3, "encryptDecrypt", "IV pos: %d = %d", i, iv[i]); + nInLen -= 16; pInMem += 16; ddocDebug(3, "encryptDecrypt", "DECRYPT using iv input left: %d", nInLen); } lOrigLen = lEncLen = 0; len = nInLen % 16; - if(len && operation == ENCRYPT) { + if(operation == ENCRYPT) { len = 16 - (nInLen % 16); ddocDebug(3, "encryptDecrypt", "Input len: %d adding padding: %d\n", nInLen, len); memset(padBuf, 0, sizeof(padBuf)); @@ -1289,6 +1366,7 @@ memcpy(pOutData->pMem, iv, 16); EVP_CIPHER_CTX_init(&ectx); EVP_CipherInit_ex(&ectx, EVP_aes_128_cbc(), NULL, (const unsigned char*)pKey->pMem, (const unsigned char*)iv, operation); + //EVP_CIPHER_CTX_set_padding(&ectx, 1); //checkErrors(); lOrigLen += nInLen; i = nOutLen; @@ -1301,6 +1379,8 @@ lEncLen += i; pOutData->nLen += i; ddocDebug(3, "encryptDecrypt", "Initial update: %d into: %d -> %d", nInLen, nOutLen, i); + + //TODO: in 1.1 don't check len if(len && operation == ENCRYPT) { EVP_CipherUpdate(&ectx, (unsigned char*)pOutData->pMem + pOutData->nLen, &i, (const unsigned char*)padBuf, len); ddocDebug(3, "encryptDecrypt", "Padding update: %d -> %d", len, i); @@ -1317,43 +1397,22 @@ ddocDebug(3, "encryptDecrypt", "Total input: %d encrypted: %d", lOrigLen, lEncLen); EVP_CIPHER_CTX_cleanup(&ectx); if(operation == DECRYPT) { - // if the last 16 bytes are all 0x0F then remove this block - // and continue evaluationg padding - len = (int)(unsigned char)((char*)pOutData->pMem)[pOutData->nLen-1]; - if(len == 16) { - ddocDebug(3, "encryptDecrypt", "check padding: %d", len); - for(i = pOutData->nLen - 16; i < pOutData->nLen - 1; i++) { - //ddocDebug(3, "encryptDecrypt", "Byte at: %d = %d", i, ((char*)pOutData->pMem)[i]); - if(((char*)pOutData->pMem)[i] != 16) { - len = 0; // set not matched flag - //break; - } - } - if(len) { - ddocDebug(3, "encryptDecrypt", "Decrypted len: %d reduce by: %d", pOutData->nLen, len); - pOutData->nLen -= len; - } - else - ddocDebug(3, "encryptDecrypt", "Decrypted len remains: %d", pOutData->nLen); - } - // check PKCS7padding + // check ANSI X.923 padding len = (int)(unsigned char)((char*)pOutData->pMem)[pOutData->nLen-1]; - if(len > 0 && len < 16) { - ddocDebug(3, "encryptDecrypt", "check padding: %d", len); + if(len > 0 && len <= 16) { + ddocDebug(3, "encryptDecrypt", "X.923 check padding: %d", len); // check if all previous are 0-s for(i = pOutData->nLen - len; i < pOutData->nLen - 1; i++) { - ddocDebug(3, "encryptDecrypt", "Byte at: %d = %d", i, ((char*)pOutData->pMem)[i]); - if(((char*)pOutData->pMem)[i]) { - len = 0; // set not matched flag - //break; - } + ddocDebug(3, "encryptDecrypt", "Byte at: %d = %d", i, ((char*)pOutData->pMem)[i]); + if(((char*)pOutData->pMem)[i]) + len = 0; // set not matched flag } - if(len) { - ddocDebug(3, "encryptDecrypt", "Decrypted len: %d reduce by: %d", pOutData->nLen, len); - pOutData->nLen -= len; + if(len >= 1) { + ddocDebug(3, "encryptDecrypt", "X.923 decrypted len: %d reduce by: %d", pOutData->nLen, len); + pOutData->nLen -= len; } else - ddocDebug(3, "encryptDecrypt", "Decrypted len remains: %d", pOutData->nLen); + ddocDebug(3, "encryptDecrypt", "X.923 decrypted len remains: %d", pOutData->nLen); } else ddocDebug(3, "encryptDecrypt", "Impossible padding: %d", len); @@ -1458,45 +1517,118 @@ DEncEncryptedKey* pEncKey, const char* pin) { - int err = ERR_OK, nSlot, len; - DEncEncryptionProperty* pEncProp; - long l; - - RETURN_IF_NULL_PARAM(pEncData) - RETURN_IF_NULL_PARAM(pEncKey) - RETURN_IF_NULL_PARAM(pin) - // check data status - if(pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED && - pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) - SET_LAST_ERROR_RETURN(ERR_DENC_DATA_STATUS, ERR_DENC_DATA_STATUS) - pEncData->nKeyStatus = DENC_KEY_STATUS_UNINITIALIZED; - nSlot = ConfigItem_lookup_int("DIGIDOC_AUTH_KEY_SLOT", 0); - // it will shrink during decrypt so this is enough - pEncData->mbufTransportKey.nLen = pEncKey->mbufTransportKey.nLen; - pEncData->mbufTransportKey.pMem = (char*)malloc(pEncData->mbufTransportKey.nLen); - if(!pEncData->mbufTransportKey.pMem) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - ddocDebug(4, "dencEncryptedData_decrypt", "Decrypt enckey: %d into: %d", - pEncKey->mbufTransportKey.nLen, pEncData->mbufTransportKey.nLen); - // MSTERN - len = pEncData->mbufTransportKey.nLen; - err = decryptWithEstID(nSlot, pin, - (const char*)pEncKey->mbufTransportKey.pMem, pEncKey->mbufTransportKey.nLen, - (char*)pEncData->mbufTransportKey.pMem, &len); - pEncData->mbufTransportKey.nLen = len; - if(err) return err; - pEncData->nKeyStatus = DENC_KEY_STATUS_INITIALIZED; - err = dencEncryptedData_decryptData(pEncData); - pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_ORIG_SIZE); - if(pEncProp && pEncProp->szContent) { - l = atol(pEncProp->szContent); - if(l > 0 && l < pEncData->mbufEncryptedData.nLen) { - ddocDebug(4, "dencEncryptedData_decrypt", "Truncating decrypted data: %d to: %d", - pEncData->mbufEncryptedData.nLen, l); - pEncData->mbufEncryptedData.nLen = l; + int nSlot = nSlot = ConfigItem_lookup_int("DIGIDOC_AUTH_KEY_SLOT", 0); + return dencEncryptedData_decryptUsingSlot(pEncData, pEncKey, pin, nSlot); +} + +//-------------------------------------------------- +// Decrypts data transport key with ID card and +// then decrypts the data with the transport key. +// pEncData - pointer to DEncEncryptedData object [REQUIRED] +// pEncKey - transport key to decrypt [REQUIRED] +// pin - pin code for smart card [REQUIRED] +// nSlot - slot nr +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencEncryptedData_decryptUsingSlot(DEncEncryptedData* pEncData, + DEncEncryptedKey* pEncKey, + const char* pin, int nSlot) +{ + int err = ERR_OK, len; + DEncEncryptionProperty* pEncProp; + long l; + + RETURN_IF_NULL_PARAM(pEncData) + RETURN_IF_NULL_PARAM(pEncKey) + RETURN_IF_NULL_PARAM(pin) + // check data status + if(pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED && + pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) + SET_LAST_ERROR_RETURN(ERR_DENC_DATA_STATUS, ERR_DENC_DATA_STATUS) + pEncData->nKeyStatus = DENC_KEY_STATUS_UNINITIALIZED; + // it will shrink during decrypt so this is enough + pEncData->mbufTransportKey.nLen = pEncKey->mbufTransportKey.nLen; + pEncData->mbufTransportKey.pMem = (char*)malloc(pEncData->mbufTransportKey.nLen); + if(!pEncData->mbufTransportKey.pMem) + SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) + ddocDebug(3, "dencEncryptedData_decrypt", "Decrypt enckey: %d into: %d", + pEncKey->mbufTransportKey.nLen, pEncData->mbufTransportKey.nLen); + len = pEncData->mbufTransportKey.nLen; + err = decryptWithEstID(nSlot, pin, + (const char*)pEncKey->mbufTransportKey.pMem, pEncKey->mbufTransportKey.nLen, + (char*)pEncData->mbufTransportKey.pMem, &len); + pEncData->mbufTransportKey.nLen = len; + if(err) return err; + pEncData->nKeyStatus = DENC_KEY_STATUS_INITIALIZED; + err = dencEncryptedData_decryptData(pEncData); + pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_ORIG_SIZE); + if(pEncProp && pEncProp->szContent) { + l = atol(pEncProp->szContent); + if(l > 0 && l < pEncData->mbufEncryptedData.nLen) { + ddocDebug(4, "dencEncryptedData_decrypt", "Truncating decrypted data: %d to: %d", + pEncData->mbufEncryptedData.nLen, l); + pEncData->mbufEncryptedData.nLen = l; + } } - } - return err; + return err; +} + +//-------------------------------------------------- +// Decrypts data transport key with ID card and +// then decrypts the data with the transport key. +// pEncData - pointer to DEncEncryptedData object [REQUIRED] +// pEncKey - transport key to decrypt [REQUIRED] +// pKey - private key for decrypting [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencEncryptedData_decryptWithKey(DEncEncryptedData* pEncData, + DEncEncryptedKey* pEncKey, + EVP_PKEY* pKey) +{ + int err = ERR_OK, len; + DEncEncryptionProperty* pEncProp; + long l; + + RETURN_IF_NULL_PARAM(pEncData) + RETURN_IF_NULL_PARAM(pEncKey) + RETURN_IF_NULL_PARAM(pKey) + // check data status + if(pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED && + pEncData->nDataStatus != DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) + SET_LAST_ERROR_RETURN(ERR_DENC_DATA_STATUS, ERR_DENC_DATA_STATUS) + pEncData->nKeyStatus = DENC_KEY_STATUS_UNINITIALIZED; + // it will shrink during decrypt so this is enough + pEncData->mbufTransportKey.nLen = pEncKey->mbufTransportKey.nLen; + pEncData->mbufTransportKey.pMem = (char*)malloc(pEncData->mbufTransportKey.nLen); + if(!pEncData->mbufTransportKey.pMem) + SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) + ddocDebug(3, "dencEncryptedData_decryptWithKey", "Decrypt enckey: %d into: %d", + pEncKey->mbufTransportKey.nLen, pEncData->mbufTransportKey.nLen); +#if OPENSSL_VERSION_NUMBER > 0x10000000 + len = EVP_PKEY_decrypt_old((unsigned char *)pEncData->mbufTransportKey.pMem, + (const unsigned char*)pEncKey->mbufTransportKey.pMem, + pEncKey->mbufTransportKey.nLen, pKey); +#else + len = EVP_PKEY_decrypt((unsigned char *)pEncData->mbufTransportKey.pMem, + (const unsigned char*)pEncKey->mbufTransportKey.pMem, + pEncKey->mbufTransportKey.nLen, pKey); +#endif + ddocDebug(3, "dencEncryptedData_decryptWithKey", "Decrypt rv: %d len: %l", err, len); + pEncData->mbufTransportKey.nLen = len; + if(len != 16) return ERR_DENC_DECRYPT; + else err = ERR_OK; + pEncData->nKeyStatus = DENC_KEY_STATUS_INITIALIZED; + err = dencEncryptedData_decryptData(pEncData); + pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_ORIG_SIZE); + if(pEncProp && pEncProp->szContent) { + l = atol(pEncProp->szContent); + if(l > 0 && l < pEncData->mbufEncryptedData.nLen) { + ddocDebug(4, "dencEncryptedData_decrypt", "Truncating decrypted data: %d to: %d", + pEncData->mbufEncryptedData.nLen, l); + pEncData->mbufEncryptedData.nLen = l; + } + } + return err; } @@ -1564,7 +1696,7 @@ // check data status - cannot compress encrypted data!!! if(pEncData->nDataStatus != DENC_DATA_STATUS_UNENCRYPTED_AND_NOT_COMPRESSED) SET_LAST_ERROR_RETURN(ERR_DENC_DATA_STATUS, ERR_DENC_DATA_STATUS) - //AM 28.05.08 2048 instead of 1024, because some bigger files got -5 (Z_BUF_ERROR) + //AM 30.04.08 2048 instead of 1024 outData.nLen = pEncData->mbufEncryptedData.nLen + 2048; // it should get smaller outData.pMem = malloc(outData.nLen); if(!outData.pMem) @@ -1578,10 +1710,10 @@ SET_LAST_ERROR_RETURN(ERR_COMPRESS, ERR_COMPRESS) } if(!err && - (nCompressOption == DENC_COMPRESS_ALLWAYS) || + ((nCompressOption == DENC_COMPRESS_ALLWAYS) || (nCompressOption == DENC_COMPRESS_BEST_EFFORT && - outData.nLen < pEncData->mbufEncryptedData.nLen)) { - snprintf(buf, sizeof(buf), "%d", pEncData->mbufEncryptedData.nLen); + outData.nLen < pEncData->mbufEncryptedData.nLen))) { + snprintf(buf, sizeof(buf), "%d", (int)(pEncData->mbufEncryptedData.nLen)); err = dencEncryptionProperty_new(pEncData, &pEncProperty, NULL, NULL, ENCPROP_ORIG_SIZE, buf); free(pEncData->mbufEncryptedData.pMem); @@ -1633,7 +1765,7 @@ (const Bytef *)pEncData->mbufEncryptedData.pMem, (uLong)pEncData->mbufEncryptedData.nLen)); ddocDebug(3, "dencEncryptedData_decompressData", "Compressed len: %d, orig-len: %ld, uncompressed: %d, RC: %d", pEncData->mbufEncryptedData.nLen, origLen, outData.nLen, err); - if(err != Z_OK) { + if(err != Z_OK) { free(outData.pMem); SET_LAST_ERROR_RETURN(ERR_DECOMPRESS, ERR_DECOMPRESS) } @@ -1713,6 +1845,7 @@ EVP_CipherInit_ex(&ectx, EVP_aes_128_cbc(), NULL, (const unsigned char*)pEncData->mbufTransportKey.pMem, (const unsigned char*)pEncData->initVector, ENCRYPT); + //EVP_CIPHER_CTX_set_padding(&ectx, 1); lOrigLen = 0; lEncSize = 0; lWritten = 0; @@ -2206,13 +2339,18 @@ // pEncData - EncryptedData object [REQUIRED] // szOrigContentId - Id atribute for new Property object [OPTIONAL] // szName - buffer for original file name [REQUIRED] +// nNameLen - buffer length of szName [REQUIRED] // szSize - buffer for size as string or irginal file [REQUIRED] +// nSizeLen - buffer length of szSize [REQUIRED] // szMime - buffer for mime type or original file [REQUIRED] +// nMimeLen - buffer length of szMime [REQUIRED] // szDfId - buffer for Id atribute of original file [REQUIRED] +// nDfIdLen - buffer length of szDfId [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- EXP_OPTION int dencOrigContent_findByIndex(DEncEncryptedData* pEncData, int origContIdx, - char* szName, char* szSize, char* szMime, char* szDfId) + char* szName, int nNameLen, char* szSize, int nSizeLen, + char* szMime, int nMimeLen, char* szDfId, int nDfIdLen) { int nCount = -1, i, n, j, k, l, m; DEncEncryptionProperty* pEncProp = 0; @@ -2223,7 +2361,10 @@ RETURN_IF_NULL_PARAM(szSize); RETURN_IF_NULL_PARAM(szMime); RETURN_IF_NULL_PARAM(szDfId); - szName[0] = szSize[0] = szMime[0] = szDfId[0] = 0; + memset(szName, 0, nNameLen); + memset(szSize, 0, nSizeLen); + memset(szMime, 0, nMimeLen); + memset(szDfId, 0, nDfIdLen); n = dencEncryptedData_GetEncryptionPropertiesCount(pEncData); for(i = 0; i < n; i++) { pEncProp = (DEncEncryptionProperty*)dencEncryptedData_GetEncryptionProperty(pEncData, i); @@ -2237,22 +2378,16 @@ ddocDebug(4, "dencOrigContent_findByIndex", "Prop: %d, count: %d, content: %s", i, nCount, p1); if(p1) { k = strlen(p1); - for(j = l = m = 0; j < k; j++) { + for(j = l = m = 0; j < k; j++) { if(p1[j] == '|') { - switch(m) { - case 0: szName[l] = 0; break; - case 1: szSize[l] = 0; break; - case 2: szMime[l] = 0; break; - case 3: szDfId[l] = 0; break; - } - l = 0; - m++; + l = 0; + m++; } else { switch(m) { - case 0: szName[l] = p1[j]; l++; break; - case 1: szSize[l] = p1[j]; l++; break; - case 2: szMime[l] = p1[j]; l++; break; - case 3: szDfId[l] = p1[j]; l++; break; + case 0: if(l < nNameLen) szName[l] = p1[j]; l++; break; + case 1: if(l < nSizeLen) szSize[l] = p1[j]; l++; break; + case 2: if(l < nMimeLen) szMime[l] = p1[j]; l++; break; + case 3: if(l < nDfIdLen) szDfId[l] = p1[j]; l++; break; } } } @@ -2261,6 +2396,24 @@ } } } + if(!szName[0] && !szSize[0]) { // if not property name="orig_files" was not found then use Filename and OriginalSize + for(i = 0; i < n; i++) { + pEncProp = (DEncEncryptionProperty*)dencEncryptedData_GetEncryptionProperty(pEncData, i); + if(pEncProp) { + p1 = (char*)dencEncryptionProperty_GetName(pEncProp); + if(p1 && !strcmp(p1, ENCPROP_FILENAME)) { + p1 = (char*)dencEncryptionProperty_GetContent(pEncProp); + if(p1) + strncpy(szName, p1, nNameLen); + } + if(p1 && !strcmp(p1, ENCPROP_ORIG_SIZE)) { + p1 = (char*)dencEncryptionProperty_GetContent(pEncProp); + if(p1) + strncpy(szSize, p1, nSizeLen); + } + } + } + } return ERR_OK; } @@ -2313,18 +2466,19 @@ int err = ERR_OK, i, n; DEncEncryptionProperty* pEncProp = 0; DataFile* pDf; - char buf[500]; + char buf[500], *sVer; RETURN_IF_NULL_PARAM(pEncData); RETURN_IF_NULL_PARAM(pSigDoc); // set the mime type + sVer = (char*)ConfigItem_lookup_str("DENC_VERSION", DENC_VERSION_1_1); err = dencEncryptedData_SetMimeType(pEncData, DENC_ENCDATA_TYPE_DDOC); n = getCountOfDataFiles(pSigDoc); for(i = 0; i < n; i++) { pDf = getDataFile(pSigDoc, i); if(pDf) { pEncProp = 0; - snprintf(buf, sizeof(buf), "%s|%ld|%s|%s", pDf->szFileName, pDf->nSize, pDf->szMimeType, pDf->szId); + snprintf(buf, sizeof(buf), "%s|%ld|%s|%s", getSimpleFileName(pDf->szFileName), pDf->nSize, pDf->szMimeType, pDf->szId); err = dencEncryptionProperty_new(pEncData, &pEncProp, NULL, NULL, ENCPROP_ORIG_CONTENT, buf); } @@ -2371,7 +2525,7 @@ RETURN_IF_NULL_PARAM(pEncData); // set the library name and version - snprintf(buf, sizeof(buf), "%s|%s", DENC_FORMAT_ENCDOC_XML, DENC_VERSION_1_0); + snprintf(buf, sizeof(buf), "%s|%s", DENC_FORMAT_ENCDOC_XML, ConfigItem_lookup_str("DENC_VERSION", DENC_VERSION_1_1)); pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_DOC_FORMAT); if(pEncProp) { // property exists, set the content err = dencEncryptionProperty_SetContent(pEncProp, (const char*)buf); @@ -2387,9 +2541,13 @@ //-------------------------------------------------- // Returns the library name and version meta-info of this document // pEncData - EncryptedData object [REQUIRED] +// szLibrary - buffer for library name +// nLibLen - length of library name buffer +// szVersion - buffer for version info +// nVerLen - length of version info buffer // returns count or -1 for error. //-------------------------------------------------- -EXP_OPTION int dencMetaInfo_GetLibVersion(DEncEncryptedData* pEncData, char* szLibrary, char* szVersion) +EXP_OPTION int dencMetaInfo_GetLibVersion(DEncEncryptedData* pEncData, char* szLibrary, int nLibLen, char* szVersion, int nVerLen) { int err = ERR_OK, i, j, n; DEncEncryptionProperty* pEncProp = 0; @@ -2399,25 +2557,28 @@ RETURN_IF_NULL_PARAM(szLibrary); RETURN_IF_NULL_PARAM(szVersion); // mark as not found - szLibrary[0] = szVersion[0] = 0; + memset(szLibrary, 0, nLibLen); + memset(szVersion, 0, nVerLen); pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_LIB_VERSION); if(pEncProp) { // property exists, set the content p1 = (char*)dencEncryptionProperty_GetContent(pEncProp); if(p1) { for(i = j = n = 0; p1[i]; i++) { - if(p1[i] == '|') { + if(p1[i] == '|' && j < nLibLen - 1) { szLibrary[j] = 0; j = 0; n++; continue; } else { - if(!n) + if(!n) { + if(j < nLibLen - 1) szLibrary[j++] = p1[i]; - else + } else { + if(j < nVerLen - 1) szVersion[j++] = p1[i]; + } } } - szVersion[j] = 0; } } return err; } @@ -2428,7 +2589,7 @@ // pEncData - EncryptedData object [REQUIRED] // returns count or -1 for error. //-------------------------------------------------- -EXP_OPTION int dencMetaInfo_GetFormatVersion(DEncEncryptedData* pEncData, char* szFormat, char* szVersion) +EXP_OPTION int dencMetaInfo_GetFormatVersion(DEncEncryptedData* pEncData, char* szFormat, int nFormat, char* szVersion, int nVersion) { int err = ERR_OK, i, j, n; DEncEncryptionProperty* pEncProp = 0; @@ -2438,25 +2599,28 @@ RETURN_IF_NULL_PARAM(szFormat); RETURN_IF_NULL_PARAM(szVersion); // mark as not found - szFormat[0] = szVersion[0] = 0; + memset(szFormat, 0, nFormat); + memset(szVersion, 0, nVersion); pEncProp = dencEncryptedData_FindEncryptionPropertyByName(pEncData, ENCPROP_DOC_FORMAT); if(pEncProp) { // property exists, set the content p1 = (char*)dencEncryptionProperty_GetContent(pEncProp); if(p1) { for(i = j = n = 0; p1[i]; i++) { - if(p1[i] == '|') { + if(p1[i] == '|' && j < nFormat - 1) { szFormat[j] = 0; j = 0; n++; continue; } else { - if(!n) + if(!n) { + if(j < nFormat - 1) szFormat[j++] = p1[i]; - else + } else { + if(j < nVersion - 1) szVersion[j++] = p1[i]; + } } } - szVersion[j] = 0; } } return err; } @@ -2498,3 +2662,85 @@ return err; } + +//-------------------------------------------------- +// Validates cdoc structure +// pEncData - EncryptedData object [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencValidate(DEncEncryptedData* pEncData) +{ + int err = ERR_OK, i; + char* p1 = 0; + char errbuf[300]; + X509* pCert = 0; + + if(!pEncData) { + printf("\nERROR: 164 Invalid format. No found!"); + SET_LAST_ERROR_RETURN_CODE(ERR_VALIDATE); + } + // xmlns + p1 = (char*)dencEncryptedData_GetXmlNs(pEncData); + if(!p1 || strcmp(p1, DENC_XMLNS_XMLENC)) { + printf("\nERROR: 164 Invalid xmlns attribute: %s. xmlns attribute is required atribute and only valid value is: %s\n", (p1 ? p1 : ""), DENC_XMLNS_XMLENC); + err = ERR_VALIDATE; + } + // + p1 = (char*)dencEncryptedData_GetEncryptionMethod(pEncData); + if(!p1 || strcmp(p1, DENC_ENC_METHOD_AES128)) { + printf("\nERROR: 164 Invalid EncryptedData encryption method: %s. Encryption method is required atribute and only valid value is: %s\n", (p1 ? p1 : ""), DENC_ENC_METHOD_AES128); + err = ERR_VALIDATE; + } + // encrypted data itself + if(!pEncData->mbufEncryptedData.pMem || !pEncData->mbufEncryptedData.nLen) { + printf("\nERROR: 164 empty cdoc! This element has no encrypted data!\n"); + err = ERR_VALIDATE; + } + // encryption properties + for(i = 0; i < dencEncryptedData_GetEncryptionPropertiesCount(pEncData); i++) { + DEncEncryptionProperty* pEncProp = dencEncryptedData_GetEncryptionProperty(pEncData, i); + if(pEncProp) { + p1 = (char*)dencEncryptionProperty_GetName(pEncProp); + if(!p1 || !strlen(p1)) { + printf("\nERROR: 164 Invalid encryption property: %d. Encryption property name attribute is required and may not be empty!\n", i); + err = ERR_VALIDATE; + } + p1 = (char*)dencEncryptionProperty_GetContent(pEncProp); + if(!p1 || !strlen(p1)) { + printf("\nERROR: 164 Invalid encryption property: %d. Encryption property content may not be empty!\n", i); + err = ERR_VALIDATE; + } + } + } + if(!dencEncryptedData_GetEncryptedKeyCount(pEncData)) { + printf("\nERROR: 164 Invalid cdoc. This cdoc has no EncryptedKey elements!\n"); + err = ERR_VALIDATE; + } + // encrypted keys + for(i = 0; i < dencEncryptedData_GetEncryptedKeyCount(pEncData); i++) { + DEncEncryptedKey* pEncKey = dencEncryptedData_GetEncryptedKey(pEncData, i); + // encryption method + p1 = (char*)dencEncryptedKey_GetEncryptionMethod(pEncKey); + if(!p1 || strcmp(p1, DENC_ENC_METHOD_RSA1_5)) { + printf("\nERROR: 164 Invalid EncryptedKey encryption method: %s. Encryption method is required atribute and only valid value is: %s\n", (p1 ? p1 : ""), DENC_ENC_METHOD_RSA1_5); + err = ERR_VALIDATE; + } + // recipients cert + pCert = dencEncryptedKey_GetCertificate(pEncKey); + if(!pCert) { + printf("\nERROR: 164 Invalid encrypted key: %d. Recipients certificate is required!\n", i); + err = ERR_VALIDATE; + } else { + if(!ddocCertCheckKeyUsage(pCert, KUIDX_DATA_ENCIPHERMENT)) { + printf("\nERROR: 164 RecipientsCertificate is not suitable for encryption - keyEncipherment flag not set!\n"); + err = ERR_VALIDATE; + } + } + } + + // xmlns + if(err) + SET_LAST_ERROR(err); + return err; +} + diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEnc.h libdigidoc-3.7.0.875/libdigidoc/DigiDocEnc.h --- libdigidoc-2.7.0/libdigidoc/DigiDocEnc.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEnc.h 2012-12-13 22:05:47.000000000 +0000 @@ -110,6 +110,7 @@ #define DENC_FORMAT_ENCDOC_XML "ENCDOC-XML" #define DENC_VERSION_1_0 "1.0" +#define DENC_VERSION_1_1 "1.1" #define DENC_COMPRESS_ALLWAYS 0 #define DENC_COMPRESS_NEVER 1 @@ -159,6 +160,14 @@ // returns error code or ERR_OK //-------------------------------------------------- EXP_OPTION int dencEncryptedData_free(DEncEncryptedData* pEncData); + + //-------------------------------------------------- + // Checks if this cdoc has embedded ddoc + // pEncData - address of object to be deleted [REQUIRED] + // returns 1 if true + //-------------------------------------------------- + EXP_OPTION int dencEncryptedData_IsDdoc(DEncEncryptedData* pEncData); + //======================< DEncEncryptedData - accessors >=================== @@ -578,7 +587,7 @@ //-------------------------------------------------- EXP_OPTION int dencEncryptedKey_SetCertificate(DEncEncryptedKey* pEncKey, X509* value); -//==========< general crypto fucntions >============ +//==========< general crypto functions >============ //-------------------------------------------------- // Locates the correct EncryptedKey object by reading @@ -591,6 +600,31 @@ EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS11(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey); //-------------------------------------------------- + // Locates the correct EncryptedKey object by reading + // users certificate from smartcard and searching the + // right EncryptedKey object + // pEncData - pointer to DEncEncryptedData object [REQUIRED] + // ppEncKey - address of a buffer for EncryptedKey pointer [REQUIRED] + // nSlot - slot nr + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey, int nSlot); + + //-------------------------------------------------- + // Locates the correct EncryptedKey object by reading + // users certificate and private key from pkcs12 file and searching the + // right EncryptedKey object + // pEncData - pointer to DEncEncryptedData object [REQUIRED] + // ppEncKey - address of a buffer for EncryptedKey pointer [REQUIRED] + // ppKey - address of private key pointer. Caller must free [REQUIRED] + // szPkcs12File - pkcs12 file name [REQUIRED] + // szPasswd - pkcs12 file password [REQUIRED]. Might be empty? + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencEncryptedData_findEncryptedKeyByPKCS12(DEncEncryptedData* pEncData, DEncEncryptedKey** ppEncKey, + EVP_PKEY** ppKey, const char* szPkcs12File, const char* szPasswd); + + //-------------------------------------------------- // Encrypts data with the generated key // pEncData - pointer to DEncEncryptedData object [REQUIRED] // nCompressOption - flag: DENC_COMPRESS_ALLWAYS, @@ -628,8 +662,32 @@ EXP_OPTION int dencEncryptedData_decrypt(DEncEncryptedData* pEncData, DEncEncryptedKey* pEncKey, const char* pin); + //-------------------------------------------------- + // Decrypts data transport key with ID card and + // then decrypts the data with the transport key. + // pEncData - pointer to DEncEncryptedData object [REQUIRED] + // pEncKey - transport key to decrypt [REQUIRED] + // pin - pin code for smart card [REQUIRED] + // nSlot - slot nr + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencEncryptedData_decryptUsingSlot(DEncEncryptedData* pEncData, + DEncEncryptedKey* pEncKey, + const char* pin, int nSlot); //-------------------------------------------------- + // Decrypts data transport key with ID card and + // then decrypts the data with the transport key. + // pEncData - pointer to DEncEncryptedData object [REQUIRED] + // pEncKey - transport key to decrypt [REQUIRED] + // pKey - private key for decrypting [REQUIRED] + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencEncryptedData_decryptWithKey(DEncEncryptedData* pEncData, + DEncEncryptedKey* pEncKey, + EVP_PKEY* pKey); + + //-------------------------------------------------- // Compresses data with ZLIB. Cannot compress encrypted data!!! // pEncData - pointer to DEncEncryptedData object [REQUIRED] // nCompressOption - flag: DENC_COMPRESS_ALLWAYS, @@ -772,13 +830,18 @@ // pEncData - EncryptedData object [REQUIRED] // szOrigContentId - Id atribute for new Property object [OPTIONAL] // szName - buffer for original file name [REQUIRED] + // nNameLen - buffer length of szName [REQUIRED] // szSize - buffer for size as string or irginal file [REQUIRED] + // nSizeLen - buffer length of szSize [REQUIRED] // szMime - buffer for mime type or original file [REQUIRED] + // nMimeLen - buffer length of szMime [REQUIRED] // szDfId - buffer for Id atribute of original file [REQUIRED] + // nDfIdLen - buffer length of szDfId [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- EXP_OPTION int dencOrigContent_findByIndex(DEncEncryptedData* pEncData, int origContIdx, - char* szName, char* szSize, char* szMime, char* szDfId); + char* szName, int nNameLen, char* szSize, int nSizeLen, + char* szMime, int nMimeLen, char* szDfId, int nDfIdLen); //-------------------------------------------------- // Checks if there is a digidoc document in this @@ -816,16 +879,20 @@ //-------------------------------------------------- // Returns the library name and version meta-info of this document // pEncData - EncryptedData object [REQUIRED] + // szLibrary - buffer for library name + // nLibLen - length of library name buffer + // szVersion - buffer for version info + // nVerLen - length of version info buffer // returns count or -1 for error. //-------------------------------------------------- - EXP_OPTION int dencMetaInfo_GetLibVersion(DEncEncryptedData* pEncData, char* szLibrary, char* szVersion); + EXP_OPTION int dencMetaInfo_GetLibVersion(DEncEncryptedData* pEncData, char* szLibrary, int nLibLen, char* szVersion, int nVerLen); //-------------------------------------------------- // Returns the format name and version meta-info of this document // pEncData - EncryptedData object [REQUIRED] // returns count or -1 for error. //-------------------------------------------------- - EXP_OPTION int dencMetaInfo_GetFormatVersion(DEncEncryptedData* pEncData, char* szFormat, char* szVersion); + EXP_OPTION int dencMetaInfo_GetFormatVersion(DEncEncryptedData* pEncData, char* szFormat, int nFormatLen, char* szVersion, int nVerLen); //-------------------------------------------------- // Deletes the meta-info properties @@ -834,6 +901,12 @@ //-------------------------------------------------- EXP_OPTION int dencMetaInfo_deleteVersionInfo(DEncEncryptedData* pEncData); + //-------------------------------------------------- + // Validates cdoc structure + // pEncData - EncryptedData object [REQUIRED] + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencValidate(DEncEncryptedData* pEncData); #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEncGen.c libdigidoc-3.7.0.875/libdigidoc/DigiDocEncGen.c --- libdigidoc-2.7.0/libdigidoc/DigiDocEncGen.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEncGen.c 2012-12-13 22:05:47.000000000 +0000 @@ -31,6 +31,9 @@ #include #include +#ifdef WIN32 + #include +#endif //-----------< XML generation functions >---------------------------- @@ -43,7 +46,7 @@ int dencGenEncryptionProperty_toXML(DEncEncryptionProperty* pEncProperty, DigiDocMemBuf* pBuf) { int err = ERR_OK; - char* p; + char* p = 0, *p1 = 0; RETURN_IF_NULL_PARAM(pBuf) RETURN_IF_NULL_PARAM(pEncProperty) @@ -70,8 +73,11 @@ if(err) return err; // content p = (char*)dencEncryptionProperty_GetContent(pEncProperty); - if(p) - err = ddocMemAppendData(pBuf, p, -1); + if(p) { + escapeXMLSymbols(p, -1, &p1); + err = ddocMemAppendData(pBuf, p1, -1); + free(p1); + } if(err) return err; err = ddocGen_endElem(pBuf, "denc:EncryptionProperty"); return err; @@ -245,7 +251,7 @@ // pBuf - memory buffer for storing xml [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- -int dencGenEncryptedData_toXML(DEncEncryptedData* pEncData, DigiDocMemBuf* pBuf) +EXP_OPTION int dencGenEncryptedData_toXML(DEncEncryptedData* pEncData, DigiDocMemBuf* pBuf) { int err = ERR_OK, l1; char* p; @@ -363,7 +369,15 @@ int err = ERR_OK; DigiDocMemBuf mbufEncData; FILE* hFile; - char convFileName[250]; +#ifdef WIN32 + wchar_t *convFileName = 0; + int i= 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "ddocGenEncryptedData_writeToFile", "file: %s, conv-file: %s len: %d", szFileName, convFileName, i); +#else + char convFileName[1024]; + ddocConvertFileName( convFileName, sizeof(convFileName), szFileName ); +#endif ddocDebug(3, "dencGenEncryptedData_writeToFile", "filename: %s", szFileName); RETURN_IF_NULL_PARAM(pEncData) @@ -371,10 +385,12 @@ // start of element mbufEncData.pMem = 0; mbufEncData.nLen = 0; - // handle file names, input is UTF-8 - ddocConvertFileName( convFileName, sizeof(convFileName), szFileName ); err = dencGenEncryptedData_toXML(pEncData, &mbufEncData); +#ifdef WIN32 + if(!err && (hFile = _wfopen(convFileName, L"wb")) != NULL) { +#else if(!err && (hFile = fopen(convFileName, "wb")) != NULL) { +#endif fwrite(mbufEncData.pMem, mbufEncData.nLen, 1, hFile); fclose(hFile); } else { diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEncGen.h libdigidoc-3.7.0.875/libdigidoc/DigiDocEncGen.h --- libdigidoc-2.7.0/libdigidoc/DigiDocEncGen.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEncGen.h 2012-12-13 22:05:47.000000000 +0000 @@ -36,7 +36,7 @@ // pBuf - memory buffer for storing xml [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- - int dencGenEncryptedData_toXML(DEncEncryptedData* pEncData, DigiDocMemBuf* pBuf); + EXP_OPTION int dencGenEncryptedData_toXML(DEncEncryptedData* pEncData, DigiDocMemBuf* pBuf); //-------------------------------------------------- // Writes encrypted data to a file diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEncSAXParser.c libdigidoc-3.7.0.875/libdigidoc/DigiDocEncSAXParser.c --- libdigidoc-2.7.0/libdigidoc/DigiDocEncSAXParser.c 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEncSAXParser.c 2012-12-13 22:05:47.000000000 +0000 @@ -20,6 +20,10 @@ // Creation //================================================== +#ifdef WIN32 +#include +#endif + #include #include #include @@ -264,7 +268,7 @@ pctx->pEncData->mbufEncryptedData.nLen = l; ddocDebug(4, "dencSaxHandleEndCipherValue", "Set encrypted data: %d bytes", l); if(pctx->pEncData->szMimeType && - !strcmp(pctx->pEncData->szMimeType, DENC_ENCDATA_MIME_ZLIB)) + (!strcmp(pctx->pEncData->szMimeType, DENC_ENCDATA_MIME_ZLIB))) pctx->pEncData->nDataStatus = DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED; else pctx->pEncData->nDataStatus = DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED; @@ -562,24 +566,39 @@ { FILE *f; int ret; - char chars[1025], convFileName[250]; + char chars[1025]; xmlParserCtxtPtr ctxt; DEncParse pctx; +#ifdef WIN32 + wchar_t *convFileName = 0; + int i= 0; +#endif RETURN_IF_NULL_PARAM(szFileName) RETURN_IF_NULL_PARAM(ppEncData) clearErrors(); *ppEncData = 0; // mark as not read yet - ddocDebug(3, "dencSaxReadEncryptedData", "file: %s", szFileName); memset(&pctx, 0, sizeof(pctx)); - ddocConvertFileName(convFileName, sizeof(convFileName), szFileName ); - if((f = fopen(convFileName, "r")) != NULL) { + //ddocConvertFileName(chars, sizeof(chars), szFileName ); + ddocDebug(3, "dencSaxReadEncryptedData", "Opening file: %s", szFileName); +#ifdef WIN32 + i = 0; + ret = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "dencSaxReadEncryptedData", "file: %s, conv-file: %s len: %d, rc: %d", szFileName, convFileName, i, ret); + if((f = _wfopen(convFileName, L"rb")) != NULL) { + ddocDebug(3, "dencSaxReadEncryptedData", "Opened w-file: %s", convFileName); +#else + if((f = fopen(szFileName, "rb")) != NULL) { + ddocDebug(3, "dencSaxReadEncryptedData", "Opened file: %s", szFileName); +#endif ret = fread(chars, 1, 1024, f); if (ret > 0) { + ddocDebug(3, "dencSaxReadEncryptedData", "Read first %d bytes", ret); ctxt = xmlCreatePushParserCtxt(dencSAXHandler, &pctx, chars, ret, szFileName); while ((ret = fread(chars, 1, 1024, f)) > 0) { - xmlParseChunk(ctxt, chars, ret, 0); + ddocDebug(3, "dencSaxReadEncryptedData", "Parsing %d bytes", ret); + xmlParseChunk(ctxt, chars, ret, 0); } xmlParseChunk(ctxt, chars, 0, 1); xmlFreeParserCtxt(ctxt); @@ -599,6 +618,35 @@ return ret; } +//-------------------------------------------------- +// Reads in encrypted XML document. +// ppEncData - address for new encrypted data object [REQUIRED] +// pData - input data [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int dencSaxReadEncryptedDataFromMemory(DEncEncryptedData** ppEncData, DigiDocMemBuf* pData) +{ + int ret; + DEncParse pctx; + + RETURN_IF_NULL_PARAM(pData) + RETURN_IF_NULL_PARAM(ppEncData) + clearErrors(); + *ppEncData = 0; // mark as not read yet + memset(&pctx, 0, sizeof(pctx)); + ddocDebug(3, "dencSaxReadEncryptedData", "Reading from mem %d bytes", pData->nLen); + ret = xmlSAXUserParseMemory(dencSAXHandler, &pctx, (const char*)pData->pMem, pData->nLen); + // cleanup stack + ret = pctx.errcode = ddocStackPopElement(&(pctx.dencStack), 1, NULL); + ddocDebug(3, "dencSaxReadEncryptedData", "End parsing mem: %d - RC: %d", pData->nLen, ret); + if(ret == 0) + *ppEncData = pctx.pEncData; + // cleanup + dencSaxCleanup(&pctx); + return ret; +} + + //===============< Large file decryption SAX handlers >============================== /* @@ -611,6 +659,7 @@ DigiDocMemBuf mbufTransportKey; DigiDocMemBuf mbufTemp; X509* pCert; + EVP_PKEY* pkey; char* szPin; int nSlot; long lB64Len, lBinLen, lDecLen; @@ -649,7 +698,15 @@ { DEncDecryptParse* pctx = (DEncDecryptParse*)ctx; ElementEntry* pCurrElem = 0; - + char *mime = NULL; + int i; + + // check the atributes + for(i = 0; atts && atts[i] && atts[i+1]; i++) { + if(!strcmp((char*)atts[i], "MimeType")) { + mime = (char*)atts[i+1]; + } + } ddocDebug(4, "dencDecryptStartElementHandler", "<%s>, err: %d", (const char*)name, pctx->errcode); if(pctx->errcode) return; // if error skip all additional parsing pctx->errcode = ddocStackPushElementSAX(&(pctx->dencStack), name, atts, &pCurrElem); @@ -665,7 +722,15 @@ pctx->nB64SkipMode++; // increment skip mode ddocDebug(4, "dencDecryptStartElementHandler", "Decode start, skip: %d", pctx->nB64SkipMode); } - + // check mime + if(strstr((char*)name, "EncryptedData")) { + + } + // + if(strstr((char*)name, "X509Certificate")) { + ddocDebug(4, "dencDecryptStartElementHandler", "Start collecting cert"); + ddocMemBuf_free(&(pctx->mbufTemp)); + } } //-------------------------------------------------- @@ -679,7 +744,10 @@ DEncDecryptParse* pctx = (DEncDecryptParse*)ctx; char buf1[4096], buf2[4096]; int l1, l2, l3; - + DigiDocMemBuf mbuf1; + + mbuf1.pMem = NULL; + mbuf1.nLen = 0; ddocDebug(4, "dencDecryptEndElementHandler", ", err: %d", (const char*)name, pctx->errcode); if(pctx->errcode) return; // if error skip all additional parsing // decode the certificate data @@ -688,13 +756,17 @@ ddocDebug(4, "dencDecryptEndElementHandler", "Decoding pem: %d cert: %s, rc: %d", pctx->mbufTemp.nLen, (pctx->pCert ? "OK" : "NULL"), pctx->errcode); ddocMemBuf_free(&(pctx->mbufTemp)); + //EVP_DecodeFinal(&(pctx->ectx),out,outl) + pctx->nB64SkipMode = 0; } // check if it was the right key and decrypt transport key if(strstr((char*)name, "EncryptedKey")) { memset(buf1, 0, sizeof(buf1)); pctx->errcode = ReadCertSerialNumber(buf1, sizeof(buf1), pctx->pCert); - ddocDebug(4, "dencDecryptEndElementHandler", "Looking for cert: %s, found: %s, rc: %d", - pctx->szCertSerial, buf1, pctx->errcode); + ddocCertGetDN(pctx->pCert, &mbuf1, 0); + ddocDebug(4, "dencDecryptEndElementHandler", "Looking for cert: %s, found: %s - %s, rc: %d", + pctx->szCertSerial, buf1, (char*)mbuf1.pMem, pctx->errcode); + ddocMemBuf_free(&mbuf1); if(!strcmp(pctx->szCertSerial, buf1)) { l1 = sizeof(buf1); memset(buf1, 0, l1); @@ -703,7 +775,7 @@ pctx->mbufTemp.nLen, l1); // cleanup temp buffer ddocMemBuf_free(&(pctx->mbufTemp)); - if(l1 != DENC_ENCRYPTED_KEY_LEN) { + if(l1 < DENC_ENCRYPTED_KEY_LEN) { SET_LAST_ERROR(ERR_DENC_DECRYPT); pctx->errcode = ERR_DENC_DECRYPT; return; @@ -718,9 +790,22 @@ } memset(pctx->mbufTransportKey.pMem, 0, l1); l3 = pctx->mbufTransportKey.nLen; - pctx->errcode = decryptWithEstID(pctx->nSlot, pctx->szPin, (char *)buf1, l1, + if(pctx->pkey) { +#if OPENSSL_VERSION_NUMBER > 0x10000000 + l3 = EVP_PKEY_decrypt_old((unsigned char *)pctx->mbufTransportKey.pMem, + (const unsigned char*)buf1, l1, pctx->pkey); +#else + l3 = EVP_PKEY_decrypt((unsigned char *)pctx->mbufTransportKey.pMem, + (const unsigned char*)buf1, l1, pctx->pkey); +#endif + pctx->mbufTransportKey.nLen = l3; + if(l3 != 16) + pctx->errcode = ERR_DENC_DECRYPT; + } else { + pctx->errcode = decryptWithEstID(pctx->nSlot, pctx->szPin, (char *)buf1, l1, (char*)pctx->mbufTransportKey.pMem, &l3); - pctx->mbufTransportKey.nLen = l3; + pctx->mbufTransportKey.nLen = l3; + } ddocDebug(4, "dencDecryptEndElementHandler", "Decrypted key-len: %d rc: %d", pctx->mbufTransportKey.nLen, pctx->errcode); if(pctx->mbufTransportKey.nLen != DENC_DECRYPTED_KEY_LEN) { @@ -776,7 +861,7 @@ { DEncDecryptParse* pctx = (DEncDecryptParse*)ctx; ElementEntry* pCurrElem = 0; - char *buf1, *buf2, *p1; + char *buf1=0, *buf2=0, *p1=0; int l1, l2, i, l; ddocDebug(4, "dencDecryptCharactersHandler", "Parsing: %d chars err: %d, skip: %d", len, pctx->errcode, pctx->nB64SkipMode); @@ -803,13 +888,13 @@ // check if the transport key is ready for decryption if(pctx->mbufTransportKey.nLen != DENC_DECRYPTED_KEY_LEN) { ddocDebug(1, "dencDecryptCharactersHandler", "Transport key len: %d", pctx->mbufTransportKey.nLen); - SET_LAST_ERROR(ERR_DENC_DECRYPT); - pctx->errcode = ERR_DENC_DECRYPT; + SET_LAST_ERROR(ERR_DENC_NO_KEY_FOUND); // not encrypted for this user! + pctx->errcode = ERR_DENC_NO_KEY_FOUND; return; } // decode base64 encrypted data pctx->lB64Len += len; - l1 = len; + l1 = len * 2; buf1 = (char*)malloc(l1); if(!buf1) { SET_LAST_ERROR(ERR_BAD_ALLOC); @@ -818,6 +903,7 @@ memset(buf1, 0, l1); ddocDebug(4, "dencDecryptCharactersHandler", "Decoding: %d into: %d, skip: %d", len, l1, pctx->nB64SkipMode); EVP_DecodeUpdate(&(pctx->ectx), (unsigned char*)buf1, &l1, (unsigned char*)ch, len); + ddocDebug(4, "dencDecryptCharactersHandler", "Decoded: %d got: %d, skip: %d", len, l1, pctx->nB64SkipMode); // if this was the first block of decoded base64 data // then use the first 16 bytes as the IV value p1 = buf1; @@ -831,49 +917,52 @@ pctx->lBinLen += l1; ddocDebug(4, "dencDecryptCharactersHandler", "Decoded: %d got: %d, skip: %d", len, l1, pctx->nB64SkipMode); // decrypt decoded data - l2 = l1 * 2; + l = l2 = l1 * 2; buf2 = (char*)malloc(l2); if(!buf2) { SET_LAST_ERROR(ERR_BAD_ALLOC); return; } memset(buf2, 0, l2); - if(pctx->nB64SkipMode == 4) - l1 += 16; // ??? + //if(pctx->nB64SkipMode == 4) + // l1 += 16; // ??? ddocDebug(4, "dencDecryptCharactersHandler", "Decrypting: %d into: %d", l1, l2); EVP_CipherUpdate(&(pctx->dctx), (unsigned char*)buf2, &l, (const unsigned char*)p1, l1); ddocDebug(4, "dencDecryptCharactersHandler", "Decrypted: %d got: %d, skip: %d", l1, l, pctx->nB64SkipMode); + if(buf1) free(buf1); // no padding until the final chunk - if(pctx->nB64SkipMode == 0 || pctx->nB64SkipMode == 4) { + if((pctx->nB64SkipMode == 0 || pctx->nB64SkipMode == 4)) { // on the last block check for a block with all 0x0F l1 = (int)(unsigned char)buf2[l-1]; if(l1 == 16) { - ddocDebug(4, "dencDecryptCharactersHandler", "Check 0x0F padding: %d", l1); + ddocDebug(4, "dencDecryptCharactersHandler", "Check 0x0F padding 1: %d", l1); for(i = l - l1; i < l - 1; i++) { + ddocDebug(4, "dencDecryptCharactersHandler", "Pad pos: %d = %d", i, buf2[i]); if(buf2[i] != 16) { l1 = 0; // set not matched flag break; } } if(l1) { - ddocDebug(4, "dencDecryptCharactersHandler", "Decrypted len: %d reduce by: %d", l2, l1); + ddocDebug(4, "dencDecryptCharactersHandler", "Decrypted len: %d reduce by: %d -> %d", l2, l1, (l-l1)); l -= l1; } } // remove padding l1 = (int)(unsigned char)buf2[l-1]; - if(l1 > 0 && l1 < 16) { + if(l1 > 0 && l1 <= 16) { ddocDebug(4, "dencDecryptCharactersHandler", "Check padding: %d", l1); for(i = l - l1; i < l - 1; i++) { + ddocDebug(4, "dencDecryptCharactersHandler", "Pad pos: %d = %d", i, buf2[i]); if(buf2[i]) { l1 = 0; // set not matched flag break; } } if(l1) { - ddocDebug(4, "dencDecryptCharactersHandler", "Decrypted len: %d reduce by: %d", l2, l1); + ddocDebug(4, "dencDecryptCharactersHandler", "Decrypted len: %d reduce by: %d -> %d", l2, l1, (l-l1)); l -= l1; } } @@ -883,11 +972,11 @@ pctx->nB64SkipMode = 1; // reset flag - look for padding } // write to file - if(pctx->hOutFile) + if(pctx->hOutFile && buf2) pctx->lDecLen += fwrite(buf2, 1, l, pctx->hOutFile); free(buf2); } - + } } @@ -940,19 +1029,24 @@ // szInputFileName - input file name [REQUIRED] // szOutputFileName - output file name [REQUIRED] // szPin - PIN1 of the id-card to decrypt the transport key [REQUIRED] +// szPkcs12File - pkcs12 key container filename [OPTIONAL] // returns error code or ERR_OK //-------------------------------------------------- EXP_OPTION int dencSaxReadDecryptFile(const char* szInputFileName, const char* szOutputFileName, - const char* szPin) + const char* szPin, const char* szPkcs12File) { FILE *f; int ret; - char chars[1025], convInFileName[250], convOutFileName[250], *p; + char chars[1025], convInFileName[256], convOutFileName[256], *p; xmlParserCtxtPtr ctxt; DEncDecryptParse pctx; X509* pCert = 0; - + EVP_PKEY *pkey = NULL; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = NULL; + mbuf1.nLen = 0; RETURN_IF_NULL_PARAM(szInputFileName) RETURN_IF_NULL_PARAM(szOutputFileName) RETURN_IF_NULL_PARAM(szPin) @@ -973,11 +1067,23 @@ ddocDebug(1, "dencSaxReadDecryptFile", "Error writing to file: %s", szOutputFileName); SET_LAST_ERROR_RETURN(ERR_FILE_WRITE, ERR_FILE_WRITE) } - pctx.errcode = findUsersCertificate(pctx.nSlot, &pCert); + // if using pkcs12 file for decryption + if(szPkcs12File) { + pctx.errcode = ReadCertificateByPKCS12(&pCert, szPkcs12File, szPin, &pkey); + pctx.pkey = pkey; + } else { + pctx.errcode = findUsersCertificate(pctx.nSlot, &pCert); + } if(pCert) { pctx.errcode = ReadCertSerialNumber(pctx.szCertSerial, sizeof(pctx.szCertSerial), pCert); - ddocDebug(3, "dencSaxReadDecryptFile", "Decryptiong using certificate: %s", pctx.szCertSerial); + ddocCertGetDN(pCert, &mbuf1, 0); + ddocDebug(3, "dencSaxReadDecryptFile", "Decrypting using certificate: %s - %s", pctx.szCertSerial, (char*)mbuf1.pMem); + ddocMemBuf_free(&mbuf1); + } else { + ddocDebug(1, "dencSaxReadDecryptFile", "Users cert for decryption could not be read from card!"); + return pctx.errcode; } + // parse and decrypt data in file if((f = fopen(convInFileName, "r")) != NULL && !pctx.errcode) { ret = fread(chars, 1, 1024, f); @@ -1029,6 +1135,7 @@ } while(ret == 1024); // do-while // last block of data ddocDebug(4, "dencSaxReadDecryptFile", "parsing final chunk: %d", strlen(chars)); + if(!pctx.errcode) xmlParseChunk(ctxt, NULL, 0, 1); xmlFreeParserCtxt(ctxt); } // if(ret > 0) diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocEncSAXParser.h libdigidoc-3.7.0.875/libdigidoc/DigiDocEncSAXParser.h --- libdigidoc-2.7.0/libdigidoc/DigiDocEncSAXParser.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocEncSAXParser.h 2012-12-13 22:05:47.000000000 +0000 @@ -39,6 +39,14 @@ EXP_OPTION int dencSaxReadEncryptedData(DEncEncryptedData** ppEncData, const char* szFileName); //-------------------------------------------------- + // Reads in encrypted XML document. + // ppEncData - address for new encrypted data object [REQUIRED] + // pData - input data [REQUIRED] + // returns error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int dencSaxReadEncryptedDataFromMemory(DEncEncryptedData** ppEncData, DigiDocMemBuf* pData); + + //-------------------------------------------------- // Decrypts an encrypted XML document and stores the // cleartext data in another document. Please note that szCertCN // parameter is no longer required as the users cert will @@ -46,11 +54,12 @@ // szInputFileName - input file name [REQUIRED] // szOutputFileName - output file name [REQUIRED] // szPin - PIN1 of the id-card to decrypt the transport key [REQUIRED] + // szPkcs12File - pkcs12 key container filename [OPTIONAL] // returns error code or ERR_OK //-------------------------------------------------- EXP_OPTION int dencSaxReadDecryptFile(const char* szInputFileName, const char* szOutputFileName, - const char* szPin); + const char* szPin, const char* szPkcs12File); #ifdef __cplusplus diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocError.c libdigidoc-3.7.0.875/libdigidoc/DigiDocError.c --- libdigidoc-2.7.0/libdigidoc/DigiDocError.c 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocError.c 2012-12-13 22:05:47.000000000 +0000 @@ -175,7 +175,18 @@ /* ERR_WPKI_SENDING_ERROR */ { "Error sending signing request to users mobile phone!", USER }, /* ERR_WPKI_SIM_ERROR */ { "SIM card error!", USER }, /* ERR_WPKI_SERVICE_ERR */ { "Mobile signing service internal error!", USER }, - +//AM 18.03.08 +/* ERR_ZIP_FILE_READ */ { "File not found in BDOC!", USER }, +/* ERR_ZIP */ { "Error in BDocZip!", USER }, +/* ERR_MANIFEST */ { "Can't parse manifest!", USER }, +/* ERR_DATAFILE_NOT_MANIFEST */ { "Datafile is not described in manifest.xml!", USER }, +/* ERR_SIG_INVALID_PROFILE */ { "Signature does not correspond to profile in manifest.xml!", USER }, +/* ERR_SIGNERS_CERT_NON_REPU */ { "Signers cert does not have non-repudiation bit set!", USER }, +/* ERR_OCSP_NONCE_SIGVAL_NOMATCH */ { "Calculated signature hash doesn't match to OCSP responder nonce field!", USER }, +/* ERR_VALIDATE */ { "Validation error! Invalid ddoc or cdoc document.", USER }, +/* ERR_OCSP_NONCE_INVALID */ { "Invalid nonce length!", TECHNICAL }, +/* ERR_SIGVAL_ASN1 */ { "Invalid signature value! Missing or wrong asn.1 signature structure", TECHNICAL }, + /* */ {"", NO_ERRORS} }; diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocError.h libdigidoc-3.7.0.875/libdigidoc/DigiDocError.h --- libdigidoc-2.7.0/libdigidoc/DigiDocError.h 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocError.h 2012-12-13 22:05:47.000000000 +0000 @@ -193,9 +193,19 @@ #define ERR_WPKI_SENDING_ERROR 154 #define ERR_WPKI_SIM_ERROR 155 #define ERR_WPKI_SERVICE_ERR 156 +//AM 18.03.08 +#define ERR_ZIP_FILE_READ 157 +#define ERR_ZIP 158 +#define ERR_MANIFEST 159 +#define ERR_DATAFILE_NOT_MANIFEST 160 +#define ERR_SIG_INVALID_PROFILE 161 +#define ERR_SIGNERS_CERT_NON_REPU 162 +#define ERR_OCSP_NONCE_SIGVAL_NOMATCH 163 +#define ERR_VALIDATE 164 +#define ERR_OCSP_NONCE_INVALID 165 +#define ERR_SIGVAL_ASN1 166 -#define ERR_MAX 158 //number of error codes. Increment, if you add a new error code - +#define ERR_MAX 168 //number of error codes. Increment, if you add a new error code #define ERROR_BUF_LENGTH 20 diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocGen.c libdigidoc-3.7.0.875/libdigidoc/DigiDocGen.c --- libdigidoc-2.7.0/libdigidoc/DigiDocGen.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocGen.c 2012-12-13 22:05:47.000000000 +0000 @@ -42,7 +42,8 @@ #include #include #include - +#include +#include #include @@ -154,18 +155,14 @@ RETURN_IF_NULL_PARAM(pTimestamp); RETURN_IF_NULL_PARAM(pSigDoc); // in version 1.3 we use format CCYY-MM-DDTHH:MM:SS-TZ - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ) { + if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ) { sscanf(szTimestamp, "%04d-%02d-%04dT%02d:%02d:%02dZ", &(pTimestamp->year), &(pTimestamp->mon), &(pTimestamp->day), &(pTimestamp->hour), &(pTimestamp->min), &(pTimestamp->sec)); pTimestamp->tz = 0; } else // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { sscanf(szTimestamp, "%04d.%02d.%04dT%02d:%02d:%02d%3d:00", &(pTimestamp->year), &(pTimestamp->mon), &(pTimestamp->day), &(pTimestamp->hour), &(pTimestamp->min), &(pTimestamp->sec), &(pTimestamp->tz)); @@ -191,17 +188,14 @@ //RETURN_IF_NULL_PARAM(pSigDoc); // if null then latest format is used // in version 1.3 we use format CCYY-MM-DDTHH:MM:SS-TZ + //AM 30.04.08 also in bdoc if(!pSigDoc || (pSigDoc && ( - !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ))) { + !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ))) { snprintf(szTimestamp, len, "%04d-%02d-%02dT%02d:%02d:%02dZ",pTimestamp->year, pTimestamp->mon, pTimestamp->day, pTimestamp->hour , pTimestamp->min, pTimestamp->sec); } else // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { snprintf(szTimestamp, len, "%04d.%02d.%02dT%02d:%02d:%02d%+03d:00",pTimestamp->year, pTimestamp->mon, pTimestamp->day, pTimestamp->hour , pTimestamp->min, pTimestamp->sec, pTimestamp->tz); @@ -255,13 +249,13 @@ tzset(); t2 = 0; // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { sscanf(szTimestamp, "%04d.%02d.%02dT%02d:%02d:%02d+%03d:00", &(tm1.tm_year), &(tm1.tm_mon), &(tm1.tm_mday), &(tm1.tm_hour) , &(tm1.tm_min), &(tm1.tm_sec), &tz); } else if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { // in version 1.1 we use format CCYY.MM.DDTHH:MM:SSZ and allways UTC time - sscanf(szTimestamp, "%04d.%02d.%02dT%02d:%02d:%02dZ", + sscanf(szTimestamp, "%04d.%02d.%02dT%02d:%02d:%02dZ", //crash? &(tm1.tm_year), &(tm1.tm_mon), &(tm1.tm_mday), &(tm1.tm_hour), &(tm1.tm_min), &(tm1.tm_sec)); } else { // in version 1.3 we use format CCYY-MM-DDTHH:MM:SSZ and allways UTC time @@ -307,7 +301,7 @@ _tzset(); time(&t); // in version 1.0 we use format CCYY.MM.DDTHH:MM:SS-TZ - if(pSigDoc && !strcmp(pSigDoc->szFormatVer, "1.0")) { + if(pSigDoc && pSigDoc->szFormatVer && !strcmp(pSigDoc->szFormatVer, "1.0")) { ddocLocalTime(&t, &tm1, 1); if(_daylight != 0) { /*if(_timezone<0){*/ @@ -359,8 +353,78 @@ xmlFreeDoc(doc); } return dest; +} + + + + +//============================================================ +// Canonicalizes XML +// source - input data +// len - input length +// returns a newly allocated buffer with canonicalized XML +// Caller must free() the result. +//============================================================ +char* canonicalizeXMLBlock(char* source, int len, char* block, char* prefix) +{ + xmlDocPtr doc = NULL; + xmlChar* pBuf = NULL; + int rc, n; + char* dest = NULL; + xmlXPathContextPtr xpathCtx; + xmlXPathObjectPtr xpathObj; + //xmlChar* incpref[] = {(xmlChar*)"ds", (xmlChar*)"xades", NULL}; + + ddocDebug(5, "canonicalizeXMLBlock", "Canonicalizing: %d bytes", len); + if((doc = xmlParseMemory(source, len)) != NULL) { + ddocDebug(5, "canonicalizeXMLBlock", "Canonicalizing parse: %s", (doc ? "OK" : "ERROR")); + /* Create xpath evaluation context */ + xpathCtx = xmlXPathNewContext(doc); + if(xpathCtx == NULL) { + ddocDebug(5, "canonicalizeXMLBlock", "Error: unable to create new XPath context"); + xmlFreeDoc(doc); + return NULL; + } + if(prefix && strlen(prefix)){ + ddocDebug(5, "canonicalizeXMLBlock","xmlXPathRegisterNs"); + if(xmlXPathRegisterNs(xpathCtx, prefix, "http://www.w3.org/2000/09/xmldsig#") != 0) { + ddocDebug(5, "canonicalizeXMLBlock","Error: failed to register namespace"); + xmlXPathFreeContext(xpathCtx); + xmlFreeDoc(doc); + return NULL; + } + } + ddocDebug(5, "canonicalizeXMLBlock","xmlXPathRegisterNs123"); + if(xmlXPathRegisterNs(xpathCtx, "xs", "http://uri.etsi.org/01903/v1.3.2#") != 0) { + ddocDebug(5, "canonicalizeXMLBlock","Error: failed to register namespace2\n"); + xmlXPathFreeContext(xpathCtx); + xmlFreeDoc(doc); + return NULL; + } + /* Evaluate xpath expression */ + xpathObj = xmlXPathEvalExpression(block, xpathCtx); + if(xpathObj == NULL) { + ddocDebug(5, "canonicalizeXMLBlock","Error: unable to evaluate xpath expression \"%s\"\n", block); + xmlXPathFreeContext(xpathCtx); + xmlFreeDoc(doc); + } + rc = xmlC14NDocDumpMemory(doc, xpathObj->nodesetval, 0, NULL, 0, &pBuf); + ddocDebug(5, "canonicalizeXMLBlock", "Canonicalizing RC: %d: BUF: %s", rc, (pBuf ? "OK" : "ERROR")); + if(pBuf) { + n = strlen((char*)pBuf); + dest = (char*)malloc(n + 1); + if(dest) + strncpy(dest, (char*)pBuf, n+1); + else + SET_LAST_ERROR_IF_NOT(dest, ERR_BAD_ALLOC); + xmlFree(pBuf); + } + xmlFreeDoc(doc); + } + return dest; } + //-------------------------------------------------- // Helper function that escapes XML special chars // src - input data @@ -411,14 +475,27 @@ switch(src[i]) { case '<': strncat(*dest, "<", l - strlen(*dest)); j += 4; break; case '>': strncat(*dest, ">", l - strlen(*dest)); j += 4; break; - case '&': strncat(*dest, "&", l - strlen(*dest)); j += 5; break; + case '&': + if(src[i+3] != ';' && src[i+4] != ';' && src[i+5] != ';') { + if(src[i+1] != '#') { + strncat(*dest, "&", l - strlen(*dest)); j += 5; break; + } else { + if(!strncmp(src+i, "&", 5)) { + strncat(*dest, "&", l - strlen(*dest)); j += 5; i += 4; break; + } + // but others? + } + } else { + (*dest)[j] = src[i]; j++; + } + break; case '\r': strncat(*dest, " ", l - strlen(*dest)); j += 5; break; case '\'': strncat(*dest, "'", l - strlen(*dest)); j += 6; break; case '\"': strncat(*dest, """, l - strlen(*dest)); j += 6; break; default: (*dest)[j] = src[i]; j++; break; } } - ddocDebug(5, "escapeXMLSymbols", "Converted: \'%s\' len: %d", *dest, j); + ddocDebug(4, "escapeXMLSymbols", "Src: %s Converted: \'%s\' len: %d", src, *dest, j); return ERR_OK; } @@ -427,12 +504,12 @@ // Creates a XML block // pSigDoc - signed document pointer // pSigInfo - signature info data -// bWithEscapes - 1=escape xml sümbols, 0=don't escape +// bWithEscapes - 1=escape xml sümbols, 0=don't escape // returns new node //============================================================ char* createXMLSignedProperties(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, int bWithEscapes) { - char buf1[300], *pRet = 0, *p1, *p2; + char buf1[1024], *pRet = 0, *p1, *p2; int len1, i, err; xmlNodePtr pSigProp, pSigSigProp, pSigCert, pN1, pN2, pN3; static xmlChar nl[] = "\n"; @@ -453,24 +530,15 @@ } else if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { // in 1.3 we use the correct etsi namespace xmlNewNs(pSigProp, (const xmlChar*)NAMESPACE_XADES_111, NULL); } -#ifdef WITH_TS - else if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { // in 1.4 we use 1.3.2 namespace - xmlNewNs(pSigProp, (const xmlChar*)NAMESPACE_XADES_132, NULL); - } -#endif // in 1.0 we had this buggy URI - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) snprintf(buf1, sizeof(buf1), "#%s-SignedProperties", pSigInfo->szId); else // current version is 1.1 snprintf(buf1, sizeof(buf1), "%s-SignedProperties", pSigInfo->szId); xmlSetProp(pSigProp, (const xmlChar*)"Id", (const xmlChar*)buf1); // Ver 1.76 - in format 1.3 Target atribute is not used - if(strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ) { + if(strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ) { snprintf(buf1, sizeof(buf1), "#%s", pSigInfo->szId); xmlSetProp(pSigProp, (const xmlChar*)"Target", (const xmlChar*)buf1); } @@ -484,13 +552,9 @@ // pN1 = xmlNewChild(pSigCert, NULL, (const xmlChar*)"Cert", nl); // Ver 1.76 - in format 1.3 Id atribute is not used - if(strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ) { + if(strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ) { // in 1.0 we had this buggy URI - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) snprintf(buf1, sizeof(buf1), "#%s-CERTINFO", pSigInfo->szId); else snprintf(buf1, sizeof(buf1), "%s-CERTINFO", pSigInfo->szId); @@ -500,12 +564,10 @@ pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"CertDigest", nl); // pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"DigestMethod", nl); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) - xmlSetProp(pN3, (const xmlChar*)"xmlns", (const xmlChar*)NAMESPACE_XML_DSIG); -#endif + xmlNodeAddContent(pN2, nl); xmlSetProp(pN3, (const xmlChar*)"Algorithm", (const xmlChar*)DIGEST_METHOD_SHA1); + // len1 = sizeof(buf1); buf1[0] = 0; @@ -513,19 +575,13 @@ if(pMBuf1) encode((const byte*)pMBuf1->pMem, pMBuf1->nLen, (byte*)buf1, &len1); pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"DigestValue", (const xmlChar*)buf1); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) - xmlSetProp(pN3, (const xmlChar*)"xmlns", (const xmlChar*)NAMESPACE_XML_DSIG); -#endif + xmlNodeAddContent(pN2, nl); // xmlNodeAddContent(pN1, nl); - // In 1.3 and 1.4 we use subelements of - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ) { + // In 1.3 we use subelements of + //AM 21.08.08 also in bdoc + if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) ) { pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"IssuerSerial", nl); pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"X509IssuerName", (const xmlChar*)ddocSigInfo_GetSignersCert_IssuerName((SignatureInfo*)pSigInfo)); @@ -540,11 +596,11 @@ (const xmlChar*)ddocSigInfo_GetSignersCert_IssuerSerial((SignatureInfo*)pSigInfo)); } // - xmlNodeAddContent(pSigSigProp, nl); - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || + if((!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { + xmlNodeAddContent(pSigSigProp, nl); pN1 = xmlNewChild(pSigSigProp, NULL, (const xmlChar*)"SignaturePolicyIdentifier", nl); // pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"SignaturePolicyImplied", nl); @@ -635,13 +691,21 @@ xmlNodeAddContent(pSigProp, nl); // convert to string pBuf = NULL; + pRet = NULL; err = xmlC14NDocDumpMemory(doc, NULL, 0, NULL, 0, &pBuf); p1 = strstr((const char*)pBuf, ""); if(p2) { p2[strlen("")] = 0; - pRet = strdup(p1); + //pRet = strdup(p1); + pRet = malloc(len1); + if(pRet) { + memset(pRet, 0, len1); + i = strlen(p1); + strncpy(pRet, p1, strlen(p1)); + } } } xmlFree(pBuf); @@ -660,7 +724,7 @@ //============================================================ EXP_OPTION char* createXMLSignedInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo) { - char buf1[100], *pRet = 0, *p1, *p2; + char buf1[300], *pRet = 0, *p1, *p2; int i, err, l1; xmlNodePtr pnSigInfo, pN1, pN2, pN3; static xmlChar nl[] = "\n"; @@ -669,6 +733,8 @@ //FILE* hFile; DataFile* pDF; DigiDocMemBuf mbuf1; + //AM 13.02.09 ecdsa-sha1 support + EVP_PKEY* pubKey = NULL; mbuf1.pMem = 0; mbuf1.nLen = 0; @@ -686,7 +752,16 @@ xmlNodeAddContent(pnSigInfo, nl); // pN1 = xmlNewChild(pnSigInfo, NULL, (const xmlChar*)"SignatureMethod", nl); - xmlSetProp(pN1, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2000/09/xmldsig#rsa-sha1"); + err = GetPublicKey(&pubKey, ddocSigInfo_GetSignersCert(pSigInfo)); + if(pubKey) { +#ifdef WITH_ECDSA + if(pubKey->type==NID_X9_62_id_ecPublicKey) + xmlSetProp(pN1, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1"); + else +#endif + xmlSetProp(pN1, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2000/09/xmldsig#rsa-sha1"); + EVP_PKEY_free(pubKey); + } xmlNodeAddContent(pnSigInfo, nl); // for(i = 0; i < pSigInfo->nDocs; i++) { @@ -695,20 +770,11 @@ snprintf(buf1, sizeof(buf1), "#%s", pSigInfo->pDocs[i]->szDocId); xmlSetProp(pN1, (const xmlChar*)"URI", (const xmlChar*)buf1); pDF = getDataFileWithId(pSigDoc, pSigInfo->pDocs[i]->szDocId); - // in ver 1.1 we use Transforms only for detached documents - if((!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || - !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) && - pDF && !strcmp(pDF->szContentType, CONTENT_DETATCHED)) { - pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"Transforms", NULL); - pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"Transform", NULL); - xmlSetProp(pN3, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.sk.ee/2002/10/digidoc#detatched-document-signature"); - xmlNodeAddContent(pN1, nl); - } pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"DigestMethod", nl); xmlSetProp(pN2, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2000/09/xmldsig#sha1"); xmlNodeAddContent(pN1, nl); // in ver 1.0 we use Transforms - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"Transforms", NULL); pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"Transform", NULL); xmlSetProp(pN3, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2000/09/xmldsig#enveloped-signature"); @@ -721,7 +787,8 @@ xmlNodeAddContent(pN1, nl); xmlNodeAddContent(pnSigInfo, nl); // in ver 1.1 we don't use mime digest Reference blocks - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + //AM 29.08.10 + if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { // document mime type digest pN1 = xmlNewChild(pnSigInfo, NULL, (const xmlChar*)"Reference", nl); if(!strcmp(pSigDoc->szFormatVer, "1.0")) @@ -753,16 +820,11 @@ !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { xmlSetProp(pN1, (const xmlChar*)"Type", (const xmlChar*)"http://uri.etsi.org/01903/v1.1.1#SignedProperties"); } -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - xmlSetProp(pN1, (const xmlChar*)"Type", (const xmlChar*)"http://uri.etsi.org/01903#SignedProperties"); - } -#endif pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"DigestMethod", nl); xmlSetProp(pN2, (const xmlChar*)"Algorithm", (const xmlChar*)DIGEST_METHOD_SHA1); xmlNodeAddContent(pN1, nl); // in 1.0 we used transforms here - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { pN2 = xmlNewChild(pN1, NULL, (const xmlChar*)"Transforms", NULL); pN3 = xmlNewChild(pN2, NULL, (const xmlChar*)"Transform", NULL); xmlSetProp(pN3, (const xmlChar*)"Algorithm", (const xmlChar*)"http://www.w3.org/2000/09/xmldsig#enveloped-signature"); @@ -777,11 +839,17 @@ pBuf = NULL; err = xmlC14NDocDumpMemory(doc, NULL, 0, NULL, 0, &pBuf); p1 = strstr((const char*)pBuf, ""); if(p2) { p2[strlen("")] = 0; - pRet = strdup(p1); + pRet = malloc(l1); + if(pRet) { + memset(pRet, 0, l1); + strncpy(pRet, p1, strlen(p1)); + //pRet = strdup(p1); + } } } xmlFree(pBuf); @@ -868,27 +936,11 @@ // Ver 1.76 - in format 1.3 we don't use the Target atribute if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { ddocMemAppendData(pMBufXML,"\n", -1); -#ifdef WITH_TS - } else if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - ddocMemAppendData(pMBufXML, "\n", -1); -#endif } else { ddocMemAppendData(pMBufXML,"szId, -1); ddocMemAppendData(pMBufXML,"\">\n", -1); } -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocSigInfo_SignatureTimeStamp_toXML(pSigInfo, &mbuf1); - if(!err) { - ddocMemAppendData(pMBufXML,(const char*)mbuf1.pMem, -1); - ddocMemAppendData(pMBufXML,"\n", -1); - } - ddocMemBuf_free(&mbuf1); - } -#endif // err = ddocCompleteCertificateRefs_toXML((SignedDoc*)pSigDoc, (SignatureInfo*)pSigInfo, &mbuf1); ddocMemAppendData(pMBufXML,(const char*)mbuf1.pMem, -1); @@ -898,22 +950,13 @@ ddocMemAppendData(pMBufXML,(const char*)mbuf1.pMem, -1); ddocMemBuf_free(&mbuf1); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocSigInfo_SigAndRefsTimeStamp_toXML(pSigInfo, &mbuf1); - if(!err) { - ddocMemAppendData(pMBufXML,(const char*)mbuf1.pMem, -1); - ddocMemAppendData(pMBufXML,"\n", -1); - } - ddocMemBuf_free(&mbuf1); - } -#endif // responder cert ddocMemAppendData(pMBufXML,"\n", -1); // TODO format cert without header for(i = 0; i < ddocCertValueList_GetCertValuesCount(pSigInfo->pCertValues); i++) { pCertValue = ddocCertValueList_GetCertValue(pSigInfo->pCertValues, i); if(pCertValue && pCertValue->nType != CERTID_VALUE_SIGNERS_CERT) { + ddocDebug(3, "addNotaryInfoXML", "Write CertVal-type: %d cert: %s", pCertValue->nType, (pCertValue->pCert ? "OK" : "NULL")); ddocCertValue_toXML(pCertValue, &mbuf1); ddocMemAppendData(pMBufXML, (const char*)mbuf1.pMem, -1); ddocMemAppendData(pMBufXML, "\n", -1); @@ -924,11 +967,7 @@ // revocation values ddocMemAppendData(pMBufXML, "", -1); // Ver 1.76 - in format 1.3 we use here additionally element - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif -) + if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) ddocMemAppendData(pMBufXML, "", -1); // OCSP response ddocMemAppendData(pMBufXML, "\n", -1); // Ver 1.76 - in format 1.3 we use here additionally element - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif -) + if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) ddocMemAppendData(pMBufXML,"", -1); ddocMemAppendData(pMBufXML,"", -1); // unsigned prop end @@ -987,9 +1022,9 @@ int addSignatureInfoXML(DigiDocMemBuf *pMBufXML, SignedDoc* pSigDoc, SignatureInfo* pSigInfo) { int err = ERR_OK; - unsigned char buf2[300], *buf1 = 0; + unsigned char buf2[500], *buf1 = 0; int len2, len1; - EVP_PKEY* pubKey; + EVP_PKEY* pubKey = NULL; SignatureValue *pSigVal; DigiDocMemBuf mbuf1; @@ -1006,7 +1041,8 @@ RETURN_IF_NULL(buf1); ddocMemAppendData(pMBufXML,(const char*)buf1, -1); free(buf1); - len1 = 200; + buf1 = 0; // mark free + len1 = 1024; buf1 = (unsigned char*)malloc(len1); RETURN_IF_BAD_ALLOC(buf1); memset(buf1, 0, len1); @@ -1017,18 +1053,20 @@ ddocMemAppendData(pMBufXML,(const char*)mbuf1.pMem, -1); ddocMemBuf_free(&mbuf1); // cert data... - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { ddocMemAppendData(pMBufXML,"szId, -1); ddocMemAppendData(pMBufXML,"-CERT\">\n", -1); } else { // RSA KEY value ddocMemAppendData(pMBufXML,"\n", -1); - ddocMemAppendData(pMBufXML,"\n\n", -1); err = GetPublicKey(&pubKey, ddocSigInfo_GetSignersCert(pSigInfo)); // FIXME // modulus - len1 = BN_bn2bin(pubKey->pkey.rsa->n, buf1); + //AM 11.02.09 + if(!err && pubKey->type==NID_rsaEncryption) { + ddocMemAppendData(pMBufXML,"\n\n", -1); + len1 = BN_bn2bin(pubKey->pkey.rsa->n, buf1); // in version 1.1 we output modulus as it is // starting from 1.2 we convert it to big-endian /*len2 = sizeof(buf2); @@ -1038,51 +1076,44 @@ if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER)) { swapBytes((byte*)buf1, len1); }*/ - len2 = sizeof(buf2); - memset(buf2, 0, len2); - encode(buf1, len1, buf2, &len2); - //printf("New modulus: %s len: %d\n", buf2, len1); - ddocMemAppendData(pMBufXML, "", -1); - ddocMemAppendData(pMBufXML,buf2, -1); - ddocMemAppendData(pMBufXML,"\n", -1); - // exponent - memset(buf1, 0, len1); - len1 = BN_bn2bin(pubKey->pkey.rsa->e, buf1); - len2 = sizeof(buf2); - memset(buf2, 0, len2); - encode(buf1, len1, buf2, &len2); - ddocMemAppendData(pMBufXML,"", -1); - ddocMemAppendData(pMBufXML,buf2, -1); - ddocMemAppendData(pMBufXML,"\n", -1); - EVP_PKEY_free(pubKey); - ddocMemAppendData(pMBufXML,"\n\n", -1); + len2 = sizeof(buf2); + memset(buf2, 0, len2); + encode(buf1, len1, buf2, &len2); + //printf("New modulus: %s len: %d\n", buf2, len1); + ddocMemAppendData(pMBufXML, "", -1); + ddocMemAppendData(pMBufXML, (char*)buf2, -1); + ddocMemAppendData(pMBufXML,"\n", -1); + // exponent + memset(buf1, 0, len1); + len1 = BN_bn2bin(pubKey->pkey.rsa->e, buf1); + len2 = sizeof(buf2); + memset(buf2, 0, len2); + encode(buf1, len1, buf2, &len2); + ddocMemAppendData(pMBufXML,"", -1); + ddocMemAppendData(pMBufXML, (char*)buf2, -1); + ddocMemAppendData(pMBufXML,"\n", -1); + ddocMemAppendData(pMBufXML,"\n\n", -1); + } // cert data ddocMemAppendData(pMBufXML,"\n", -1); } free(buf1); - + buf1 = 0; // mark freed + RETURN_IF_NOT(err == ERR_OK, err); // check sig-value encode errors err = getCertPEM(ddocSigInfo_GetSignersCert(pSigInfo), 0, (char**)&buf1); RETURN_IF_NULL(buf1); - ddocMemAppendData(pMBufXML,buf1, -1); + ddocMemAppendData(pMBufXML, (char*)buf1, -1); free(buf1); ddocMemAppendData(pMBufXML,"\n", -1); // VS in releases prior to 1.76 we had incorrect atributes -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - ddocMemAppendData(pMBufXML,"szId, -1); - ddocMemAppendData(pMBufXML,"\">\n", -1); - ddocMemAppendData(pMBufXML,(const char*)buf2, -1); - } else -#endif if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { ddocMemAppendData(pMBufXML,"szId, -1); ddocMemAppendData(pMBufXML,"\">\n", -1); - ddocMemAppendData(pMBufXML,(const char*)buf2, -1); } else { ddocMemAppendData(pMBufXML,"\n", -1); } + EVP_PKEY_free(pubKey); // signed properties buf1 = (unsigned char*)createXMLSignedProperties(pSigDoc, pSigInfo, 1); RETURN_IF_NULL(buf1); @@ -1136,21 +1167,23 @@ // pMBufDigest - pointer to buffer for digest if we only want the digest // pMBufXML - output buffer if we want data to be returned in mem buf //============================================================ -int generateDataFileXML(SignedDoc* pSigDoc, DataFile* pDataFile, +EXP_OPTION int generateDataFileXML(SignedDoc* pSigDoc, DataFile* pDataFile, const char* szDataFile, FILE* hFile, DigiDocMemBuf* pMBufXML) { int err = ERR_OK, len1, len2, j, k; - char buf1[2048], buf2[4096], fixedFileName[FILENAME_MAX], *p, *p2; + char buf1[2050], buf2[5000], fixedFileName[1024], *p = 0; char *name, *value, *fName; FILE *fIn = 0; EVP_ENCODE_CTX ectx; SHA_CTX sctx; DigiDocMemBuf mbuf1, mbuf2, mbuf3; - +#ifdef WIN32 + wchar_t *convFileName = 0; +#endif RETURN_IF_NULL_PARAM(pSigDoc); RETURN_IF_NULL_PARAM(pDataFile); - RETURN_IF_NULL_PARAM(szDataFile); + //RETURN_IF_NULL_PARAM(szDataFile); mbuf1.pMem = 0; mbuf1.nLen = 0; @@ -1160,17 +1193,12 @@ // replaces '&' with '&' memset(fixedFileName, 0, sizeof(fixedFileName)); fName = (char*)getSimpleFileName(pDataFile->szFileName); - for(k = j = 0; k < (int)strlen(fName); k++) { - if(fName[k] == '&') { - strncat(fixedFileName, "&", sizeof(fixedFileName) - strlen(fixedFileName)); - j += 5; - } else { - fixedFileName[j] = fName[k]; - j++; - } - } + escapeXMLSymbols(fName, -1, &p); + if(p) + strncpy(fixedFileName, p, sizeof(fixedFileName)); + free(p); p = 0; //in versions 1.0, 1.1 and 1.2 we used bad encoding - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || + if((!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { #ifdef WIN32 @@ -1182,27 +1210,20 @@ #endif strncpy(fixedFileName, buf2, sizeof(fixedFileName)); } - // in version 1.0 we use DigestType and DigestValue attributes - ddocMemSetLength(&mbuf2, 300); - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || - !strcmp(pDataFile->szContentType, CONTENT_HASHCODE)) { + // in version 1.0 we use DigestType and DigestValue attributes, PR. - size fix + ddocMemSetLength(&mbuf2, 1024); + if((!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER))) { ddocEncodeBase64(ddocDataFile_GetDigestValue(pDataFile), &mbuf1); + //AM 17.11.08 moved these 2 lines after ddocEncodeBase64 + if(mbuf1.pMem && ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] == '\n') + ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] = 0; snprintf((char*)mbuf2.pMem, mbuf2.nLen, "szContentType, fixedFileName, pDataFile->szId, pDataFile->szMimeType, pDataFile->nSize, pDataFile->szDigestType, (char*)mbuf1.pMem); ddocMemBuf_free(&mbuf1); - } else { // in version 1.2 we don't use those attributes except for detached files - if(!strcmp(pDataFile->szContentType, CONTENT_DETATCHED)) { - ddocEncodeBase64(ddocDataFile_GetDetachedDigestValue(pDataFile), &mbuf1); - snprintf((char*)mbuf2.pMem, mbuf2.nLen, - "szContentType, - fixedFileName, pDataFile->szId, pDataFile->szMimeType, pDataFile->nSize, - pDataFile->szDigestType, (char*)mbuf1.pMem); - ddocMemBuf_free(&mbuf1); - } else + } else { snprintf((char*)mbuf2.pMem, mbuf2.nLen, "szContentType, fixedFileName, pDataFile->szId, pDataFile->szMimeType, pDataFile->nSize); @@ -1222,16 +1243,43 @@ // VS - ver 1.80 - in format 1.3 we started using SignedDoc schema if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) ddocMemAppendData(&mbuf2, " xmlns=\"http://www.sk.ee/DigiDoc/v1.3.0#\"", -1); -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) - ddocMemAppendData(&mbuf2, " xmlns=\"http://www.sk.ee/DigiDoc/v1.4.0#\"", -1); -#endif ddocMemAppendData(&mbuf2, ">", -1); // end of generating header + // if DataFile content is already in memory then convert to base64 and use it + if(pDataFile->mbufContent.pMem && pDataFile->mbufContent.nLen && pMBufXML) { + if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED) || + !strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) { //allready in base64 + ddocMemAppendData(&mbuf2, pDataFile->mbufContent.pMem, pDataFile->mbufContent.nLen); + } + ddocMemAppendData(&mbuf2, "", -1); + p = canonicalizeXML((char*)mbuf2.pMem, mbuf2.nLen); + RETURN_IF_NULL(p); + ddocDebug(3, "generateDataFileXML", "canonicalized df: \'%s\'", p); + //ddocDebugWriteFile(3, "df-data0.txt", &mbuf2); + SHA1_Init(&sctx); + SHA1_Update(&sctx, (const char*)p, strlen(p)); + free(p); p = 0; + len2 = sizeof(buf2); + SHA1_Final((unsigned char*)buf2, &sctx); + ddocDataFile_SetDigestValue(pDataFile, buf2, DIGEST_LEN); + if(pMBufXML) + ddocMemAppendData(pMBufXML, mbuf2.pMem, mbuf2.nLen); + ddocMemBuf_free(&mbuf2); + len1 = sizeof(buf1); + bin2hex(pDataFile->mbufDigest.pMem, pDataFile->mbufDigest.nLen, buf1, &len1); + ddocDebug(3, "generateDataFileXML", "DataFile: %s calc-digest: %s", pDataFile->szId, buf1); + len1 = sizeof(buf1); + encode((const byte*)pDataFile->mbufDigest.pMem, pDataFile->mbufDigest.nLen, (byte*)buf1, &len1); + ddocDebug(3, "generateDataFileXML", "DataFile: %s calc-digest: %s", pDataFile->szId, buf1); + + return err; + } + if(hFile) fputs((const char*)mbuf2.pMem, hFile); #ifdef WITH_BASE64_HASHING_HACK SHA1_Init(&sctx); - if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) { + if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64) && + strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { // in ddoc 1.0 we calculate hash over original data ddocMemAppendData(&mbuf2, "", -1); p = canonicalizeXML((char*)mbuf2.pMem, mbuf2.nLen); RETURN_IF_NULL(p); @@ -1244,68 +1292,98 @@ free(p); p = 0; } #endif - if(pMBufXML) { // in memory we use only for composing hashcode DataFile header for service - // we still have to calculate hash code ower the original DataFile header - p = strstr((const char*)mbuf2.pMem, "ContentType"); - if(!p) return ERR_FILE_READ; - p += 13; - *p = 0; - ddocMemAppendData(pMBufXML, (const char*)mbuf2.pMem, -1); - ddocMemAppendData(pMBufXML, CONTENT_HASHCODE, -1); - p++; - p = strchr((const char*)p, '\"'); - if(p) { - p2 = strchr((const char*)p, '>'); - if(p2) { - *p2 = 0; - ddocMemAppendData(pMBufXML, (const char*)p, -1); - // add digest - ddocMemAppendData(pMBufXML, " DigestType=\"sha1\" DigestValue=\"", -1); - // now calculate total DataFile value... - } - } - } // in base64 hashing hack mode we don't keep DF content constantly in memory #ifdef WITH_BASE64_HASHING_HACK if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) ddocMemBuf_free(&mbuf2); #endif - err = ddocConvertFileName(fixedFileName, sizeof(fixedFileName), pDataFile->szFileName); - if(err) return err; + + //err = ddocConvertFileName(fixedFileName, sizeof(fixedFileName), pDataFile->szFileName); + //if(err) return err; + strncpy(fixedFileName, pDataFile->szFileName, sizeof(fixedFileName)); // if this is our temp file not a real input file // then don't change anything in it. - if(strcmp(fixedFileName, szDataFile) != 0) { + if(strcmp(pDataFile->szFileName, szDataFile) != 0) { +#ifdef WIN32 + len2 = 0; + err = utf82unicode((const char*)szDataFile, (char**)&convFileName, &len2); + fIn = _wfopen(convFileName, L"rb"); + ddocDebug(3, "generateDataFileXML", "Opening FILE1: %s, conv-file: %s len: %d, RC: %d", szDataFile, convFileName, len2, (fIn != NULL)); + free(convFileName); // now I don't need it any more + if(fIn != NULL) { +#else if((fIn = fopen(szDataFile, "rb")) != NULL) { - ddocDebug(4, "generateDataFileXML", "Opened FILE: %s", szDataFile); - while((len1 = fread(buf1, 1, sizeof(buf1), fIn)) > 0) { +#endif + ddocDebug(4, "generateDataFileXML", "Opened FILE01: %s", szDataFile); + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) + EVP_DecodeInit(&ectx); + while((len1 = fread(buf1, 1, sizeof(buf1)-2, fIn)) > 0) { #ifdef WITH_BASE64_HASHING_HACK if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) { - ddocDebug(4, "generateDataFileXML", "sha1 update: \'%s\'", buf1); - SHA1_Update(&sctx, (const char*)buf1, len1); - mbuf3.pMem = buf1; - mbuf3.nLen = strlen(buf1); - ddocDebugWriteFile(4, "df-data0.txt", &mbuf3); + buf1[len1] = 0; +#ifdef WIN32 // must remove \r that was generated during data file extact + if(strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { + ddocCanonicalizePCDATA(buf1); + len1 = strlen(buf1); + } +#endif + if(strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { + ddocDebug(4, "generateDataFileXML", "sha1 update: \'%s\'", buf1); + SHA1_Update(&sctx, (const char*)buf1, len1); + mbuf3.pMem = buf1; + mbuf3.nLen = len1; + ddocDebugWriteFile(4, "df-data0.txt", &mbuf3); + } else { // in ddoc 1.0 we calculate hash over original data + p = buf1; + while(*p == ' ' || *p == '\n' || *p == '\r') p++; + ddocDebug(4, "generateDataFileXML", "decode: %s", p); + len2 = sizeof(buf2); + EVP_DecodeUpdate(&ectx, (unsigned char*)buf2, &len2, (unsigned char*)p, strlen(p)); + ddocDebug(4, "generateDataFileXML", "sha1 update orig: %d: dec: %d", len1, len2); + SHA1_Update(&sctx, (const char*)buf2, len2); + //ddocDebugWriteFile(4, "df-data0.txt", &mbuf3); + } } else { #endif ddocMemAppendData(&mbuf2, buf1, len1); #ifdef WITH_BASE64_HASHING_HACK } #endif + if(hFile) fwrite(buf1, sizeof(char), len1, hFile); - //if(pMBufXML) // do nothing for Hashcode dataFile body - //ddocMemAppendData(pMBufXML, buf1, len1); } fclose(fIn); - ddocDebug(4, "generateDataFileXML", "Closed FILE: %s", szDataFile); + ddocDebug(4, "generateDataFileXML", "Closed FILE01: %s", szDataFile); fIn = 0; + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { + len2 = sizeof(buf2); + EVP_DecodeFinal(&ectx, (unsigned char*)buf2, &len2); + SHA1_Update(&sctx, (const char*)buf2, len2); + ddocDebug(4, "generateDataFileXML", "sha1 final dec: %d", len1, len2); + len2 = sizeof(buf2); + SHA1_Final((unsigned char*)buf2, &sctx); + ddocDataFile_SetDigestValue(pDataFile, buf2, DIGEST_LEN); + len1 = sizeof(buf1); + bin2hex(pDataFile->mbufDigest.pMem, pDataFile->mbufDigest.nLen, buf1, &len1); + ddocDebug(3, "generateDataFileXML", "DataFile: %s calc-digest: %s", pDataFile->szId, buf1); + } } } else { // if the file must be embedded if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64) || !strcmp(pDataFile->szContentType, CONTENT_EMBEDDED)) { +#ifdef WIN32 + len2 = 0; + err = utf82unicode((const char*)fixedFileName, (char**)&convFileName, &len2); + fIn = _wfopen(convFileName, L"rb"); + ddocDebug(3, "generateDataFileXML", "Opening FILE2: %s, conv-file: %s len: %d, RC: %d", fixedFileName, convFileName, len2, (fIn != NULL)); + free(convFileName); // now I don't need it any more + if(fIn != NULL) { +#else if((fIn = fopen(fixedFileName, "rb")) != NULL) { - ddocDebug(4, "generateDataFileXML", "Opened FILE: %s", fixedFileName); +#endif + ddocDebug(4, "generateDataFileXML", "Opened FILE2: %s", fixedFileName); // if encoded if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) { EVP_EncodeInit(&ectx); @@ -1326,8 +1404,6 @@ #endif if(hFile) fwrite(buf2, sizeof(char), len2, hFile); - //if(pMBufXML) // do nothing for Hashcode dataFile body - // ddocMemAppendData(pMBufXML, buf2, len2); } EVP_EncodeFinal(&ectx, (unsigned char*)buf2, &len2); buf2[len2] = 0; @@ -1344,8 +1420,6 @@ #endif if(hFile) fwrite(buf2, sizeof(char), len2, hFile); - //if(pMBufXML) // do nothing for Hashcode dataFile body - // ddocMemAppendData(pMBufXML, buf2, len2); } else if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED)) { while((len1 = fread(buf1, 1, sizeof(buf1), fIn)) > 0) { @@ -1353,8 +1427,6 @@ ddocMemAppendData(&mbuf2, buf1, len1); if(hFile) fwrite(buf1, sizeof(char), len1, hFile); - //if(pMBufXML) - //ddocMemAppendData(pMBufXML, buf1, len1); } else if(!strcmp(pDataFile->szCharset, CHARSET_ISO_8859_1)) { len2 = sizeof(buf2); @@ -1390,24 +1462,27 @@ SET_LAST_ERROR(ERR_UNSUPPORTED_CHARSET); } fclose(fIn); - ddocDebug(4, "generateDataFileXML", "Closed FILE: %s", szDataFile); + ddocDebug(4, "generateDataFileXML", "Closed FILE2: %s", szDataFile); fIn = 0; - } else + } else { + ddocDebug(1, "generateDataFileXML", "Error reading FILE2: %s", szDataFile); err = ERR_FILE_READ; + } } } // not temp file // print suffix-whitespace //if(pDataFile->szDataSuffix) // BIO_puts(bOutFile, pDataFile->szDataSuffix); - // else for DETATCHED do nothing! setString(&(pDataFile->szDigestType), DIGEST_SHA1_NAME, -1); #ifdef WITH_BASE64_HASHING_HACK if(!strcmp(pDataFile->szContentType, CONTENT_EMBEDDED_BASE64)) { + if(strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { // in ddoc 1.0 we calculate hash over original data ddocDebug(4, "generateDataFileXML", "sha1 update: \'%s\'", ""); SHA1_Update(&sctx, "", 11); mbuf3.pMem = ""; mbuf3.nLen = strlen(""); ddocDebugWriteFile(4, "df-data0.txt", &mbuf3); + } memset(buf2, 0, sizeof(buf2)); SHA1_Final((unsigned char*)buf2, &sctx); ddocDataFile_SetDigestValue(pDataFile, buf2, DIGEST_LEN); @@ -1429,6 +1504,7 @@ SHA1((const unsigned char*)p, strlen(p), (unsigned char*)buf2); ddocDebug(4, "generateDataFileXML", "CANONICAL XML: \'%s\'", p); free(p); + ddocDebug(4, "generateDataFileXML", "will update DF digest as ctype is %s", pDataFile->szContentType); ddocDataFile_SetDigestValue(pDataFile, buf2, DIGEST_LEN); ddocEncodeBase64(ddocDataFile_GetDigestValue(pDataFile), &mbuf2); if(pMBufXML) { @@ -1448,9 +1524,11 @@ ddocMemAppendData(pMBufXML, "", -1); } if (err != ERR_OK) SET_LAST_ERROR(err); + ddocDebug(4, "generateDataFileXML", "done: %d", err); return err; } +#define DD_TEMP_FILE_MAX 200 //-------------------------------------------------- // Creates a new signed XML document @@ -1466,11 +1544,14 @@ FILE *hFile = 0; DataFile* pDf = NULL; char ** arrTempFiles = NULL; - char buf1[FILENAME_MAX]; + char buf1[1024]; DigiDocMemBuf mbuf1; - +#ifdef WIN32 + wchar_t *convFileName = 0; +#endif + RETURN_IF_NULL_PARAM(pSigDoc); - RETURN_IF_NULL_PARAM(szSigDocFile || pMBufXML); + //RETURN_IF_NULL_PARAM(szSigDocFile || pMBufXML); mbuf1.pMem = 0; mbuf1.nLen = 0; buf1[0] = 0; @@ -1488,44 +1569,42 @@ for(i = 0; i < nFiles; i++) { pDf = getDataFile(pSigDoc, i); ddocDebug(3, "createSignedXMLDoc", "DataFile: %s - %s", pDf->szId, pDf->szFileName); - arrTempFiles[i] = (char*)malloc(FILENAME_MAX); + arrTempFiles[i] = (char*)malloc(DD_TEMP_FILE_MAX); arrTempFiles[i][0] = 0; // do not copy newly added files if(!strchr((const char*)pDf->szFileName, '/') && !strchr((const char*)pDf->szFileName, '\\')) { - err = getTempFileName(arrTempFiles[i], FILENAME_MAX); + err = getTempFileName(arrTempFiles[i], DD_TEMP_FILE_MAX); // VS: test the new parser based on xmlReader interface //err = ddocXRdrCopyDataFile(pSigDoc, szOldFile, (const char*)arrTempFiles[i], pDf->szId, CHARSET_ISO_8859_1, CHARSET_ISO_8859_1); - ddocDebug(3, "createSignedXMLDoc", "Store DataFile: %s to: %s", pDf->szId, (const char*)arrTempFiles[i]); + ddocDebug(3, "createSignedXMLDoc", "Store DataFile: %s to: %s size: %d", pDf->szId, (const char*)arrTempFiles[i], pDf->nSize); err = ddocExtractDataFile(pSigDoc, szOldFile, (const char*)arrTempFiles[i], pDf->szId, "NO-CHANGE"); - } + } } } if(szSigDocFile) { - err = ddocConvertFileName(buf1, sizeof(buf1), szSigDocFile); - if(err) return err; +#ifdef WIN32 + i = 0; + err = utf82unicode((const char*)szSigDocFile, (char**)&convFileName, &i); + ddocDebug(3, "createSignedXMLDoc", "Opening FILE: %s, conv-file: %s len: %d", szSigDocFile, convFileName, i); + if(err) return err; +#else + err = ddocConvertFileName(buf1, sizeof(buf1), szSigDocFile); + ddocDebug(3, "createSignedXMLDoc", "Opening FILE: %s", buf1); + if(err) return err; +#endif } // now create the new document - ddocDebug(3, "createSignedXMLDoc", "Opening FILE: %s", buf1); +#ifdef WIN32 + if((szSigDocFile && (hFile = _wfopen(convFileName, L"wb")) != NULL) || pMBufXML) { +#else if((szSigDocFile && (hFile = fopen(buf1, "wb")) != NULL) || pMBufXML) { +#endif if(szSigDocFile) fputs("\n", hFile); if(pMBufXML) ddocMemAppendData(pMBufXML, "\n", -1); // VS: ver 1.80 - in version 1.3 we started using SignedDoc namespace -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - if(szSigDocFile) - fprintf(hFile, "\n", pSigDoc->szFormat, pSigDoc->szFormatVer); - if(pMBufXML) { - ddocMemAppendData(pMBufXML, "szFormat, -1); - ddocMemAppendData(pMBufXML, "\" version=\"", -1); - ddocMemAppendData(pMBufXML, pSigDoc->szFormatVer, -1); - ddocMemAppendData(pMBufXML, "\" xmlns=\"http://www.sk.ee/DigiDoc/v1.4.0#\">\n", -1); - } - } else -#endif if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) { if(szSigDocFile) fprintf(hFile, "\n", pSigDoc->szFormat, pSigDoc->szFormatVer); @@ -1550,29 +1629,34 @@ // DataFile objects for(i = 0; i < nFiles; i++) { pDf = getDataFile(pSigDoc, i); + ddocDebug(3, "createSignedXMLDoc", "DF: %d file: %s temp: %s", i, pDf->szFileName, (arrTempFiles ? arrTempFiles[i] : "NONE")); // if the file must be embedded if(arrTempFiles && arrTempFiles[i] && checkFileExists(arrTempFiles[i])) { - ddocDebug(3, "createSignedXMLDoc", "Use temp file: %s", arrTempFiles[i]); - err = generateDataFileXML(pSigDoc, pDf, (const char*)arrTempFiles[i], hFile, pMBufXML); - } else { - err = ddocConvertFileName(buf1, sizeof(buf1), pDf->szFileName); - if(err) { - if(hFile) fclose(hFile); - return err; - } - ddocDebug(3, "createSignedXMLDoc", "Create new data file: %s", buf1); - err = generateDataFileXML(pSigDoc, pDf, (const char*)buf1, hFile, pMBufXML); - } + ddocDebug(3, "createSignedXMLDoc", "Use temp file: %s", arrTempFiles[i]); + err = generateDataFileXML(pSigDoc, pDf, (const char*)arrTempFiles[i], hFile, &mbuf1); + ddocDebug(3, "createSignedXMLDoc", "Use temp file: %s rc: %d", arrTempFiles[i], err); + if(!err && pMBufXML) + ddocMemAppendData(pMBufXML, mbuf1.pMem, mbuf1.nLen); + ddocMemBuf_free(&mbuf1); + ddocDebug(3, "createSignedXMLDoc", "Used temp file: %s", arrTempFiles[i]); + } else if(checkFileExists(pDf->szFileName) || pDf->mbufContent.pMem) { // TODO: test id out-mem sign works + ddocDebug(3, "createSignedXMLDoc", "Create new data file: %s", pDf->szFileName); + err = generateDataFileXML(pSigDoc, pDf, (const char*)pDf->szFileName, hFile, &mbuf1); + ddocDebug(3, "createSignedXMLDoc", "Create new data file: %s rc: %d", pDf->szFileName, err); + if(!err && pMBufXML) + ddocMemAppendData(pMBufXML, mbuf1.pMem, mbuf1.nLen); + ddocMemBuf_free(&mbuf1); + ddocDebug(3, "createSignedXMLDoc", "Created new data file: %s", pDf->szFileName); + } if(szSigDocFile) fputs("\n", hFile); if(pMBufXML) ddocMemAppendData(pMBufXML, "\n", -1); } + ddocDebug(3, "createSignedXMLDoc", "Gen sigs"); for(i = 0; i < pSigDoc->nSignatures; i++) { - // VS: deny writing orphoned signatures ! - /* if(pSigDoc->pSignatures[i]->pSigValue && - (pSigDoc->pSignatures[i]->pSigValue->mbufSignatureValue.pMem || - pSigDoc->pSignatures[i]->mbufOrigContent.pMem)) {*/ + ddocDebug(3, "createSignedXMLDoc", "Gen sig: %d", i); + // VS: if Signature has been read from file then // use the original content if(pSigDoc->pSignatures[i]->mbufOrigContent.pMem) { @@ -1590,7 +1674,6 @@ err = ddocMemAppendData(pMBufXML, (const char*)mbuf1.pMem, mbuf1.nLen); ddocMemBuf_free(&mbuf1); } - // } } // for i < pSigDoc->nSignatures if(szSigDocFile) { fputs("", hFile); @@ -1601,6 +1684,8 @@ } if(pMBufXML) ddocMemAppendData(pMBufXML, "", -1); + ddocDebug(3, "createSignedXMLDoc", "Generated"); + // delete temporary files we created when // extracting the data files from original XML signed doc // VS: fix the bug of deleting input files @@ -1611,14 +1696,19 @@ for(i = 0; i < nFiles; i++) { pDf = getDataFile(pSigDoc, i); // ignore not being able to delete temp file. It returns -1 - _unlink((const char*)arrTempFiles[i]); + //_unlink((const char*)arrTempFiles[i]); free(arrTempFiles[i]); } free(arrTempFiles); } } else err = ERR_FILE_WRITE; + ddocDebug(3, "createSignedXMLDoc", "Cleanup1"); +#ifdef WIN32 + if(convFileName) free(convFileName); +#endif if (err != ERR_OK) SET_LAST_ERROR(err); + ddocDebug(3, "createSignedXMLDoc", "Done"); return err; } @@ -1630,17 +1720,27 @@ //-------------------------------------------------- EXP_OPTION int createSignedDoc(SignedDoc* pSigDoc, const char* szOldFile, const char* szOutputFile) { - int err = ERR_OK; - + int err = ERR_OK; + long lSize = 0; RETURN_IF_NULL_PARAM(pSigDoc); RETURN_IF_NULL_PARAM(szOutputFile); RETURN_IF_NULL_PARAM(pSigDoc->szFormat); - + if(szOldFile && strlen(szOldFile)) { + calculateFileSize(szOldFile, &lSize); + ddocDebug(3, "createSignedDoc", "Old file: %s ddoc-size: %ld", szOldFile, lSize); + if(lSize == 0) { + ddocDebug(1, "createSignedDoc", "Invalid old file: %s ddoc-size: %ld", szOldFile, lSize); + SET_LAST_ERROR(ERR_FILE_READ); + return ERR_FILE_READ; + } + } clearErrors(); if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) || - !strcmp(pSigDoc->szFormat, DIGIDOC_XML_1_1_NAME)) { - err = createSignedXMLDoc(pSigDoc, szOldFile, szOutputFile, NULL); - } + !strcmp(pSigDoc->szFormat, DIGIDOC_XML_1_1_NAME) + ) { + err = createSignedXMLDoc(pSigDoc, szOldFile, szOutputFile, NULL); + ddocDebug(3, "createSignedDoc", "Done"); + } else err = ERR_UNSUPPORTED_FORMAT; if (err != ERR_OK) SET_LAST_ERROR(err); @@ -1664,7 +1764,7 @@ clearErrors(); if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) || !strcmp(pSigDoc->szFormat, DIGIDOC_XML_1_1_NAME)) { - err = createSignedXMLDoc(pSigDoc, szOldFile, NULL, pMBuf); + err = createSignedXMLDoc(pSigDoc, szOldFile, NULL, pMBuf); } else err = ERR_UNSUPPORTED_FORMAT; @@ -1672,7 +1772,6 @@ return err; } - //-------------------------------------------------- // Removes incomplete or orphoned signatures. // Signature is incomplete if it hasn't got the signature diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocGen.h libdigidoc-3.7.0.875/libdigidoc/DigiDocGen.h --- libdigidoc-2.7.0/libdigidoc/DigiDocGen.h 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocGen.h 2012-12-13 22:05:47.000000000 +0000 @@ -122,6 +122,8 @@ //============================================================ char* canonicalizeXML(char* source, int len); +char* canonicalizeXMLBlock(char* source, int len, char* block, char* prefix); + //============================================================ // Creates a XML block // pSigDoc - signed document pointer @@ -139,7 +141,7 @@ // hFile - output file handle // pMBufXML - output buffer if we want data to be returned in mem buf //============================================================ -int generateDataFileXML(SignedDoc* pSigDoc, DataFile* pDataFile, +EXP_OPTION int generateDataFileXML(SignedDoc* pSigDoc, DataFile* pDataFile, const char* szDataFile, FILE* hFile, DigiDocMemBuf* pMBufXML); //-------------------------------------------------- diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocGlobals.c libdigidoc-3.7.0.875/libdigidoc/DigiDocGlobals.c --- libdigidoc-2.7.0/libdigidoc/DigiDocGlobals.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocGlobals.c 2012-12-13 22:05:47.000000000 +0000 @@ -46,13 +46,20 @@ p->g_bAddSigAndRefsTimeStamp = 1; p->g_nTsaMaxTsInterval = 1; p->m_nDebugLevel = 0; - strncpy(p->g_szTsaUrl, "http://ns.szikszi.hu:8080/tsa", sizeof(p->g_szTsaUrl)); memset(p->m_szDebugFilePath, 0, sizeof(p->m_szDebugFilePath)); // VS: changed initialization + g_current_TSAProfile = p; } // init config store - initConfigStore(NULL); + if(!isConfigInited()) + initConfigStore(NULL); } return p; } +EXP_OPTION void TSAProfile_free() +{ + if(g_current_TSAProfile) + free(g_current_TSAProfile); + g_current_TSAProfile = 0; +} \ No newline at end of file diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocGlobals.h libdigidoc-3.7.0.875/libdigidoc/DigiDocGlobals.h --- libdigidoc-2.7.0/libdigidoc/DigiDocGlobals.h 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocGlobals.h 2012-12-13 22:05:47.000000000 +0000 @@ -57,9 +57,9 @@ // default TSAProfile (to be extended) -extern LPTSAProfile g_current_TSAProfile; - +//extern LPTSAProfile g_current_TSAProfile; +EXP_OPTION void TSAProfile_free(); #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocHTTP.c libdigidoc-3.7.0.875/libdigidoc/DigiDocHTTP.c --- libdigidoc-2.7.0/libdigidoc/DigiDocHTTP.c 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocHTTP.c 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,44 @@ +#include +#include +#include +#include +#include + +//-------------------------------------------------- +// Returns HTTP return code +// pBuf- buffer with HTTP response +// returns error code or HTTP response code +//-------------------------------------------------- +int ddocGetHttpResponseCode(DigiDocMemBuf* pBuf) +{ + int rc = ERR_OK; + char *p = (char*)pBuf->pMem; + RETURN_IF_NULL_PARAM(pBuf); + if(p && !strncmp(p, "HTTP", 4)) { + while(*p && *p != ' ') p++; + while(*p && !isdigit(*p)) p++; + rc = atoi(p); + } else + return ERR_HTTP_ERR; + return rc; +} + +//-------------------------------------------------- +// Returns HTTP response body +// pInBuf- buffer with HTTP response +// pOutBuf - buffer for response body +// returns error code or ERR_OK +//-------------------------------------------------- +int ddocGetHttpPayload(DigiDocMemBuf* pInBuf, DigiDocMemBuf* pOutBuf) +{ + int err = ERR_OK; + char *p; + RETURN_IF_NULL_PARAM(pInBuf); + RETURN_IF_NULL_PARAM(pOutBuf); + if((p = strstr((char*)pInBuf->pMem, "\r\n\r\n")) != NULL) { + p += 4; + err = ddocMemAssignData(pOutBuf, p, pInBuf->nLen - (int)(p - (char*)pInBuf->pMem)); + } else + return ERR_HTTP_ERR; + return err; +} diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocHTTP.h libdigidoc-3.7.0.875/libdigidoc/DigiDocHTTP.h --- libdigidoc-2.7.0/libdigidoc/DigiDocHTTP.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocHTTP.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,4 @@ +#include + +int ddocGetHttpResponseCode(DigiDocMemBuf* pBuf); +int ddocGetHttpPayload(DigiDocMemBuf* pInBuf, DigiDocMemBuf* pOutBuf); diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocLib.c libdigidoc-3.7.0.875/libdigidoc/DigiDocLib.c --- libdigidoc-2.7.0/libdigidoc/DigiDocLib.c 2010-01-28 17:13:46.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocLib.c 2012-12-13 22:05:47.000000000 +0000 @@ -88,10 +88,11 @@ #define WIN32_PKCS 1 #ifdef WIN32 - #include #include #endif +#include + #include #include #include @@ -99,6 +100,8 @@ #include #include #include +//AM +#include #include #include @@ -130,22 +133,16 @@ char g_szLibName[] = "CDigiDoc"; char g_szLibVer[] = DIGIDOC_VERSION; //char g_szLibVer[] = VERSION; -char* g_szSupportedVersions[] = { "1.0", "1.1", "1.2", "1.3" -#ifdef WITH_TS - , "1.4" -#endif +char* g_szSupportedVersions[] = { "1.0", "1.1", "1.2", "1.3", "0.7" }; -char* g_arrFormats[] = { SK_XML_1_NAME, 0 }; +char* g_arrFormats[] = { SK_XML_1_NAME, DIGIDOC_XML_1_1_NAME, 0 }; FormatAndVer g_supportedFormatsAndVersions[] = { { SK_XML_1_NAME, SK_XML_1_VER }, { DIGIDOC_XML_1_1_NAME, DIGIDOC_XML_1_1_VER }, { DIGIDOC_XML_1_1_NAME, DIGIDOC_XML_1_2_VER }, { DIGIDOC_XML_1_1_NAME, DIGIDOC_XML_1_3_VER }, -#ifdef WITH_TS - { DIGIDOC_XML_1_1_NAME, DIGIDOC_XML_1_4_VER }, -#endif { NULL, NULL } // list end marker }; @@ -275,7 +272,7 @@ EXP_OPTION void initDigiDocLib() { memset(g_szGUIVersion, 0, sizeof(g_szGUIVersion)); -#if defined(__FreeBSD__) || defined(__APPLE__) +#if defined(__FreeBSD__) struct tm local_tm; time_t t; time(&t); @@ -283,10 +280,12 @@ _timezone = - local_tm.tm_gmtoff; _daylight = local_tm.tm_isdst; #endif + //ddocDebug(1, "initDigiDocLib", "init openssl & digidoc lib"); ERR_load_ERR_strings(); ERR_load_crypto_strings(); ERR_clear_error(); OpenSSL_add_all_algorithms(); + SSL_library_init(); #ifdef WIN32 InitializeCriticalSection(&cs_ddocErrors); InitializeCriticalSection(&cs_ddocLocaltime); @@ -356,7 +355,6 @@ byte* pDigestBuf, int* nDigestLen, long* lFileLen) { int err = ERR_OK; - SHA_CTX ctx; byte buf[FILE_BUFSIZE]; int i; FILE *f = NULL; @@ -369,7 +367,8 @@ memset(pDigestBuf, 0, *nDigestLen); if(nDigestType == DIGEST_SHA1) { if(*nDigestLen >= SHA_DIGEST_LENGTH) { - *nDigestLen = SHA_DIGEST_LENGTH; + SHA_CTX ctx; + *nDigestLen = SHA_DIGEST_LENGTH; if((f = fopen(szFileName,"rb")) != NULL) { //byte *data,*temp_data; SHA1_Init(&ctx); @@ -388,6 +387,29 @@ } else err = ERR_DIGEST_LEN; + } //AM 22.04.08 + else if(nDigestType == DIGEST_SHA256){ + if(*nDigestLen >= SHA_DIGEST_LENGTH) { + SHA256_CTX ctx; + *nDigestLen = SHA256_DIGEST_LENGTH; + if((f = fopen(szFileName,"rb")) != NULL) { + //byte *data,*temp_data; + SHA256_Init(&ctx); + *lFileLen = 0; + for (;;) { + i = fread(buf, sizeof(char), FILE_BUFSIZE, f); + if (i <= 0) break; + *lFileLen += i; + SHA256_Update(&ctx, buf, (unsigned long)i); + } + SHA256_Final(pDigestBuf,&ctx); + fclose(f); + } // if - fopen + else + err = ERR_FILE_READ; + } + else + err = ERR_DIGEST_LEN; } else err = ERR_UNSUPPORTED_DIGEST; @@ -405,16 +427,32 @@ EXP_OPTION int calculateFileSize(const char* szFileName, long* lFileLen) { FILE* hFile = 0; +#ifdef WIN32 + int i = 0, err = ERR_OK; + wchar_t *convFileName = 0; +#endif RETURN_IF_NULL_PARAM(szFileName); RETURN_IF_NULL_PARAM(lFileLen); + if(!szFileName || !strlen(szFileName)) return 0; +#ifdef WIN32 + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + ddocDebug(3, "calculateFileSize", "Opening FILE: %s, conv-file: %s len: %d", szFileName, convFileName, i); + if((hFile = _wfopen(convFileName,L"rb")) != NULL) { +#else if((hFile = fopen(szFileName,"rb")) != NULL) { +#endif fseek(hFile, 0, SEEK_END); - *lFileLen = ftell(hFile); + (*lFileLen) = ftell(hFile); + ddocDebug(3, "calculateFileSize", "Closing FILE: %s, size: %ld", szFileName, (*lFileLen)); fclose(hFile); } // if - fopen else SET_LAST_ERROR_RETURN_CODE(ERR_FILE_READ); +#ifdef WIN32 + if(convFileName) free(convFileName); +#endif + return ERR_OK; } @@ -551,7 +589,13 @@ if(*nDigestLen >= SHA_DIGEST_LENGTH) { *nDigestLen = SHA_DIGEST_LENGTH; SHA1(data, nDataLen, pDigestBuf); - } + } + }//AM 22.04.08 + else if(nDigestType == DIGEST_SHA256) { + if(*nDigestLen >= SHA256_DIGEST_LENGTH) { + *nDigestLen = SHA256_DIGEST_LENGTH; + SHA256(data, nDataLen, pDigestBuf); + } else err = ERR_DIGEST_LEN; } @@ -588,7 +632,7 @@ //============================================================ // Get the absolute filename with path //============================================================ -EXP_OPTION int getFullFileName(const char* szFileName, char* szDest, size_t len) +EXP_OPTION int getFullFileName(const char* szFileName, char* szDest, int len) { int err = ERR_OK; memset(szDest, 0, len); @@ -598,13 +642,13 @@ } else { // local filename, must prepend directory _getcwd(szDest, len); #ifdef WIN32 - if(strlen(szDest) < len - 2) + if(strlen(szDest) < (size_t)(len - 2)) strncat(szDest, "\\", sizeof(szDest) - strlen(szDest)); #else - if(strlen(szDest) < len - 2) + if(strlen(szDest) < (size_t)(len - 2)) strncat(szDest, "/", sizeof(szDest) - strlen(szDest)); #endif - if(strlen(szDest) + strlen(szFileName) < len - 2) + if(strlen(szDest) + strlen(szFileName) < (size_t)(len - 2)) strncat(szDest, szFileName, sizeof(szDest) - strlen(szDest)); } return err; @@ -614,7 +658,7 @@ //============================================================ // Get the path part of full file name //============================================================ -EXP_OPTION int getFileNamePath(const char* szFileName, char* szPath, size_t len) +EXP_OPTION int getFileNamePath(const char* szFileName, char* szPath, int len) { int nFound = 0, i, err = ERR_OK; @@ -638,28 +682,19 @@ // Gets a new temporary filename // buf - filename buffer //============================================================ -EXP_OPTION int getTempFileName(char* szFileName, size_t len) +EXP_OPTION int getTempFileName(char* szFileName, int len) { - char tbuf[200]; -#ifdef WIN32 - char* pFileName = 0; -#else int f = 0; -#endif + char* pFileName = 0; RETURN_IF_NULL_PARAM(szFileName); memset(szFileName, 0, len); #ifdef WIN32 - GetTempPath(sizeof(tbuf), tbuf); - pFileName = _tempnam(tbuf, "ddoc"); - strncpy(szFileName, pFileName, len); - free(pFileName); + pFileName = _tempnam(0, "ddoc"); #else - strncpy(tbuf, "/tmp/ddocXXXXXX", sizeof(tbuf)); - f = mkstemp(tbuf); - if (f > 0) // Maybe we should use the file instead of closing it and reopening later? - close(f); - strncpy(szFileName, tbuf, len); + pFileName = tempnam(0, "ddoc"); #endif + strncpy(szFileName, pFileName, len); + free(pFileName); return ERR_OK; } @@ -709,18 +744,26 @@ //-------------------------------------------------- EXP_OPTION int checkFileExists(const char* szFileName) { - FILE* hFile; - int exists = 0, err; - char buf1[300]; - - err = ddocConvertFileName(buf1, sizeof(buf1), szFileName); - if(err) return 0; // return doesn't exist if error - if (strlen(buf1) > 0) { - if((hFile = fopen(buf1, "r")) != NULL) { + FILE* hFile = 0; + int exists = 0; +#ifdef WIN32 + int i = 0, err = ERR_OK; + wchar_t *convFileName = 0; +#endif + if(szFileName && strlen(szFileName) > 0) { +#ifdef WIN32 + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); + if((hFile = _wfopen(convFileName, L"r")) != NULL) { +#else + if((hFile = fopen(szFileName, "r")) != NULL) { +#endif exists = 1; fclose(hFile); } } +#ifdef WIN32 + if(convFileName) free(convFileName); +#endif return exists; } @@ -759,7 +802,7 @@ RETURN_IF_NULL_PARAM(pRecvData); RETURN_IF_NULL_PARAM(url); - ddocDebug(3, "ddocPullUrl", "URL: %s, in: %d bytes", url, pSendData->nLen); + ddocDebug(4, "ddocPullUrl", "URL: %s, in: %d bytes", url, pSendData->nLen); //there is an HTTP proxy - connect to that instead of the target host if (proxyHost != 0 && *proxyHost != '\0') { host = (char*)proxyHost; @@ -774,8 +817,10 @@ } if((cbio = BIO_new_connect(host)) != 0) { - if(port != NULL) + ddocDebug(4, "ddocPullUrl", "Host: %s port: %s", host, port); + if(port != NULL) { BIO_set_conn_port(cbio, port); + } if(use_ssl == 1) { ctx = SSL_CTX_new(SSLv23_client_method()); SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); @@ -909,8 +954,7 @@ EXP_OPTION int ddocGetSignedHash(SignatureInfo* pSigInfo, char* pBuf, int* pBufLen, int enc, int bWithAsn1Prefix) { - int err = ERR_OK; - size_t l1 = 0; + int err = ERR_OK, l1 = 0; char buf1[50]; DigiDocMemBuf *pMBuf; @@ -931,7 +975,7 @@ err = ERR_BUF_LEN; } else { - if(sizeof(buf1) > pMBuf->nLen) { + if(sizeof(buf1) > (size_t)pMBuf->nLen) { memcpy(buf1, pMBuf->pMem, pMBuf->nLen); l1 = pMBuf->nLen; } @@ -941,7 +985,7 @@ bin2hex((const byte*)buf1, l1, (char*)pBuf, pBufLen); } else if(enc == 1) { // base64 mode if(bWithAsn1Prefix) { - if(sizeof(buf1) > sizeof(g_sigPrefix) + pMBuf->nLen) { + if(sizeof(buf1) > sizeof(g_sigPrefix) + (size_t)pMBuf->nLen) { memcpy(buf1, g_sigPrefix, sizeof(g_sigPrefix)); memcpy(buf1 + sizeof(g_sigPrefix), pMBuf->pMem, pMBuf->nLen); l1 = pMBuf->nLen + sizeof(g_sigPrefix); @@ -950,7 +994,7 @@ err = ERR_BUF_LEN; } else { - if(sizeof(buf1) > pMBuf->nLen) { + if(sizeof(buf1) > (size_t)pMBuf->nLen) { memcpy(buf1, pMBuf->pMem, pMBuf->nLen); l1 = pMBuf->nLen; } @@ -960,7 +1004,7 @@ encode((const byte*)buf1, l1, (byte*)pBuf, pBufLen); } else { if(bWithAsn1Prefix) { - if(*pBufLen > sizeof(g_sigPrefix) + pMBuf->nLen) { + if(*pBufLen > (int)sizeof(g_sigPrefix) + pMBuf->nLen) { memcpy(pBuf, g_sigPrefix, sizeof(g_sigPrefix)); memcpy(pBuf + sizeof(g_sigPrefix), pMBuf->pMem, pMBuf->nLen); *pBufLen = pMBuf->nLen + sizeof(g_sigPrefix); @@ -980,7 +1024,6 @@ return err; } - //================< deprecated functions> ================================= #ifdef WITH_DEPRECATED_FUNCTIONS diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocLib.h libdigidoc-3.7.0.875/libdigidoc/DigiDocLib.h --- libdigidoc-2.7.0/libdigidoc/DigiDocLib.h 2010-01-28 16:54:31.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocLib.h 2012-12-13 22:05:47.000000000 +0000 @@ -98,7 +98,7 @@ //-------------------------------------------------- EXP_OPTION int ddocLocalTime(time_t* pTime, struct tm* pTmStruct, int bLocal); -EXP_OPTION int getTempFileName(char* szFileName, size_t len); +EXP_OPTION int getTempFileName(char* szFileName, int len); //==========< general crypto fucntions >============ @@ -172,9 +172,9 @@ // Get the filename part of full file name EXP_OPTION const char* getSimpleFileName(const char* szFileName); // Get the absolute filename with path -EXP_OPTION int getFullFileName(const char* szFileName, char* szDest, size_t len); +EXP_OPTION int getFullFileName(const char* szFileName, char* szDest, int len); // Get the path part of full file name - EXP_OPTION int getFileNamePath(const char* szFileName, char* szPath, size_t len); + EXP_OPTION int getFileNamePath(const char* szFileName, char* szPath, int len); //------------------------ ?? diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocMem.c libdigidoc-3.7.0.875/libdigidoc/DigiDocMem.c --- libdigidoc-2.7.0/libdigidoc/DigiDocMem.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocMem.c 2012-12-13 22:05:47.000000000 +0000 @@ -93,6 +93,16 @@ return ddocMemAppendData(pBuf, data, len); } +EXP_OPTION int ddocMemAssignData2(DigiDocMemBuf* pBuf, const char* data, long len) +{ + RETURN_IF_NULL_PARAM(pBuf); + RETURN_IF_NULL_PARAM(data); + // ddocDebug(7, "ddocAssignData", "Len: %d data: \'%s\'", len, data); + pBuf->pMem = 0; + pBuf->nLen = 0; + return ddocMemAppendData(pBuf, data, len); +} + //-------------------------------------------------- // Helper function to free/cleanup memory buffer // This does not attempt to release the buffer object @@ -118,12 +128,19 @@ //-------------------------------------------------- EXP_OPTION int ddocMemAssignString(char** dest, const char* src) { + int i; RETURN_IF_NULL_PARAM(dest); RETURN_IF_NULL_PARAM(src); if(*dest) free(*dest); - *dest = (char*)strdup(src); + i = strlen(src) + 10; + *dest = malloc(i); + if(*dest) { + memset(*dest, 0, i); + strncpy(*dest, src, strlen(src)); + } + //*dest = (char*)strdup(src); if(!dest) SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) else @@ -161,6 +178,60 @@ } return err; } +//AM SMARTLINK +EXP_OPTION int ddocMemGetSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2, + const char* search, const char* replacement) +{ + int err = ERR_OK, i, n,found=0; + + RETURN_IF_NULL_PARAM(pBuf1); + RETURN_IF_NULL_PARAM(pBuf1->pMem); + RETURN_IF_NULL_PARAM(pBuf2); + RETURN_IF_NULL_PARAM(search); + RETURN_IF_NULL_PARAM(replacement); + //ddocDebug(7, "ddocMemReplaceSubstr", "Replace: \'%s\' with: \'%s\' in: \'%s\'", + // search, replacement, (const char*)pBuf1->pMem); + ddocMemBuf_free(pBuf2); + n = strlen(search); + for(i = 0; !err && (i < pBuf1->nLen); i++) { + if(!strncmp((char*)pBuf1->pMem + i, search, n) && !found) { // match + err = ddocMemAppendData(pBuf2, search, -1); + i += strlen(search) - 1; found = 1; + } else if (found){ + if(!strncmp((char*)pBuf1->pMem + i, replacement, n) && found) { // match + err = ddocMemAppendData(pBuf2, replacement, -1); + i += strlen(replacement) - 1; break; + } + err = ddocMemAppendData(pBuf2, (char*)pBuf1->pMem + i, 1); + } + } + return err; +} + + +//-------------------------------------------------- +// Replaces a substring with another substring +// pBuf1 - memory buffer to search in +// pBuf2 - memory buffer to write converted value to +// search - search value +// replacement - replacement value +//-------------------------------------------------- +EXP_OPTION char *replaceStr(char *str, char *orig, char *rep) +{ + static char buffer[4096]; + char *p; + + if(!(p = strstr(str, orig))) + return str; + + strncpy(buffer, str, p-str); + buffer[p-str] = '\0'; + + sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig)); + + return buffer; +} + //-------------------------------------------------- // Compares memory buffers diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocMem.h libdigidoc-3.7.0.875/libdigidoc/DigiDocMem.h --- libdigidoc-2.7.0/libdigidoc/DigiDocMem.h 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocMem.h 2012-12-13 22:05:47.000000000 +0000 @@ -51,6 +51,7 @@ // len - length of data or -1 for zero terminated strings //-------------------------------------------------- EXP_OPTION int ddocMemAssignData(DigiDocMemBuf* pBuf, const char* data, long len); + EXP_OPTION int ddocMemAssignData2(DigiDocMemBuf* pBuf, const char* data, long len); //-------------------------------------------------- // Helper function to set buffer length as required @@ -85,6 +86,9 @@ //-------------------------------------------------- EXP_OPTION int ddocMemReplaceSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2, const char* search, const char* replacment); + EXP_OPTION int ddocMemGetSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2, + const char* search, const char* replacment); +EXP_OPTION char *replaceStr(char *str, char *orig, char *rep); //-------------------------------------------------- // Compares memory buffers // pBuf1 - memory buffer to value 1 diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocOCSP.c libdigidoc-3.7.0.875/libdigidoc/DigiDocOCSP.c --- libdigidoc-2.7.0/libdigidoc/DigiDocOCSP.c 2009-06-13 18:31:10.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocOCSP.c 2012-12-13 22:05:47.000000000 +0000 @@ -28,7 +28,7 @@ #include #include #include - +#include #include #include #include @@ -41,9 +41,53 @@ #include #include #include +#include + +#ifdef FRAMEWORK +#ifdef __APPLE__ +#include +#endif + +static int password_callback(char *buf, int bufsiz, int verify, void *cb_data) +{ + static const char password[] = "pass"; + int res = strlen(password); + if (res > bufsiz) + res = bufsiz; + memcpy(buf, password, res); + return res; +} +#endif //================< OCSP functions> ================================= +static int ddocOcspProxyAuthInfo(char *authinfo, const char *user, const char *pass) +{ + BIO *b64 = 0, *hash = 0; + char *data = 0; + + RETURN_IF_NULL_PARAM(authinfo); + authinfo[0] = 0; + + if(!user && !pass) + return ERR_OK; + + b64 = BIO_new(BIO_f_base64()); + RETURN_IF_NOT(b64, ERR_NULL_POINTER); + BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); + + hash = BIO_push(b64, BIO_new(BIO_s_mem())); + RETURN_IF_NOT(hash, ERR_NULL_POINTER); + + BIO_printf(hash, "%s:%s", user, pass); + (void)BIO_flush(hash); + + BIO_get_mem_data(hash, &data); + sprintf(authinfo, "Proxy-Authorization: Basic %s\r\n", data); + + BIO_free_all(hash); + return ERR_OK; +} //============================================================ @@ -240,7 +284,8 @@ int calcNotaryDigest(SignedDoc* pSigDoc, NotaryInfo* pNotary) { int err = ERR_OK, l1; - char buf1[25]; + //AM 24.04.08 increased buffer size for sha256 + char buf1[DIGEST_LEN256+2]; RETURN_IF_NULL_PARAM(pNotary); RETURN_IF_NULL_PARAM(pSigDoc); @@ -274,13 +319,18 @@ OCSP_SINGLERESP *single = NULL; OCSP_CERTID *cid = NULL; X509_EXTENSION *nonce; - //AM 26.09.08 - DigiDocMemBuf mbuf1; - mbuf1.pMem = 0; - mbuf1.nLen = 0; + //AM 26.09.08 + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; + RETURN_IF_NULL_PARAM(pNotary); RETURN_IF_NULL_PARAM(resp); + ddocDebug(3, "initializeNotaryInfoWithOCSP", "OCSP status: %d", OCSP_response_status(resp)); + // save the response in memory + err = ddocNotInfo_SetOCSPResponse_Value(pNotary, resp); + // check the OCSP Response validity switch(OCSP_response_status(resp)) { case OCSP_RESPONSE_STATUS_SUCCESSFUL: // OK @@ -298,12 +348,13 @@ default: SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNSUCCESSFUL); } - RETURN_IF_NULL_PARAM(resp->responseBytes);; + RETURN_IF_NULL_PARAM(resp->responseBytes); rb = resp->responseBytes; if(OBJ_obj2nid(rb->responseType) != NID_id_pkix_OCSP_basic) SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNKNOWN_TYPE); if((br = OCSP_response_get1_basic(resp)) == NULL) SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_BASIC_RESP); + ddocDebug(4, "initializeNotaryInfoWithOCSP", "test2"); rd = br->tbsResponseData; if(ASN1_INTEGER_get(rd->version) != 0) SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_WRONG_VERSION); @@ -342,13 +393,125 @@ err = asn1time2str(pSigDoc, rd->producedAt, buf, sizeof(buf)); setString(&(pNotary->timeProduced), buf, -1); n = sizeof(buf); - if(rid->type == V_OCSP_RESPID_NAME) { + if(rid->type == V_OCSP_RESPID_NAME){ //X509_NAME_oneline(rid->value.byName,buf,n); - //AM 26.09.08 - err = ddocCertGetDNFromName(rid->value.byName, &mbuf1); - RETURN_IF_NOT(err == ERR_OK, err); - err = ddocNotInfo_SetResponderId(pNotary, (char*)mbuf1.pMem, -1); - ddocMemBuf_free(&mbuf1); + err = ddocCertGetDNFromName(rid->value.byName, &mbuf1); + err = ddocNotInfo_SetResponderId(pNotary, (char*)mbuf1.pMem, -1); + ddocMemBuf_free(&mbuf1); + } + if(rid->type == V_OCSP_RESPID_KEY) { + err = ddocNotInfo_SetResponderId(pNotary, (const char*)rid->value.byKey->data, rid->value.byKey->length); + } + // digest type + i2t_ASN1_OBJECT(buf,sizeof(buf),cid->hashAlgorithm->algorithm); + //AM 24.11.09 why its needed? added if. 08.12.09 used for gen + if(!pNotary->szDigestType){ + setString(&(pNotary->szDigestType), buf, -1); + } + // signature algorithm + i2t_ASN1_OBJECT(buf,sizeof(buf),br->signatureAlgorithm->algorithm); + setString(&(pNotary->szSigType), buf, -1); + // notary cert + if(notCert && !err) + err = addNotaryInfoCert(pSigDoc, pNotary, notCert); + // get the digest from original OCSP data + if(initDigest && notCert) { + err = calcNotaryDigest(pSigDoc, pNotary); + } + if(br != NULL) + OCSP_BASICRESP_free(br); + if (err != ERR_OK) SET_LAST_ERROR(err); + return err; +} + +int initializeNotaryInfoWithOCSP2(SignedDoc *pSigDoc, NotaryInfo *pNotary, + OCSP_RESPONSE *resp, X509 *notCert, int initDigest) +{ + int n, err = ERR_OK; + char buf[500]; + OCSP_RESPBYTES *rb = NULL; + OCSP_BASICRESP *br = NULL; + OCSP_RESPDATA *rd = NULL; + OCSP_RESPID *rid = NULL; + // OCSP_CERTSTATUS *cst = NULL; + OCSP_SINGLERESP *single = NULL; + OCSP_CERTID *cid = NULL; + X509_EXTENSION *nonce; + //AM 26.09.08 + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; + + + RETURN_IF_NULL_PARAM(pNotary); + RETURN_IF_NULL_PARAM(resp); + // check the OCSP Response validity + switch(OCSP_response_status(resp)) { + case OCSP_RESPONSE_STATUS_SUCCESSFUL: // OK + break; + case OCSP_RESPONSE_STATUS_MALFORMEDREQUEST: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_MALFORMED); + case OCSP_RESPONSE_STATUS_INTERNALERROR: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_INTERNALERR); + case OCSP_RESPONSE_STATUS_TRYLATER: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_TRYLATER); + case OCSP_RESPONSE_STATUS_SIGREQUIRED: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_SIGREQUIRED); + case OCSP_RESPONSE_STATUS_UNAUTHORIZED: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNAUTHORIZED); + default: + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNSUCCESSFUL); + } + RETURN_IF_NULL_PARAM(resp->responseBytes);; + rb = resp->responseBytes; + if(OBJ_obj2nid(rb->responseType) != NID_id_pkix_OCSP_basic) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNKNOWN_TYPE); + if((br = OCSP_response_get1_basic(resp)) == NULL) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_BASIC_RESP); + rd = br->tbsResponseData; + if(ASN1_INTEGER_get(rd->version) != 0) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_WRONG_VERSION); + n = sk_OCSP_SINGLERESP_num(rd->responses); + if(n != 1) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_ONE_RESPONSE); + single = sk_OCSP_SINGLERESP_value(rd->responses, 0); + RETURN_IF_NULL(single); + cid = single->certId; + RETURN_IF_NULL(cid); + ddocDebug(4, "initializeNotaryInfoWithOCSP", "CertStatus-type: %d", single->certStatus->type); + //printf("TYPE: %d\n", single->certStatus->type); + //Am test + /*if(single->certStatus->type != 0) { + ddocDebug(4, "initializeNotaryInfoWithOCSP", "errcode: %d", handleOCSPCertStatus(single->certStatus->type)); + SET_LAST_ERROR_RETURN_CODE(handleOCSPCertStatus(single->certStatus->type)); + }*/ + //Removed 31.10.2003 + //if(single->singleExtensions) + // SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_SINGLE_EXT); + if(!rd->responseExtensions || + (sk_X509_EXTENSION_num(rd->responseExtensions) != 1) || + ((nonce = sk_X509_EXTENSION_value(rd->responseExtensions, 0)) == NULL)) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_NONCE); + i2t_ASN1_OBJECT(buf,sizeof(buf),nonce->object); + if(strcmp(buf, OCSP_NONCE_NAME)) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_NONCE); + rid = rd->responderId; + if(rid->type == V_OCSP_RESPID_NAME) { + pNotary->nRespIdType = RESPID_NAME_TYPE; + } else if(rid->type == V_OCSP_RESPID_KEY) { + pNotary->nRespIdType = RESPID_KEY_TYPE; + } else { + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_WRONG_RESPID); + } + // producedAt + err = asn1time2str(pSigDoc, rd->producedAt, buf, sizeof(buf)); + setString(&(pNotary->timeProduced), buf, -1); + n = sizeof(buf); + if(rid->type == V_OCSP_RESPID_NAME){ + err = ddocCertGetDNFromName(rid->value.byName, &mbuf1); + RETURN_IF_NOT(err == ERR_OK, err); + err = ddocNotInfo_SetResponderId(pNotary, (char*)mbuf1.pMem, -1); + ddocMemBuf_free(&mbuf1); } if(rid->type == V_OCSP_RESPID_KEY) { err = ddocNotInfo_SetResponderId(pNotary, (const char*)rid->value.byKey->data, rid->value.byKey->length); @@ -388,10 +551,12 @@ RETURN_IF_NULL_PARAM(ppResp); RETURN_IF_NULL_PARAM(pMBufInData); RETURN_IF_NULL_PARAM(pMBufInData->pMem); + *ppResp = 0; ddocDebug(4, "ddocOcspReadOcspResp", "converting: %d bytes to OCSP_RESPONSE", pMBufInData->nLen); p1 = (unsigned char*)pMBufInData->pMem; d2i_OCSP_RESPONSE(ppResp, (const unsigned char**)&p1, pMBufInData->nLen); ddocDebug(4, "ddocOcspReadOcspResp", "OCSP_RESPONSE: %s", (*ppResp ? "OK" : "ERR")); + if(!(*ppResp)) err = ERR_OCSP_UNSUCCESSFUL; return err; } @@ -457,6 +622,30 @@ return ERR_OK; } +//============================================================ +// Converts OCSP_REQUEST to DER form +// pResp - OCSP_REQUEST +// pMBuf - output buffer for OCSP req +// returns error code +//============================================================ +EXP_OPTION int ddocWriteOcspDER(OCSP_REQUEST* pReq, DigiDocMemBuf* pMBuf) +{ + int l1; + char *p1, *p2; + + RETURN_IF_NULL_PARAM(pMBuf); + RETURN_IF_NULL_PARAM(pReq); + l1 = i2d_OCSP_REQUEST(pReq, NULL); + p1 = (char*)malloc(l1+10); + RETURN_IF_BAD_ALLOC(p1); + p2 = p1; + i2d_OCSP_REQUEST(pReq, (unsigned char**)&p2); + ddocMemAppendData(pMBuf, p1, l1); + free(p1); + return ERR_OK; +} + + //-------------------------------------------------- // Helper function to return OCSP_RESPONSE in base64 form // Memory buffer will be resized as necessary. @@ -548,9 +737,9 @@ return(NULL); } - met = X509V3_EXT_get(ex); + met = (X509V3_EXT_METHOD*)X509V3_EXT_get(ex); p = ex->value->data; -#if OPENSSL_VERSION_NUMBER > 0x00908000L +#if OPENSSL_VERSION_NUMBER > 0x00908000 // crashes here! st = ASN1_item_d2i(NULL, (const unsigned char**)&p, ex->value->length, ASN1_ITEM_ptr(met->it)); #else @@ -614,102 +803,72 @@ ASN1_INTEGER *sno; const EVP_MD *dgst; X509_ALGOR *alg; - unsigned char md[EVP_MAX_MD_SIZE]; + unsigned char md[EVP_MAX_MD_SIZE], buf1[100]; unsigned int len; + int l1; + DigiDocMemBuf mbuf1, mbuf2; + mbuf1.pMem = mbuf2.pMem = NULL; + mbuf1.nLen = mbuf2.nLen = 0; + l1 = (int)sizeof(buf1); + memset(buf1, 0, l1); if(cert != NULL) { + ddocCertGetSubjectDN(cert, &mbuf1); // standard variant would be //pId = OCSP_cert_to_id(EVP_sha1(), cert, issuer); - - // issuer name hashi arvutamine - iname = X509_get_issuer_name(cert); - dgst = EVP_sha1(); - len = sizeof(md); - if(X509_NAME_digest(iname, dgst, md, &len)) { - // issuer key hashi lugemine - //ikey = get_authority_key(cert->cert_info->extensions); - ikey = get_authority_key_from_cert(cert); - if(ikey != NULL) { - // serial numbri lugemine - sno = X509_get_serialNumber(cert); - // OCSP certid koostamine - if((pId = OCSP_CERTID_new()) != NULL) { - // replace default algorithm ??? - alg = pId->hashAlgorithm; - if(alg->algorithm != NULL) - ASN1_OBJECT_free(alg->algorithm); - alg->algorithm = OBJ_nid2obj(EVP_MD_type(dgst)); - if((alg->parameter = ASN1_TYPE_new()) != NULL) { - alg->parameter->type = V_ASN1_NULL; - ASN1_INTEGER_free(pId->serialNumber); - pId->serialNumber = ASN1_INTEGER_dup(sno); - if(!ASN1_OCTET_STRING_set(pId->issuerNameHash, md, len) || - !ASN1_OCTET_STRING_set(pId->issuerKeyHash, ikey, strlen((const char*)ikey)) || - !pId->serialNumber) { - fprintf(stderr, "Unable to fill in CID\n"); - OCSP_CERTID_free(pId); - pId = NULL; - } - } // else - failed to create algorithm - } - // cleanup ikey - free(ikey); - - } // else failed to find Authority Key Identifier - else { - //TODO: on UNIX crashes here - pCACert ? - pId = OCSP_cert_to_id(NULL, cert, pCACert); - - } - } // else - SHA1 failed - } + if(pCACert) { + ddocCertGetSubjectDN(pCACert, &mbuf2); + ddocDebug(3, "createOCSPCertid", "Create ocsp id for cert: %s by CA: %s", (char*)mbuf1.pMem, (char*)mbuf2.pMem); + pId = OCSP_cert_to_id(EVP_sha1(), cert, pCACert); + + } else { // CA unknown + ddocDebug(3, "createOCSPCertid", "Create ocsp id for cert: %s unknown CA", (char*)mbuf1.pMem); + // issuer name hashi arvutamine + iname = X509_get_issuer_name(cert); + dgst = EVP_sha1(); + len = sizeof(md); + if(X509_NAME_digest(iname, dgst, md, &len)) { + // issuer key hashi lugemine + //ikey = get_authority_key(cert->cert_info->extensions); + ikey = get_authority_key_from_cert(cert); + if(ikey != NULL) { + // serial numbri lugemine + sno = X509_get_serialNumber(cert); + // OCSP certid koostamine + if((pId = OCSP_CERTID_new()) != NULL) { + // replace default algorithm ??? + alg = pId->hashAlgorithm; + if(alg->algorithm != NULL) + ASN1_OBJECT_free(alg->algorithm); + alg->algorithm = OBJ_nid2obj(EVP_MD_type(dgst)); + if((alg->parameter = ASN1_TYPE_new()) != NULL) { + alg->parameter->type = V_ASN1_NULL; + ASN1_INTEGER_free(pId->serialNumber); + pId->serialNumber = ASN1_INTEGER_dup(sno); + if(!ASN1_OCTET_STRING_set(pId->issuerNameHash, md, len) || + !ASN1_OCTET_STRING_set(pId->issuerKeyHash, ikey, strlen((const char*)ikey)) || + !pId->serialNumber) + { + fprintf(stderr, "Unable to fill in CID\n"); + OCSP_CERTID_free(pId); + pId = NULL; + } + } // else - failed to create algorithm + } + // cleanup ikey + free(ikey); + } + } // else - SHA1 failed + } + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + if(pId) + bin2hex((const byte*)pId->issuerKeyHash->data, pId->issuerKeyHash->length, (byte*)buf1, &l1); + ddocDebug(3, "createOCSPCertid", "Created ocsp id %s issuer-key-hash: %s", (pId ? "OK" : "ERR"), buf1); return pId; } -//-------------------------------------------------- -// Helper function that handles OCSP nonce "the old way" -// e.g. by sending pure data instead of ASN.1 OCTET_STRING -// like in openssl 0.9.7d. This required to correctly -// handle OCSP verification. This code was contributed -// by Sven Heiberg -//-------------------------------------------------- -static int MY_ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts, unsigned char *val, int len) -{ - unsigned char *tmpval; - ASN1_OCTET_STRING os; - int ret = 0; - - if (len <= 0) - len = OCSP_DEFAULT_NONCE_LENGTH; - if (val) - tmpval = val; - else { - tmpval = (unsigned char*)OPENSSL_malloc(len); - if (!tmpval) - goto err; - RAND_pseudo_bytes(tmpval, len); - } - os.data = tmpval; - os.length = len; - if(!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce, &os, 0, X509V3_ADD_REPLACE)) - goto err; - ret = 1; -err: - if(!val) - OPENSSL_free(tmpval); - return ret; -} - -int MY_OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len) -{ - return MY_ocsp_add1_nonce(&req->tbsRequest->requestExtensions, val, len); -} - -int MY_OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len) -{ - return MY_ocsp_add1_nonce(&resp->tbsResponseData->responseExtensions, val, len); -} - //-------------------------------------------------- // Creates an OCSP_REQUEST object @@ -726,31 +885,26 @@ int createOCSPRequest(SignedDoc* pSigDoc, OCSP_REQUEST **req, X509 *cert, X509* pCACert, byte* nonce, int nlen) { - int err = ERR_OK; + int err = ERR_OK, l2; OCSP_CERTID *id = 0; - + byte buf2[DIGEST_LEN256 * 2 + 2]; + RETURN_IF_NULL_PARAM(req); RETURN_IF_NULL_PARAM(cert); RETURN_IF_NULL_PARAM(nonce); //RETURN_IF_NULL_PARAM(pCACert); if((*req = OCSP_REQUEST_new()) != 0) { - // VS - ver 1.66 if((id = createOCSPCertid(cert, pCACert)) != 0) { if(OCSP_request_add0_id(*req, id)) { - if(pSigDoc && - (!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || - !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || - !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - )) { - if((err = MY_OCSP_request_add1_nonce(*req, nonce, nlen)) != 0) + if((err = OCSP_request_add1_nonce(*req, nonce, nlen)) != 0) err = ERR_OK; - } else { - if((err = OCSP_request_add1_nonce(*req, nonce, nlen)) != 0) - err = ERR_OK; - } + // debug + l2 = sizeof(buf2); + memset(buf2, 0, l2); + if(nlen <= DIGEST_LEN256) { + bin2hex((const char*)nonce, nlen, (byte*)buf2, &l2); + ddocDebug(3, "createOCSPRequest", "Sending nonce: %s len: %d err: %d", buf2, nlen, err); + } } } } @@ -782,7 +936,7 @@ adrhdr[0] = 0; if(ip_addr > 0) snprintf(adrhdr, sizeof(adrhdr), "From: %d.%d.%d.%d\r\n", - (ip_addr>>24)&0xFF, (ip_addr>>16)&0xFF, (ip_addr>>8)&0xFF, ip_addr&0xFF); + (int)(ip_addr>>24)&0xFF, (int)(ip_addr>>16)&0xFF, (int)(ip_addr>>8)&0xFF, (int)(ip_addr&0xFF)); len = i2d_OCSP_REQUEST(req, NULL); if(BIO_printf(b, req_txt, path, getLibName(), getLibVersion(), getGUIVersion(), (ip_addr > 0 ? adrhdr : ""), len) < 0) { @@ -896,21 +1050,24 @@ char *host = NULL, *port = NULL, *path = "/"; int err = ERR_OK, use_ssl = -1; int connResult = 0; - long e; + long e = 0; RETURN_IF_NULL_PARAM(resp); RETURN_IF_NULL_PARAM(req); RETURN_IF_NULL_PARAM(url); //there is an HTTP proxy - connect to that instead of the target host + ddocDebug(3, "sendOCSPRequest", "Send OCSP to: %s over: %s:%s", url, + (proxyHost ? proxyHost : ""), (proxyPort ? proxyPort : "")); if (proxyHost != 0 && *proxyHost != '\0') { host = proxyHost; if(proxyPort != 0 && *proxyPort != '\0') port = proxyPort; path = url; } else { - if(OCSP_parse_url(url, &host, &port, &path, &use_ssl) == 0) { + if((err = OCSP_parse_url(url, &host, &port, &path, &use_ssl)) == 0) { //printf("BIO_parse_url failed\n"); + ddocDebug(1, "sendOCSPRequest", "BIO_parse_url failed: %d - %s", err, url); return ERR_WRONG_URL_OR_PROXY; } } @@ -939,6 +1096,7 @@ //if (*resp == 0) // printErrors(); } else { + ddocDebug(1, "sendOCSPRequest", "BIO-Connection error: %d - %ld", err, e); //printf("BIO_do_connect failed, rc = %d, shouldRetry = %d\n", connResult, BIO_should_retry(cbio)); //printErrors(); //if no connection @@ -955,11 +1113,96 @@ SSL_CTX_free(ctx); } } - else + else { err = ERR_CONNECTION_FAILURE; + ddocDebug(1, "sendOCSPRequest", "Connection error: %d", err); + } return(err); } + +//-------------------------------------------------- +// sends an OCSP_REQUES object to remore server and +// retrieves the OCSP_RESPONSE object +// resp - buffer to store the new responses pointer +// req - request objects pointer +// url - OCSP responder URL +// ip_addr - senders ip address if known or 0 +//-------------------------------------------------- +int sendOCSPRequest2(OCSP_RESPONSE** resp, OCSP_REQUEST *req, + char* url, char* proxyHost, char* proxyPort, char *proxyUser, char *proxyPass, + unsigned long ip_addr) +{ + int err = ERR_OK, l1; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; + char buf1[30], buf2[200], buf3[100], *p1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + ddocMemAssignData(&mbuf1, "POST ", -1); + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) { + ddocMemAppendData(&mbuf1, url, -1); + } else { + p1 = strstr(url, "://"); + if(p1) p1 += 3; + if(p1) p1 = strchr(p1, '/'); + if(p1) + ddocMemAppendData(&mbuf1, p1, -1); + else + ddocMemAppendData(&mbuf1, "/", -1); + } + ddocMemAppendData(&mbuf1, " HTTP/1.0\r\n", -1); + buf1[0] = buf2[0] = 0; + if(ip_addr > 0) + snprintf(buf1, sizeof(buf1), "From: %d.%d.%d.%d\r\n", + (int)(ip_addr>>24)&0xFF, (int)(ip_addr>>16)&0xFF, (int)(ip_addr>>8)&0xFF, (int)ip_addr&0xFF); + snprintf(buf2, sizeof(buf2), "User-Agent: LIB %s/%s APP %s\r\n%s", + getLibName(), getLibVersion(), getGUIVersion(), (ip_addr > 0 ? buf1 : "")); + ddocMemAppendData(&mbuf1, "Content-Type: application/ocsp-request\r\n", -1); + ddocMemAppendData(&mbuf1, buf2, -1); + //ddocMemAppendData(&mbuf1, "Host: www.sk.ee\r\n", -1); + //ddocMemAppendData(&mbuf1, "Accept: */*\r\n", -1); + // convert OCSP req + err = ddocWriteOcspDER(req, &mbuf3); + if(!err) { + snprintf(buf1, sizeof(buf1), "Content-Length: %d\r\n", (int)mbuf3.nLen); + ddocMemAppendData(&mbuf1, buf1, -1); + ddocMemAppendData(&mbuf1, "Connection: Close\r\n", -1); + if(proxyUser || proxyPass) { + err = ddocOcspProxyAuthInfo(buf3, proxyUser, proxyPass); + ddocMemAppendData(&mbuf1, buf3, -1); + } + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) // if we use proxy then send also Proxy-Connection + ddocMemAppendData(&mbuf1, "Proxy-Connection: Close\r\n", -1); + ddocMemAppendData(&mbuf1, "\r\n", -1); + ddocMemAppendData(&mbuf1, mbuf3.pMem, mbuf3.nLen); + ddocMemBuf_free(&mbuf3); + ddocDebug(3, "sendOCSPRequest2", "Send to host: %s request len: %d", url, mbuf1.nLen); + err = ddocPullUrl(url, &mbuf1, &mbuf2, proxyHost, proxyPort); + ddocDebug(3, "sendOCSPRequest2", "Recevied len: %d RC: %d", mbuf2.nLen, err); + if(!err && ((l1 = ddocGetHttpResponseCode(&mbuf2)) == 200)) { + ddocDebug(4, "sendOCSPRequest2", "HTTP response\n-----\n%s\n-----\n", mbuf2.pMem); + err = ddocGetHttpPayload(&mbuf2, &mbuf3); + if(!err) + err = ddocOcspReadOcspResp(resp, &mbuf3); + } else { + ddocDebug(1, "sendOCSPRequest2", "Ocsp request failed with http code: %d rc: %d", l1, err); + err = ERR_OCSP_UNSUCCESSFUL; + ddocDebug(1, "sendOCSPRequest2", "HTTP error message\n-----\n%s\n-----\n", mbuf2.pMem); + } + } + // cleanup + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + return err; +} + + //-------------------------------------------------- // Creates and writes an OCSP_REQUEST object // to disk @@ -1013,18 +1256,63 @@ { EVP_PKEY *pkey; int err = ERR_OK; - time_t tNow; STACK_OF(X509)* certs = NULL; X509* x509=0; - +#ifdef FRAMEWORK + SecIdentityRef identity = 0; + err = SecIdentityCopyPreference(CFSTR("ocsp.sk.ee"), 0, 0, &identity); + if(!identity) + return ERR_OK; + + SecCertificateRef certref = 0; + SecKeyRef keyref = 0; + err = SecIdentityCopyCertificate(identity, &certref); + err = SecIdentityCopyPrivateKey(identity, &keyref); + CFRelease(identity); + RETURN_IF_NULL(certref); + RETURN_IF_NULL(keyref); + + CFDataRef certdata = SecCertificateCopyData(certref); + CFRelease(certref); + RETURN_IF_NULL(certdata); + const unsigned char *p = CFDataGetBytePtr(certdata); + x509 = d2i_X509(0, &p, CFDataGetLength(certdata)); + CFRelease(certdata); + RETURN_IF_NULL(x509); + + CFDataRef keydata = 0; + SecKeyImportExportParameters params; + memset( ¶ms, 0, sizeof(params) ); + params.version = SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION; + params.passphrase = CFSTR("pass"); + err = SecKeychainItemExport(keyref, kSecFormatWrappedPKCS8, 0, ¶ms, &keydata); + CFRelease(keyref); + RETURN_IF_NULL(keydata); + BIO *bio = BIO_new_mem_buf((void*)CFDataGetBytePtr(keydata), CFDataGetLength(keydata)); + pkey = d2i_PKCS8PrivateKey_bio(bio, 0, &password_callback, 0); + CFRelease(keydata); + BIO_free(bio); + + RETURN_IF_NULL(pkey); +#else RETURN_IF_NULL_PARAM(filename); + if(strlen(filename) == 0) + return ERR_OK; + err = ReadCertificateByPKCS12(&x509, filename, passwd, &pkey); RETURN_IF_NOT(err == ERR_OK, err); +#endif +#if 0 // miscalulates on mac time zone // VS: ver 1.66 time(&tNow); err = isCertValid(x509, tNow); +#else + if( X509_cmp_current_time(x509->cert_info->validity->notBefore) >= 0 && + X509_cmp_current_time(x509->cert_info->validity->notAfter) <= 0) + err = ERR_CERT_INVALID; +#endif if (err != ERR_OK) X509_free(x509); RETURN_IF_NOT(err == ERR_OK, ERR_PKCS12_EXPIRED); @@ -1039,6 +1327,8 @@ } X509_free(x509); EVP_PKEY_free(pkey); + //AM 22.04.08 + sk_X509_free(certs); return err; } @@ -1123,14 +1413,40 @@ const X509** caCerts, const X509* pNotCert, char* pkcs12FileName, char* pkcs12Password, char* notaryURL, char* proxyHost, char* proxyPort, - unsigned long ip) + unsigned long ip) +{ + return getConfirmationWithIpEx(pSigDoc, pSigInfo, caCerts, pNotCert, + pkcs12FileName, pkcs12Password, notaryURL, proxyHost, proxyPort, 0, 0, ip); +} +//-------------------------------------------------- +// Creates and sends an OCSP_REQUEST object +// to the notary server, receives the response +// and uses it to create a confirmation object. +// pSigDoc - signed doc info +// pSigInfo - signature info +// caCerts - responder CA certs chain +// notaryCert - notarys cert search +// pkcs12FileName - +// pkcs12Password - +// notaryURL - notarys URL +// proxyHost - proxy host if needed +// proxyPort - proxy port if needed +// proxyUser - proxy user if needed +// proxyPass - proxy pass if needed +// ip - callers ip address if known +//-------------------------------------------------- +EXP_OPTION int getConfirmationWithIpEx(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + const X509** caCerts, const X509* pNotCert, + char* pkcs12FileName, char* pkcs12Password, + char* notaryURL, char* proxyHost, char* proxyPort, + char* proxyUser, char* proxyPass, unsigned long ip) { OCSP_REQUEST *req = 0; OCSP_RESPONSE *resp = 0; X509 *cert = 0, *pCA = 0; int err = ERR_OK, l1, i; - byte buf1[DIGEST_LEN+2]; + byte buf1[DIGEST_LEN256+2]; NotaryInfo* pNotInf = NULL; DigiDocMemBuf* pMBuf; @@ -1145,60 +1461,57 @@ l1 = sizeof(buf1); pMBuf = ddocSigInfo_GetSignatureValue_Value(pSigInfo); RETURN_IF_NOT(pMBuf, err); - // in format 1.4 we use just a plain random value for hash -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { #ifdef WIN32 RAND_screen(); RAND_bytes((unsigned char*)buf1, DIGEST_LEN); #else - if(l1 = RAND_load_file("/dev/urandom", 1024)) { + if((l1 = RAND_load_file("/dev/urandom", 1024)) > 0) { RAND_bytes((unsigned char*)buf1, DIGEST_LEN); l1 = DIGEST_LEN; } #endif - } else -#endif - err = calculateDigest(pMBuf->pMem, pMBuf->nLen, DIGEST_SHA1, buf1, &l1); + err = calculateDigest(pMBuf->pMem, pMBuf->nLen, DIGEST_SHA1, buf1, &l1); RETURN_IF_NOT(err == ERR_OK, err); // find lowest CA cert for(i = 0; (caCerts != NULL) && (caCerts[i] != NULL); i++) pCA = (X509*)caCerts[i]; err = createOCSPRequest(pSigDoc, &req, cert, pCA, buf1, l1); - RETURN_IF_NOT(err == ERR_OK, err); // if both are NULL then this means don't sign OCSP requests - if(pkcs12FileName /*&& pkcs12Password*/) { + if(!err && ConfigItem_lookup_bool("SIGN_OCSP", 1) /*pkcs12FileName && pkcs12Password*/) { ddocDebug(3, "getConfirmationWithIp", "Sign OCSP request with: %s", pkcs12FileName); err=signOCSPRequestPKCS12(req, pkcs12FileName, pkcs12Password); + ddocDebug(3, "getConfirmationWithIp", "Signing ocsp rc: %d", err); } - RETURN_IF_NOT(err == ERR_OK, err); - ddocDebug(3, "getConfirmationWithIp", "Send OCSP to: %s over: %s:%s", notaryURL, + if(!err) { + ddocDebug(3, "getConfirmationWithIp", "Send OCSP to: %s over: %s:%s", notaryURL, (proxyHost ? proxyHost : ""), (proxyPort ? proxyPort : "")); - err = sendOCSPRequest(&resp, req, notaryURL, proxyHost, proxyPort, ip); - RETURN_IF_NOT(err == ERR_OK, err); - - err = NotaryInfo_new(&pNotInf, pSigDoc, pSigInfo); - RETURN_IF_NOT(err == ERR_OK, err); - - err = initializeNotaryInfoWithOCSP(pSigDoc, pNotInf, resp, NULL, 1); - RETURN_IF_NOT(err == ERR_OK, err); + err = sendOCSPRequest2(&resp, req, notaryURL, proxyHost, proxyPort, proxyUser, proxyPass, ip); + } + if(!err) + err = NotaryInfo_new(&pNotInf, pSigDoc, pSigInfo); + //AM initializeNotaryInfoWithOCSP2? + if(!err) + err = initializeNotaryInfoWithOCSP(pSigDoc, pNotInf, resp, NULL, 1); - if(caCerts && pNotCert) { + if(!err && caCerts && pNotCert) { err = finalizeAndVerifyNotary(pSigDoc, pSigInfo, pNotInf, caCerts, pNotCert); - RETURN_IF_NOT(err == ERR_OK, err); + } + // VS - if finalizing notary fails then remove it - #8602 + if(err) { + if(pNotInf) + ddocDebug(3, "getConfirmationWithIp", "Delete notary: %s because of error: %d", pNotInf->szId, err); + NotaryInfo_delete(pSigInfo); } if(resp) OCSP_RESPONSE_free(resp); - //AM 22.04.08 - if(req) - OCSP_REQUEST_free(req); - return ERR_OK; + if(req) + OCSP_REQUEST_free(req); + return err; } - //-------------------------------------------------- // Adds responder certificate to notary, searches it's // CA chain and then verifies notary @@ -1208,26 +1521,43 @@ // notaryCert - notarys cert search // returns error code //-------------------------------------------------- -int EXP_OPTION finalizeAndVerifyNotary(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, +int EXP_OPTION finalizeAndVerifyNotary2(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, NotaryInfo* pNotInf, - const X509** caCerts, const X509* pNotCert) + const X509** caCerts, const X509* pNotCert, const X509* pSigCa) { int err = ERR_OK; RETURN_IF_NULL_PARAM(pNotCert); RETURN_IF_NULL_PARAM(caCerts); - ddocDebug(3, "finalizeAndVerifyNotary", "Notary: %s cert: %s", pNotInf->szId, (pNotCert ? "OK" : "NULL")); + ddocDebug(3, "finalizeAndVerifyNotary2", "Notary: %s cert: %s", pNotInf->szId, (pNotCert ? "OK" : "NULL")); err = addNotaryInfoCert(pSigDoc, pNotInf, (X509*)pNotCert); RETURN_IF_NOT(err == ERR_OK, err); err = calcNotaryDigest(pSigDoc, pNotInf); RETURN_IF_NOT(err == ERR_OK, err); - err = verifyNotaryInfoCERT(pSigDoc, pSigInfo, pNotInf, caCerts, NULL, pNotCert); + err = verifyNotaryInfoCERT2(pSigDoc, pSigInfo, pNotInf, caCerts, NULL, pNotCert, pSigCa); RETURN_IF_NOT(err == ERR_OK, err); - ddocDebug(3, "finalizeAndVerifyNotary", "rc: %d cert: %s cert2: %s", err, (pNotCert ? "OK" : "NULL"), (ddocSigInfo_GetOCSPRespondersCert(pSigInfo) ? "OK" : "NULL")); + ddocDebug(3, "finalizeAndVerifyNotary2", "rc: %d cert: %s cert2: %s", err, (pNotCert ? "OK" : "NULL"), (ddocSigInfo_GetOCSPRespondersCert(pSigInfo) ? "OK" : "NULL")); return ERR_OK; } //-------------------------------------------------- +// Adds responder certificate to notary, searches it's +// CA chain and then verifies notary +// pSigDoc - signed doc info +// pSigInfo - signature info +// caCertSearches - responder CA certs chain +// notaryCert - notarys cert search +// returns error code +//-------------------------------------------------- +int EXP_OPTION finalizeAndVerifyNotary(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + NotaryInfo* pNotInf, + const X509** caCerts, const X509* pNotCert) +{ + return finalizeAndVerifyNotary2(pSigDoc, pSigInfo, pNotInf, caCerts, pNotCert, NULL); +} + + +//-------------------------------------------------- // Verfies OCSP_RESPONSE signature // pResp - signed OCSP response // caCerts - CA certificate pointer array terminated with NULL diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocOCSP.h libdigidoc-3.7.0.875/libdigidoc/DigiDocOCSP.h --- libdigidoc-2.7.0/libdigidoc/DigiDocOCSP.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocOCSP.h 2012-12-13 22:05:47.000000000 +0000 @@ -71,14 +71,36 @@ char* notaryURL, char* proxyHost, char* proxyPort, unsigned long ip); +// another way to get OCSP confirmation by sending also callers ip address +EXP_OPTION int getConfirmationWithIpEx(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + const X509** caCerts, const X509* pNotCert, + char* pkcs12FileName, char* pkcs12Password, + char* notaryURL, char* proxyHost, char* proxyPort, + char* proxyUser, char* proxyPass, unsigned long ip); + // use this if you passed NULL-s to getConfirmation() param notaryCert EXP_OPTION int finalizeAndVerifyNotary(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, NotaryInfo* pNotInf, const X509** caCerts, const X509* pNotCert); +//-------------------------------------------------- +// Adds responder certificate to notary, searches it's +// CA chain and then verifies notary +// pSigDoc - signed doc info +// pSigInfo - signature info +// caCertSearches - responder CA certs chain +// notaryCert - notarys cert search +// returns error code +//-------------------------------------------------- +int EXP_OPTION finalizeAndVerifyNotary2(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + NotaryInfo* pNotInf, + const X509** caCerts, const X509* pNotCert, const X509* pSigCa); + int ReadOCSPResponse(OCSP_RESPONSE **newOCSP_RESPONSE, const char* szFileName); int initializeNotaryInfoWithOCSP(SignedDoc *pSigDoc, NotaryInfo *pNotary, OCSP_RESPONSE *resp, X509 *notCert, int initDigest); +int initializeNotaryInfoWithOCSP2(SignedDoc *pSigDoc, NotaryInfo *pNotary, + OCSP_RESPONSE *resp, X509 *notCert, int initDigest); //-------------------------------------------------- // Verfies OCSP_RESPONSE signature diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocObj.c libdigidoc-3.7.0.875/libdigidoc/DigiDocObj.c --- libdigidoc-2.7.0/libdigidoc/DigiDocObj.c 2010-01-28 16:54:31.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocObj.c 2012-12-13 22:05:47.000000000 +0000 @@ -27,10 +27,13 @@ #include #include #include +#include +#include #include #include - - +#include +#include +#include //============================================================ // Sets a string element of a struct to a new value @@ -70,7 +73,7 @@ RETURN_IF_NULL_PARAM(format); RETURN_IF_NULL_PARAM(version); - + ddocDebug(1, "SignedDoc_new", "format: %s version: %s", (format ? format : "NULL"), (version ? version : "NULL")); pSigDoc = (SignedDoc*)malloc(sizeof(SignedDoc)); RETURN_IF_BAD_ALLOC(pSigDoc); memset(pSigDoc, 0, sizeof(SignedDoc)); @@ -78,17 +81,14 @@ (!strcmp(format, DIGIDOC_XML_1_1_NAME) && (!strcmp(version, DIGIDOC_XML_1_1_VER) || !strcmp(version, DIGIDOC_XML_1_2_VER) || - // Ver 1.76 - add support for format 1.3 - !strcmp(version, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(version, DIGIDOC_XML_1_4_VER) -#endif - ))) { + !strcmp(version, DIGIDOC_XML_1_3_VER) ))) { setString(&(pSigDoc->szFormat), format, -1); setString(&(pSigDoc->szFormatVer), version, -1); - } - else + setString(&(pSigDoc->szFileName), "", -1); + } else { + ddocDebug(1, "SignedDoc_new", "unsupported version"); SET_LAST_ERROR_RETURN_CODE(ERR_UNSUPPORTED_VERSION); + } *pSignedDoc = pSigDoc; return ERR_OK; } @@ -117,6 +117,10 @@ free(pSigDoc->szFormat); if(pSigDoc->szFormatVer) free(pSigDoc->szFormatVer); + if(pSigDoc->szFileName) + free(pSigDoc->szFileName); + if(pSigDoc->szProfile) + free(pSigDoc->szProfile); if(pSigDoc) free(pSigDoc); } @@ -210,7 +214,7 @@ // pSigDoc - signed document // id - data file id // filename - filename -// contentType - DETATCHED, EMBEDDED or EMBEDDED_BASE64 +// contentType - EMBEDDED or EMBEDDED_BASE64 // mime - mime type // size - file size // digType - digestType @@ -232,7 +236,7 @@ RETURN_IF_NULL_PARAM(newDataFile); RETURN_IF_NULL_PARAM(pSigDoc); - ddocDebug(4, "DataFile_new", "SigDoc ver: %s, file: %s, contentType: %s, mimeType: %s", + ddocDebug(3, "DataFile_new", "SigDoc ver: %s, file: %s, contentType: %s, mimeType: %s", (pSigDoc ? pSigDoc->szFormatVer : "NULL"), (filename ? filename : "NULL"), contentType, mime); //clearErrors(); if(!id) @@ -258,7 +262,7 @@ pSigDoc->pDataFiles = pDataFiles; if(id) { setString(&(pDataFile->szId), id, -1); - } else { + } else { snprintf(buf1, sizeof(buf1), "D%d", nId); setString(&(pDataFile->szId), buf1, -1); } @@ -280,6 +284,11 @@ } if(mime) setString(&(pDataFile->szMimeType), mime, -1); + if((!contentType || strcmp(contentType, CONTENT_EMBEDDED_BASE64)) + && !ConfigItem_lookup_bool("EMBEDDED_XML_SUPPORT", 0)) { + SET_LAST_ERROR(ERR_BAD_DATAFILE_CONTENT_TYPE); + return ERR_BAD_DATAFILE_CONTENT_TYPE; + } if(contentType) setString(&(pDataFile->szContentType), contentType, -1); pDataFile->nSize = size; @@ -304,6 +313,7 @@ DataFile** pDataFiles = NULL; RETURN_IF_NULL_PARAM(pSigDoc); + ddocDebug(3, "DataFile_delete", "id: %s", id); if(pSigDoc->nSignatures > 0) SET_LAST_ERROR_RETURN_CODE(ERR_MODIFY_SIGNED_DOC); if((pDataFile = getDataFileWithId(pSigDoc, id)) != 0) { @@ -314,15 +324,15 @@ for(i = j = 0; i < pSigDoc->nDataFiles; i++) { if(strcmp(pSigDoc->pDataFiles[i]->szId, id)) pDataFiles[j++] = pSigDoc->pDataFiles[i]; - else - DataFile_free(pSigDoc->pDataFiles[i]); + else{ + DataFile_free(pSigDoc->pDataFiles[i]);} } free(pSigDoc->pDataFiles); pSigDoc->pDataFiles = pDataFiles; pSigDoc->nDataFiles = n; } else { - for(i = 0; i < pSigDoc->nDataFiles; i++) - DataFile_free(pSigDoc->pDataFiles[i]); + for(i = 0; i < pSigDoc->nDataFiles; i++){ + DataFile_free(pSigDoc->pDataFiles[i]);} free(pSigDoc->pDataFiles); pSigDoc->pDataFiles = NULL; pSigDoc->nDataFiles = 0; @@ -405,7 +415,7 @@ *pLen = strlen((const char*)*ppBuf); // in version 1.2 and earlier we had bad UTF-8 for some chars // check and fix it for newer clients - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || + if((!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { convWinToFName(pDf->szFileName, (char*)*ppBuf, *pLen+1); @@ -422,16 +432,63 @@ // maxLen - max cacheable DataFile size // value - character values read from file // len - length of chars ??? +// isBase64 - is allready in base64 form or not (1/0) //-------------------------------------------------- -void ddocAppendDataFileData(DataFile* pDf, int maxLen, void* data, int len) +EXP_OPTION void ddocAppendDataFileData(DataFile* pDf, int maxLen, void* data, int len, int isBase64) { + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; ddocDebug(5, "ddocAppendDataFileData", "append: %d, max: %d", len, maxLen); if(pDf && pDf->nSize < maxLen) { ddocDebug(6, "ddocAppendDataFileData", "DF: %s, size: %d, max: %d", pDf->szId, pDf->nSize, maxLen); - ddocMemAppendData(&(pDf->mbufContent), data, len); + // original content must be kept in the form it will exist in file + if(!strcmp(pDf->szContentType, CONTENT_EMBEDDED_BASE64) && !isBase64) { + mbuf2.pMem = data; + mbuf2.nLen = len; + ddocEncodeBase64(&mbuf2, &mbuf1); + ddocMemAppendData(&(pDf->mbufContent), mbuf1.pMem, mbuf1.nLen); + ddocMemBuf_free(&mbuf1); + } + else + ddocMemAppendData(&(pDf->mbufContent), data, len); } } +//-------------------------------------------------- +// Creates new DataFile and assigns contet from memory +// ppDataFile address of pointer to return new DataFile object +// pSigDoc - SignedDoc object +// id - new DataFile id. Use NULL for default +// filename - filename +// contentType - content type +// mime - mime type +// pData - address of DataFile content to be assigned +// size - length of data in bytes +// return error code +//-------------------------------------------------- +EXP_OPTION int createDataFileInMemory(DataFile **ppDataFile, SignedDoc* pSigDoc, const char* id, + const char* filename, const char* contentType, + const char* mime, const char* pData, long size) +{ + int err = ERR_OK; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + err = DataFile_new(ppDataFile, pSigDoc, id, + filename, contentType, + mime, size, NULL, 0, NULL, NULL); + if(!err && pData) { + ddocAppendDataFileData(*ppDataFile, size+1, (void*)pData, size, 0); + // calculate hash so it can be used in signing + err = generateDataFileXML(pSigDoc, *ppDataFile, NULL, NULL, &mbuf1); + ddocMemBuf_free(&mbuf1); + } + return err; +} + //============================================================ // cleanup DataFile memory // pDataFile - data file object to be cleaned up @@ -525,6 +582,34 @@ return err; } +//-------------------------------------------------- +// Accessor for WrongDigest atribute of DataFile object. +// pDataFile - address of object [REQUIRED] +// returns value of atribute or NULL. +//-------------------------------------------------- +EXP_OPTION DigiDocMemBuf* ddocDataFile_GetWrongDigestValue(DataFile* pDataFile) +{ + RETURN_OBJ_IF_NULL(pDataFile, NULL) + return &(pDataFile->mbufWrongDigest); +} + +//-------------------------------------------------- +// Mutatoror for WrongDigest atribute of DataFile object. +// pDataFile - address of object [REQUIRED] +// value - new value for atribute [REQUIRED] +// len - length of value in bytes [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddocDataFile_SetWrongDigestValue(DataFile* pDataFile, + const char* value, long len) +{ + int err = ERR_OK; + RETURN_IF_NULL_PARAM(pDataFile) + RETURN_IF_NULL_PARAM(value) + err = ddocMemAssignData(&(pDataFile->mbufWrongDigest), value, len); + return err; +} + //============================================================ // Removes this NotaryInfo from signed doc and frees it's memory // pSigInfo - signature object @@ -624,53 +709,39 @@ EXP_OPTION int calculateDataFileSizeAndDigest(SignedDoc* pSigDoc, const char* id, const char* filename, int digType) { - int err = ERR_OK, len1; + int err = ERR_OK, len1 = 0; char buf1[DIGEST_LEN+2]; - char fnameBuf[200]; - long len2; + long len2 = 0; DataFile* pDataFile; RETURN_IF_NULL_PARAM(pSigDoc); + ddocDebug(3, "calculateDataFileSizeAndDigest", "File: %s id: %s", filename, id); pDataFile = getDataFileWithId(pSigDoc, id); - RETURN_IF_NULL(pDataFile); + RETURN_IF_NOT(pDataFile, ERR_FILE_READ); if(digType == DIGEST_SHA1) { // in version 1.0 we use DigestType and DigestValue // attrributes of DataFile element and calculate the digest // over the original content - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { - // if content type is HASHCODE then we are finished because - // we are supposed to believe what the sender has stored here - if(strcmp(pDataFile->szContentType, CONTENT_HASHCODE)) { + if(!strcmp(pSigDoc->szFormat, SK_XML_1_NAME) && !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { len1 = sizeof(buf1); err = calculateFileDigest(filename, digType, (byte*)buf1, &len1, &len2); RETURN_IF_NOT(err == ERR_OK, err); ddocDataFile_SetDigestValue(pDataFile, buf1, len1); pDataFile->nSize = len2; - } - } + } // in version 1.1 we don't use those attributes // and we calculate the digest over the whole // DataFile element including the tags else { - ddocConvertFileName(fnameBuf, sizeof(fnameBuf), pDataFile->szFileName); - if(!strcmp(pDataFile->szContentType, CONTENT_DETATCHED)) { - len1 = sizeof(buf1); - err = calculateFileDigest(fnameBuf, digType, - (byte*)buf1, &len1, &len2); - RETURN_IF_NOT(err == ERR_OK, err); - setString((char**)&(pDataFile->szDigestType), DIGEST_SHA1_NAME, -1); - ddocDataFile_SetDetachedDigestValue(pDataFile, buf1, len1); - pDataFile->nSize = len2; - } else - err = calculateFileSize(fnameBuf, &pDataFile->nSize); - ddocDebug(4, "calculateDataFileSizeAndDigest", "File: %s size: %d", fnameBuf, pDataFile->nSize); - err = generateDataFileXML(pSigDoc, pDataFile, fnameBuf, NULL, NULL); + err = calculateFileSize(filename, &pDataFile->nSize); + ddocDebug(4, "calculateDataFileSizeAndDigest", "File: %s size: %d", filename, pDataFile->nSize); + err = generateDataFileXML(pSigDoc, pDataFile, filename, NULL, NULL); } } else SET_LAST_ERROR_RETURN_CODE(ERR_UNSUPPORTED_DIGEST); - return ERR_OK; + return err; } @@ -805,8 +876,7 @@ // pBuf - memory buffer for storing xml [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- -int ddocDigestValue_toXML(const SignedDoc* pSigDoc, - const DigestValue* pDigestValue, DigiDocMemBuf* pBuf) +int ddocDigestValue_toXML(const DigestValue* pDigestValue, DigiDocMemBuf* pBuf) { int err = ERR_OK; DigiDocMemBuf mbuf1; @@ -822,41 +892,26 @@ // Algorithm atribute err = ddocGen_addAtribute(pBuf, "Algorithm", pDigestValue->szDigestMethod); if(err) return err; -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocGen_addAtribute(pBuf, "xmlns", NAMESPACE_XML_DSIG); - if(err) return err; - } -#endif //err = ddocGen_startElemEnd(pBuf); //err = ddocGen_endElem(pBuf, "DigestMethod"); // end of element start tag err = ddocMemAppendData(pBuf, "/>\n", -1); } if(pDigestValue->mbufDigestValue.pMem) { -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocGen_startElemBegin(pBuf, "DigestValue"); - if(err) return err; - err = ddocGen_addAtribute(pBuf, "xmlns", NAMESPACE_XML_DSIG); - if(err) return err; - err = ddocGen_startElemEnd(pBuf); - if(err) return err; - } else { -#endif err = ddocGen_startElem(pBuf, "DigestValue"); -#ifdef WITH_TS } -#endif + if(err) return err; // digest value ddocEncodeBase64(&(pDigestValue->mbufDigestValue), &mbuf1); + //AM 17.11.08 to remove newline after base64 + if(mbuf1.pMem && ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] == '\n') + ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] = 0; err = ddocMemAppendData(pBuf, (char*)mbuf1.pMem, -1); ddocMemBuf_free(&mbuf1); if(err) return err; err = ddocGen_endElem(pBuf, "DigestValue"); err = ddocMemAppendData(pBuf, "\n", -1); - } return err; } @@ -1027,11 +1082,14 @@ } // end of element start tag err = ddocGen_startElemEnd(pBuf); - err = ddocMemAppendData(pBuf, "\n", -1); + //err = ddocMemAppendData(pBuf, "\n", -1); if(err) return err; // signature value if(pSignatureValue) { ddocEncodeBase64(ddocSignatureValue_GetSignatureValue(pSignatureValue), &mbuf1); + //AM 17.11.08 to remove newline after base64 + if(mbuf1.pMem && ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] == '\n') + ((char*)mbuf1.pMem)[strlen((const char*)mbuf1.pMem)-1] = 0; err = ddocMemAppendData(pBuf, (char*)mbuf1.pMem, -1); ddocMemBuf_free(&mbuf1); } @@ -1093,6 +1151,47 @@ } return err; } +EXP_OPTION int bdocCertID_new(CertID** ppCertID, + int nType, const char* szId, + const char* szIssuerSerial, const char* szIssuerName, + void* szDigVal, long lDigLen) +{ + int err = ERR_OK; + + // check input parameters + ddocDebug(4, "ddocCertID_new", "id: %s, type: %d, issuer-serial: %s issuer-name: %s, dig-len: %ld", + (szId ? szId : "NULL"), nType, + (szIssuerSerial ? szIssuerSerial : "NULL"), + (szIssuerName ? szIssuerName : "NULL"), lDigLen); + RETURN_IF_NULL_PARAM(ppCertID); + *ppCertID = 0; // mark as not yet allocated + // allocate memory for new CertID + *ppCertID = (CertID*)malloc(sizeof(CertID)); + if(!(*ppCertID)) + SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) + memset(*ppCertID, 0, sizeof(CertID)); + (*ppCertID)->nType = nType; + // set optional fields + if(szId) { + err = ddocMemAssignString((char**)&((*ppCertID)->szId), szId); + if(err) return err; + } + if(szIssuerSerial) { + err = ddocMemAssignString((char**)&((*ppCertID)->szIssuerSerial), szIssuerSerial); + if(err) return err; + } + if(szIssuerName) { + err = ddocMemAssignString((char**)&((*ppCertID)->szIssuerName), szIssuerName); + if(err) return err; + } + if(szDigVal && lDigLen) { + if(!(*ppCertID)->pDigestValue){ + ddocDigestValue_new(&((*ppCertID)->pDigestValue), 0, szDigVal, lDigLen); + }else + err = ddocDigestValue_SetDigestValue((*ppCertID)->pDigestValue, szDigVal, lDigLen); + } + return err; +} //-------------------------------------------------- // "Destructor" of CertID object @@ -1112,6 +1211,8 @@ free(pCertID->szIssuerName); if(pCertID->pDigestValue) ddocDigestValue_free(pCertID->pDigestValue); + if(pCertID->szDigestType) + free(pCertID->szDigestType); free(pCertID); return err; } @@ -1243,7 +1344,8 @@ err = ddocGen_startElemBegin(pBuf, "Cert"); if(err) return err; // only formats 1.0, 1.1 and 1.2 we use the Id atribute - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || + //AM 28.10.08 can also have 1.0 version + if((!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { // Id atribute @@ -1256,7 +1358,7 @@ // err = ddocGen_startElem(pBuf, "CertDigest"); if(err) return err; - ddocDigestValue_toXML(pSigDoc, pCertID->pDigestValue, pBuf); + ddocDigestValue_toXML(pCertID->pDigestValue, pBuf); err = ddocGen_endElem(pBuf, "CertDigest"); if(err) return err; err = ddocMemAppendData(pBuf, "\n", -1); @@ -1265,11 +1367,12 @@ if(err) return err; err = ddocMemAppendData(pBuf, "\n", -1); // only formats 1.0, 1.1 and 1.2 we use the IssuerSerial element alone - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) || + //AM 29.10.08 + if((!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME))|| !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { err = ddocMemAppendData(pBuf, ddocCertID_GetIssuerSerial(pCertID), -1); - } else { // in 1.3 and 1.4 we use all subelement of + } else { // in 1.3 and 1.4 we use all subelement of err = ddocGen_startElemBegin(pBuf, "X509IssuerName"); if(err) return err; err = ddocGen_addAtribute(pBuf, "xmlns", NAMESPACE_XML_DSIG); @@ -1313,10 +1416,7 @@ { int err = ERR_OK, i, n; CertID* pCertID; -#ifdef WITH_TS - char buf1[100]; -#endif - + RETURN_IF_NULL_PARAM(pBuf) RETURN_IF_NULL_PARAM(pSigDoc) RETURN_IF_NULL_PARAM(pSigInfo) @@ -1324,18 +1424,11 @@ // err = ddocGen_startElemBegin(pBuf, "CompleteCertificateRefs"); if(err) return err; -#ifdef WITH_TS - // in version 1.4 we need the Id atribute - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - snprintf(buf1, sizeof(buf1), "%s-CERTREFS", pSigInfo->szId); - err = ddocGen_addAtribute(pBuf, "Id", buf1); - } -#endif // end of element start tag err = ddocGen_startElemEnd(pBuf); if(err) return err; // (not used in 1.0, 1.1 and 1.2 - if(strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && + if((strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { err = ddocGen_startElem(pBuf, "CertRefs"); @@ -1348,7 +1441,8 @@ ddocCertID_toXML(pSigDoc, pCertID, pBuf); } // (not used in 1.0, 1.1 and 1.2 - if(strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && + //AM 29.10.08 + if((strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) && strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) { err = ddocGen_endElem(pBuf, "CertRefs"); @@ -1368,7 +1462,8 @@ const SignatureInfo* pSigInfo, DigiDocMemBuf* pBuf) { int err = ERR_OK, l1, l2; - char buf1[30], buf2[40], *p1, *p2; + //AM 28.04.04 increased buffer for sha256 + char buf1[80], buf2[80], *p1, *p2; const DigiDocMemBuf *pMBuf = 0; RETURN_IF_NULL_PARAM(pBuf) @@ -1378,13 +1473,6 @@ // err = ddocGen_startElemBegin(pBuf, "CompleteRevocationRefs"); if(err) return err; -#ifdef WITH_TS - // in version 1.4 we need the Id atribute - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - snprintf(buf1, sizeof(buf1), "%s-REVOCREFS", pSigInfo->szId); - err = ddocGen_addAtribute(pBuf, "Id", buf1); - } -#endif // end of element start tag err = ddocGen_startElemEnd(pBuf); if(err) return err; @@ -1410,36 +1498,6 @@ // err = ddocGen_startElem(pBuf, "ResponderID"); if(err) return err; -#ifdef WITH_TS - // in version 1.4 we need the Id atribute - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - if(pSigInfo->pNotary->nRespIdType == RESPID_NAME_TYPE) { - err = ddocGen_startElem(pBuf, "ByName"); - if(err) return err; - p1 = (char*)ddocNotInfo_GetResponderId_Value(pSigInfo->pNotary); - RETURN_IF_NULL(p1); - err = ddocMemAppendData(pBuf, p1, -1); - if(err) return err; - err = ddocGen_endElem(pBuf, "ByName"); - if(err) return err; - } - if(pSigInfo->pNotary->nRespIdType == RESPID_KEY_TYPE) { - err = ddocGen_startElem(pBuf, "ByKey"); - if(err) return err; - pMBuf = ddocNotInfo_GetResponderId(pSigInfo->pNotary); - RETURN_IF_NULL(pMBuf); - l2 = pMBuf->nLen * 2 + 10; - p2 = (char*)malloc(l2); - RETURN_IF_NULL(p2); - memset(p2, 0, l2); - encode((const byte*)pMBuf->pMem, pMBuf->nLen, (byte*)p2, &l2); - err = ddocMemAppendData(pBuf, p2, -1); - if(err) return err; - err = ddocGen_endElem(pBuf, "ByKey"); - if(err) return err; - } - } else { -#endif if(pSigInfo->pNotary->nRespIdType == RESPID_NAME_TYPE) { p1 = (char*)ddocNotInfo_GetResponderId_Value(pSigInfo->pNotary); RETURN_IF_NULL(p1); @@ -1458,9 +1516,6 @@ } else { SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_WRONG_RESPID); } -#ifdef WITH_TS - } -#endif err = ddocGen_endElem(pBuf, "ResponderID"); if(err) return err; err = ddocMemAppendData(pBuf, "\n", -1); @@ -1487,12 +1542,6 @@ // err = ddocGen_startElemBegin(pBuf, "DigestMethod"); if(err) return err; -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocGen_addAtribute(pBuf, "xmlns", NAMESPACE_XML_DSIG); - if(err) return err; - } -#endif err = ddocGen_addAtribute(pBuf, "Algorithm", DIGEST_METHOD_SHA1); err = ddocGen_startElemEnd(pBuf); if(err) return err; @@ -1501,21 +1550,8 @@ err = ddocMemAppendData(pBuf, "\n", -1); if(err) return err; // -#ifdef WITH_TS - if(!strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - err = ddocGen_startElemBegin(pBuf, "DigestValue"); - if(err) return err; - err = ddocGen_addAtribute(pBuf, "xmlns", NAMESPACE_XML_DSIG); - if(err) return err; - err = ddocGen_startElemEnd(pBuf); - if(err) return err; - } else { -#endif err = ddocGen_startElem(pBuf, "DigestValue"); if(err) return err; -#ifdef WITH_TS - } -#endif l2 = sizeof(buf2); err = calculateNotaryInfoDigest(pSigDoc, pSigInfo->pNotary, (byte*)buf2, &l2); l1 = sizeof(buf1); @@ -1708,6 +1744,7 @@ RETURN_OBJ_IF_NULL(szSerial, NULL) ddocDebug(4, "ddocCertIDList_GetCertIDOfSerial", "find serial: %s", szSerial); for(i = 0; i < pCertIDList->nCertIDs; i++) { + //AM 19.09.08 if(pCertIDList->pCertIDs[i]->szIssuerSerial){ if(!strcmp(pCertIDList->pCertIDs[i]->szIssuerSerial, szSerial)) return pCertIDList->pCertIDs[i]; @@ -1867,7 +1904,7 @@ if(err) return err; err = ddocGen_startElemEnd(pBuf); if(err) return err; - err = ddocMemAppendData(pBuf, "\n", -1); + //err = ddocMemAppendData(pBuf, "\n", -1); if(pCertValue->pCert) { err = getCertPEM(pCertValue->pCert, 0, &p1); if(p1) { @@ -2006,9 +2043,11 @@ RETURN_OBJ_IF_NULL(pCertValueList, NULL) ddocDebug(4, "ddocCertValueList_GetCertValueOfType", "find type: %d", nType); for(i = 0; i < pCertValueList->nCertValues; i++) { + ddocDebug(4, "ddocCertValueList_GetCertValueOfType", "idx: %d", i); ddocDebug(4, "ddocCertValueList_GetCertValueOfType", "idx: %d type: %d", i, pCertValueList->pCertValues[i]->nType); - if(pCertValueList->pCertValues[i]->nType == nType) - return pCertValueList->pCertValues[i]; + if(pCertValueList->pCertValues[i]->nType == nType){ + ddocDebug(4, "ddocCertValueList_GetCertValueOfType", "found"); + return pCertValueList->pCertValues[i];} } return NULL; } @@ -2021,6 +2060,7 @@ //-------------------------------------------------- EXP_OPTION CertValue* ddocCertValueList_GetOrCreateCertValueOfType(CertValueList* pCertValueList, int nType) { + CertValue* pCertValue = ddocCertValueList_GetCertValueOfType(pCertValueList, nType); if(!pCertValue) { ddocCertValue_new(&pCertValue, nType, 0, 0); @@ -2351,26 +2391,28 @@ SignatureInfo** pSignatures; RETURN_IF_NULL_PARAM(pSigDoc); - if((pSignature = getSignatureWithId(pSigDoc, id)) != NULL) { + ddocDebug(3, "SignatureInfo_delete", "id: %s", id); + if((pSignature = getSignatureWithId(pSigDoc, id)) != NULL) { n = pSigDoc->nSignatures - 1; if(n > 0) { pSignatures = (SignatureInfo**)malloc(n * sizeof(void*)); RETURN_IF_BAD_ALLOC(pSignatures); for(i = j = 0; i < pSigDoc->nSignatures; i++) { - if(strcmp(pSigDoc->pSignatures[i]->szId, id)) - pSignatures[j++] = pSigDoc->pSignatures[i]; - else - SignatureInfo_free(pSigDoc->pSignatures[i]); + if(strcmp(pSigDoc->pSignatures[i]->szId, id)) { + pSignatures[j++] = pSigDoc->pSignatures[i]; + } else { + SignatureInfo_free(pSigDoc->pSignatures[i]); + } } free(pSigDoc->pSignatures); pSigDoc->pSignatures = pSignatures; - pSigDoc->nSignatures = n; + pSigDoc->nSignatures = j; } else { - for(i = 0; i < pSigDoc->nSignatures; i++) + for(i = 0; i < pSigDoc->nSignatures; i++){ SignatureInfo_free(pSigDoc->pSignatures[i]); free(pSigDoc->pSignatures); pSigDoc->pSignatures = NULL; - pSigDoc->nSignatures = 0; + pSigDoc->nSignatures = 0;} } } else @@ -2431,14 +2473,13 @@ ddocMemBuf_free(&(pSigInfo->mbufOrigContent)); if(pSigInfo->pNotary) NotaryInfo_free(pSigInfo->pNotary); -#ifdef WITH_TS - if(pSigInfo->pTimestamps) - ddocTimestampInfoList_free(pSigInfo->pTimestamps); -#endif if(pSigInfo->pCertIDs) ddocCertIDList_free(pSigInfo->pCertIDs); if(pSigInfo->pCertValues) ddocCertValueList_free(pSigInfo->pCertValues); + //AM 23.05.08 + if(pSigInfo->szDigestType) + free(pSigInfo->szDigestType); free(pSigInfo); } @@ -2604,6 +2645,45 @@ } //============================================================ +// Returns signaers certs - issuer-name +// pSigInfo - signature info object +// pMbuf - memory buffer to return hash +// return required atribute value +//============================================================ +EXP_OPTION const char* ddocSigInfo_GetSignersCert_IssuerNameAndHash(const SignatureInfo* pSigInfo, DigiDocMemBuf *pMbuf) +{ + CertID* pCertID = 0; + X509* pCert = 0; +/* DigiDocMemBuf mbuf1, mbuf2, mbuf3; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; +*/ + RETURN_OBJ_IF_NULL(pSigInfo, NULL); + RETURN_OBJ_IF_NULL(pMbuf, NULL); + pCertID = ddocCertIDList_GetCertIDOfType(pSigInfo->pCertIDs, CERTID_TYPE_SIGNERS_CERTID); + RETURN_OBJ_IF_NULL(pCertID, NULL); + pCert = ddocSigInfo_GetSignersCert(pSigInfo); + RETURN_OBJ_IF_NULL(pCert, NULL); + /*ddocCertGetSubjectCN(pCert, &mbuf1); + readSubjectKeyIdentifier(pCert, &mbuf2); + ddocEncodeBase64(&mbuf2, &mbuf3); + ddocMemBuf_free(&mbuf2); + readAuthorityKeyIdentifier(pCert, pMbuf); + ddocEncodeBase64(pMbuf, &mbuf2); + ddocDebug(3, "ddocSigInfo_GetSignersCert_IssuerNameAndHash", "CN: %s subj-hash: %s issuer-hash: %s", (char*)mbuf1.pMem, (char*)mbuf3.pMem, (char*)mbuf2.pMem); + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3);*/ + readAuthorityKeyIdentifier(pCert, pMbuf); + return ddocCertID_GetIssuerName(pCertID); +} + +//============================================================ // Sets signers certs issuer name // pSigInfo - signature info object // value - new value @@ -2661,6 +2741,20 @@ } //-------------------------------------------------- +// Finds last CertID object of this signature +// pSigInfo - signature info object [REQUIRED] +// returns CertID pointer or NULL for error +//-------------------------------------------------- +EXP_OPTION CertID* ddocSigInfo_GetLastCertID(const SignatureInfo* pSigInfo) +{ + RETURN_OBJ_IF_NULL(pSigInfo, NULL); + if(pSigInfo->pCertIDs) + return ddocCertIDList_GetLastCertID(pSigInfo->pCertIDs); + return NULL; +} + + +//-------------------------------------------------- // Finds a CertID object with required type or creates a new one // pSigInfo - signature info object [REQUIRED] // nType - type of CertID object [REQUIRED] @@ -2684,8 +2778,10 @@ EXP_OPTION CertValue* ddocSigInfo_GetCertValueOfType(const SignatureInfo* pSigInfo, int nType) { RETURN_OBJ_IF_NULL(pSigInfo, NULL); + ddocDebug(9, "ddocSigInfo_GetCertValueOfType", "start"); if(pSigInfo->pCertValues) return ddocCertValueList_GetCertValueOfType(pSigInfo->pCertValues, nType); + ddocDebug(9, "ddocSigInfo_GetCertValueOfType", "end"); return NULL; } @@ -2771,10 +2867,15 @@ CertValue *pCertValue = 0; RETURN_OBJ_IF_NULL(pSigInfo, NULL); if(pSigInfo->pCertValues) { + ddocDebug(5, "ddocSigInfo_GetOCSPRespondersCert", "start"); pCertValue = ddocSigInfo_GetCertValueOfType(pSigInfo, CERTID_VALUE_RESPONDERS_CERT); - if(pCertValue) + ddocDebug(5, "ddocSigInfo_GetOCSPRespondersCert", "end"); + if(pCertValue){ pCert = pCertValue->pCert; + ddocDebug(5, "ddocSigInfo_GetOCSPRespondersCert", "test");} } + ddocDebug(5, "ddocSigInfo_GetOCSPRespondersCert", "end2"); + if(pCert) ddocDebug(5, "ddocSigInfo_GetOCSPRespondersCert", "pCert exists" ); return pCert; } @@ -2814,9 +2915,9 @@ int err = ERR_OK, l1; char buf1[100], buf2[200], buf3[300], buf4[100]; CertID *pCertID = 0; - DigiDocMemBuf mbuf1; - mbuf1.pMem = 0; - mbuf1.nLen = 0; + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; RETURN_IF_NULL_PARAM(pSigInfo); RETURN_IF_NULL_PARAM(pCert); @@ -2827,12 +2928,12 @@ (unsigned int*)&l1), ERR_X509_DIGEST); if(err) return err; err = ReadCertSerialNumber(buf2, sizeof(buf2), pCert); + memset(buf3, 0, sizeof(buf3)); //AM 26.09.08 //X509_NAME_oneline(X509_get_issuer_name(pCert), buf3, sizeof(buf3)); err = ddocCertGetIssuerDN(pCert, &mbuf1); RETURN_IF_NOT(err == ERR_OK, err); - // now set all those atributes switch(nCertIdType) { case CERTID_TYPE_SIGNERS_CERTID: @@ -2845,13 +2946,6 @@ snprintf(buf4, sizeof(buf4), "%s-OCSP_CERTINFO", pSigInfo->szId); ddocCertID_new(&pCertID, CERTID_TYPE_RESPONDERS_CERTID, buf4, buf2, (char*)mbuf1.pMem, buf1, l1); break; -#ifdef WITH_TS - case CERTID_TYPE_TSA_CERTID: - err = ddocSigInfo_SetTSACert(pSigInfo, pCert); - snprintf(buf4, sizeof(buf4), "%s-TSA_CERTINFO", pSigInfo->szId); - ddocCertID_new(&pCertID, CERTID_TYPE_TSA_CERTID, buf4, buf2, (char*)mbuf1.pMem, buf1, l1); - break; -#endif } RETURN_IF_NOT(pCertID, ERR_BAD_ALLOC); if(!pSigInfo->pCertIDs) { @@ -2862,414 +2956,11 @@ ddocCertIDList_addCertID(pSigInfo->pCertIDs, pCertID); ddocDebug(3, "ddocSigInfo_addCert", "Added signers cert-id: %s type: %d", pCertID->szId, pCertID->nType); } - ddocMemBuf_free(&mbuf1); - return ERR_OK; -} - - -#ifdef WITH_TS - - -//-------------------------------------------------- -// Finds the TSA certificate -// pSigInfo - signature info object [REQUIRED] -// returns certificate or NULL -//-------------------------------------------------- -EXP_OPTION X509* ddocSigInfo_GetTSACert(const SignatureInfo* pSigInfo) -{ - X509 *pCert = 0; - CertValue *pCertValue = 0; - RETURN_OBJ_IF_NULL(pSigInfo, NULL); - if(pSigInfo->pCertValues) { - pCertValue = ddocSigInfo_GetCertValueOfType(pSigInfo, CERTID_VALUE_TSA_CERT); - if(pCertValue) - pCert = pCertValue->pCert; - } - return pCert; -} - -//-------------------------------------------------- -// Sets the TSA certificate -// pSigInfo - signature info object [REQUIRED] -// pTsInfo - timestamp object [REQUIRED] -// pCert - certificate [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocSigInfo_SetTSACert(SignatureInfo* pSigInfo, X509* pCert) -{ - int err = ERR_OK; - CertValue *pCertValue = 0; - char buf1[50]; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(pCert); - pCertValue = ddocSigInfo_GetOrCreateCertValueOfType(pSigInfo, CERTID_VALUE_TSA_CERT); - if(pCertValue) { - snprintf(buf1, sizeof(buf1), "%s-TSA_CERT", pSigInfo->szId); - err = ddocCertValue_SetId(pCertValue, buf1); - if(!err) - err = ddocCertValue_SetCert(pCertValue, pCert); - } - return err; -} - - -//============================================================ -// Returns the next free signature id -// pTimestampInfoList - timestamp list pointer -//============================================================ -EXP_OPTION int getNextTSId(TimestampInfoList* pTimestampInfoList) -{ - int id = 0, n, i; - char* p; - RETURN_OBJ_IF_NULL(pTimestampInfoList, -1); - for(i = 0; i < pTimestampInfoList->nTimestampInfos; i++) { - TimestampInfo* pTS = pTimestampInfoList->pTimestampInfos[i]; - RETURN_OBJ_IF_NULL(pTS, -1); - RETURN_OBJ_IF_NULL(pTS->szId, -1); - p = pTS->szId + strlen(pTS->szId)-1; - while(*p && isdigit(*p)) p--; - n = atoi(p+1); - if(id <= n) - id = n+1; - } - return id; -} - -//-------------------------------------------------- -// Finds a TimestampInfo object with required type -// pSigInfo - signature info object [REQUIRED] -// nType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetTypestampOfType(const SignatureInfo* pSigInfo, const char* szType) -{ - RETURN_OBJ_IF_NULL(pSigInfo, NULL); - if(pSigInfo->pTimestamps) - return ddocTimestampInfoList_GetTimestampInfoOfType(pSigInfo->pTimestamps, szType); - return NULL; -} - -//-------------------------------------------------- -// Finds a TimestampInfo object with required type -// pSigInfo - signature info object [REQUIRED] -// nType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetOrCreateTypestampOfType(SignatureInfo* pSigInfo, const char* szType) -{ - char buf1[20]; - - RETURN_OBJ_IF_NULL(pSigInfo, NULL); - if(!pSigInfo->pTimestamps) - ddocTimestampInfoList_new(&(pSigInfo->pTimestamps)); - // generate id for new TS - snprintf(buf1, sizeof(buf1), "%s-T%d", pSigInfo->szId, getNextTSId(pSigInfo->pTimestamps)); - return ddocTimestampInfoList_GetOrCreateTimestampInfoOfType(pSigInfo->pTimestamps, buf1, szType); -} - -//-------------------------------------------------- -// Finds last TimestampInfo object -// pSigInfo - signature info object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetLastTypestamp(const SignatureInfo* pSigInfo) -{ - RETURN_OBJ_IF_NULL(pSigInfo, NULL); - if(pSigInfo->pTimestamps) - return ddocTimestampInfoList_GetTimestampInfo(pSigInfo->pTimestamps, - ddocTimestampInfoList_GetTimestampInfosCount(pSigInfo->pTimestamps) - 1); - return NULL; -} - -//-------------------------------------------------- -// Calculates digest of timestampable xml block -// pSigDoc - signed doc pointer [REQUIRED] -// pSigInfo - signature pointer [REQUIRED] -// nTsType - timestamp type [REQUIRED] -// pMBufDigest - buffer for digest [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocCalculateTimestampSourceDigest(const SignedDoc* pSigDoc, - const SignatureInfo* pSigInfo, - int nTsType, DigiDocMemBuf* pMBufDigest) -{ - int err = ERR_OK, l1; - const SignatureValue *pSigValue = 0; - DigiDocMemBuf mbuf1, mbuf2; - char *p; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(pMBufDigest); - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - ddocDebug(3, "ddocCalculateTimestampSourceDigest", "Sig: %s, type: %d", pSigInfo->szId, nTsType); - // TS_TYPE_SIGNATURE - if(nTsType == ID_TS_TYPE_SIGNATURE) { - pSigValue = ddocSigInfo_GetSignatureValue((SignatureInfo*)pSigInfo); - RETURN_IF_NULL(pSigValue); - err = ddocSignatureValue_toXML(pSigValue, &mbuf1); - if(err) return err; - p = (char*)canonicalizeXML((char*)mbuf1.pMem, mbuf1.nLen); - if(p) { - err = ddocMemAppendData(&mbuf2, p, -1); - free(p); - p = 0; - } - ddocMemBuf_free(&mbuf1); - } - // TS_TYPE_SIG_AND_REFS - if(nTsType == ID_TS_TYPE_SIG_AND_REFS) { - pSigValue = ddocSigInfo_GetSignatureValue((SignatureInfo*)pSigInfo); - RETURN_IF_NULL(pSigValue); - err = ddocSignatureValue_toXML(pSigValue, &mbuf1); - if(err) return err; - p = (char*)canonicalizeXML((char*)mbuf1.pMem, mbuf1.nLen); - if(p) { - err = ddocMemAppendData(&mbuf2, p, -1); - free(p); - p = 0; - } - ddocMemBuf_free(&mbuf1); - err = ddocSigInfo_SignatureTimeStamp_toXML(pSigInfo, &mbuf1); - if(err) return err; - p = (char*)canonicalizeXML((char*)mbuf1.pMem, mbuf1.nLen); - if(p) { - err = ddocMemAppendData(&mbuf2, p, -1); - free(p); - p = 0; - } - err = ddocMemAppendData(&mbuf2, "\n", -1); - ddocMemBuf_free(&mbuf1); - err = ddocCompleteCertificateRefs_toXML((SignedDoc*)pSigDoc, pSigInfo, &mbuf1); - if(err) return err; - p = (char*)canonicalizeXML((char*)mbuf1.pMem, mbuf1.nLen); - if(p) { - err = ddocMemAppendData(&mbuf2, p, -1); - free(p); - p = 0; - } - ddocMemBuf_free(&mbuf1); - err = ddocCompleteRevocationRefs_toXML((SignedDoc*)pSigDoc, pSigInfo, &mbuf1); - if(err) return err; - p = (char*)canonicalizeXML((char*)mbuf1.pMem, mbuf1.nLen); - if(p) { - err = ddocMemAppendData(&mbuf2, p, -1); - free(p); - p = 0; - } - ddocMemBuf_free(&mbuf1); - } - - - //ddocDebug(5, "ddocCalculateTimestampSourceDigest", "Timestamping: %s", (char*)mbuf2.pMem); - ddocDebugWriteFile(4, "tsinp.txt", &mbuf2); - // calculate digest - l1 = 30; - ddocMemSetLength(pMBufDigest, l1); - calculateDigest((const byte*)mbuf2.pMem, mbuf2.nLen, DIGEST_SHA1, (byte*)pMBufDigest->pMem, &l1); - pMBufDigest->nLen = l1; - ddocMemBuf_free(&mbuf2); - // debug - l1 = 50; - ddocMemSetLength(&mbuf2, l1); - bin2hex((const byte*)pMBufDigest->pMem, pMBufDigest->nLen, (char*)mbuf2.pMem, &l1); - ddocDebug(3, "ddocCalculateTimestampSourceDigest", "digest: %s", (char*)mbuf2.pMem); - - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - return err; -} - -//-------------------------------------------------- -// Adds a to signature -// retrieves the TS_RESP object -// pSigInfo - signature pointer [REQUIRED] -// ppCert - TSA certificate [OPTIONAL] -// policy - policy OID [OPTIONAL] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocGetSignatureTimeStamp(SignatureInfo* pSigInfo, X509** ppCert, - const char* policy, const char* url, - const char* proxyHost, const char* proxyPort) -{ - int err = ERR_OK; - TimestampInfo* pTsInfo = 0; - DigiDocMemBuf mbuf1, mbuf2; - TS_RESP* pResp = 0; - char buf1[50]; - X509* pTsaCert = 0; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(url); - RETURN_IF_NULL_PARAM(ppCert); - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - ddocDebug(3, "ddocGetSignatureTimeStamp", "url: %s proxy: %s/%s cert: %s", - (url ? url : "NULL"), (proxyHost ? proxyHost : ""), - (proxyPort ? proxyPort : ""), (ppCert ? "OK" : "NULL")); - // compose data to timestamp & calc digest - err = ddocCalculateTimestampSourceDigest(0, pSigInfo, ID_TS_TYPE_SIGNATURE, &mbuf1); - // get timestamp - if(!err) - err = ddocSendTSRequest(&mbuf1, &pResp, policy, 1, 1, - url, proxyHost, proxyPort); - if(err) return err; - // convert and add new timestamp - err = ddocTsWriteTsResp(pResp, &mbuf2); - if(err) return err; - pTsInfo = ddocSigInfo_GetOrCreateTypestampOfType(pSigInfo, TS_TYPE_SIGNATURE); - RETURN_IF_NULL(pTsInfo); - err = ddocTimestampInfo_SetTS(pTsInfo, mbuf2.pMem, mbuf2.nLen); - if(err) return err; - err = ddocTimestampInfo_SetRealDigest(pTsInfo, mbuf1.pMem, mbuf1.nLen); - ddocMemBuf_free(&mbuf1); - // set Include elements - snprintf(buf1, sizeof(buf1), "#%s-SIG", pSigInfo->szId); - err = ddocTimestampInfo_AddIncludeInfo(pTsInfo, buf1); ddocMemBuf_free(&mbuf1); - // get TSA cert - err = ddocTsResp_GetSignerCert(pResp, &pTsaCert); - if(!pTsaCert) - pTsaCert = *ppCert; // use only if not returned by TSA - RETURN_IF_NULL(pTsaCert); - // set cert & certid - if(!ddocSigInfo_GetTSACert(pSigInfo)) - err = ddocSigInfo_addCert(pSigInfo, pTsaCert, CERTID_TYPE_TSA_CERTID); - else if(pTsaCert) - X509_free(pTsaCert); - ddocTsResp_GetSignerCert(pResp, ppCert); - ddocDebug(3, "ddocGetSignatureTimeStamp", "RC: %d", err); - if(pResp) - TS_RESP_free(pResp); - return err; -} - -//-------------------------------------------------- -// Generates element XML -// pSigInfo - signature pointer [REQUIRED] -// pMBuf - buffer for XML [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocSigInfo_SignatureTimeStamp_toXML(const SignatureInfo* pSigInfo, DigiDocMemBuf* pMBuf) -{ - TimestampInfo *pTsInfo = 0; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(pMBuf); - pTsInfo = ddocSigInfo_GetTypestampOfType((SignatureInfo*)pSigInfo, TS_TYPE_SIGNATURE); - if(pTsInfo) - return ddocTimestampInfo_toXML(pTsInfo, pMBuf); - else - return 0; -} - -//-------------------------------------------------- -// Generates element XML -// pSigInfo - signature pointer [REQUIRED] -// pMBuf - buffer for XML [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocSigInfo_SigAndRefsTimeStamp_toXML(const SignatureInfo* pSigInfo, DigiDocMemBuf* pMBuf) -{ - TimestampInfo *pTsInfo = 0; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(pMBuf); - pTsInfo = ddocSigInfo_GetTypestampOfType((SignatureInfo*)pSigInfo, TS_TYPE_SIG_AND_REFS); - if(pTsInfo) - return ddocTimestampInfo_toXML(pTsInfo, pMBuf); - else - return 0; + return ERR_OK; } -//-------------------------------------------------- -// Adds a to signature -// retrieves the TS_RESP object -// pSigInfo - signature pointer [REQUIRED] -// ppCert - TSA certificate, returnes cert [OPTIONAL] -// policy - policy OID [OPTIONAL] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocGetSigAndRefsTimeStamp(const SignedDoc* pSigDoc, - const SignatureInfo* pSigInfo, X509** ppCert, - const char* policy, const char* url, - const char* proxyHost, const char* proxyPort) -{ - int err = ERR_OK; - TimestampInfo* pTsInfo = 0, *pTs2 = 0; - DigiDocMemBuf mbuf1, mbuf2; - TS_RESP* pResp = 0; - char buf1[50]; - X509* pTsaCert = 0; - - RETURN_IF_NULL_PARAM(pSigInfo); - RETURN_IF_NULL_PARAM(url); - RETURN_IF_NULL_PARAM(ppCert); - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - ddocDebug(3, "ddocGetSigAndRefsTimeStamp", "url: %s proxy: %s/%s", - (url ? url : "NULL"), (proxyHost ? proxyHost : ""), - (proxyPort ? proxyPort : "")); - err = ddocCalculateTimestampSourceDigest(pSigDoc, pSigInfo, ID_TS_TYPE_SIG_AND_REFS, &mbuf1); - // get timestamp - if(!err) - err = ddocSendTSRequest(&mbuf1, &pResp, policy, 1, 1, - url, proxyHost, proxyPort); - if(err) return err; - // convert and add new timestamp - err = ddocTsWriteTsResp(pResp, &mbuf2); - if(err) return err; - pTsInfo = ddocSigInfo_GetOrCreateTypestampOfType((SignatureInfo*)pSigInfo, TS_TYPE_SIG_AND_REFS); - RETURN_IF_NULL(pTsInfo); - if(err) return err; - err = ddocTimestampInfo_SetRealDigest(pTsInfo, mbuf1.pMem, mbuf1.nLen); - ddocMemBuf_free(&mbuf1); - err = ddocTimestampInfo_SetTS(pTsInfo, mbuf2.pMem, mbuf2.nLen); - // set Include elements - snprintf(buf1, sizeof(buf1), "#%s-SIG", pSigInfo->szId); - err = ddocTimestampInfo_AddIncludeInfo(pTsInfo, buf1); - pTs2 = ddocSigInfo_GetTypestampOfType((SignatureInfo*)pSigInfo, TS_TYPE_SIGNATURE); - RETURN_IF_NULL_PARAM(pTs2); - snprintf(buf1, sizeof(buf1), "#%s", pTs2->szId); - err = ddocTimestampInfo_AddIncludeInfo(pTsInfo, buf1); - snprintf(buf1, sizeof(buf1), "#%s-CERTREFS", pSigInfo->szId); - err = ddocTimestampInfo_AddIncludeInfo(pTsInfo, buf1); - snprintf(buf1, sizeof(buf1), "#%s-REVOCREFS", pSigInfo->szId); - err = ddocTimestampInfo_AddIncludeInfo(pTsInfo, buf1); - - ddocMemBuf_free(&mbuf2); - // get TSA cert - err = ddocTsResp_GetSignerCert(pResp, &pTsaCert); - if(!pTsaCert) - pTsaCert = *ppCert; // use only if not returned by TSA - RETURN_IF_NULL(pTsaCert); - // set cert - if(!ddocSigInfo_GetTSACert((SignatureInfo*)pSigInfo)) - err = ddocSigInfo_addCert((SignatureInfo*)pSigInfo, pTsaCert, CERTID_TYPE_TSA_CERTID); - else if(pTsaCert) - X509_free(pTsaCert); - ddocTsResp_GetSignerCert(pResp, ppCert); - ddocDebug(3, "ddocGetSigAndRefsTimeStamp", "RC: %d", err); - if(pResp) - TS_RESP_free(pResp); - return err; -} - -#endif //======================< DocInfo functions >========================================= @@ -3312,6 +3003,9 @@ } memset(pDocInfo, 0, sizeof(DocInfo)); pDocInfos[pSigInfo->nDocs-1] = pDocInfo; + // PR. leak found + if(pSigInfo->pDocs) + free(pSigInfo->pDocs); pSigInfo->pDocs = pDocInfos; if(docId) setString(&(pDocInfo->szDocId), docId, -1); @@ -3456,12 +3150,12 @@ //============================================================ EXP_OPTION int addAllDocInfos(SignedDoc* pSigDoc, SignatureInfo* pSigInfo) { - int i, c; + int i, c, l2; int len = 0; //Added by AA 28/10/2003 - not defined len value DataFile *pDf = NULL; DocInfo *pDocInfo = NULL; - byte buf[DIGEST_LEN+2]; + byte buf[DIGEST_LEN+2], buf2[50]; RETURN_IF_NULL_PARAM(pSigDoc); RETURN_IF_NULL_PARAM(pSigInfo); @@ -3471,19 +3165,17 @@ RETURN_IF_NULL(pDf); buf[0] = 0; // in version 1.0 we use mime digest - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { len = sizeof(buf); calculateDigest((const byte*)pDf->szMimeType, strlen(pDf->szMimeType), DIGEST_SHA1, buf, &len); } - if(!strcmp(pDf->szContentType, CONTENT_HASHCODE) && - pDf->mbufDetachedDigest.pMem) { - addDocInfo(&pDocInfo, pSigInfo, pDf->szId, - pDf->szDigestType, (byte*)pDf->mbufDetachedDigest.pMem, - pDf->mbufDetachedDigest.nLen, buf, len); - } else // in 1.1 we don't use mime digest - addDocInfo(&pDocInfo, pSigInfo, pDf->szId, + memset(buf2, 0, sizeof(buf2)); + l2 = 0; + encode((const byte*)pDf->mbufDigest.pMem, pDf->mbufDigest.nLen, (byte*)buf2, &l2); + ddocDebug(3, "addAllDocInfos", "DF: %d digest \'%s\'", pDf->szId, buf2); + addDocInfo(&pDocInfo, pSigInfo, pDf->szId, pDf->szDigestType, (byte*)pDf->mbufDigest.pMem, pDf->mbufDigest.nLen, buf, len); } @@ -3547,7 +3239,7 @@ EXP_OPTION int calculateSignedPropertiesDigest(SignedDoc* pSigDoc, SignatureInfo* pSigInfo) { int err = ERR_OK, l1, l2; - byte buf1[DIGEST_LEN+2], *buf2 = 0, *buf3 = 0; + byte buf1[DIGEST_LEN256+2], *buf2 = 0, *buf3 = 0; RETURN_IF_NULL_PARAM(pSigInfo); /* P.R 0->1 */ @@ -3555,8 +3247,8 @@ RETURN_IF_NULL(buf2); buf3 = canonicalizeXML((char*)buf2, strlen((const char*)buf2)); //dumpInFile("sigprop-sig1.txt", buf2); - l2 = strlen((const char*)buf3); - l1 = sizeof(buf1); + l2 = (int)strlen((const char*)buf3); + l1 = (int)sizeof(buf1); calculateDigest(buf3, l2, DIGEST_SHA1, buf1, &l1); free(buf2); free(buf3); @@ -3578,10 +3270,10 @@ RETURN_IF_NULL_PARAM(pSigInfo); RETURN_IF_NULL_PARAM(digBuf); - buf2 = (byte*)createXMLSignedInfo(pSigDoc, pSigInfo); + buf2 = (byte*)createXMLSignedInfo(pSigDoc, pSigInfo); RETURN_IF_NULL(buf2); l2 = strlen((const char*)buf2); - calculateDigest(buf2, l2, DIGEST_SHA1, digBuf, digLen); + calculateDigest(buf2, l2, DIGEST_SHA1, digBuf, digLen); free(buf2); return err; } @@ -3613,14 +3305,15 @@ ddocDebug(3, "setSignatureValueFromFile", "read: %d", i); for(j = 0; j < i; j++) { if(isxdigit(buf[j])) { - if(isdigit(buf[j])) + if(isdigit(buf[j])) { sbuf[slen++] = buf[j]; - else + } else { sbuf[slen++] = toupper(buf[j]); - } - } - } - ddocDebug(3, "setSignatureValueFromFile", "input: %d - \'%s\'", slen, sbuf); + } // else + } // if + } // for + } + ddocDebug(3, "setSignatureValueFromFile", "input: %d - \'%s\'", slen, sbuf); // decode hex memset(buf, 0, sizeof(buf)); j = 0; @@ -3632,8 +3325,8 @@ encode((const byte*)buf, j, (byte*)sbuf, &slen); ddocDebug(3, "setSignatureValueFromFile", "encoded: %d - \'%s\'", slen, sbuf); if(j == SIGNATURE_LEN) { - snprintf(buf1, sizeof(buf1), "#%s-SIG", pSigInfo->szId); - ddocSignatureValue_new(&(pSigInfo->pSigValue), buf1, SIGN_RSA_NAME, buf, j); + snprintf((char*)buf1, sizeof(buf1), "#%s-SIG", pSigInfo->szId); + ddocSignatureValue_new(&(pSigInfo->pSigValue), (char*)buf1, SIGN_RSA_NAME, (char*)buf, j); //ddocMemBuf_free(&(pSigInfo->mbufOrigContent)); if(pSigInfo->mbufOrigContent.pMem) { p1 = strstr((char*)pSigInfo->mbufOrigContent.pMem, "mbufOrigContent.pMem, -1); - ddocMemAppendData(&mbuf1, sbuf, -1); + ddocMemAppendData(&mbuf1, (char*)sbuf, -1); p1++; //ddocDebug(3, "setSignatureValueFromFile", "add: %s", p1); ddocMemAppendData(&mbuf1, p1, -1); @@ -3673,7 +3366,8 @@ RETURN_IF_NULL_PARAM(szSignature); //clearErrors(); - RETURN_IF_NOT(sigLen == SIGNATURE_LEN, ERR_SIGNATURE); + // VS: not quite sure if there's not a second constant to use instead of removing the check + //RETURN_IF_NOT(sigLen == SIGNATURE_LEN, ERR_SIGNATURE); ddocSignatureValue_new(&(pSigInfo->pSigValue), 0, SIGN_RSA_NAME, szSignature, sigLen); ddocMemBuf_free(&(pSigInfo->mbufOrigContent)); return ERR_OK; @@ -3708,7 +3402,7 @@ { int id = 0, n, i; SignatureInfo* pSigInfo = 0; - + RETURN_OBJ_IF_NULL(pSigDoc, -1); for(i = 0; i < getCountOfSignatures(pSigDoc); i++) { pSigInfo = getSignature(pSigDoc, i); @@ -3873,6 +3567,8 @@ free(pNotary->szNotType); if(pNotary->timeProduced) free(pNotary->timeProduced); + if(pNotary->szProducedAt) + free(pNotary->szProducedAt); ddocMemBuf_free(&(pNotary->mbufRespId)); if(pNotary->szDigestType) free(pNotary->szDigestType); @@ -3945,7 +3641,7 @@ { int err = ERR_OK; OCSP_BASICRESP *br = NULL; - + RETURN_IF_NULL_PARAM(pResp); RETURN_IF_NULL_PARAM(pType); RETURN_IF_NULL_PARAM(pMbufRespId); @@ -3957,9 +3653,9 @@ *pType = RESPID_NAME_TYPE; ddocMemSetLength(pMbufRespId, 300); //X509_NAME_oneline(br->tbsResponseData->responderId->value.byName, (char*)pMbufRespId->pMem, pMbufRespId->nLen); - //AM 26.09.08 - err = ddocCertGetDNFromName(br->tbsResponseData->responderId->value.byName, pMbufRespId); - RETURN_IF_NOT(err == ERR_OK, err); + //AM 26.09.08 + err = ddocCertGetDNFromName(br->tbsResponseData->responderId->value.byName, pMbufRespId); + //RETURN_IF_NOT(err == ERR_OK, err); break; case V_OCSP_RESPID_KEY: *pType = RESPID_KEY_TYPE; @@ -4079,6 +3775,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return p1; } @@ -4106,6 +3805,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4132,6 +3834,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4154,12 +3859,33 @@ if(!err && br && br->tbsResponseData && br->tbsResponseData->producedAt) { err = asn1time2time_t_local(br->tbsResponseData->producedAt, pTime); } + //AM 22.06.08 lets free br too + if(br) + OCSP_BASICRESP_free(br); if(pResp) OCSP_RESPONSE_free(pResp); return err; } //============================================================ +// Returns OCSP responses producedAt from xml as time_t +// pNotary - Notary info +// pTime - address of time_t variable +// return error code OR ERR_OK. +//============================================================ +int ddocNotInfo_GetProducedAtXml_timet(const NotaryInfo* pNotary, time_t* pTime) +{ + int err = ERR_OK; + + RETURN_IF_NULL_PARAM(pNotary); + RETURN_IF_NULL_PARAM(pTime); + if(!err && pNotary->szProducedAt) { + err = str2time_t(pNotary->szProducedAt, pTime); + } + return err; +} + +//============================================================ // Returns OCSP responses nextUpdate atribute as string // pNotary - Notary info // pMBuf - buffer for nextUpdate value @@ -4182,6 +3908,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4207,6 +3936,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4232,6 +3964,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4243,29 +3978,50 @@ //============================================================ int ddocNotInfo_GetOcspRealDigest(const NotaryInfo* pNotary, DigiDocMemBuf* pMBuf) { - int err = ERR_OK; + int err = ERR_OK, nIdx = 0, l1 = 0, l2 = 0, nCheckOcspLen = 0; OCSP_RESPONSE *pResp = 0; OCSP_BASICRESP *br = NULL; OCSP_SINGLERESP *single = NULL; - X509_EXTENSION *nonce = NULL; - + X509_EXTENSION *ext = NULL; + byte* p = 0, buf2[DIGEST_LEN256 * 2 + 2]; + RETURN_IF_NULL_PARAM(pNotary); RETURN_IF_NULL_PARAM(pMBuf); err = ddocNotInfo_GetBasicResp(pNotary, &pResp, &br, &single); + nCheckOcspLen = ConfigItem_lookup_int("CHECK_OCSP_NONCE", 0); if(!err && br) { - nonce = sk_X509_EXTENSION_value(br->tbsResponseData->responseExtensions, 0); - if(nonce) { - if(nonce->value->length > DIGEST_LEN) - err = ddocMemAssignData(pMBuf, (const char*)(nonce->value->data + - (nonce->value->length - DIGEST_LEN)), DIGEST_LEN); - else - err = ddocMemAssignData(pMBuf, (const char*)nonce->value->data, nonce->value->length); + nIdx = OCSP_BASICRESP_get_ext_by_NID(br, NID_id_pkix_OCSP_Nonce, -1); + if(nIdx >= 0) { + ext = OCSP_BASICRESP_get_ext(br, nIdx); + if(ext != NULL) { + int l1 = ASN1_STRING_length(ext->value); + p = ASN1_STRING_data(ext->value); + if(l1 > 2 && p[0] == V_ASN1_OCTET_STRING && p[1] == l1-2) + err = ddocMemAssignData(pMBuf, (const char*)p+2, l1-2); + else + err = ddocMemAssignData(pMBuf, (const char*)p, l1); + // debug + l2 = sizeof(buf2); + memset(buf2, 0, l2); + if(l1 <= DIGEST_LEN256) { + bin2hex((const byte*)p, l1, (byte*)buf2, &l2); + ddocDebug(3, "ddocNotInfo_GetOcspRealDigest", "Not: %s nonce: %s len: %d err: %d", + pNotary->szId, buf2, l1, err); + } + if(l1 != 22 && nCheckOcspLen) { + ddocDebug(1, "ddocNotInfo_GetOcspRealDigest", "Not: %s invalid nonce: %s len: %d err: %d", + pNotary->szId, buf2, l1, err); + err = ERR_OCSP_NONCE_INVALID; + } + } } else err = ERR_OCSP_NO_NONCE; } if(pResp) OCSP_RESPONSE_free(pResp); + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4290,6 +4046,9 @@ } if(pResp) OCSP_RESPONSE_free(pResp); + // PR. leak found + if(br) + OCSP_BASICRESP_free(br); return err; } @@ -4348,10 +4107,13 @@ err = ddocSigInfo_SetOCSPRespondersCert(pSigInfo, cert); buf[0] = 0; err = ReadCertSerialNumber(buf, sizeof(buf), cert); - if(strlen(buf)) + if(strlen(buf)){ pCertID = ddocCertIDList_GetCertIDOfSerial(pSigInfo->pCertIDs, buf); + } if(!pCertID) pCertID = ddocSigInfo_GetOrCreateCertIDOfType(pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); + else //AM quick fix for smartlink bdoc + if(pCertID->nType==0)pCertID->nType = CERTID_TYPE_RESPONDERS_CERTID; RETURN_IF_NULL(pCertID); ddocCertID_SetIssuerSerial(pCertID, buf); n = sizeof(buf); @@ -4449,28 +4211,150 @@ EXP_OPTION int calculateNotaryInfoDigest(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo, byte* digBuf, int* digLen) { - OCSP_BASICRESP* pBsResp; SignatureInfo* pSigInfo; int err = ERR_OK; const DigiDocMemBuf *pMBuf = 0; - // in version 1.0 we calculated digest over tbsResponseData - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { - pSigInfo = ddocGetSignatureForNotary(pSigDoc, pNotInfo); - RETURN_IF_NULL_PARAM(pSigInfo); - err = notary2ocspBasResp(pSigDoc, pNotInfo, ddocSigInfo_GetOCSPRespondersCert(pSigInfo), &pBsResp); - if(err == ERR_OK) { - err = calculateOcspBasicResponseDigest(pBsResp, digBuf, digLen); - OCSP_BASICRESP_free(pBsResp); - } - } else { // in version 1.1 we calculate digest over the whole OCSP_RESPONSE - pMBuf = ddocNotInfo_GetOCSPResponse(pNotInfo); - RETURN_IF_NULL(pMBuf); + pMBuf = ddocNotInfo_GetOCSPResponse(pNotInfo); + RETURN_IF_NULL(pMBuf); + pSigInfo = ddocGetSignatureForNotary(pSigDoc, pNotInfo); + RETURN_IF_NULL_PARAM(pSigInfo); + if(!strcmp(pNotInfo->szDigestType,DIGEST_SHA256_NAME)) + err = calculateDigest((const byte*)pMBuf->pMem, pMBuf->nLen, DIGEST_SHA256, digBuf, digLen); + else err = calculateDigest((const byte*)pMBuf->pMem, pMBuf->nLen, DIGEST_SHA1, digBuf, digLen); - } if (err != ERR_OK) SET_LAST_ERROR(err); return err; } +//AM 12.03.08 +//-------------------------------------------------- +// Sets the CA Responders certificate +// pSigInfo - signature info object [REQUIRED] +// pCert - certificate [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddocSigInfo_SetCACert(SignatureInfo* pSigInfo, X509* pCert) +{ + int err = ERR_OK; + CertValue *pCertValue = 0; + char buf1[50]; + + RETURN_IF_NULL_PARAM(pSigInfo); + RETURN_IF_NULL_PARAM(pCert); + pCertValue = ddocSigInfo_GetOrCreateCertValueOfType(pSigInfo, CERTID_VALUE_CA_CERT); + if(pCertValue) { + snprintf(buf1, sizeof(buf1), "%s-CA_CERT", pSigInfo->szId); + err = ddocCertValue_SetId(pCertValue, buf1); + if(!err) + err = ddocCertValue_SetCert(pCertValue, pCert); + } + return err; +} + +//============================================================ +// Calculates and stores a signature for this SignatureInfo object +// Uses PKCS#12 file to sign the info +// pSigInfo - signature info object +// nSigType - signature type code +// szPkcs12File - PKCS#12 file +// passwd - key password +//============================================================ +EXP_OPTION int calculateSignatureWithPkcs12(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + const char* szPkcs12File, const char* passwd) +{ + int err = ERR_OK; + int sigLen; + char sigDig[100]; + char signature[256]; + char* buf1; + int l2; + EVP_PKEY *pkey = 0; + X509* x509 = 0; + EVP_MD_CTX ctx; + DigiDocMemBuf mbuf1; + + RETURN_IF_NULL_PARAM(pSigInfo); + RETURN_IF_NULL_PARAM(pSigDoc); + RETURN_IF_NULL_PARAM(szPkcs12File); + ddocDebug(3, "calculateSignatureWithPkcs12", "Keystore: %s passwd-len: %d", + szPkcs12File, (passwd ? strlen(passwd) : 0)); + // read pkcs12 file + err = ReadCertificateByPKCS12(&x509, szPkcs12File, passwd, &pkey); + RETURN_IF_NOT(err == ERR_OK, err); + // try key-usage check + if(ConfigItem_lookup_int("KEY_USAGE_CHECK", 1) && x509) { + if(!ddocCertCheckKeyUsage(x509, KUIDX_NON_REPUDIATION)) { + X509_free(x509); + EVP_PKEY_free(pkey); + SET_LAST_ERROR(ERR_SIGNERS_CERT_NON_REPU); + return ERR_SIGNERS_CERT_NON_REPU; + } + } + // set signers cert + setSignatureCert(pSigInfo, x509); + // create signing timestamp + createTimestamp(pSigDoc, (char*)sigDig, sizeof(sigDig)); + setString((char**)&(pSigInfo->szTimeStamp), (const char*)sigDig, -1); + // Signed properties digest + buf1 = createXMLSignedProperties(pSigDoc, pSigInfo, 0); + mbuf1.pMem = canonicalizeXML((char*)buf1, strlen(buf1)); + mbuf1.nLen = strlen((const char*)mbuf1.pMem); + ddocDebugWriteFile(4, "sigprop-signed.txt", &mbuf1); + l2 = sizeof(sigDig); + err = calculateDigest((const byte*)mbuf1.pMem, mbuf1.nLen, DIGEST_SHA1, sigDig, &l2); + free(buf1); + ddocMemBuf_free(&mbuf1); + if (err != ERR_OK) { + SET_LAST_ERROR(err); + return err; + } + ddocSigInfo_SetSigPropDigest(pSigInfo, (const char*)sigDig, l2); + ddocSigInfo_SetSigPropRealDigest(pSigInfo, (const char*)sigDig, l2); + // create signed info + buf1 = createXMLSignedInfo(pSigDoc, pSigInfo); + if (!buf1) { + err = ERR_NULL_POINTER; + SET_LAST_ERROR(err); + return err ; + } + mbuf1.pMem = buf1; //canonicalizeXML((char*)buf1, strlen(buf1)); + mbuf1.nLen = strlen((const char*)mbuf1.pMem); + //ddocDebugWriteFile(4, "siginf-signed.txt", &mbuf1); + ddocDebug(3, "calculateSignatureWithPkcs12", "Sig-inf: \n---\n%s\n---\nlen: %d", buf1, strlen(buf1)); + // get digest + l2 = sizeof(sigDig); + err = calculateDigest((const byte*)buf1, strlen(buf1), DIGEST_SHA1, (byte*)sigDig, &l2); + // debug + sigLen = sizeof(signature); + bin2hex((const byte*)sigDig, l2, (char*)signature, &sigLen); + ddocDebug(3, "calculateSignatureWithPkcs12", "Sig-inf hash hex: %s", signature); + sigLen = sizeof(signature); + encode((const byte*)sigDig, l2, (char*)signature, &sigLen); + ddocDebug(3, "calculateSignatureWithPkcs12", "Sig-inf hash b64: %s", signature); + if (err != ERR_OK) { + err = ERR_NULL_POINTER; + SET_LAST_ERROR(err); + return err; + } + ddocSigInfo_SetSigInfoRealDigest(pSigInfo, (const char*)sigDig, l2); + // sign data + sigLen = sizeof(signature); + memset(signature, 0, sizeof(signature)); + // sign data + EVP_SignInit(&ctx, EVP_sha1()); + EVP_SignUpdate(&ctx, buf1, (unsigned long)strlen(buf1)); + err = EVP_SignFinal(&ctx, signature, &sigLen, pkey); + free(buf1); + if(err == ERR_LIB_NONE) + err = ERR_OK; + // set signature value + ddocSigInfo_SetSignatureValue(pSigInfo, (const char*)signature, (int)sigLen); + ddocDebug(3, "calculateSignatureWithPkcs12", "Sig-len: %ld", sigLen); + //X509_free(x509); + EVP_PKEY_free(pkey); + + return err; +} diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocObj.h libdigidoc-3.7.0.875/libdigidoc/DigiDocObj.h --- libdigidoc-2.7.0/libdigidoc/DigiDocObj.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocObj.h 2012-12-13 22:05:47.000000000 +0000 @@ -27,9 +27,6 @@ #include #include #include -#ifdef WITH_TS -#include -#endif //==========< DigiDoc object structure >======================== @@ -84,6 +81,8 @@ #define CERTID_TYPE_SIGNERS_CERTID 1 #define CERTID_TYPE_RESPONDERS_CERTID 2 #define CERTID_TYPE_TSA_CERTID 3 +//AM 12.03.08 +#define CERTID_VALUE_CA_CERT 4 typedef struct CertID_st { @@ -92,6 +91,8 @@ char* szIssuerSerial; char* szIssuerName; DigestValue* pDigestValue; + //AM 24.04.08 + char* szDigestType; // digest method used } CertID; typedef struct CertIDList_st { @@ -103,6 +104,8 @@ #define CERTID_VALUE_SIGNERS_CERT 1 #define CERTID_VALUE_RESPONDERS_CERT 2 #define CERTID_VALUE_TSA_CERT 3 +//AM 12.03.08 +#define CERTID_TYPE_CA_CERTID 4 typedef struct CertValue_st { int nType; @@ -120,7 +123,7 @@ char* szId; // data file id char* szFileName; // signed doc file name char* szMimeType; // date file mime type - char* szContentType; // DETATCHED, EMBEDDED or EMBEDDED_BASE64 + char* szContentType; // EMBEDDED or EMBEDDED_BASE64 long nSize; // file size (unencoded) char* szDigestType; // digest type DigiDocMemBuf mbufDigest; // real DataFile digest value @@ -137,6 +140,7 @@ char* szId; // Notary id char* szNotType; // notary info type (OCSP-1.0) char* timeProduced; // producedAt + char* szProducedAt; // producedAt in xml int nRespIdType; // RESP_ID_NAME, RESP_ID_KEY DigiDocMemBuf mbufRespId; // responder id value char* szDigestType; // digest method used @@ -161,11 +165,10 @@ SignerRole signerRole; DigiDocMemBuf mbufOrigContent; NotaryInfo* pNotary; -#ifdef WITH_TS - TimestampInfoList *pTimestamps; -#endif CertIDList *pCertIDs; CertValueList *pCertValues; + //AM 24.04.08 + char* szDigestType; // digest method used } SignatureInfo; @@ -177,6 +180,10 @@ DataFile** pDataFiles; int nSignatures; SignatureInfo** pSignatures; + //AM 14.03.08 + char* szFileName; + //AM 13.05.08 + char* szProfile; } SignedDoc; //============================================================ @@ -252,7 +259,22 @@ EXP_OPTION int ddocDataFile_SetDetachedDigestValue(DataFile* pDataFile, const char* value, long len); +//-------------------------------------------------- +// Accessor for WrongDigest atribute of DataFile object. +// pDataFile - address of object [REQUIRED] +// returns value of atribute or NULL. +//-------------------------------------------------- +EXP_OPTION DigiDocMemBuf* ddocDataFile_GetWrongDigestValue(DataFile* pDataFile); +//-------------------------------------------------- +// Mutatoror for WrongDigest atribute of DataFile object. +// pDataFile - address of object [REQUIRED] +// value - new value for atribute [REQUIRED] +// len - length of value in bytes [REQUIRED] +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddocDataFile_SetWrongDigestValue(DataFile* pDataFile, + const char* value, long len); // Returns number of DataFile attributes EXP_OPTION int getCountOfDataFileAttributes(const DataFile* pDataFile); @@ -266,13 +288,28 @@ int ddocGetDataFileCachedData(SignedDoc* pSigDoc, const char* szDocId, void** ppBuf, long* pLen); // apppends DataFile content to cache -void ddocAppendDataFileData(DataFile* pDf, int maxLen, void* data, int len); +EXP_OPTION void ddocAppendDataFileData(DataFile* pDf, int maxLen, void* data, int len, int isBase64); // calculates file size and digest and store in the // given DataFile object EXP_OPTION int calculateDataFileSizeAndDigest(SignedDoc* pSigDoc, const char* id, const char* filename, int digType); +//-------------------------------------------------- +// Creates new DataFile and assigns contet from memory +// ppDataFile address of pointer to return new DataFile object +// pSigDoc - SignedDoc object +// id - new DataFile id. Use NULL for default +// filename - filename +// contentType - content type +// mime - mime type +// pData - address of DataFile content to be assigned +// size - length of data in bytes +//-------------------------------------------------- +EXP_OPTION int createDataFileInMemory(DataFile **ppDataFile, SignedDoc* pSigDoc, const char* id, + const char* filename, const char* contentType, + const char* mime, const char* pData, long size); + //======================< DigestValue functions >============================= //-------------------------------------------------- @@ -335,12 +372,11 @@ //-------------------------------------------------- // Generates XML for element -// pSigDoc - signed doc object [REQUIRED] // pDigestValue - DigestValue object [REQUIRED] // pBuf - memory buffer for storing xml [REQUIRED] // returns error code or ERR_OK //-------------------------------------------------- -int ddocDigestValue_toXML(const SignedDoc* pSigDoc, const DigestValue* pDigestValue, DigiDocMemBuf* pBuf); +int ddocDigestValue_toXML(const DigestValue* pDigestValue, DigiDocMemBuf* pBuf); //======================< SignatureValue functions >============================= @@ -526,6 +562,7 @@ // returns error code or ERR_OK //-------------------------------------------------- int ddocCompleteCertificateRefs_toXML(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, DigiDocMemBuf* pBuf); +int bdocCompleteCertificateRefs_toXML(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, DigiDocMemBuf* pBuf); //-------------------------------------------------- // Generates XML for element @@ -831,6 +868,14 @@ EXP_OPTION const char* ddocSigInfo_GetSignersCert_IssuerName(const SignatureInfo* pSigInfo); //============================================================ +// Returns signaers certs - issuer-name +// pSigInfo - signature info object +// pMbuf - memory buffer to return hash +// return required atribute value +//============================================================ +EXP_OPTION const char* ddocSigInfo_GetSignersCert_IssuerNameAndHash(const SignatureInfo* pSigInfo, DigiDocMemBuf *pMbuf); + +//============================================================ // Sets signers certs issuer name // pSigInfo - signature info object // value - new value @@ -868,6 +913,12 @@ //-------------------------------------------------- EXP_OPTION CertID* ddocSigInfo_GetOrCreateCertIDOfType(SignatureInfo* pSigInfo, int nType); +//-------------------------------------------------- +// Finds last CertID object of this signature +// pSigInfo - signature info object [REQUIRED] +// returns CertID pointer or NULL for error +//-------------------------------------------------- +EXP_OPTION CertID* ddocSigInfo_GetLastCertID(const SignatureInfo* pSigInfo); //-------------------------------------------------- // Finds a CertValue object with required type @@ -930,110 +981,10 @@ // return error code or ERR_OK //============================================================ EXP_OPTION int ddocSigInfo_addCert(SignatureInfo* pSigInfo, X509* pCert, int nCertIdType); +//AM +EXP_OPTION int bdocSigInfo_addCert(SignatureInfo* pSigInfo, X509* pCert, int nCertIdType); -#ifdef WITH_TS - -//-------------------------------------------------- -// Finds the TSA certificate -// pSigInfo - signature info object [REQUIRED] -// returns certificate or NULL -//-------------------------------------------------- -EXP_OPTION X509* ddocSigInfo_GetTSACert(const SignatureInfo* pSigInfo); - -//-------------------------------------------------- -// Sets the TSA certificate -// pSigInfo - signature info object [REQUIRED] -// pTsInfo - timestamp object [REQUIRED] -// pCert - certificate [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocSigInfo_SetTSACert(SignatureInfo* pSigInfo, X509* pCert); - -//-------------------------------------------------- -// Finds a TimestampInfo object with required type -// pSigInfo - signature info object [REQUIRED] -// nType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetTypestampOfType(const SignatureInfo* pSigInfo, const char* szType); - -//-------------------------------------------------- -// Finds a TimestampInfo object with required type -// pSigInfo - signature info object [REQUIRED] -// nType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetOrCreateTypestampOfType(SignatureInfo* pSigInfo, const char* szType); - -//-------------------------------------------------- -// Finds last TimestampInfo object -// pSigInfo - signature info object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocSigInfo_GetLastTypestamp(const SignatureInfo* pSigInfo); - -//-------------------------------------------------- -// Calculates digest of timestampable xml block -// pSigDoc - signed doc pointer [REQUIRED] -// pSigInfo - signature pointer [REQUIRED] -// nTsType - timestamp type [REQUIRED] -// pMBufDigest - buffer for digest [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocCalculateTimestampSourceDigest(const SignedDoc* pSigDoc, - const SignatureInfo* pSigInfo, - int nTsType, DigiDocMemBuf* pMBufDigest); - -//-------------------------------------------------- -// Adds a to signature -// retrieves the TS_RESP object -// pSigInfo - signature pointer [REQUIRED] -// ppCert - TSA certificate, returnes TSA cert [OPTIONAL] -// policy - policy OID [OPTIONAL] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocGetSignatureTimeStamp(SignatureInfo* pSigInfo, X509** ppCert, - const char* policy, const char* url, - const char* proxyHost, const char* proxyPort); - - -//-------------------------------------------------- -// Generates element XML -// pSigInfo - signature pointer [REQUIRED] -// pMBuf - buffer for XML [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocSigInfo_SignatureTimeStamp_toXML(const SignatureInfo* pSigInfo, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Adds a to signature -// retrieves the TS_RESP object -// pSigInfo - signature pointer [REQUIRED] -// ppCert - TSA certificate [OPTIONAL] -// policy - policy OID [OPTIONAL] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocGetSigAndRefsTimeStamp(const SignedDoc* pSigDoc, - const SignatureInfo* pSigInfo, X509** ppCert, - const char* policy, const char* url, - const char* proxyHost, const char* proxyPort); - -//-------------------------------------------------- -// Generates element XML -// pSigInfo - signature pointer [REQUIRED] -// pMBuf - buffer for XML [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocSigInfo_SigAndRefsTimeStamp_toXML(const SignatureInfo* pSigInfo, DigiDocMemBuf* pMBuf); - -#endif // Returns the last SignatureInfo object EXP_OPTION SignatureInfo* ddocGetLastSignature(const SignedDoc* pSigDoc); @@ -1205,6 +1156,14 @@ int ddocNotInfo_GetProducedAt_timet(const NotaryInfo* pNotary, time_t* pTime); //============================================================ +// Returns OCSP responses producedAt from xml as time_t +// pNotary - Notary info +// pTime - address of time_t variable +// return error code OR ERR_OK. +//============================================================ +int ddocNotInfo_GetProducedAtXml_timet(const NotaryInfo* pNotary, time_t* pTime); + +//============================================================ // Returns OCSP responses thisUpdate atribute as time_t // pNotary - Notary info // pTime - address of time_t variable @@ -1296,6 +1255,16 @@ // Calculates digest EXP_OPTION int calculateSignedInfoDigest(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, byte* digBuf, int* digLen); +//============================================================ +// Calculates and stores a signature for this SignatureInfo object +// Uses PKCS#12 file to sign the info +// pSigInfo - signature info object +// nSigType - signature type code +// szPkcs12File - PKCS#12 file +// passwd - key password +//============================================================ +EXP_OPTION int calculateSignatureWithPkcs12(SignedDoc* pSigDoc, SignatureInfo* pSigInfo, + const char* szPkcs12File, const char* passwd); #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocPKCS11.c libdigidoc-3.7.0.875/libdigidoc/DigiDocPKCS11.c --- libdigidoc-2.7.0/libdigidoc/DigiDocPKCS11.c 2009-12-30 13:40:41.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocPKCS11.c 2012-12-13 22:05:47.000000000 +0000 @@ -29,6 +29,7 @@ #include "DigiDocDebug.h" #include "DigiDocCert.h" #include "DigiDocGen.h" +#include "DigiDocConvert.h" #include #include @@ -54,7 +55,7 @@ CK_RV rv; // load PKCS#11 driver - ddocDebug(3, "initPKCS11Library", "Loading driver: %s\n", libName); + ddocDebug(3, "initPKCS11Library", "Loading driver: %s", libName); #ifdef WIN32 pLibrary = LoadLibrary((LPCSTR)libName); #else @@ -69,7 +70,7 @@ pC_GetFunctionList = (CK_C_GetFunctionList)dlsym(pLibrary, "C_GetFunctionList"); #endif if(pC_GetFunctionList != NULL) { - ddocDebug(3, "initPKCS11Library", "Getting PKCS#11 func!\n"); + ddocDebug(3, "initPKCS11Library", "Getting PKCS#11 func!"); // Get function pointers to all PKCS #11 functions rv = (*pC_GetFunctionList)(&ckFunc); if(rv == CKR_OK) { @@ -78,7 +79,7 @@ rv = (*ckFunc->C_Initialize)(0); ddocDebug(3, "initPKCS11Library", "Initlialized: %d", (int)rv); if(rv != CKR_OK) { - ddocDebug(2, "initPKCS11Library", "Error initializing library!\n"); + ddocDebug(2, "initPKCS11Library", "Error initializing library!"); pLibrary = NULL; // error initializing the library } } else { @@ -183,13 +184,13 @@ err = ERR_PKCS_SLOT_LIST; SET_LAST_ERROR(err); } - if ((slot < 0) || (slot >= idlen)) { + if ((slot < 0) || (slot >= (int)idlen)) { err = ERR_PKCS_WRONG_SLOT; SET_LAST_ERROR(err); } // it's useful to test DLL load status this way: ok = 0; - for(i = 0; i < idlen; i++) { + for(i = 0; i < (int)idlen; i++) { rv = GetSlotInfo(&slotinfo, slotids[i]); if(slotinfo.flags & CKF_TOKEN_PRESENT) { ddocDebug(3, "loadAndTestDriver", "Read Token: %ld", (long)i); @@ -237,9 +238,11 @@ va"lja kutsuda. */ CK_RV rv = (*ckFunc->C_OpenSession)(slotId, CKF_SERIAL_SESSION,0,0,&hSession); + ddocDebug(3, "OpenSession", "Open sess for slot id: %u - sess: %uld RV = %u", slotId, hSession, rv); if(rv == CKR_OK && pin) { // don't login if pin is null. Session can be used also to read certs. /* Kommentaar: Ainult CKU_USER toetatud. */ rv = (*ckFunc->C_Login)(hSession, CKU_USER, (unsigned char*)pin, strlen(pin)); + ddocDebug(3, "OpenSession", "Login for slot id: %u - sess: %uld RV = %u", slotId, hSession, rv); if(rv != CKR_OK) hSession = CK_INVALID_HANDLE; // mark session bad! } @@ -268,7 +271,7 @@ rv = (*ckFunc->C_Sign)(hSession, sigData, dataLen, Signature, ulSignatureLen); if(rv != CKR_OK) - ddocDebug(1, "SignData", "Error signing - sess: %uld pkey: %uld slen: %uld dlen: %uld. RV = %uld\n", + ddocDebug(1, "SignData", "Error signing - sess: %u pkey: %uld slen: %uld dlen: %uld. RV = %u", hSession, hPrivateKey, ulSignatureLen, dataLen, rv); } // if C_SignInit else @@ -367,8 +370,8 @@ } // if rv rv = (*ckFunc->C_FindObjectsFinal)(hSession); } // for j - if(hCert == CK_INVALID_HANDLE) - *certLen = 0; + //if(hCert == CK_INVALID_HANDLE) + // *certLen = 0; return hCert; } @@ -435,34 +438,87 @@ return rv; } +//============================================================ +// Locates a private key on the token on basis of its CKA_ID attribute. +// hSession - card session handle +// idData - id value +// idLen - length of id value +// hKey - address of key handle to be returned +// return objects handle or -1 for failure +//============================================================ +CK_RV LocatePrivateKeyWithId(CK_SESSION_HANDLE hSession, CK_BYTE_PTR idData, CK_ULONG idLen, CK_OBJECT_HANDLE_PTR hKey) +{ + CK_OBJECT_HANDLE Objects[10]; + CK_RV rv; + CK_ULONG ulObjectCount = sizeof(Objects)/sizeof(CK_OBJECT_HANDLE), i; + CK_OBJECT_CLASS ObjClass = CKO_PRIVATE_KEY; + CK_ATTRIBUTE Template1[] = { + { CKA_CLASS, &ObjClass, sizeof(ObjClass) }, + { CKA_ID, (void*)idData, idLen } + }; + CK_ULONG ulCount = sizeof(Template1) / sizeof(CK_ATTRIBUTE); + char buf2[40]; + int l2; + + l2 = sizeof(buf2); + bin2hex((const byte*)idData, idLen, (char*)buf2, &l2); + ddocDebug(3, "LocatePrivateKeyWithId", "LocatePrivateKey with id: %s", buf2); + //Template1[1].pValue = idData; + rv = (*ckFunc->C_FindObjectsInit)(hSession, Template1, ulCount); + if(rv==CKR_OK) { + // Get list of object handles + rv = (*ckFunc->C_FindObjects)(hSession,Objects,ulObjectCount, &ulObjectCount); + ddocDebug(3, "LocatePrivateKeyWithId", "Find: %d count: %ld", rv, ulObjectCount); + if(rv==CKR_OK) { + // get labels of all possible private keys + for(i = 0; i < ulObjectCount; i++) { + ddocDebug(3, "LocatePrivateKeyWithId", "Key handle: %d", Objects[i]); + *hKey = Objects[i]; + } // for i < ulObjectsCount + } + } + // Remember to call C_FindObjectsFinal to terminate the search + rv = (*ckFunc->C_FindObjectsFinal)(hSession); + return rv; +} + + + int ddocLocateSlotWithSignatureCert(LIBHANDLE pLibrary, CK_SLOT_ID* slotids, - CK_SLOT_ID* pSlotId, char* pLabel, CK_ULONG nLabelLen) + CK_SLOT_ID* pSlotId, X509** ppCert, + char idData[20], int* pIdLen, int nSlot, int* pIdx) { - int err = ERR_OK, i, j; + int err = ERR_PRIVKEY_READ, i, j, nMatch, l3; CK_RV rv; CK_SESSION_HANDLE hSession = 0; CK_OBJECT_HANDLE objects[10]; - CK_ULONG ulObjectCount = sizeof(objects)/sizeof(CK_OBJECT_HANDLE), ulCount = 0, l1 = 0; + CK_BYTE buf2[20], buf3[40]; + CK_ULONG ulObjectCount = sizeof(objects)/sizeof(CK_OBJECT_HANDLE), ulCount = 0, l1 = 0, l2 = 0; CK_OBJECT_CLASS ObjClass = CKO_CERTIFICATE; + CK_ATTRIBUTE Template1[] = { { CKA_CLASS, &ObjClass, sizeof(ObjClass) } }; CK_ATTRIBUTE Template2[] = { - { CKA_VALUE, (void*)0, l1 } - //, { CKA_ID, (void*)pLabel, nLabelLen } + { CKA_VALUE, (void*)0, l1 }, + { CKA_ID, (void*)0, sizeof(buf2)} }; - char buf1[3000]; - X509* pCert; - + char buf1[3000], buf4[64]; + X509* pCert = 0; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; RETURN_IF_NULL_PARAM(pLibrary); RETURN_IF_NULL_PARAM(pSlotId); RETURN_IF_NULL_PARAM(slotids); - RETURN_IF_NULL_PARAM(pLabel); + RETURN_IF_NULL_PARAM(idData); + RETURN_IF_NULL_PARAM(ppCert); // mark as not found - *pSlotId = INVALID_SLOTIID; + memset(idData, 0, *pIdLen); ddocDebug(3, "ddocLocateSlotWithSignatureCert", "Driver handle: %d err = %d", pLibrary, err); // now check every slot - for(i = 0; i < 20; i++) { + for(i = 0, nMatch = 0; (i < 20) && !(*ppCert); i++) { if(slotids[i] != INVALID_SLOTIID) { ddocDebug(3, "ddocLocateSlotWithSignatureCert", "Checking slot nr: %d id: %d", i, slotids[i]); // open session to slot but no login since we just need the cert @@ -480,29 +536,56 @@ for(j = 0; j < (int)ulObjectCount; j++) { l1 = sizeof(buf1); memset(buf1, 0, l1); - //Template2[0].pValue = 0; // check length first + l2 = sizeof(buf2); + memset(buf2, 0, l2); + Template2[0].pValue = 0; // check length first rv = (*ckFunc->C_GetAttributeValue)(hSession, objects[j], Template2, ulCount); if(rv == CKR_OK && Template2[0].ulValueLen < sizeof(buf1)) { l1 = Template2[0].ulValueLen; // now get cert data Template2[0].pValue = buf1; + Template2[1].pValue = buf2; rv = (*ckFunc->C_GetAttributeValue)(hSession, objects[j], Template2, ulCount); ddocDebug(3, "ddocLocateSlotWithSignatureCert", "slot id: %ld, object: %ld cert-len: %ld rv: %ld", slotids[i], j, l1, rv); pCert = 0; err = ddocDecodeX509Data(&pCert, (const byte*)buf1, l1); - if(pCert) - ddocDebug(3, "ddocLocateSlotWithSignatureCert", - "flags: %ld kusage: %ld xkusage: %ld ku-dig-sign: %d ku-non-repud: %d ku-ex: %d non-rep-ex: %d", - pCert->ex_flags, pCert->ex_kusage, pCert->ex_xkusage, - pCert->ex_kusage & X509v3_KU_DIGITAL_SIGNATURE, - pCert->ex_kusage & X509v3_KU_NON_REPUDIATION, - pCert->ex_xkusage & X509v3_KU_DIGITAL_SIGNATURE, - pCert->ex_xkusage & X509v3_KU_NON_REPUDIATION); - if(pCert) - X509_free(pCert); - - } + if(pCert) { + // debug + memset(buf4, 0, sizeof(buf4)); + ReadCertSerialNumber(buf4, sizeof(buf4), pCert); + ddocCertGetSubjectCN(pCert, &mbuf1); + ddocDebug(3, "ddocLocateSlotWithSignatureCert", "slot id: %ld, object: %ld cert-serial: %s CN: %s", + slotids[i], j, buf4, (char*)mbuf1.pMem); + if(ddocCertCheckKeyUsage(pCert, KUIDX_NON_REPUDIATION)) { + if((!nSlot || nSlot == nMatch) && !(*ppCert)) { + l3 = sizeof(buf3); + memset(buf3, 0, l3); + bin2hex((const byte*)buf2, (int)Template2[1].ulValueLen, (char*)buf3, &l3); + ddocDebug(3, "ddocLocateSlotWithSignatureCert", "Selecting slot: %d id: %d key-id %s", i, slotids[i], buf3); + *pSlotId = slotids[i]; + *pIdx = i; + // keep this cert for signing + if(*ppCert) + X509_free(*ppCert); + (*ppCert) = pCert; + pCert = NULL; // mark as used + memcpy(idData, buf2, Template2[1].ulValueLen); + *pIdLen = Template2[1].ulValueLen; + err = ERR_OK; // found it + ddocDebug(3, "ddocLocateSlotWithSignatureCert", "Selected key/cert: %s - %s", buf4, (char*)mbuf1.pMem); + } else { // useable slot but not a match by slot id + ddocDebug(3, "ddocLocateSlotWithSignatureCert", "Useable slot: %d but search: %d", nMatch, nSlot); + nMatch++; + } + } // if non-repu cert + ddocMemBuf_free(&mbuf1); + } // if pCert + if(pCert) + X509_free(pCert); + pCert = 0; + + } // if get-attribute ok } // for j < ulObjectCount } // if found any certs } // if find-init ok @@ -535,16 +618,18 @@ CK_RV rv; CK_SLOT_ID slotids[20], slId = 0; CK_SESSION_HANDLE hSession = 0; - CK_OBJECT_HANDLE hPrivateKey, hKeys[20], hCert; - char keyId[20][20]; + CK_OBJECT_HANDLE hPrivateKey = 0, hKeys[20], hCert; + char keyId[20][20], kId[20]; CK_ULONG keyIdLen[20]; CK_BYTE certData[2048]; CK_BYTE sigDig[100], padDig[130]; - CK_BYTE signature[200]; + CK_BYTE signature[256]; CK_BYTE padding[] = { 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20 }; + //CK_BYTE padding256[] = { 48, 49, 48, 13, 6, 9, 96, 134, 72, 1 ,101, 3, 4, 2, 1, 5, 0, 4, 32}; + //CK_BYTE padding256[] = { 48, 33, 48, 13, 6, 9, 96, 134, 72, 1 ,101, 3, 4, 2, 1, 5, 0, 4, 32}; char* buf1; - int l1, l2; - X509* x509; + int l1, l2, kILen; + X509* x509 = 0; DigiDocMemBuf mbuf1; RETURN_IF_NULL_PARAM(pSigInfo); @@ -560,54 +645,88 @@ pLibrary, err, slot); RETURN_IF_NOT(err == ERR_OK, err); // inittialize - slId = INVALID_SLOTIID; // not found yet - //err = ddocLocateSlotWithSignatureCert(pLibrary, slotids, - // &slId, (char*)signature, sizeof(signature)); - - // find suitable slotid - - for(l1 = 0; l1 < 20; l1++) { - if(slotids[l1] != INVALID_SLOTIID) - ddocDebug(3, "calculateSignatureWithEstID", - "Slot idx: %d = %d", l1, slotids[l1]); - if(slotids[l1] != INVALID_SLOTIID && l1 == slot) { - slId = slotids[l1]; - ddocDebug(3, "calculateSignatureWithEstID", - "Select idx: %d slot: %d", l1, slId); - } + slId = INVALID_SLOTIID; // not found yet + // try key-usage check + if(ConfigItem_lookup_int("KEY_USAGE_CHECK", 1)) { + kILen = sizeof(kId); + ddocDebug(3, "calculateSignatureWithEstID", "Find slot by key-usage, slot: %d", slot); + err = ddocLocateSlotWithSignatureCert(pLibrary, slotids, &slId, &x509, kId, &kILen, slot, &l1); + ddocDebug(3, "calculateSignatureWithEstID", + "Select by key-usage slot idx: %d = %d err: %d key-id: %s, kid-len: %d", l1, slId, err, kId, kILen); + if(err != ERR_OK || l1 < 0 || l1 >= 20) { + SET_LAST_ERROR(ERR_SIGNERS_CERT_NON_REPU); + return ERR_SIGNERS_CERT_NON_REPU; + } + } else { + ddocDebug(3, "calculateSignatureWithEstID", "Find slot by slot idx: %d", slot); + for(l1 = 0; (l1 < 20) && (slId == INVALID_SLOTIID); l1++) { + if(slotids[l1] != INVALID_SLOTIID) + ddocDebug(3, "calculateSignatureWithEstID", + "Slot idx: %d = %d", l1, slotids[l1]); + if(slotids[l1] != INVALID_SLOTIID && l1 == slot) { + slId = slotids[l1]; + ddocDebug(3, "calculateSignatureWithEstID", + "Select idx: %d slot: %d", l1, slId); + } // if slotid + } // for } - + // use default if not found by key-id or direct + if(slId == INVALID_SLOTIID) { + l1 = ConfigItem_lookup_int("DIGIDOC_SIGNATURE_SLOT", 0); + if(slotids[l1] != INVALID_SLOTIID) { + ddocDebug(3, "calculateSignatureWithEstID", + "Select default slot idx: %d = %d", l1, slotids[l1]); + slId = slotids[l1]; + } + } + // open session if(slId != INVALID_SLOTIID) { hSession = OpenSession(slId, passwd); ddocDebug(3, "calculateSignatureWithEstID", - "Open sess for slot: %d sess = %uld\n", slId, hSession); + "Open sess for slot: %d sess = %d", slId, hSession); if (hSession == CK_INVALID_HANDLE) { err = ERR_PKCS_LOGIN; SET_LAST_ERROR(err); return err; } - ddocDebug(3, "calculateSignatureWithEstID", "OpenSession ok, hSession = %d\n", (int)hSession); - - // get private key - for(l1 = 0; l1 < 20; l1++) { - memset(keyId[l1], 0, 20); - keyIdLen[l1] = 0; - } - err = LocatePrivateKey(hSession, keyId, keyIdLen, hKeys); - //ddocDebug(3, "calculateSignatureWithEstID", "Priv key: %s", keyId); - //if (hPrivateKey == CK_INVALID_HANDLE) { err = ERR_PKCS_PK; SET_LAST_ERROR(err); return err; } - - // get cert - memset(certData, 0, sizeof(certData)); - certLen = sizeof(certData); - hCert = LocateCertificate(hSession, certData, &certLen, keyId, keyIdLen, &nKey); - hPrivateKey = hKeys[nKey]; - ddocDebug(3, "calculateSignatureWithEstID", "selected priv-key: %ld pos %d id: %s", hPrivateKey, nKey, keyId[nKey]); - ddocDebug(3, "calculateSignatureWithEstID", "Cert-len: %ld", certLen); - //printf("Cert: %s", certData); - if (hCert == (CK_OBJECT_HANDLE)-1) { err = ERR_PKCS_CERT_LOC; SET_LAST_ERROR(err); return err; } + ddocDebug(3, "calculateSignatureWithEstID", "OpenSession ok, hSession1 = %d", (int)hSession); - // set cert data - err = ddocDecodeX509Data(&x509, certData, certLen); + if(!x509) { + ddocDebug(3, "calculateSignatureWithEstID", "Cert ok"); + // get private key + for(l1 = 0; l1 < 20; l1++) { + memset(keyId[l1], 0, 20); + keyIdLen[l1] = 0; + } + err = LocatePrivateKey(hSession, keyId, keyIdLen, hKeys); + //ddocDebug(3, "calculateSignatureWithEstID", "Priv key: %s", keyId); + // + + // get cert + memset(certData, 0, sizeof(certData)); + certLen = sizeof(certData); + hCert = LocateCertificate(hSession, certData, &certLen, keyId, keyIdLen, &nKey); + hPrivateKey = hKeys[nKey]; + ddocDebug(3, "calculateSignatureWithEstID", "selected priv-key: %ld pos %d id: %s", hPrivateKey, nKey, keyId[nKey]); + ddocDebug(3, "calculateSignatureWithEstID", "Cert-len: %ld", certLen); + //printf("Cert: %s", certData); + if (hCert == (CK_OBJECT_HANDLE)-1) { err = ERR_PKCS_CERT_LOC; SET_LAST_ERROR(err); return err; } + + // set cert data + err = ddocDecodeX509Data(&x509, certData, certLen); + + + } else { // cert already found + //kILen = sizeof(kId); + ddocDebug(3, "calculateSignatureWithEstID", "Locate priv key2 id: %s, len: %d, hkey: %d", kId, kILen, hPrivateKey); + err = LocatePrivateKeyWithId(hSession, (CK_BYTE_PTR)kId, kILen, &hPrivateKey); + ddocDebug(3, "calculateSignatureWithEstID", "Priv key-id: %s len: %d hkey: %d err: %d", kId, kILen, hPrivateKey, err); + } + ddocDebug(3, "calculateSignatureWithEstID", "Priv key: %d err: %d", hPrivateKey, err); + if (hPrivateKey == CK_INVALID_HANDLE) { err = ERR_PKCS_PK; SET_LAST_ERROR(err); return err; } if (!x509) { err = ERR_PKCS_CERT_DECODE; } - setSignatureCert(pSigInfo, x509); + + // save cert in file + if(ConfigItem_lookup_int("DEBUG_LEVEL", 1) > 3) + saveCert(x509, "signer.pem", FILE_FORMAT_PEM); + setSignatureCert(pSigInfo, x509); // FIXME createTimestamp(pSigDoc, (char*)sigDig, sizeof(sigDig)); @@ -635,7 +754,7 @@ ddocSigInfo_SetSigPropDigest(pSigInfo, (const char*)sigDig, l2); ddocSigInfo_SetSigPropRealDigest(pSigInfo, (const char*)sigDig, l2); // create signed info - buf1 = createXMLSignedInfo(pSigDoc, pSigInfo); + buf1 = createXMLSignedInfo(pSigDoc, pSigInfo); if (!buf1) { err = ERR_NULL_POINTER; SET_LAST_ERROR(err); @@ -643,8 +762,7 @@ } // get digest l2 = sizeof(sigDig); - err = calculateDigest((const byte*)buf1, strlen(buf1), - DIGEST_SHA1, sigDig, &l2); + err = calculateDigest((const byte*)buf1, strlen(buf1), DIGEST_SHA1, sigDig, &l2); free(buf1); if (err != ERR_OK) { err = ERR_NULL_POINTER; @@ -656,10 +774,10 @@ sigLen = sizeof(signature); memset(signature, 0, sizeof(signature)); // pad PKCS#1 ver 1 - padDigLen = 35; - memset(padDig, 0, sizeof(padDig)); - memcpy(padDig, padding, 15); - memcpy(padDig + 15, sigDig, l2); + padDigLen = 35; + memset(padDig, 0, sizeof(padDig)); + memcpy(padDig, padding, 15); + memcpy(padDig + 15, sigDig, l2); //rv = RSA_padding_add_PKCS1_type_1(padDig, padDigLen, sigDig, l2); //rv = RSA_padding_check_PKCS1_type_1(sigDig, l2, padDig, padDigLen, padDigLen+1); // checkErrors(); @@ -674,6 +792,8 @@ // set signature value ddocSigInfo_SetSignatureValue(pSigInfo, (const char*)signature, (int)sigLen); + ddocDebug(3, "calculateSignatureWithEstID", "Sig-len: %ld", sigLen); + } // if slotid found if(hSession) @@ -735,6 +855,7 @@ } } // open session + //ddocDebug(3, "decryptWithEstID", "OpenSession id = %d, pin: %s", (int)slId, pin); hSession = OpenSession(slId, pin); if (hSession == CK_INVALID_HANDLE) { SET_LAST_ERROR(ERR_PKCS_LOGIN); return ERR_PKCS_LOGIN; } ddocDebug(3, "decryptWithEstID", "OpenSession ok, hSession = %d", (int)hSession); @@ -792,16 +913,23 @@ err = loadAndTestDriver(ConfigItem_lookup(driver), &pLibrary, (CK_SLOT_ID*)slotids, 20, (CK_ULONG)slot); if(err) return err; - + //debug + for(l1 = l2 = 0; l1 < 20; l1++) { + if(slotids[l1] != INVALID_SLOTIID) { + ddocDebug(3, "findUsersCertificate", "Slot1: %d, id %d", l1, slotids[l1]); + } + } // find the right slotid for(l1 = l2 = 0; l1 < 20; l1++) { if(slotids[l1] != INVALID_SLOTIID) { + ddocDebug(3, "findUsersCertificate", "Slot2: %d, id %d", l1, slotids[l1]); if(l2 == slot) - slId = slotids[l1]; + slId = slotids[l1]; l2++; } } // open session + ddocDebug(3, "findUsersCertificate", "OpenSession slotid %d", slId); hSession = OpenSession(slId, NULL); if (hSession == CK_INVALID_HANDLE) { SET_LAST_ERROR(ERR_PKCS_LOGIN); return ERR_PKCS_LOGIN; } ddocDebug(3, "findUsersCertificate", "OpenSession ok, hSession = %d", (int)hSession); diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocParser.c libdigidoc-3.7.0.875/libdigidoc/DigiDocParser.c --- libdigidoc-2.7.0/libdigidoc/DigiDocParser.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocParser.c 2012-12-13 22:05:47.000000000 +0000 @@ -39,7 +39,7 @@ #include #include -#define MAX_FILENAME 250 +#define MAX_FILENAME 255 //=====================< DataFile extraction function >============================= @@ -164,14 +164,16 @@ // handle end element if(*phFile && ((operation == EXTRACT_OP_WITH_TAGS && !xmlStrcmp(name, (xmlChar*)"DataFile")) || - xmlStrcmp(name, (xmlChar*)"DataFile"))) + xmlStrcmp(name, (xmlChar*)"DataFile"))) { if(operation == EXTRACT_OP_BODY_MEM) { RETURN_IF_NULL_PARAM(pBuf); err = ddocMemAppendData(pBuf, "", -1); - } else + } else { fprintf(*phFile, "", name); + } + } // check if it's the correct end element if(!xmlStrcmp(name, (xmlChar*)"DataFile")) { // possible end if(*phFile && *phFile != (FILE*)1) { // file opened then it's the correct end element @@ -182,6 +184,9 @@ if(*phFile) *phFile = 0; } + // PR. fix mem leak + if(name) + xmlFree(name); break; case XML_READER_TYPE_ATTRIBUTE: break; @@ -259,9 +264,9 @@ EXP_OPTION int ddocXRdrExtractDataFile(SignedDoc* pSigDoc, const char* szFileName, const char* szDataFileName, const char* szDocId, const char* szCharset) { - char szConvDigiDocName[MAX_FILENAME]; - char szConvDataFileName[MAX_FILENAME]; - char szContentType[MAX_CONTENT_TYPE]; + char szConvDigiDocName[MAX_FILENAME+1]; + char szConvDataFileName[MAX_FILENAME+1]; + char szContentType[MAX_CONTENT_TYPE+1]; xmlTextReaderPtr reader; FILE* hFile = 0; int ret; @@ -332,8 +337,8 @@ EXP_OPTION int ddocXRdrGetDataFile(SignedDoc* pSigDoc, const char* szFileName, const char* szDocId, DigiDocMemBuf* pBuf) { - char szConvDigiDocName[MAX_FILENAME]; - char szContentType[MAX_CONTENT_TYPE]; + char szConvDigiDocName[MAX_FILENAME+1]; + char szContentType[MAX_CONTENT_TYPE+1]; xmlTextReaderPtr reader; FILE* hFile = 0; int ret; @@ -396,9 +401,9 @@ int ddocXRdrCopyDataFile(SignedDoc* pSigDoc, const char* szFileName, const char* szDataFileName, const char* szDocId, const char* szCharset) { - char szConvDigiDocName[MAX_FILENAME]; - char szConvDataFileName[MAX_FILENAME]; - char szContentType[MAX_CONTENT_TYPE]; + char szConvDigiDocName[MAX_FILENAME+1]; + char szConvDataFileName[MAX_FILENAME+1]; + char szContentType[MAX_CONTENT_TYPE+1]; xmlTextReaderPtr reader; FILE* hFile = 0; int ret; @@ -868,7 +873,7 @@ !ddocStackHasParentWithName(pStack, (xmlChar*)"DataFile", pCurrElem)) { DataFile *pDF = ddocGetLastDataFile(*ppSigDoc); // collect contents - ddocAppendDataFileData(pDF, lMaxDFLen, (void*)value, strlen((const char*)value)); + ddocAppendDataFileData(pDF, lMaxDFLen, (void*)value, strlen((const char*)value), !strcmp(pDF->szContentType, CONTENT_EMBEDDED_BASE64)); } // content of @@ -1129,7 +1134,7 @@ EXP_OPTION int ddocXRdrReadSignedDocFromFile(const char* szFileName, SignedDoc** pSigDoc, long lMaxDFLen) { - char szConvDigiDocName[MAX_FILENAME]; + char szConvDigiDocName[MAX_FILENAME+1]; xmlTextReaderPtr reader; ElementEntry stack; DigiDocMemBuf memBuf1, memBuf2; diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocSAXParser.c libdigidoc-3.7.0.875/libdigidoc/DigiDocSAXParser.c --- libdigidoc-2.7.0/libdigidoc/DigiDocSAXParser.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocSAXParser.c 2012-12-13 22:05:47.000000000 +0000 @@ -31,7 +31,6 @@ #include #include #include - #include #include #include @@ -53,6 +52,7 @@ #ifdef WIN32 #define snprintf _snprintf + #include #endif extern int ddocCheckFormatAndVer(const char* format, const char* version); @@ -92,11 +92,6 @@ DigiDocMemBuf mbufSigData; // char bCollectSigData; DigiDocMemBuf mbufSigPartData; // and -#ifdef WITH_TS - DigiDocMemBuf mbufTsInput; // total timestamp hash input data - DigiDocMemBuf mbufTsInpElem; // one xml elem for ts input before canonicalization - char bCollectTsInput; -#endif char bCollectSigPartData; long lMaxDFLen; time_t tStartParse; @@ -119,10 +114,6 @@ ddocMemBuf_free(&(pctx->mbufElemData)); ddocMemBuf_free(&(pctx->mbufSigData)); ddocMemBuf_free(&(pctx->mbufSigPartData)); -#ifdef WITH_TS - ddocMemBuf_free(&(pctx->mbufTsInput)); - ddocMemBuf_free(&(pctx->mbufTsInpElem)); -#endif if(pctx->pMemBufDF) ddocMemBuf_free(pctx->pMemBufDF); if(pctx->bDataFile) @@ -152,12 +143,6 @@ pctx->bCollectSigPartData = 1; pctx->errcode = ddocMemBuf_free(&(pctx->mbufSigPartData)); break; -#ifdef WITH_TS - case FLAG_TS_INP: - pctx->bCollectTsInput = 1; - pctx->errcode = ddocMemBuf_free(&(pctx->mbufTsInpElem)); - break; -#endif } pctx->bNoXMLElemData = bNoXml; return pctx->errcode; @@ -185,12 +170,6 @@ pctx->bCollectSigPartData = 0; pctx->errcode = ddocMemBuf_free(&(pctx->mbufSigPartData)); break; -#ifdef WITH_TS - case FLAG_TS_INP: - pctx->bCollectTsInput = 0; - pctx->errcode = ddocMemBuf_free(&(pctx->mbufTsInpElem)); - break; -#endif } pctx->bNoXMLElemData = bNoXml; return pctx->errcode; @@ -278,8 +257,37 @@ if(ddocCheckFormatAndVer(pctx->pSigDoc->szFormat, pctx->pSigDoc->szFormatVer)) SET_LAST_ERROR(ERR_UNSUPPORTED_FORMAT); +} + +void unescapeFilename(char** szFileName, const char* str1, const char* str2) +{ + DigiDocMemBuf mbuf1, mbuf2; + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + ddocDebug(4, "unescapeFilename", "In: %s replace: %s with: %s", *szFileName, str1, str2); + if(szFileName && strstr((const char*)(*szFileName), str1)) { + mbuf1.pMem = *szFileName; mbuf1.nLen = strlen(*szFileName); + ddocMemReplaceSubstr(&mbuf1, &mbuf2, str1, str2); + setString(szFileName, (const char*)mbuf2.pMem, -1); + ddocMemBuf_free(&mbuf2); + ddocDebug(4, "unescapeFilename", "Escaped: %s", *szFileName); + } } +int utf8strlen(const char* src) +{ + int i, j; + unsigned char uc; + for(i = 0, j = 0; src && src[i]; i++) { + uc = (unsigned char)(0x000000FF & src[i]); + if(uc <= 0x7F || uc >= 0xC0) + j++; + } + ddocDebug(4, "utf8strlen", "Str: %s, len: %d", src, j); + return j; +} //-------------------------------------------------- // handles the start of a element. @@ -290,9 +298,10 @@ //-------------------------------------------------- void handleStartDataFile(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) { - int i, err = ERR_OK; + int i, err = ERR_OK, j; long size = -1; const char *id = 0, *mime = 0, *dtype = 0, *dvalue = 0, *ctype = 0; + char *p = 0; DigiDocMemBuf mbuf1, mbuf2; DataFile* pDataFile = NULL; @@ -312,18 +321,12 @@ if(!strcmp((const char*)atts[i], "Id")) id = (const char*)atts[i+1]; if(!strcmp((const char*)atts[i], "Filename")) { - err = ddocMemAppendData(&mbuf1, (const char*)atts[i+1], -1); - // replace "&" with "&" - err = ddocMemReplaceSubstr(&mbuf1, &mbuf2, "&", "&"); - // only if we had some changes - if(mbuf1.nLen != mbuf2.nLen) { - // assign back to mbuf1 - err = ddocMemBuf_free(&mbuf1); - err = ddocMemAssignData(&mbuf1, (const char*)mbuf2.pMem, mbuf2.nLen); - } - err = ddocMemBuf_free(&mbuf2); - ddocDebug(4, "handleStartDataFile", "Filename in: \'%s\' out: \'%s\'", - atts[i+1], (char*)mbuf1.pMem); + escapeXMLSymbols((const char*)atts[i+1], -1, &p); + if(p) + err = ddocMemAppendData(&mbuf1, p, -1); + free(p); p = 0; + ddocDebug(4, "handleStartDataFile", "Filename in: \'%s\' out: \'%s\'", + atts[i+1], (char*)mbuf1.pMem); } if(!strcmp((const char*)atts[i], "MimeType")) mime = (const char*)atts[i+1]; @@ -336,18 +339,55 @@ if(!strcmp((const char*)atts[i], "Size")) size = atol((const char*)atts[i+1]); } - if(!id || !mime || !mbuf1.nLen || size < 0 || !ctype) { + if (!id || (strlen(id) > 21)) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + ddocDebug(1, "handleStartDataFile", "Arr err id: %s", id); + return; + } + // VS: check id uniqueness + for(j = 0; j < getCountOfDataFiles(pctx->pSigDoc); j++) { + pDataFile = getDataFile(pctx->pSigDoc, j); + if(pDataFile && pDataFile->szId && !strcmp(pDataFile->szId, id)) { + ddocDebug(1, "handleStartDataFile", "DF %d has same id: %s", j, id); + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + return; + } + } + if (!mime || (strlen(mime) > 255)) { SET_LAST_ERROR(ERR_DIGIDOC_PARSE); - ddocDebug(1, "handleStartDataFile", - "Arr err - id: %s mime: %s file: %s size: %d ctype: %s", - id, mime, (char*)mbuf1.pMem, size, ctype); + ddocDebug(1, "handleStartDataFile", "Arr err mime: %s", mime); + return; + } + if (!mbuf1.pMem || (utf8strlen(mbuf1.pMem) > 255)) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + return; + } + if (size < 0) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + ddocDebug(1, "handleStartDataFile", "Arr err size: %d", size); + return; + } + if (!ctype || (strlen(ctype) > 40)) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + ddocDebug(1, "handleStartDataFile", "Arr err ctype: %s", ctype); + return; + } + if (!pctx->pSigDoc->szFormatVer) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + ddocDebug(1, "handleStartDataFile", "Arr err sigdoc missing"); + return; + } + if ((dtype && (strlen(dtype) > 10)) || + (dvalue && (strlen(dvalue) > 100))) { + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + ddocDebug(1, "handleStartDataFile", "Arr err - dtype: %s dvalue: %s", dtype, dvalue); + return; + } + if((!ctype || strcmp(ctype, CONTENT_EMBEDDED_BASE64)) + && !ConfigItem_lookup_bool("EMBEDDED_XML_SUPPORT", 0)) { + SET_LAST_ERROR(ERR_BAD_DATAFILE_CONTENT_TYPE); return; } - SET_LAST_ERROR_RETURN_VOID_IF(strcmp(ctype, CONTENT_DETATCHED) && - strcmp(ctype, CONTENT_EMBEDDED) && - strcmp(ctype, CONTENT_EMBEDDED_BASE64) && - strcmp(ctype, "HASHCODE"), - ERR_BAD_DATAFILE_CONTENT_TYPE); ddocDebug(4, "handleStartDataFile", "Check ignore"); // if not in ignore mode / level if(!pctx->nIgnoreDataFile) { @@ -392,9 +432,13 @@ if(!strcmp(ctype, CONTENT_EMBEDDED) || pctx->nIgnoreDataFile) pctx->nIgnoreDataFile++; // cleanup - err = ddocMemBuf_free(&mbuf1); err = ddocMemBuf_free(&mbuf2); - + err = ddocMemBuf_free(&mbuf1); + // replace & with & if necessary + unescapeFilename(&(pDataFile->szFileName), "&", "&"); + unescapeFilename(&(pDataFile->szFileName), "'", "'"); + unescapeFilename(&(pDataFile->szFileName), """, "\""); + ddocDebug(4, "handleStartDataFile", "Final filename: \'%s\'", pDataFile->szFileName); } @@ -415,11 +459,12 @@ // decode the content data ddocDebug(4, "handleDataFile", "DF: %s, append len: %d", pctx->ctx2, len); pDf = getDataFileWithId(pctx->pSigDoc, pctx->ctx2); - ddocAppendDataFileData(pDf, pctx->lMaxDFLen, (void*)value, len); + ddocAppendDataFileData(pDf, pctx->lMaxDFLen, (void*)value, len, !strcmp(pDf->szContentType, CONTENT_EMBEDDED_BASE64)); if(!strcmp(pctx->ctx3, CONTENT_EMBEDDED_BASE64)) { // if using DataFile Base64 hack #ifdef WITH_BASE64_HASHING_HACK - if(strcmp(pctx->pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(pctx->pSigDoc->szFormatVer && strcmp(pctx->pSigDoc->szFormatVer, SK_XML_1_VER) && + pctx->pSigDoc->szFormat && strcmp(pctx->pSigDoc->szFormat, SK_XML_1_NAME)) { ch = ((char*)value)[len]; ((char*)value)[len] = 0; ddocDebug(4, "handleDataFile", "sha1 update: \'%s\' len: %d", value, len); @@ -499,7 +544,7 @@ pctx->bDataFile = NULL; } // in version 1.0 we calculate digest over original data - if(!strcmp(pctx->pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(pctx->pSigDoc->szFormat && !strcmp(pctx->pSigDoc->szFormat, SK_XML_1_NAME)) { if(!strcmp(pDf->szContentType, CONTENT_EMBEDDED_BASE64)) { ddocDebug(3, "handleEndDataFile", "final sha1"); SHA1_Final((unsigned char*)buf, &(pctx->sctx)); @@ -536,7 +581,7 @@ ddocMemBuf_free(&(pctx->mbufElemData)); pctx->bCollectElemData = 0; } - } else if(pctx->checkFileDigest && strcmp(pDf->szContentType, CONTENT_HASHCODE)) { + } else if(pctx->checkFileDigest) { l1 = sizeof(buf); err = calculateFileDigest(pDf->szFileName, DIGEST_SHA1, (byte*)buf, &l1, &l); @@ -584,10 +629,15 @@ SHA1_Init(&(pctx->sctx)); SHA1_Update(&(pctx->sctx), pTmp2, strlen(pTmp2)); SHA1_Final((unsigned char*)buf,&(pctx->sctx)); - ddocDataFile_SetDigestValue(pDf, buf, DIGEST_LEN); - setString((char**)&(pDf->szDigestType), DIGEST_SHA1_NAME, -1); - l1 = sizeof(buf); - encode((byte*)pDf->mbufDigest.pMem, pDf->mbufDigest.nLen, (byte*)buf, &l1); + ddocDataFile_SetDigestValue(pDf, buf, DIGEST_LEN); + setString((char**)&(pDf->szDigestType), DIGEST_SHA1_NAME, -1); + ddocDebug(4, "handleEndDataFile", "DF: %s digest updated", pDf->szId); + l1 = sizeof(buf); + encode((byte*)pDf->mbufDigest.pMem, pDf->mbufDigest.nLen, (byte*)buf, &l1); + ddocDebug(4, "handleEndDataFile", "DF: %s calc digest: %s len: %d", pDf->szId, buf, l1); + // P.R ends + ddocDebug(4, "handleEndDataFile", "DF: %s canonical XML: \'%s\'", pDf->szId, pTmp2); + ddocDebug(4, "handleEndDataFile", "DF: %s calc digest: %s len: %d", pDf->szId, buf, l1); ddocDebug(4, "handleEndDataFile", "DF: %s canonical XML: \'%s\'", @@ -611,17 +661,34 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartSignature(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartSignature(SigDocParse* pctx, const xmlChar **atts) { - int i; + int i, j; SignatureInfo *pSignatureInfo; + + if(!pctx->pSigDoc || !pctx->pSigDoc->szFormat) { + pctx->errcode = ERR_DIGIDOC_PARSE; + addError(pctx->errcode, __FILE__, __LINE__, "Signature not in ddoc container!"); + // ddocDebug(1, "handleStartSignature", "Signature has no ddoc container"); + // SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + return; + } for (i = 0; (atts != NULL) && (atts[i] != NULL); i += 2) { if(!strcmp((const char*)atts[i], "Id")) { - memset(pctx->ctx1, 0, sizeof(pctx->ctx1)); + memset(pctx->ctx1, 0, sizeof(pctx->ctx1)); memset(pctx->ctx2, 0, sizeof(pctx->ctx2)); memset(pctx->ctx3, 0, sizeof(pctx->ctx3)); strncpy(pctx->ctx1, (const char*)atts[i+1], /*sizeof(pctx->ctx1)-*/50); - SignatureInfo_new(&pSignatureInfo, pctx->pSigDoc, (const char*)atts[i+1]); // MEMLEAK: ??? + // check id uniqueness + for(j = 0; j < getCountOfSignatures(pctx->pSigDoc); j++) { + pSignatureInfo = getSignature(pctx->pSigDoc, j); + if(pSignatureInfo && pSignatureInfo->szId && !strcmp(pSignatureInfo->szId, (const char*)atts[i+1])) { + ddocDebug(1, "handleStartSignature", "Signature: %d has same id: %s", j, (const char*)atts[i+1]); + SET_LAST_ERROR(ERR_DIGIDOC_PARSE); + return; + } + } + SignatureInfo_new(&pSignatureInfo, pctx->pSigDoc, (const char*)atts[i+1]); // MEMLEAK: ??? } } } @@ -632,10 +699,9 @@ // handles the start of a element. // Records the reference URI attribute // pctx - pointer to XML parsing work-area -// name - tag name // atts - attributes //-------------------------------------------------- -void handleStartReference(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartReference(SigDocParse* pctx, const xmlChar **atts) { strncpy(pctx->ctx2, ddocSaxParseFindAttrib(atts, "URI", ""), sizeof(pctx->ctx2)-1); } @@ -644,10 +710,9 @@ // handles the start of a element. // Records the signature method // pctx - pointer to XML parsing work-area -// name - tag name // atts - attributes //-------------------------------------------------- -void handleStartSignatureMethod(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartSignatureMethod(SigDocParse* pctx, const xmlChar **atts) { SignatureInfo *pSigInfo; const char *alg; @@ -658,7 +723,14 @@ !strcmp(alg+strlen(alg)-8, "rsa-sha1") && (pctx->ctx1[0] == 'S')) { ddocSignatureValue_new(&(pSigInfo->pSigValue), 0, SIGN_RSA_NAME, 0, 0); + } +#ifdef WITH_ECDSA + else if((alg != NULL) && (pSigInfo != NULL) && + !strcmp(alg+strlen(alg)-10, "ecdsa-sha1") && + (pctx->ctx1[0] == 'S')) { + ddocSignatureValue_new(&(pSigInfo->pSigValue), 0, SIGN_ECDSA_NAME, 0, 0); } +#endif } @@ -669,7 +741,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartDigestMethod(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartDigestMethod(SigDocParse* pctx, const xmlChar **atts) { SignatureInfo *pSigInfo; const char *alg; @@ -698,11 +770,6 @@ char buf1[300]; DigiDocMemBuf mbuf1, mbuf2; const DigiDocMemBuf *pMBuf = 0; -#ifdef WITH_TS - int k; - TimestampInfo* pTS = NULL; - TS_RESP* pResp = NULL; -#endif RETURN_IF_NULL_PARAM(pSigInfo); mbuf1.pMem = 0; @@ -725,7 +792,7 @@ l1 = sizeof(buf1); memset(buf1, 0, l1); ReadCertSerialNumber(buf1, l1, pCert); - //AM 19.09.08 + //AM 19.09.08 if(cid->szIssuerSerial){ if(!strcmp(cid->szIssuerSerial, buf1)) { cval1 = cval2; @@ -746,7 +813,7 @@ if(pSigInfo->pNotary->nRespIdType == RESPID_NAME_TYPE) { err = ddocCertGetSubjectCN(ddocCertValue_GetCert(cval1), &mbuf1); memset(buf1, 0, sizeof(buf1)); - findCN((char*)pMBuf->pMem, buf1); // defined in DigiDocConfig.c + findCN((char*)pMBuf->pMem, buf1, sizeof(buf1)); // defined in DigiDocConfig.c if(!strcmp(buf1, (const char*)mbuf1.pMem)) { // yes this is a responders cert ddocDebug(3, "selectCertIdAndValueTypes", "cert: %s responder %s -> RESPONDER", @@ -787,33 +854,6 @@ ddocMemBuf_free(&mbuf2); } // ByKey } // if pMBuf -#ifdef WITH_TS - if(cid->nType == CERTID_TYPE_UNKNOWN) { - // Test2: is this a TSA cert ? - for(k = 0; pSigInfo->pTimestamps && - k < ddocTimestampInfoList_GetTimestampInfosCount(pSigInfo->pTimestamps); k++) { - pTS = ddocTimestampInfoList_GetTimestampInfo(pSigInfo->pTimestamps, k); - ddocTsReadTsResp(&pResp, (DigiDocMemBuf*)ddocTimestampInfo_GetTS(pTS)); - if(pResp) { - ddocTsResp_GetSignerCertSerial(pResp, &mbuf1); - ddocDebug(3, "selectCertIdAndValueTypes", "TSA cert: %s this cert %s -> TSA", - (const char*)mbuf1.pMem, cid->szIssuerSerial); - if(!strcmp(cid->szIssuerSerial, (const char*)mbuf1.pMem)) { - // yes this is a TSA cert - cid->nType = CERTID_TYPE_TSA_CERTID; - cval1->nType = CERTID_VALUE_TSA_CERT; - snprintf(buf1, sizeof(buf1), "%s-TSA_CERTINFO", pSigInfo->szId); - ddocCertID_SetId(cid, buf1); - break; - } - ddocMemBuf_free(&mbuf1); - TS_RESP_free(pResp); - pResp = 0; - } - ddocDebug(3, "selectCertIdAndValueTypes", "done with TS: %s", pTS->szId); - } - } // if not a responders cert -#endif } } // for certids } @@ -828,19 +868,15 @@ // name - tag name //-------------------------------------------------- // FIXME : error handling -void handleEndEncapsulatedOCSPValue(SigDocParse* pctx, const xmlChar *name) +void handleEndEncapsulatedOCSPValue(SigDocParse* pctx) { OCSP_RESPONSE* pResp; NotaryInfo* pNotInfo = 0; SignatureInfo* pSig = 0; - /* - int len1, n; - byte buf1[DIGEST_LEN+2]; - const DigiDocMemBuf *pMBuf; - */ // convert the X509 cert data to // cert and replace the pointer value + RETURN_VOID_IF_NULL(pctx->pSigDoc->szFormatVer); pNotInfo = ddocGetLastNotaryInfo(pctx->pSigDoc); RETURN_VOID_IF_NULL(pNotInfo); // VS: 1.76 correct the check pSig = ddocGetLastSignature(pctx->pSigDoc); @@ -853,30 +889,16 @@ // in ver 1.2 we have correct OCSP digest // VS 1.76 - add 1.3 version too if(!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER) || - !strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER) -#ifdef WITH_TS - || !strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER) -#endif - ) - /*pctx->errcode =*/ initializeNotaryInfoWithOCSP(pctx->pSigDoc, pNotInfo, pResp, ddocSigInfo_GetOCSPRespondersCert(pSig), 0); + !strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) + pctx->errcode = initializeNotaryInfoWithOCSP(pctx->pSigDoc, pNotInfo, pResp, ddocSigInfo_GetOCSPRespondersCert(pSig), 0); else // in older versions the digest was incorrect /*pctx->errcode =*/ initializeNotaryInfoWithOCSP(pctx->pSigDoc, pNotInfo, pResp, ddocSigInfo_GetOCSPRespondersCert(pSig), 1); - } /*else + OCSP_RESPONSE_free(pResp); + } /*else checkErrors();*/ + ddocDebug(3, "handleEndEncapsulatedOCSPValue", "RC: %d", pctx->errcode); if(pctx->errcode) return; - // check the OCSP digest value - // VS 2.3.12 - now check everything later during verifyNotary - /* - len1 = sizeof(buf1); - n = calculateNotaryInfoDigest(pctx->pSigDoc, pNotInfo, buf1, &len1); - pMBuf = ddocNotInfo_GetOcspDigest(pNotInfo); - RETURN_VOID_IF_NULL(pMBuf); - if(n || compareByteArrays(buf1, len1, (byte*)pMBuf->pMem, pMBuf->nLen)) { - SET_LAST_ERROR(ERR_BAD_OCSP_RESPONSE_DIGEST); - pctx->errcode = ERR_BAD_OCSP_RESPONSE_DIGEST; - } - */ // now we have OCSP value too // determine the correct types of certid and certvalue objects now /*pctx->errcode =*/ selectCertIdAndValueTypes(pSig); @@ -890,7 +912,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartSignedProperties(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartSignedProperties(SigDocParse* pctx, const xmlChar **atts) { if(!pctx->nIgnoreDataFile) ddocSaxParseStartCollecting(pctx, FLAG_SIG_PART, 0); @@ -904,7 +926,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndSignedProperties(SigDocParse* pctx, const xmlChar *name) +void handleEndSignedProperties(SigDocParse* pctx) { char* pTmp2; char buf[DIGEST_LEN+3], buf2[40]; @@ -948,7 +970,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartSignedInfo(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartSignedInfo(SigDocParse* pctx) { if(!pctx->nIgnoreDataFile) { // mark the start of data collect mode @@ -963,7 +985,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndSignedInfo(SigDocParse* pctx, const xmlChar *name) +void handleEndSignedInfo(SigDocParse* pctx) { char* pTmp; char buf[DIGEST_LEN+3]; @@ -994,7 +1016,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartCert(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartCert(SigDocParse* pctx, const xmlChar **atts) { char *p = 0, buf1[50]; SignatureInfo* pSigInfo = NULL; @@ -1026,26 +1048,42 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartSigningCertificate(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartSigningCertificate(SigDocParse* pctx) { SignatureInfo* pSigInfo = NULL; CertID *pCertID = NULL; - + X509* x509 = NULL; + int ret = 0; + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; pSigInfo = ddocGetLastSignature(pctx->pSigDoc); ddocDebug(3, "handleStartSigningCertificate", "Sig: %s", (pSigInfo ? pSigInfo->szId : "NULL")); RETURN_VOID_IF_NULL(pSigInfo); pCertID = ddocSigInfo_GetOrCreateCertIDOfType(pSigInfo, CERTID_TYPE_SIGNERS_CERTID); snprintf(pctx->ctx2, sizeof(pctx->ctx2)-1, "%s-CERTINFO", pSigInfo->szId); + x509 = ddocSigInfo_GetSignersCert(pSigInfo); + if(x509){ + ret = ddocCertGetIssuerDN(x509, &mbuf1); + if(ret == 0) { + if(pCertID && mbuf1.pMem) + ddocCertID_SetIssuerName(pCertID, (char*)mbuf1.pMem); + } + } } + //-------------------------------------------------- // handles the start of a element. // pctx - pointer to XML parsing work-area // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartUnsignedSignatureProperties(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartUnsignedSignatureProperties(SigDocParse* pctx) { SignatureInfo* pSigInfo = NULL; NotaryInfo *pNotaryInfo; @@ -1066,7 +1104,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartCompleteCertificateRefs(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartCompleteCertificateRefs(SigDocParse* pctx) { SignatureInfo* pSigInfo = 0; @@ -1084,7 +1122,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartOCSPIdentifier(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartOCSPIdentifier(SigDocParse* pctx, const xmlChar **atts) { strncpy(pctx->ctx2, ddocSaxParseFindAttrib(atts, "URI", ""), sizeof(pctx->ctx2)-1); } @@ -1095,7 +1133,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndX509Certificate(SigDocParse* pctx, const xmlChar *name) +void handleEndX509Certificate(SigDocParse* pctx) { X509* x509 = 0; SignatureInfo* pSigInfo = 0; @@ -1121,7 +1159,7 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleStartEncapsulatedX509Certificate(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) +void handleStartEncapsulatedX509Certificate(SigDocParse* pctx, const xmlChar **atts) { SignatureInfo* pSigInfo = 0; const char *p1 = 0; @@ -1149,7 +1187,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndEncapsulatedX509Certificate(SigDocParse* pctx, const xmlChar *name) +void handleEndEncapsulatedX509Certificate(SigDocParse* pctx) { X509* x509 = 0; NotaryInfo* pNotInf = 0; @@ -1172,198 +1210,6 @@ ddocSaxParseEndCollecting(pctx, FLAG_XML_ELEM, 0); } -#ifdef WITH_TS -//-------------------------------------------------- -// handles the start of a element. -// pctx - pointer to XML parsing work-area -// name - tag name -// atts - attributes -//-------------------------------------------------- -void handleStartSignatureTimeStamp(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) -{ - SignatureInfo* pSigInfo = 0; - const char *p1 = 0; - TimestampInfo *pTS; - - pSigInfo = ddocGetLastSignature(pctx->pSigDoc); - p1 = ddocSaxParseFindAttrib(atts, "Id", NULL); - ddocDebug(3, "handleStartSignatureTimeStamp", "Sig: %s, type: %s", - (pSigInfo ? pSigInfo->szId : "NULL"), (p1 ? p1 : "NULL")); - RETURN_VOID_IF_NULL(pSigInfo); - pTS = ddocSigInfo_GetOrCreateTypestampOfType(pSigInfo, TS_TYPE_SIGNATURE); - if(p1) - ddocTimestampInfo_SetId(pTS, p1); - // free possible old xml data here - //ddocMemBuf_free(&(pctx->mbufTsInput)); -} - -//-------------------------------------------------- -// handles the start of a element. -// pctx - pointer to XML parsing work-area -// name - tag name -// atts - attributes -//-------------------------------------------------- -void handleStartSigAndRefsTimeStamp(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) -{ - SignatureInfo* pSigInfo = 0; - const char *p1 = 0; - TimestampInfo *pTS; - - pSigInfo = ddocGetLastSignature(pctx->pSigDoc); - p1 = ddocSaxParseFindAttrib(atts, "Id", NULL); - ddocDebug(3, "handleStartSigAndRefsTimeStamp", "Sig: %s, type: %s", - (pSigInfo ? pSigInfo->szId : "NULL"), (p1 ? p1 : "NULL")); - RETURN_VOID_IF_NULL(pSigInfo); - pTS = ddocSigInfo_GetOrCreateTypestampOfType(pSigInfo, TS_TYPE_SIG_AND_REFS); - if(p1) - ddocTimestampInfo_SetId(pTS, p1); -} - - -//-------------------------------------------------- -// handles the start of a element. -// pctx - pointer to XML parsing work-area -// name - tag name -// atts - attributes -//-------------------------------------------------- -void handleStartInclude(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts) -{ - SignatureInfo* pSigInfo = 0; - const char *p1 = 0; - TimestampInfo *pTS; - - pSigInfo = ddocGetLastSignature(pctx->pSigDoc); - pTS = ddocSigInfo_GetLastTypestamp(pSigInfo); - p1 = ddocSaxParseFindAttrib(atts, "URI", NULL); - ddocDebug(3, "handleStartInclude", "Sig: %s, TS: %s URI: %s", - (pSigInfo ? pSigInfo->szId : "NULL"), (pTS ? pTS->szId : ""), - (p1 ? p1 : "NULL")); - RETURN_VOID_IF_NULL(pSigInfo); - RETURN_VOID_IF_NULL(pTS); - RETURN_VOID_IF_NULL(p1); - ddocTimestampInfo_AddIncludeInfo(pTS, p1); -} - -//-------------------------------------------------- -// handles the start of a element. -// Records the timestamp data -// pctx - pointer to XML parsing work-area -// name - tag name -//-------------------------------------------------- -void handleEndEncapsulatedTimeStamp(SigDocParse* pctx, const xmlChar *name) -{ - SignatureInfo* pSigInfo = 0; - TimestampInfo *pTS; - DigiDocMemBuf mbuf1; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - pSigInfo = ddocGetLastSignature(pctx->pSigDoc); - pTS = ddocSigInfo_GetLastTypestamp(pSigInfo); - RETURN_VOID_IF_NULL(pSigInfo); - RETURN_VOID_IF_NULL(pTS); - ddocDecodeBase64Data(pctx->mbufElemData.pMem, pctx->mbufElemData.nLen, &mbuf1); - ddocTimestampInfo_SetTS(pTS, (const char*)mbuf1.pMem, mbuf1.nLen); - // cleanup - ddocSaxParseEndCollecting(pctx, FLAG_XML_ELEM, 0); - ddocMemBuf_free(&mbuf1); -} - -//-------------------------------------------------- -// handles the end of a element. -// Records the xml data used to calculate timesamp imprint. -// pctx - pointer to XML parsing work-area -// name - tag name -//-------------------------------------------------- -void handleEndSignatureTimeStamp(SigDocParse* pctx, const xmlChar *name) -{ - char *p1 = 0; - - p1 = (char*)canonicalizeXML((char*)pctx->mbufTsInpElem.pMem, pctx->mbufTsInpElem.nLen); - ddocDebugWriteFile(4, "ts-sigts-txt.txt", &(pctx->mbufTsInpElem)); - if(p1) { - // keep the canonicalized xml as we need it also for SigAndRefsTimeStamp hash - ddocMemAppendData(&(pctx->mbufTsInput), p1, -1); - ddocMemAppendData(&(pctx->mbufTsInput), "\n", -1); - free(p1); - p1 = 0; - } - // cleanup - ddocSaxParseEndCollecting(pctx, FLAG_TS_INP, 0); -} - -//-------------------------------------------------- -// handles the end of a element. -// Records the xml data used to calculate timesamp imprint. -// pctx - pointer to XML parsing work-area -// name - tag name -//-------------------------------------------------- -void handleEndCompleteCertificateRefs(SigDocParse* pctx, const xmlChar *name) -{ - char *p1 = 0; - - p1 = (char*)canonicalizeXML((char*)pctx->mbufTsInpElem.pMem, pctx->mbufTsInpElem.nLen); - ddocDebugWriteFile(4, "ts-completecertrefs-txt.txt", &(pctx->mbufTsInpElem)); - if(p1) { - // keep the canonicalized xml as we need it also for SigAndRefsTimeStamp hash - ddocMemAppendData(&(pctx->mbufTsInput), p1, -1); - free(p1); - p1 = 0; - } - // cleanup - ddocSaxParseEndCollecting(pctx, FLAG_TS_INP, 0); -} - -//-------------------------------------------------- -// handles the end of a element. -// Records the xml data used to calculate timesamp imprint. -// pctx - pointer to XML parsing work-area -// name - tag name -//-------------------------------------------------- -void handleEndCompleteRevocationRefs(SigDocParse* pctx, const xmlChar *name) -{ - char *p1 = 0; - int l1; - TimestampInfo *pTsInfo = 0; - SignatureInfo *pSigInfo = 0; - DigiDocMemBuf mbuf1, mbuf2; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - pSigInfo = ddocGetLastSignature(pctx->pSigDoc); - if(!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - p1 = (char*)canonicalizeXML((char*)pctx->mbufTsInpElem.pMem, pctx->mbufTsInpElem.nLen); - ddocDebugWriteFile(4, "ts-completerevocrefs-txt.txt", &(pctx->mbufTsInpElem)); - if(p1) { - // keep the canonicalized xml as we need it also for SigAndRefsTimeStamp hash - ddocMemAppendData(&(pctx->mbufTsInput), p1, -1); - free(p1); - p1 = 0; - // debug write hash input to a file - ddocDebugWriteFile(4, "ts-sigandrefs-inp.txt", &(pctx->mbufTsInput)); - // calculate hash - l1 = 25; - ddocMemSetLength(&mbuf1, l1); - calculateDigest((const byte*)pctx->mbufTsInput.pMem, pctx->mbufTsInput.nLen, DIGEST_SHA1, (byte*)mbuf1.pMem, &l1); - mbuf1.nLen = l1; - pTsInfo = ddocSigInfo_GetOrCreateTypestampOfType(pSigInfo, TS_TYPE_SIG_AND_REFS); - if(pTsInfo) - ddocTimestampInfo_SetRealDigest(pTsInfo, mbuf1.pMem, mbuf1.nLen); - ddocEncodeBase64(&mbuf1, &mbuf2); - ddocDebug(3, "handleEndCompleteRevocationRefs", "Calculated SigAndRefsTimeStamp hash: %s", (const char*)mbuf2.pMem); - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - } - } - // cleanup - ddocSaxParseEndCollecting(pctx, FLAG_TS_INP, 0); -} - -#endif // WITH_TS - - //-------------------------------------------------- // handles the content of a element. // Decodes and reads in digest value @@ -1371,9 +1217,9 @@ // name - tag name // atts - attributes //-------------------------------------------------- -void handleEndDigestValue(SigDocParse* pctx, const xmlChar *name) +void handleEndDigestValue(SigDocParse* pctx) { - char id[10], type[20]; + char id[100], type[100]; SignatureInfo* pSigInfo = NULL; NotaryInfo* pNotInfo = NULL; DocInfo* pDocInfo = NULL; @@ -1449,7 +1295,7 @@ // value - character values read from file // len - length of chars ??? //-------------------------------------------------- -void handleEndSigningTime(SigDocParse* pctx, const xmlChar *name) +void handleEndSigningTime(SigDocParse* pctx) { SignatureInfo *pSigInfo; @@ -1503,7 +1349,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndClaimedRole(SigDocParse* pctx, const xmlChar *name) +void handleEndClaimedRole(SigDocParse* pctx) { SignatureInfo* pSigInfo; @@ -1522,7 +1368,7 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndCertifiedRole(SigDocParse* pctx, const xmlChar *name) +void handleEndCertifiedRole(SigDocParse* pctx) { SignatureInfo* pSigInfo; @@ -1541,7 +1387,7 @@ // value - character values read from file // len - length of chars ??? //-------------------------------------------------- -void handleEndIssuerSerial(SigDocParse* pctx, const xmlChar *name) +void handleEndIssuerSerial(SigDocParse* pctx) { SignatureInfo* pSigInfo; char id[20], type[20]; @@ -1570,7 +1416,7 @@ // value - character values read from file // len - length of chars ??? //-------------------------------------------------- -void handleEndIssuerName(SigDocParse* pctx, const xmlChar *name) +void handleEndIssuerName(SigDocParse* pctx) { SignatureInfo* pSigInfo; char id[20], type[20]; @@ -1580,8 +1426,8 @@ if(!strcmp(type, "CERTINFO")) { pSigInfo = ddocGetLastSignature(pctx->pSigDoc); pCertID = ddocSigInfo_GetCertIDOfType(pSigInfo, CERTID_TYPE_SIGNERS_CERTID); - if(pCertID && pctx->mbufElemData.pMem) - ddocCertID_SetIssuerName(pCertID, (char*)pctx->mbufElemData.pMem); + //if(pCertID && pctx->mbufElemData.pMem) + //ddocCertID_SetIssuerName(pCertID, (char*)pctx->mbufElemData.pMem); } if(!strcmp(type, "UNKNOWN_CERTINFO")) { pSigInfo = ddocGetLastSignature(pctx->pSigDoc); @@ -1610,25 +1456,18 @@ // value - character values read from file // len - length of chars ??? //-------------------------------------------------- -void handleEndResponderID(SigDocParse* pctx, const xmlChar *name) +void handleEndResponderID(SigDocParse* pctx) { NotaryInfo* pNotInf; DigiDocMemBuf mbuf1; mbuf1.pMem = 0; mbuf1.nLen = 0; + RETURN_VOID_IF_NULL(pctx->pSigDoc->szFormatVer); pNotInf = ddocGetLastNotaryInfo(pctx->pSigDoc); ddocDebug(3, "handleEndResponderId", "notary: %s id: %s, len: %d", (pNotInf ? pNotInf->szId : "NULL"), (const char*)pctx->mbufElemData.pMem, pctx->mbufElemData.nLen); if(pNotInf && pctx->mbufElemData.pMem) { - // in 1.4 format we have for text form responder id - // if this had been base64 form key hash then we had had -#ifdef WITH_TS - if(!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - pctx->errcode = ddocNotInfo_SetResponderId(pNotInf, (const char*)pctx->mbufElemData.pMem, pctx->mbufElemData.nLen); - pNotInf->nRespIdType = RESPID_NAME_TYPE; - } else { -#endif // in earlier format we din't have and // so we must detect if this is text or base64 if(isTextResponderId((const char*)pctx->mbufElemData.pMem)) { @@ -1639,9 +1478,28 @@ pctx->errcode = ddocNotInfo_SetResponderId(pNotInf, (const char*)mbuf1.pMem, mbuf1.nLen); pNotInf->nRespIdType = RESPID_KEY_TYPE; } -#ifdef WITH_TS - } -#endif + pctx->errcode = ddocSaxParseEndCollecting(pctx, FLAG_XML_ELEM, 0); + } +} + +//-------------------------------------------------- +// handles the end of a +// Reads in OCSP ProducedAt timestamp +// pctx - pointer to XML parsing work-area +// value - character values read from file +// len - length of chars ??? +//-------------------------------------------------- +void handleEndProducedAt(SigDocParse* pctx) +{ + NotaryInfo* pNotInf = NULL; + + RETURN_VOID_IF_NULL(pctx->pSigDoc); + pNotInf = ddocGetLastNotaryInfo(pctx->pSigDoc); + RETURN_VOID_IF_NULL(pNotInf); + ddocDebug(3, "handleEndProducedAt", "notary: %s produced at: %s len: %d", + (pNotInf ? pNotInf->szId : "NULL"), (const char*)pctx->mbufElemData.pMem, pctx->mbufElemData.nLen); + if(pNotInf && pctx->mbufElemData.pMem) { + setString(&(pNotInf->szProducedAt), (const char*)pctx->mbufElemData.pMem, -1 /* pctx->mbufElemData.nLen*/); pctx->errcode = ddocSaxParseEndCollecting(pctx, FLAG_XML_ELEM, 0); } } @@ -1653,7 +1511,7 @@ // value - character values read from file // len - length of chars ??? //-------------------------------------------------- -void handleEndByKey(SigDocParse* pctx, const xmlChar *name) +void handleEndByKey(SigDocParse* pctx) { NotaryInfo* pNotInf; DigiDocMemBuf mbuf1; @@ -1679,48 +1537,19 @@ // pctx - pointer to XML parsing work-area // name - tag name //-------------------------------------------------- -void handleEndSignatureValue(SigDocParse* pctx, const xmlChar* name) +void handleEndSignatureValue(SigDocParse* pctx) { SignatureInfo* pSigInfo; DigiDocMemBuf mbuf1, mbuf2; char *p1 = 0, *p2 = 0; int l1; -#ifdef WITH_TS - TimestampInfo* pTsInfo = 0; -#endif + mbuf1.pMem = 0; mbuf1.nLen = 0; mbuf2.pMem = 0; mbuf2.nLen = 0; + RETURN_VOID_IF_NULL(pctx->pSigDoc->szFormatVer); pSigInfo = ddocGetLastSignature(pctx->pSigDoc); -#ifdef WITH_TS - if(!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { - // calculate hash of caninicalized sig-value xml - p1 = (char*)canonicalizeXML((char*)pctx->mbufElemData.pMem, pctx->mbufElemData.nLen); - ddocDebugWriteFile(4, "sigval.txt", &(pctx->mbufElemData)); - if(p1) { - // free possibly collected old timestamp input data (for earlier signatures) - ddocMemBuf_free(&(pctx->mbufTsInput)); - // keep the canonicalized xml as we need it also for SigAndRefsTimeStamp hash - ddocMemAppendData(&(pctx->mbufTsInput), p1, -1); - // debug write hash input to a file - ddocDebugWriteFile(4, "ts-sigval-inp.txt", &(pctx->mbufTsInput)); - l1 = 25; - ddocMemSetLength(&mbuf1, l1); - calculateDigest((const byte*)p1, strlen(p1), DIGEST_SHA1, (byte*)mbuf1.pMem, &l1); - mbuf1.nLen = l1; - pTsInfo = ddocSigInfo_GetOrCreateTypestampOfType(pSigInfo, TS_TYPE_SIGNATURE); - if(pTsInfo) - ddocTimestampInfo_SetRealDigest(pTsInfo, mbuf1.pMem, mbuf1.nLen); - ddocEncodeBase64(&mbuf1, &mbuf2); - ddocDebug(3, "handleEndSignatureValue", "Calculated SignatureValueTimeStamp hash: %s", (const char*)mbuf2.pMem); - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - free(p1); - p1 = 0; - } - } -#endif // decode signature value p1 = strchr((const char*)pctx->mbufElemData.pMem, '>'); if(p1) @@ -1751,39 +1580,54 @@ int ddocSaxParseCollectStartTag(SigDocParse* pctx, const xmlChar *name, const xmlChar **atts, char *pcFlag, DigiDocMemBuf* pMBuf) { - int i, addXmlns = 0; + int i, addXmlns = 0, addXmlns3 = 0; + char *p = 0; // if we are in collect data mode then // record this tag data if(*pcFlag) { // don't use this attribute for 1.0 format - if((!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || + if(pctx->pSigDoc->szFormatVer && (!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_1_VER) || !strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_2_VER)) && (!strcmp((const char*)name, "SignedProperties") || !strcmp((const char*)name, "SignedInfo"))) // must have this attribute addXmlns = 1; else addXmlns = 0; // don't need this atribute + ddocDebug(3, "ddocSaxParseCollectStartTag", "Format: %s name: %s", pctx->pSigDoc->szFormatVer, (const char*)name); + if(pctx->pSigDoc->szFormatVer && !strcmp((const char*)name, "DataFile")) { + if(!strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_3_VER)) // must have this attribute + addXmlns3 = 1; + } pctx->errcode = ddocMemAppendData(pMBuf, "<", -1); if(!pctx->errcode) pctx->errcode = ddocMemAppendData(pMBuf, (const char*)name, -1); for (i = 0; !pctx->errcode && (atts != NULL) && (atts[i] != NULL); i += 2) { pctx->errcode = ddocMemAppendData(pMBuf, " ", -1); if(!pctx->errcode) - pctx->errcode = ddocMemAppendData(pMBuf, (const char*)atts[i], -1); - if(!pctx->errcode) - pctx->errcode = ddocMemAppendData(pMBuf, "=\"", -1); + pctx->errcode = ddocMemAppendData(pMBuf, (const char*)atts[i], -1); if(!pctx->errcode) - pctx->errcode = ddocMemAppendData(pMBuf, (const char*)atts[i+1], -1); + pctx->errcode = ddocMemAppendData(pMBuf, "=\"", -1); + if(!pctx->errcode) { + escapeXMLSymbols((const char*)atts[i+1], -1, &p); + if(p) { + pctx->errcode = ddocMemAppendData(pMBuf, p, -1); + free(p); + } + } if(!pctx->errcode) - pctx->errcode = ddocMemAppendData(pMBuf, "\"", -1); - if(!strcmp((const char*)atts[i], "xmlns")) - addXmlns = 0; // already has this atribute - } + pctx->errcode = ddocMemAppendData(pMBuf, "\"", -1); + if(!strcmp((const char*)atts[i], "xmlns")) { + addXmlns = 0; // already has this atribute + addXmlns3 = 0; + } + } // for if(addXmlns && !pctx->errcode) pctx->errcode = ddocMemAppendData(pMBuf, " xmlns=\"http://www.w3.org/2000/09/xmldsig#\"", -1); + if(addXmlns3 && !pctx->errcode) + pctx->errcode = ddocMemAppendData(pMBuf, " xmlns=\"http://www.sk.ee/DigiDoc/v1.3.0#\"", -1); if(!pctx->errcode) pctx->errcode = ddocMemAppendData(pMBuf, ">", -1); - ddocDebug(6, "ddocSaxParseCollectStartTag", "Element tag collected: %d", pMBuf->nLen); + ddocDebug(3, "ddocSaxParseCollectStartTag", "Element tag collected: %d - %s", pMBuf->nLen, (char*)pMBuf->pMem); } return pctx->errcode; } @@ -1813,9 +1657,9 @@ handleStartDataFile(pctx, name, atts); } if(!strcmp((const char*)name, "SignedProperties")) - handleStartSignedProperties(pctx, name, atts); + handleStartSignedProperties(pctx, atts); if(!strcmp((const char*)name, "SignedInfo")) - handleStartSignedInfo(pctx, name, atts); + handleStartSignedInfo(pctx); // if we are not in a and we encounter // the tag then start collecting original content if(!pctx->nIgnoreDataFile && @@ -1826,15 +1670,6 @@ ddocSaxParseCollectStartTag(pctx, name, atts, &(pctx->bCollectSigData), &(pctx->mbufSigData)); } // we need the tags here because of hash value calculation -#ifdef WITH_TS - if((pctx && pctx->pSigDoc && pctx->pSigDoc->szFormatVer && - !strcmp(pctx->pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) && - (!strcmp((const char*)name, "SignatureTimeStamp") || - !strcmp((const char*)name, "CompleteCertificateRefs") || - !strcmp((const char*)name, "CompleteRevocationRefs") )) - pctx->errcode = ddocSaxParseStartCollecting(pctx, FLAG_TS_INP, 0); - ddocSaxParseCollectStartTag(pctx, name, atts, &(pctx->bCollectTsInput), &(pctx->mbufTsInpElem)); -#endif // collect general tag data if(!strcmp((const char*)name, "SignatureValue")) pctx->errcode = ddocSaxParseStartCollecting(pctx, FLAG_XML_ELEM, 0); @@ -1842,8 +1677,8 @@ // use base64 DataFile parsing optimization // only possible if: a) not 1.0 format b) base64 content c) check config settings #ifdef WITH_BASE64_HASHING_HACK - if((pctx->bCollectDFData == 1) && - strcmp(pctx->pSigDoc->szFormatVer, SK_XML_1_VER) && + if((pctx->bCollectDFData == 1) && pctx->pSigDoc->szFormatVer && pctx->pSigDoc->szFormat && + (strcmp(pctx->pSigDoc->szFormatVer, SK_XML_1_VER) && strcmp(pctx->pSigDoc->szFormat, SK_XML_1_NAME))&& !strcmp(pctx->ctx3, CONTENT_EMBEDDED_BASE64) ) { // append end tag ddocMemAppendData(&(pctx->mbufElemData), "", -1); @@ -1868,37 +1703,29 @@ if(!strcmp((const char*)name, "SignedDoc")) handleStartSignedDoc(pctx, name, atts); if(!strcmp((const char*)name, "Signature")) - handleStartSignature(pctx, name, atts); + handleStartSignature(pctx, atts); if(!strcmp((const char*)name, "Reference")) - handleStartReference(pctx, name, atts); + handleStartReference(pctx, atts); if(!strcmp((const char*)name, "SignatureMethod")) - handleStartSignatureMethod(pctx, name, atts); + handleStartSignatureMethod(pctx, atts); if(!strcmp((const char*)name, "DigestMethod")) - handleStartDigestMethod(pctx, name, atts); + handleStartDigestMethod(pctx, atts); if(!strcmp((const char*)name, "Cert")) - handleStartCert(pctx, name, atts); + handleStartCert(pctx, atts); /*if(!strcmp((const char*)name, "ResponderID")) // TODO: do we need it ??? handleStartResponderId(pctx, name, atts);*/ /* if(!strcmp((const char*)name, "Certificate")) // TODO: do we need it ??? handleStartCertificate(pctx, name, atts);*/ if(!strcmp((const char*)name, "UnsignedSignatureProperties")) - handleStartUnsignedSignatureProperties(pctx, name, atts); -#ifdef WITH_TS - if(!strcmp((const char*)name, "SignatureTimeStamp")) - handleStartSignatureTimeStamp(pctx, name, atts); - if(!strcmp((const char*)name, "SigAndRefsTimeStamp")) - handleStartSigAndRefsTimeStamp(pctx, name, atts); - if(!strcmp((const char*)name, "Include")) - handleStartInclude(pctx, name, atts); -#endif + handleStartUnsignedSignatureProperties(pctx); if(!strcmp((const char*)name, "OCSPIdentifier")) - handleStartOCSPIdentifier(pctx, name, atts); + handleStartOCSPIdentifier(pctx, atts); if(!strcmp((const char*)name, "SigningCertificate")) - handleStartSigningCertificate(pctx, name, atts); + handleStartSigningCertificate(pctx); if(!strcmp((const char*)name, "CompleteCertificateRefs")) - handleStartCompleteCertificateRefs(pctx, name, atts); + handleStartCompleteCertificateRefs(pctx); if(!strcmp((const char*)name, "EncapsulatedX509Certificate")) - handleStartEncapsulatedX509Certificate(pctx, name, atts); + handleStartEncapsulatedX509Certificate(pctx, atts); // start collecting but release old if exists if(!strcmp((const char*)name, "X509SerialNumber") || !strcmp((const char*)name, "X509IssuerName")) { @@ -1914,6 +1741,7 @@ !strcmp((const char*)name, "X509Certificate") || !strcmp((const char*)name, "SigningTime") || !strcmp((const char*)name, "ResponderID") || + !strcmp((const char*)name, "ProducedAt") || !strcmp((const char*)name, "ByName") || !strcmp((const char*)name, "ByKey") || !strcmp((const char*)name, "City") || @@ -1975,9 +1803,6 @@ // collect separately and data ddocSaxParseCollectEndElement(pctx, name, &(pctx->bCollectSigData), &(pctx->mbufSigData)); ddocSaxParseCollectEndElement(pctx, name, &(pctx->bCollectSigPartData), &(pctx->mbufSigPartData)); -#ifdef WITH_TS - ddocSaxParseCollectEndElement(pctx, name, &(pctx->bCollectTsInput), &(pctx->mbufTsInpElem)); -#endif if(pctx->mbufSigData.pMem && !strcmp((const char*)name, "Signature")) { pSigInfo = ddocGetLastSignature(pctx->pSigDoc); if(pSigInfo) { @@ -1993,47 +1818,39 @@ } if(!pctx->nIgnoreDataFile) { if(!strcmp((const char*)name, "EncapsulatedX509Certificate")) - handleEndEncapsulatedX509Certificate(pctx, name); + handleEndEncapsulatedX509Certificate(pctx); if(!strcmp((const char*)name, "EncapsulatedOCSPValue")) - handleEndEncapsulatedOCSPValue(pctx, name); -#ifdef WITH_TS - if(!strcmp((const char*)name, "EncapsulatedTimeStamp")) - handleEndEncapsulatedTimeStamp(pctx, name); - if(!strcmp((const char*)name, "SignatureTimeStamp")) - handleEndSignatureTimeStamp(pctx, name); - if(!strcmp((const char*)name, "CompleteCertificateRefs")) - handleEndCompleteCertificateRefs(pctx, name); - if(!strcmp((const char*)name, "CompleteRevocationRefs")) - handleEndCompleteRevocationRefs(pctx, name); -#endif + handleEndEncapsulatedOCSPValue(pctx); if(!strcmp((const char*)name, "ClaimedRole")) - handleEndClaimedRole(pctx, name); + handleEndClaimedRole(pctx); if(!strcmp((const char*)name, "CertifiedRole")) - handleEndCertifiedRole(pctx, name); + handleEndCertifiedRole(pctx); if(!strcmp((const char*)name, "X509Certificate")) - handleEndX509Certificate(pctx, name); + handleEndX509Certificate(pctx); if(!strcmp((const char*)name, "SignedProperties")) - handleEndSignedProperties(pctx, name); + handleEndSignedProperties(pctx); if(!strcmp((const char*)name, "SignedInfo")) - handleEndSignedInfo(pctx, name); + handleEndSignedInfo(pctx); if(!strcmp((const char*)name, "SignatureValue")) - handleEndSignatureValue(pctx, name); + handleEndSignatureValue(pctx); if(!strcmp((const char*)name, "ResponderID")) - handleEndResponderID(pctx, name); + handleEndResponderID(pctx); + if(!strcmp((const char*)name, "ProducedAt")) + handleEndProducedAt(pctx); if(!strcmp((const char*)name, "ByName")) - handleEndResponderID(pctx, name); + handleEndResponderID(pctx); if(!strcmp((const char*)name, "ByKey")) - handleEndByKey(pctx, name); + handleEndByKey(pctx); if(!strcmp((const char*)name, "DigestValue")) - handleEndDigestValue(pctx, name); + handleEndDigestValue(pctx); if(!strcmp((const char*)name, "SigningTime")) - handleEndSigningTime(pctx, name); + handleEndSigningTime(pctx); if(!strcmp((const char*)name, "IssuerSerial")) - handleEndIssuerSerial(pctx, name); + handleEndIssuerSerial(pctx); if(!strcmp((const char*)name, "X509SerialNumber")) - handleEndIssuerSerial(pctx, name); + handleEndIssuerSerial(pctx); if(!strcmp((const char*)name, "X509IssuerName")) - handleEndIssuerName(pctx, name); + handleEndIssuerName(pctx); //if(!strcmp((const char*)name, "Cert")) // handleEndCert(pctx, name); if(!strcmp((const char*)name, "City")) @@ -2101,16 +1918,6 @@ } } -#ifdef WITH_TS - if(pctx->bCollectTsInput) { - if(!pctx->errcode) { - p = 0; - pctx->errcode = escapeXMLSymbols((const char*)ch, len, &p); - pctx->errcode = ddocMemAppendData(&(pctx->mbufTsInpElem), p, -1); - free(p); - } - } -#endif ddocDebug(5, "charactersHandler", "End collecting"); if(!strcmp(pctx->tag, "DataFile")) handleDataFile(pctx, ch, len); @@ -2499,7 +2306,7 @@ * * called when a pcdata block has been parsed */ -static void cdataBlockHandler(void *ctx, const xmlChar *value, int len) +static void cdataBlockHandler(void * ctx, const xmlChar *value, int len) { fprintf(stdout, "SAX.pcdata(%.20s, %d)\n", (char *) value, len); } @@ -2514,7 +2321,7 @@ * Display and format a warning messages, gives file, line, position and * extra parameters. */ -static void warningHandler(void *ctx, const char *msg, ...) +static void warningHandler(void * ctx, const char *msg, ...) { va_list args; @@ -2650,17 +2457,15 @@ { int err = ERR_OK, ret; FILE *f; - char chars[16385], *p, convFileName[250], buf1[16385]; + char chars[16385], *p, buf1[16385]; xmlParserCtxtPtr ctxt; SigDocParse pctx; -#ifndef WITH_BASE64_HASHING_HACK - int l1; -#endif DigiDocMemBuf mbuf1; - // debug - /*initConfigStore(NULL); - createOrReplacePrivateConfigItem(NULL, "DEBUG_LEVEL", "5"); - createOrReplacePrivateConfigItem(NULL, "DEBUG_FILE", "digidoc.log");*/ +#ifdef WIN32 + wchar_t *convFileName = 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &ret); + ddocDebug(3, "ddocSaxReadSignedDocFromFile", "file: %s, conv-file: %s", szFileName, convFileName); +#endif ddocDebug(3, "ddocSaxReadSignedDocFromFile", "digidoc: %s, checkDig: %d, maxDF: %ld", szFileName, checkFileDigest, lMaxDFLen); @@ -2668,10 +2473,20 @@ RETURN_IF_NULL_PARAM(szFileName); clearErrors(); memset(&pctx, 0, sizeof(pctx)); - ddocConvertFileName(convFileName, sizeof(convFileName), szFileName); - ddocDebug(4, "ddocSaxReadSignedDocFromFile", "reading file: %s", convFileName); - if ((f = fopen(convFileName, "r")) != NULL) { +#ifdef WIN32 + ddocDebug(3, "ddocSaxReadSignedDocFromFile", "Opening file: %s", convFileName); + if(!err && ((f = _wfopen(convFileName, "r")) != NULL)) { +#else + ddocDebug(3, "ddocSaxReadSignedDocFromFile", "Opening file: %s", szFileName); + if(!err && ((f = fopen(szFileName, "r")) != NULL)) { +#endif ddocDebug(4, "ddocSaxReadSignedDocFromFile", "file opened"); + memset(chars,0,sizeof(chars)); + ret = fread(chars, 1, 100, f); + if (ret > 0) { + p = strstr(chars, " 0) { - p = strstr(chars, " 0 && !strcmp(pctx.ctx4, CONTENT_EMBEDDED_BASE64)) { // bypass mode // look for new element start "<" p = strchr(chars, '<'); @@ -2751,12 +2564,15 @@ err = ERR_FILE_READ; ddocDebug(1, "ddocSaxReadSignedDocFromFile", "error reading file: %s, err: %d", szFileName, err); } - ddocDebug(3, "ddocSaxReadSignedDocFromFile", "success reading file: %s, err: %d", szFileName, err); if (err != ERR_OK) SET_LAST_ERROR(err); if(!err) err = getLastError(); + ddocDebug(3, "ddocSaxReadSignedDocFromFile", "success reading file: %s, err: %d", szFileName, err); // cleanup parser context ddocSAXCleanup(&pctx); +#ifdef WIN32 + free(convFileName); +#endif return err; } @@ -2773,9 +2589,10 @@ int len, long lMaxDFLen) { int err = ERR_OK; - int ret; + int ret, l2; SigDocParse pctx; - + char * p = 0; + ddocDebug(3, "ddocSaxReadSignedDocFromMemory", "data len: %d, maxDF: %ld", len, lMaxDFLen); RETURN_IF_NULL_PARAM(ppSigDoc); RETURN_IF_NULL_PARAM(pData); @@ -2789,7 +2606,16 @@ pctx.szInputFileName = 0; pctx.checkFileDigest = 0; pctx.lMaxDFLen = lMaxDFLen; - ret = xmlSAXUserParseMemory(debugSAXHandler, &pctx, (const char*)pData, len); + // skip any BOM marks or other non-xml chars at the beginning + if(pData) + p = strstr((const char*)pData, " +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +char* g_xmlHdr1 = "\n"; +char* g_xmlEnd1 = ""; +char* g_xmlHdr2 = "\n"; +char* g_xmlEnd2 = ""; + + + +int ddocXmlElem(DigiDocMemBuf* pMbuf, const char* szElem, const char* szValue) +{ + int err = ERR_OK; + if(szValue) { + err = ddocGen_startElem(pMbuf, szElem); + if(!err) + err = ddocMemAppendData(pMbuf, szValue, -1); + if(!err) + err = ddocGen_endElem(pMbuf, szElem); + } + return err; +} + +int findXmlElemValue(DigiDocMemBuf* pMbMsg, const char* szTag, DigiDocMemBuf* pMbValue) +{ + char *p1, *p2; + char tag[50]; + + p1 = (char*)pMbMsg->pMem; + if(p1) { + snprintf(tag, sizeof(tag), "<%s", szTag); + p1 = strstr(p1, tag); + if(p1) { + while(*p1 && *p1 != '>') p1++; + if(*p1 && *p1 == '>') p1++; + snprintf(tag, sizeof(tag), " (long)p1) { + ddocMemAssignData(pMbValue, p1, (int)(p2 - p1)); + return 0; + } + } + } + return -1; +} + + +//-------------------------------------------------- +// Signs the document and gets return status back +// pSigDoc - signed document object +// szIdCode - personal id code +// szPhoneNo - users phone number +// szLang - language code +// manifest - manifest or role +// city - signers address , city +// state - signers address , state or province +// zip - signers address , postal code +// country - signers address , country name +// pSesscode - pointer to long int buffer for returning session code +// szChallenge - buffer for returning challenge code (char 4) +// nChalLen - length of challenge buffer +// return error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddsSign(SignedDoc* pSigDoc, + const char* szIdCode, const char* szPhoneNo, + const char* szLang, const char* szServiceName, + const char* manifest, const char* city, + const char* state, const char* zip, + const char* country, + char* url, char* proxyHost, char* proxyPort, + long* pSesscode, char* szChallenge, int nChalLen) +{ + int err = ERR_OK, i, l1; + char *p1 = 0; + DataFile *pDf = 0; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; + char buf1[40]; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + ddocDebug(3, "ddsSign", "Creating M-ID signature using: %s", szPhoneNo); + RETURN_IF_NULL_PARAM(pSigDoc); + RETURN_IF_NULL_PARAM(szIdCode); + RETURN_IF_NULL_PARAM(country); + RETURN_IF_NULL_PARAM(szPhoneNo); + RETURN_IF_NULL_PARAM(url); + RETURN_IF_NULL_PARAM(pSesscode); + RETURN_IF_NULL_PARAM(szChallenge); + ddocMemAssignData(&mbuf2, g_xmlHdr1, -1); + // create xml request + err = ddocXmlElem(&mbuf2, "IDCode", szIdCode); + err = ddocXmlElem(&mbuf2, "SignersCountry", country); + err = ddocXmlElem(&mbuf2, "PhoneNo", szPhoneNo); + err = ddocXmlElem(&mbuf2, "Language", szLang); + err = ddocXmlElem(&mbuf2, "ServiceName", szServiceName); + err = ddocXmlElem(&mbuf2, "Role", manifest); + err = ddocXmlElem(&mbuf2, "City", city); + err = ddocXmlElem(&mbuf2, "StateOrProvince", state); + err = ddocXmlElem(&mbuf2, "PostalCode", zip); + err = ddocXmlElem(&mbuf2, "CountryName", country); + err = ddocGen_startElem(&mbuf2, "DataFiles"); + for(i = 0; i < getCountOfDataFiles(pSigDoc); i++) { + pDf = getDataFile(pSigDoc, i); + err = ddocGen_startElem(&mbuf2, "DataFileDigest"); + err = ddocXmlElem(&mbuf2, "Id", pDf->szId); + err = ddocXmlElem(&mbuf2, "DigestType", pDf->szDigestType); + l1 = sizeof(buf1); + memset(buf1, 0, l1); + encode((const byte*)pDf->mbufDigest.pMem, pDf->mbufDigest.nLen, (byte*)buf1, &l1); + err = ddocXmlElem(&mbuf2, "DigestValue", buf1); + err = ddocGen_endElem(&mbuf2, "DataFileDigest"); + } + err = ddocGen_endElem(&mbuf2, "DataFiles"); + err = ddocXmlElem(&mbuf2, "Format", pSigDoc->szFormat); + err = ddocXmlElem(&mbuf2, "Version", pSigDoc->szFormatVer); + sprintf(buf1, "S%d", getNextSignatureId(pSigDoc)); + err = ddocXmlElem(&mbuf2, "SignatureID", buf1); + err = ddocXmlElem(&mbuf2, "MessagingMode", "asynchClientServer"); + err = ddocXmlElem(&mbuf2, "AsyncConfiguration", "0"); + ddocMemAppendData(&mbuf2, g_xmlEnd1, -1); + + // create http req + ddocMemAssignData(&mbuf1, "POST ", -1); + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) { + ddocMemAppendData(&mbuf1, url, -1); + } else { + p1 = strstr(url, "://"); + if(p1) p1 += 3; + if(p1) p1 = strchr(p1, '/'); + if(p1) + ddocMemAppendData(&mbuf1, p1, -1); + else + ddocMemAppendData(&mbuf1, "/", -1); + } + ddocMemAppendData(&mbuf1, " HTTP/1.0\r\n", -1); + ddocMemAppendData(&mbuf1, "User-Agent: DigiDocLib\r\n", -1); + ddocMemAppendData(&mbuf1, "Content-Type: text/xml; charset=utf-8\r\n", -1); + snprintf(buf1, sizeof(buf1), "Content-Length: %d\r\n", (int)mbuf2.nLen); + ddocMemAppendData(&mbuf1, buf1, -1); + ddocMemAppendData(&mbuf1, "Connection: Close\r\n", -1); + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) // if we use proxy then send also Proxy-Connection + ddocMemAppendData(&mbuf1, "Proxy-Connection: Close\r\n", -1); + ddocMemAppendData(&mbuf1, "SOAPAction: \"\"\r\n", -1); + ddocMemAppendData(&mbuf1, "\r\n", -1); + ddocMemAppendData(&mbuf1, mbuf2.pMem, mbuf2.nLen); + ddocDebug(4, "ddsSign", "Send to host: %s request len: %d", url, mbuf1.nLen); + ddocDebug(4, "ddsSign", "Sending: \n---\n%s\n---\n", mbuf1.pMem); + ddocMemBuf_free(&mbuf2); + err = ddocPullUrl(url, &mbuf1, &mbuf2, proxyHost, proxyPort); + ddocDebug(4, "ddsSign", "Recevied len: %d RC: %d", mbuf2.nLen, err); + //ddocDebug(3, "ddsSign", "Received: \n---\n%s\n---\n", mbuf2.pMem); + if(!err && ((l1 = ddocGetHttpResponseCode(&mbuf2)) == 200)) { + err = ddocGetHttpPayload(&mbuf2, &mbuf3); + ddocMemBuf_free(&mbuf2); + ddocDebug(4, "ddsSign", "SOAP: \n---\n%s\n---\n", mbuf3.pMem); + err = findXmlElemValue(&mbuf3, "Sesscode", &mbuf2); + if(!err) + (*pSesscode) = atol((char*)mbuf2.pMem); + //ddocDebug(3, "ddsSign", "Sesscode: %ld", (*pSesscode)); + ddocMemBuf_free(&mbuf2); + err = findXmlElemValue(&mbuf3, "ChallengeID", &mbuf2); + //ddocDebug(3, "ddsSign", "Challenge id %s", mbuf2.pMem); + if(!err && mbuf2.pMem && mbuf2.nLen) { + memset(szChallenge, 0, nChalLen); + strncpy(szChallenge, mbuf2.pMem, mbuf2.nLen); + } + ddocDebug(3, "ddsSign", "Sesscode: %ld Challenge id %s RC: %d", (*pSesscode), szChallenge, err); + ddocMemBuf_free(&mbuf2); + } + + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + RETURN_IF_NOT(err == ERR_OK, err); + return err; +} + + +//------------------------------------------ +// Gets DigiDocService session status and returns status code +// If session is ready then signature will be returned +// pSigDoc - signed document object to be modified +// pMBufSig - buffer for returning signature +// returns DigiDocService session status code +//------------------------------------------ +EXP_OPTION int ddsGetStatus(SignedDoc* pSigDoc, long lSesscode, + char* url, char* proxyHost, char* proxyPort, + int* pStatus) +{ + int err = ERR_OK, l1; + SignatureInfo *pSigInfo = 0; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; + char buf1[40], *p1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + ddocDebug(3, "ddsGetStatus", "Get Status for sess: %ld", lSesscode); + RETURN_IF_NULL_PARAM(pSigDoc); + RETURN_IF_NULL_PARAM(url); + RETURN_IF_NULL_PARAM(pStatus); + *pStatus = 0; + ddocMemAssignData(&mbuf2, g_xmlHdr2, -1); + // create xml request + sprintf(buf1, "%ld", lSesscode); + err = ddocXmlElem(&mbuf2, "Sesscode", buf1); + err = ddocXmlElem(&mbuf2, "WaitSignature", "false"); + ddocMemAppendData(&mbuf2, g_xmlEnd2, -1); + + // create http req + ddocMemAssignData(&mbuf1, "POST ", -1); + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) { + ddocMemAppendData(&mbuf1, url, -1); + } else { + p1 = strstr(url, "://"); + if(p1) p1 += 3; + if(p1) p1 = strchr(p1, '/'); + if(p1) + ddocMemAppendData(&mbuf1, p1, -1); + else + ddocMemAppendData(&mbuf1, "/", -1); + } + ddocMemAppendData(&mbuf1, " HTTP/1.0\r\n", -1); + ddocMemAppendData(&mbuf1, "User-Agent: DigiDocLib\r\n", -1); + ddocMemAppendData(&mbuf1, "Content-Type: text/xml; charset=utf-8\r\n", -1); + snprintf(buf1, sizeof(buf1), "Content-Length: %d\r\n", (int)mbuf2.nLen); + ddocMemAppendData(&mbuf1, buf1, -1); + ddocMemAppendData(&mbuf1, "Connection: Close\r\n", -1); + if(proxyHost || (proxyPort && atoi(proxyPort) > 0)) // if we use proxy then send also Proxy-Connection + ddocMemAppendData(&mbuf1, "Proxy-Connection: Close\r\n", -1); + ddocMemAppendData(&mbuf1, "SOAPAction: \"\"\r\n", -1); + ddocMemAppendData(&mbuf1, "\r\n", -1); + ddocMemAppendData(&mbuf1, mbuf2.pMem, mbuf2.nLen); + ddocDebug(4, "ddsGetStatus", "Send to host: %s request len: %d", url, mbuf1.nLen); + ddocDebug(4, "ddsGetStatus", "Sending: \n---\n%s\n---\n", mbuf1.pMem); + ddocMemBuf_free(&mbuf2); + err = ddocPullUrl(url, &mbuf1, &mbuf2, proxyHost, proxyPort); + ddocDebug(4, "ddsGetStatus", "Recevied len: %d RC: %d", mbuf2.nLen, err); + //ddocDebug(3, "ddsSign", "Received: \n---\n%s\n---\n", mbuf2.pMem); + if(!err && ((l1 = ddocGetHttpResponseCode(&mbuf2)) == 200)) { + err = ddocGetHttpPayload(&mbuf2, &mbuf3); + ddocMemBuf_free(&mbuf2); + ddocDebug(4, "ddsGetStatus", "SOAP: \n---\n%s\n---\n", mbuf3.pMem); + err = findXmlElemValue(&mbuf3, "Status", &mbuf2); + if(!err && mbuf2.pMem) { + if(!strcmp((char*)mbuf2.pMem, "OUTSTANDING_TRANSACTION")) + (*pStatus) = STATUS_OUTSTANDING_TRANSACTION; + if(!strcmp((char*)mbuf2.pMem, "SIGNATURE")) + (*pStatus) = STATUS_SIGNATURE; + if(!strcmp((char*)mbuf2.pMem, "ERROR")) + (*pStatus) = STATUS_ERROR; + + } + ddocDebug(3, "ddsGetStatus", "Sesscode: %ld Status: %d RC: %d", lSesscode, (*pStatus), err); + ddocMemBuf_free(&mbuf2); + if((*pStatus) == STATUS_SIGNATURE) { + err = findXmlElemValue(&mbuf3, "Signature", &mbuf2); + ddocDebug(4, "ddsGetStatus", "Sig-esacped: \n---\n%s\n---\n", mbuf2.pMem); + p1 = escape2xmlsym((char*)mbuf2.pMem); + ddocDebug(4, "ddsGetStatus", "Signature: \n---\n%s\n---\n", p1); + sprintf(buf1, "S%d", getNextSignatureId(pSigDoc)); + SignatureInfo_new(&pSigInfo, pSigDoc, buf1); + ddocMemAssignData(&(pSigInfo->mbufOrigContent), p1, -1); + free(p1); + } + } + + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + RETURN_IF_NOT(err == ERR_OK, err); + return err; +} + diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocService.h libdigidoc-3.7.0.875/libdigidoc/DigiDocService.h --- libdigidoc-2.7.0/libdigidoc/DigiDocService.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocService.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,78 @@ +#ifndef __DIGI_DOC_SRV_H__ +#define __DIGI_DOC_SRV_H__ +//================================================== +// FILE: DigiDocService.h +// PROJECT: Digi Doc +// DESCRIPTION: Digi Doc functions for DigiDocService access +// AUTHOR: Veiko Sinivee, Sunset Software O† +//================================================== +// Copyright (C) AS Sertifitseerimiskeskus +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// GNU Lesser General Public Licence is available at +// http://www.gnu.org/copyleft/lesser.html +//================================================== + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define STATUS_UNKNOWN 0 +#define STATUS_OUTSTANDING_TRANSACTION 1 +#define STATUS_SIGNATURE 2 +#define STATUS_ERROR 3 + + //------------------------------------------ + // Gets DigiDocService session status and returns status code + // If session is ready then signature will be returned + // pSigDoc - signed document object to be modified + // pStatus - buffer for returning status + // returns DigiDocService session status code + //------------------------------------------ + EXP_OPTION int ddsGetStatus(SignedDoc* pSigDoc, long lSesscode, + char* url, char* proxyHost, char* proxyPort, + int* pStatus); + + //-------------------------------------------------- + // Signs the document and gets return status back + // pSigDoc - signed document object + // szIdCode - personal id code + // szPhoneNo - users phone number + // szLang - language code + // manifest - manifest or role + // city - signers address , city + // state - signers address , state or province + // zip - signers address , postal code + // country - signers address , country name + // pSesscode - pointer to long int buffer for returning session code + // szChallenge - buffer for returning challenge code (char 4) + // nChalLen - length of challenge buffer + // return error code or ERR_OK + //-------------------------------------------------- + EXP_OPTION int ddsSign(SignedDoc* pSigDoc, + const char* szIdCode, const char* szPhoneNo, + const char* szLang, const char* szServiceName, + const char* manifest, const char* city, + const char* state, const char* zip, + const char* country, + char* url, char* proxyHost, char* proxyPort, + long* pSesscode, char* szChallenge, int nChalLen); + + + +#ifdef __cplusplus +} +#endif + + +#endif // __DIGI_DOC_CFG_H__ diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocVerify.c libdigidoc-3.7.0.875/libdigidoc/DigiDocVerify.c --- libdigidoc-2.7.0/libdigidoc/DigiDocVerify.c 2009-05-20 13:35:47.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocVerify.c 2012-12-13 22:05:47.000000000 +0000 @@ -20,17 +20,20 @@ // Creation //================================================== -#include -#include -#include -#include -#include -//#include -#include -#include +#include "libdigidoc/DigiDocVerify.h" +#include "libdigidoc/DigiDocError.h" +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocDebug.h" +#include "libdigidoc/DigiDocConvert.h" +#include "libdigidoc/DigiDocError.h" +#include "libdigidoc/DigiDocCert.h" +#include "libdigidoc/DigiDocGen.h" #include +#ifdef WITH_ECDSA + #include +#endif #include #include #include @@ -144,6 +147,48 @@ return err; } +//============================================================ +// Compares two byte arrays and returns 0 for OK. +// doesn't record an error on error stack +// dig1 - byte array 1 +// len1 - byte array 1 length +// dig2 - byte array 2 +// len2 - byte array 2 length +//============================================================ +EXP_OPTION int compareByteArraysNoErr(const byte* dig1, int len1, const byte* dig2, int len2) +{ + int i; + + if(!dig1 || !dig2 || len1 != len2) + return -1; + for(i = 0; i < len1; i++) { + if(dig1[i] != dig2[i]) + return -2; + } + return 0; +} + +//byte sigvalasn1[] = { 48, 33, 48, 9, 6, 5, 43, 14, 3, 2, 26, 5, 0, 4, 20 }; +byte sigvalasn1[] = { + 0x30, 0x1f, 0x30, 0x07, 0x06, + 0x05, 0x2b, 0x0e, 0x03, 0x02, + 0x1a, 0x04, 0x14 }; +byte sigvalasn2[] = { + 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, + 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 }; + +int verifySigValAsn1(byte* sigval, int len) +{ + if(!sigval || + (compareByteArraysNoErr(sigval, len, sigvalasn1, sizeof(sigvalasn1)) && + compareByteArraysNoErr(sigval, len, sigvalasn2, sizeof(sigvalasn2)))) { + ddocDebug(1, "verifySigValAsn1", "Invalid signature value asn.1 len: ", len); + SET_LAST_ERROR(ERR_SIGVAL_ASN1); + return ERR_SIGVAL_ASN1; + } + return ERR_OK; +} + //-------------------------------------------------- // Verifies files SHA1-RSA signature (EstID specific!!!) // digest - digest data @@ -158,22 +203,106 @@ EXP_OPTION int verifyEstIDSignature(const byte* digest, int digestLen, int nDigestType, byte* pSigBuf, int nSigLen, X509* cert) { - int err = ERR_OK; + int err = ERR_OK, nCheckSigValAsn1 = 1; EVP_PKEY* pkey = 0; - byte buf2[DIGEST_LEN+2], buf3[200], buf4[50], buf5[50]; + byte buf2[DIGEST_LEN+2], buf3[500], buf4[200], buf5[200],buf256[DIGEST_LEN256+2]; int l2 = 0, l1; - + //AM 11.02.09 ecdsa-sha1 support for LI +#ifdef WITH_ECDSA + ECDSA_SIG *ecsig; +#endif RETURN_IF_NULL_PARAM(digest); RETURN_IF_NULL_PARAM(pSigBuf); RETURN_IF_NULL_PARAM(cert); + ddocDebug(3, "verifyEstIDSignature", "start"); + nCheckSigValAsn1 = ConfigItem_lookup_int("CHECK_SIGNATURE_VALUE_ASN1", 1); if(nDigestType == DIGEST_SHA1) { if((err = GetPublicKey(&pkey, cert)) == ERR_OK) { l2 = sizeof(buf3); memset(buf3, 0, sizeof(buf3)); ERR_clear_error(); //swapBytes(pSigBuf, nSigLen); +#ifdef WITH_ECDSA + if(pkey->type==NID_X9_62_id_ecPublicKey){ + ecsig = ECDSA_SIG_new(); + ecsig->r = BN_new(); + ecsig->s = BN_new(); + if (!BN_bin2bn(pSigBuf, nSigLen/2,ecsig->r) || !BN_bin2bn(pSigBuf + nSigLen/2, nSigLen/2, ecsig->s)){ + ECDSA_SIG_free(ecsig); + EVP_PKEY_free(pkey); + return ERR_COMPARE; + } + l2 = ECDSA_do_verify(digest, digestLen, ecsig, pkey->pkey.ec); + ECDSA_SIG_free(ecsig); + if (l2 == -1){ + /* error */ + err = ERR_COMPARE; + } + else if (l2 == 0){ + /* incorrect signature */ + err = ERR_COMPARE; + } + else { /* ret == 1 */ + /* signature ok */ + err = ERR_OK; + } + }else +#endif + if(pkey->type==NID_rsaEncryption){ + clearErrors(); + l2 = RSA_public_decrypt(nSigLen, pSigBuf, buf3, pkey->pkey.rsa, RSA_PKCS1_PADDING); //RSA_PKCS1_PADDING); //RSA_NO_PADDING); + checkErrors(); + ddocDebug(3, "verifyEstIDSignature", "decryted sig-hash len: %d", l2); + // debug info + l1 = sizeof(buf4); + if(digestLen > 0) { + memset(buf4, 0, sizeof(buf4)); + encode((const byte*)digest, digestLen, (byte*)buf4, &l1); + ddocDebug(3, "verifyEstIDSignature", "calculated hash: %s len: %d", buf4, digestLen); + } + l1 = sizeof(buf4); + if(l2 > 0) { // TODO: lisa asn.1 prefixi kontroll + memset(buf4, 0, sizeof(buf4)); + encode((const byte*)buf3, l2, (byte*)buf4, &l1); + ddocDebug(3, "verifyEstIDSignature", "decrypted hash: %s len: %d", buf4, l2); + } + memset(buf2, 0, DIGEST_LEN); + checkErrors(); + if(l2 > DIGEST_LEN) { + err = verifySigValAsn1(buf3, l2 - DIGEST_LEN); + memcpy(buf2, buf3 + l2 - DIGEST_LEN, DIGEST_LEN); + } else { + memcpy(buf2, buf3, DIGEST_LEN); + if(nCheckSigValAsn1) { + err = ERR_SIGVAL_ASN1; + SET_LAST_ERROR(err); + ddocDebug(1, "verifyEstIDSignature", "Invalid rsa-sha1 siganture length: %d", l2); + } + } + if(!err) + err = compareByteArrays(digest, digestLen, buf2, DIGEST_LEN); + //debug + l1 = sizeof(buf4); + encode((const byte*)digest, digestLen, (byte*)buf4, &l1); + l1 = sizeof(buf5); + encode((const byte*)buf2, DIGEST_LEN, (byte*)buf5, &l1); + ddocDebug(3, "verifyEstIDSignature", "comp-hash: %s sig-hash: %s, err: %d", buf4, buf5, err); + } else + err = ERR_UNSUPPORTED_SIGNATURE; + + EVP_PKEY_free(pkey); + checkErrors(); + } + //AM 23.04.08 + } else if(nDigestType == DIGEST_SHA256) { + if((err = GetPublicKey(&pkey, cert)) == ERR_OK) { + l2 = sizeof(buf3); + memset(buf3, 0, sizeof(buf3)); + ERR_clear_error(); + //swapBytes(pSigBuf, nSigLen); l2 = RSA_public_decrypt(nSigLen, pSigBuf, buf3, pkey->pkey.rsa, RSA_PKCS1_PADDING); //RSA_PKCS1_PADDING); //RSA_NO_PADDING); - ddocDebug(3, "verifyEstIDSignature", "decryted sig-hash len: %d", l2); + checkErrors(); + ddocDebug(3, "verifyEstIDSignature", "decryted sig-hash len: %d", l2); // debug info l1 = sizeof(buf4); if(digestLen > 0) { @@ -187,18 +316,19 @@ encode((const byte*)buf3, l2, (byte*)buf4, &l1); ddocDebug(3, "verifyEstIDSignature", "decrypted hash: %s len: %d", buf4, l2); } - memset(buf2, 0, DIGEST_LEN); + memset(buf256, 0, DIGEST_LEN); if(l2 > DIGEST_LEN) - memcpy(buf2, buf3 + l2 - DIGEST_LEN, DIGEST_LEN); + memcpy(buf256, buf3 + l2 - DIGEST_LEN, DIGEST_LEN); else - memcpy(buf2, buf3, DIGEST_LEN); + memcpy(buf256, buf3, DIGEST_LEN); checkErrors(); - err = compareByteArrays(digest, digestLen, buf2, DIGEST_LEN); + //err = compareByteArrays(digest, digestLen, buf256, DIGEST_LEN256); + err = compareByteArrays(digest, DIGEST_LEN, buf256, DIGEST_LEN); //debug l1 = sizeof(buf4); encode((const byte*)digest, digestLen, (byte*)buf4, &l1); l1 = sizeof(buf5); - encode((const byte*)buf2, DIGEST_LEN, (byte*)buf5, &l1); + encode((const byte*)buf256, DIGEST_LEN256, (byte*)buf5, &l1); ddocDebug(3, "verifyEstIDSignature", "comp-hash: %s sig-hash: %s, err: %d", buf4, buf5, err); EVP_PKEY_free(pkey); @@ -211,9 +341,11 @@ err = ERR_UNSUPPORTED_DIGEST; if (err != ERR_OK) SET_LAST_ERROR(err); + ddocDebug(3, "verifyEstIDSignature", "end"); return err; } + //============================================================ // Compares two byte arrays and returns 0 for OK // dig1 - byte array 1 @@ -237,6 +369,8 @@ return err; } + + //============================================================ // Verifies the digest of the given doc in this signature // pSigDoc - signed doc data @@ -246,13 +380,12 @@ //============================================================ // FIXME : Hard to understand the logic EXP_OPTION int verifySigDocDigest(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const DocInfo* pDocInfo, const char* szFileName, const char* szDataFile) + const DocInfo* pDocInfo, const char* szDataFile) { int err = ERR_OK; int l1, l2; - long l; DataFile *pDf = NULL ; - byte buf1[DIGEST_LEN+2], buf2[50], buf3[50], buf4[50]; + byte buf1[DIGEST_LEN+2], buf2[100], buf3[100], buf4[100]; char *attNames = NULL, *attValues = NULL, *pTmp1 = NULL, *pTmp2 = NULL; //FILE *hFile; @@ -268,35 +401,11 @@ ddocDebug(3, "verifySigDocDigest", "SigDoc: %s DF: %s len1: %d len2: %d, ctype: %s", pSigDoc->szFormatVer, pDf->szId, pDf->mbufDigest.nLen, pDocInfo->nDigestLen, pDf->szContentType); - if(!strcmp(pDf->szContentType, CONTENT_HASHCODE)) { - ddocDebug(3, "verifySigDocDigest", "DF: %s ContentType: %s len1: %d len2: %d, type1: %s type2: %s", - pDf->szId, pDf->szContentType, - pDf->mbufDetachedDigest.nLen, pDocInfo->nDigestLen, - pDocInfo->szDigestType, pDf->szDigestType); - if(strcmp(pDocInfo->szDigestType, pDf->szDigestType)) - err = ERR_DOC_DIGEST; - else - err = compareByteArrays(pDocInfo->szDigest, pDocInfo->nDigestLen, - (byte*)pDf->mbufDetachedDigest.pMem, pDf->mbufDetachedDigest.nLen); - if(err != ERR_OK) - err = ERR_DOC_DIGEST; - } - if(!strcmp(pDf->szContentType, CONTENT_DETATCHED)) { - if(szFileName) { - l1 = sizeof(buf1); - err = calculateFileDigest(szFileName, - DIGEST_SHA1, buf1, &l1, &l); - RETURN_IF_NOT(err == ERR_OK, err); - err = compareByteArrays(buf1, l1, - (byte*)pDf->mbufDetachedDigest.pMem, pDf->mbufDetachedDigest.nLen); - RETURN_IF_NOT(err == ERR_OK, err); - } else - SET_LAST_ERROR_RETURN_CODE(ERR_DOC_DIGEST); - } // the new digest calculation on the fly doesn't // work for old 1.0 files + //AM 29.10.09 if(!strcmp(pDf->szContentType, CONTENT_EMBEDDED) && - !strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + (!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME))) { attNames = "Id"; attValues = pDf->szId; err = readTagContents(&pTmp2, szDataFile, "DataFile", 1, @@ -318,7 +427,7 @@ } } if(!strcmp(pDf->szContentType, CONTENT_EMBEDDED) || - !strcmp(pDf->szContentType, CONTENT_EMBEDDED_BASE64)) { + !strcmp(pDf->szContentType, CONTENT_EMBEDDED_BASE64)){ buf2[0] = buf3[0] = buf4[0] = 0; l2 = sizeof(buf2); if(pDocInfo->szDigest) @@ -344,6 +453,7 @@ if(err != ERR_OK) err = ERR_DOC_DIGEST; } + if (err != ERR_OK) SET_LAST_ERROR(err); ddocDebug(3, "verifySigDocDigest", "SigDoc DF: %s err: %d", pDf->szId, err); @@ -371,7 +481,7 @@ pDf = getDataFileWithId(pSigDoc, pDocInfo->szDocId); RETURN_IF_NULL(pDf); // we check mime digest only in ver 1.0 - if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER)) { + if(!strcmp(pSigDoc->szFormatVer, SK_XML_1_VER) && !strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { l1 = sizeof(buf1); err = calculateDigest((const byte*)pDf->szMimeType, strlen(pDf->szMimeType), DIGEST_SHA1, buf1, &l1); @@ -401,7 +511,7 @@ RETURN_IF_NULL_PARAM(pSigInfo); err = ddocCompareDigestValues(pSigInfo->pSigPropDigest, pSigInfo->pSigPropRealDigest); RETURN_IF_NOT(err == ERR_OK, ERR_SIGPROP_DIGEST); - return ERR_OK; + return err; } //============================================================ @@ -413,14 +523,27 @@ int err = ERR_OK; int l1, l2; char szOtherSerial[100]; - byte buf1[DIGEST_LEN+2], buf2[DIGEST_LEN*2], buf3[DIGEST_LEN*2]; + byte buf1[DIGEST_LEN256+2], buf2[DIGEST_LEN256*2], buf3[DIGEST_LEN256*2]; DigiDocMemBuf* pMBuf; - + CertID* pCertID = 0; + X509* pCert; + RETURN_IF_NULL_PARAM(pSigInfo); RETURN_IF_NULL_PARAM(ddocSigInfo_GetSignersCert(pSigInfo)); l1 = sizeof(buf1); - RETURN_IF_NOT(X509_digest(ddocSigInfo_GetSignersCert(pSigInfo), - EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); + //AM 24.04.08 + pCertID = ddocCertIDList_GetCertIDOfType(pSigInfo->pCertIDs, CERTID_TYPE_SIGNERS_CERTID); + if(pCertID->szDigestType){ + if(!strcmp(pCertID->szDigestType,DIGEST_SHA256_NAME)){ + RETURN_IF_NOT(X509_digest(ddocSigInfo_GetSignersCert(pSigInfo), + EVP_sha256(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); } + else{ + RETURN_IF_NOT(X509_digest(ddocSigInfo_GetSignersCert(pSigInfo), + EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); } + }else{ + RETURN_IF_NOT(X509_digest(ddocSigInfo_GetSignersCert(pSigInfo), + EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); + } // debug memset(buf2, 0, sizeof(buf2)); memset(buf3, 0, sizeof(buf3)); @@ -435,8 +558,18 @@ err = compareByteArrays((const byte*)pMBuf->pMem, pMBuf->nLen, buf1, l1); RETURN_IF_NOT(err == ERR_OK, ERR_WRONG_CERT); err = ReadCertSerialNumber(szOtherSerial, sizeof(szOtherSerial), ddocSigInfo_GetSignersCert(pSigInfo)); + ddocDebug(3, "verifySigCert", "SIG: %s signer-cert-serial: %s cert-serial2: %s", + pSigInfo->szId, ddocSigInfo_GetSignersCert_IssuerSerial(pSigInfo), szOtherSerial); RETURN_IF_NOT(((err == ERR_OK) && !strcmp(ddocSigInfo_GetSignersCert_IssuerSerial(pSigInfo), szOtherSerial)), ERR_WRONG_CERT); + // check key usage + pCert = ddocSigInfo_GetSignersCert(pSigInfo); + if(!ddocCertCheckKeyUsage(pCert, KUIDX_NON_REPUDIATION)) { + ddocDebug(1, "verifySigCert", "SIG: %s cert has no non-repudiation key usage", pSigInfo->szId); + SET_LAST_ERROR(ERR_SIGNERS_CERT_NON_REPU); + return ERR_SIGNERS_CERT_NON_REPU; + } else + ddocDebug(3, "verifySigCert", "SIG: %s cert has non-repudiation key usage", pSigInfo->szId); return err; } @@ -448,20 +581,16 @@ // signerCA - direct signer CA certs filename // szDateFile - name of the digidoc file // bUseCA - use CA certs or not 1/0 -// pPaths - file name / path pairs for detatched files -// nPaths - number of file name / path pairs // from original file and use it for hash function. // This is usefull if the file has been generated by // another library and possibly formats these elements // differently. //============================================================ EXP_OPTION int verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const char* signerCA, const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths) + const char* signerCA, const char* szDataFile, int bUseCA) { int err = ERR_OK; - int j, k, i; - char *pFileName = NULL; + int j, k; X509* cert = NULL; DocInfo* pDocInfo = NULL; DataFile* pDf = NULL; @@ -487,14 +616,7 @@ pDf = getDataFileWithId(pSigDoc, pDocInfo->szDocId); RETURN_IF_NULL(pDf); ddocDebug(4, "verifySignatureInfo", "DF: %s", pDf->szId); - // find data file path - for(i = 0; i < nPaths; i++) { - if(!strcmp(pDf->szFileName, pPaths->szFileName)) { - pFileName = pPaths->szPath; - break; - } - } - err = verifySigDocDigest(pSigDoc, pSigInfo, pDocInfo, pFileName, szDataFile); + err = verifySigDocDigest(pSigDoc, pSigInfo, pDocInfo, szDataFile); ddocDebug(4, "verifySignatureInfo", "DF: %s verify: %d", pDf->szId, err); if(err == ERR_OK) err = verifySigDocMimeDigest(pSigDoc, pSigInfo, pDocInfo, NULL); @@ -526,7 +648,7 @@ //============================================================ EXP_OPTION int verifySigDoc(const SignedDoc* pSigDoc, const char* signerCA, const char** caFiles, const char* caPath, const char* notCert, - const char* szDataFile, int bUseCA, FilePath* pPaths, int nPaths) + const char* szDataFile, int bUseCA) { SignatureInfo* pSigInfo; @@ -537,7 +659,7 @@ for(i = 0; i < d; i++) { pSigInfo = getSignature(pSigDoc, i); err = verifySignatureInfo(pSigDoc, pSigInfo, signerCA, - szDataFile, bUseCA, pPaths, nPaths); + szDataFile, bUseCA); RETURN_IF_NOT(err == ERR_OK, err); err = verifyNotaryInfo(pSigDoc, pSigInfo, pSigInfo->pNotary, caFiles, caPath, notCert); RETURN_IF_NOT(err == ERR_OK, err); @@ -562,14 +684,21 @@ RETURN_IF_NULL_PARAM(pSigInfo); RETURN_IF_NULL_PARAM(pNotInfo); pCertID = ddocSigInfo_GetCertIDOfType((SignatureInfo*)pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); - RETURN_IF_NULL(pCertID); + RETURN_IF_NOT(pCertID, ERR_WRONG_CERT); pMBuf = ddocCertID_GetDigestValue(pCertID); RETURN_IF_NULL(pMBuf); l1 = sizeof(buf1); + ddocDebug(9, "verifyNotCert", "ddocSigInfo_GetOCSPRespondersCert start"); pCert = ddocSigInfo_GetOCSPRespondersCert(pSigInfo); RETURN_IF_NOT(pCert, ERR_WRONG_CERT); - RETURN_IF_NOT(X509_digest(pCert, EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); + if(pNotInfo->szDigestType!=NULL){ + if(!strcmp(pNotInfo->szDigestType,DIGEST_SHA256_NAME)){ + RETURN_IF_NOT(X509_digest(pCert, EVP_sha256(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); } + else { + RETURN_IF_NOT(X509_digest(pCert, EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); } + }else{ + RETURN_IF_NOT(X509_digest(pCert, EVP_sha1(), buf1, (unsigned int*)&l1), ERR_X509_DIGEST); } err = compareByteArrays((const byte*)pMBuf->pMem, pMBuf->nLen, buf1, l1); RETURN_IF_NOT(err == ERR_OK, ERR_WRONG_CERT); err = ReadCertSerialNumber(szOtherSerial, sizeof(szOtherSerial), ddocSigInfo_GetOCSPRespondersCert(pSigInfo)); @@ -677,18 +806,21 @@ single->certStatus->value.good = ASN1_NULL_new(); single->certId->hashAlgorithm = setCIDAlgorithm(EVP_sha1()); err = ddocNotInfo_GetIssuerNameHash(pNotInfo, &mbuf1); - ASN1_OCTET_STRING_set(single->certId->issuerNameHash, (char*)mbuf1.pMem, mbuf1.nLen); + ASN1_OCTET_STRING_set(single->certId->issuerNameHash, (unsigned char*)mbuf1.pMem, mbuf1.nLen); ddocMemBuf_free(&mbuf1); err = ddocNotInfo_GetIssuerKeyHash(pNotInfo, &mbuf1); - ASN1_OCTET_STRING_set(single->certId->issuerKeyHash, (char*)mbuf1.pMem, mbuf1.nLen); + ASN1_OCTET_STRING_set(single->certId->issuerKeyHash, (unsigned char*)mbuf1.pMem, mbuf1.nLen); ddocMemBuf_free(&mbuf1); pSigInfo = ddocGetSignatureForNotary(pSigDoc, pNotInfo); RETURN_IF_NULL(pSigInfo); pCertID = ddocSigInfo_GetCertIDOfType(pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); if(pCertID) { + ddocDebug(9, "notary2ocspBasResp", "pCertID"); ddocMemAppendData(&mbuf1, ddocCertID_GetIssuerSerial(pCertID), -1); } else { + ddocDebug(9, "notary2ocspBasResp", "no pCertID"); pCertVal = ddocCertValueList_GetCertValueOfType(pSigInfo->pCertValues, CERTID_VALUE_RESPONDERS_CERT); + ddocDebug(9, "notary2ocspBasResp", "ddocCertValueList_GetCertValueOfType"); if(pCertVal) { ddocMemSetLength(&mbuf1, 100); ReadCertSerialNumber((char*)mbuf1.pMem, mbuf1.nLen-1, pCertVal->pCert); @@ -708,7 +840,7 @@ // add nonce err = ddocNotInfo_GetOcspRealDigest(pNotInfo, &mbuf1); if(!err) - err = OCSP_basic_add1_nonce((*pBasResp), (char*)mbuf1.pMem, mbuf1.nLen); + err = OCSP_basic_add1_nonce((*pBasResp), (unsigned char*)mbuf1.pMem, mbuf1.nLen); ddocMemBuf_free(&mbuf1); if (err == ERR_LIB_NONE){ err = ERR_OK; @@ -719,8 +851,11 @@ ddocMemBuf_free(&mbuf1); } else { OCSP_BASICRESP_free(*pBasResp); + // PR. avoid double free + *pBasResp = 0; SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_NONCE); } + ddocDebug(9, "notary2ocspBasResp", "end"); // checkErrors(); return ERR_OK; } @@ -736,7 +871,6 @@ EXP_OPTION int verifyNotaryInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, const NotaryInfo* pNotInfo, - // VS - ver 1.66 const char** caFiles, const char *CApath, const char* notCertFile) { @@ -786,24 +920,30 @@ // CA2file - actual parent cert //-------------------------------------------------- int setup_verifyCERT(X509_STORE **newX509_STORE, - const char *CApath, - // VS - ver 1.66 - const X509** certs) + const char *CApath, const X509** certs) { X509_STORE *store; X509_LOOKUP *lookup; int i; + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; if((store = X509_STORE_new()) == NULL) goto end; lookup = X509_STORE_add_lookup(store,X509_LOOKUP_file()); if (lookup == NULL) goto end; - // VS - ver 1.66 - for(i = 0; certs && certs[i]; i++) + for(i = 0; certs && certs[i]; i++) { + ddocDebug(4, "setup_verifyCERT", "add cert: %d cert: %s", i, (certs[i] ? "OK" : "NULL")); + ddocCertGetSubjectDN((X509*)certs[i], &mbuf1); + ddocDebug(4, "setup_verifyCERT", "add cert: %d cert: %s", i, (char*)mbuf1.pMem); X509_STORE_add_cert(store, (X509*)certs[i]); - + ddocMemBuf_free(&mbuf1); + } + ddocDebug(4, "setup_verifyCERT", "certs added"); lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir()); if (lookup == NULL) goto end; if (CApath) { + ddocDebug(4, "setup_verifyCERT", "lookup dir: %s", CApath); if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) { //BIO_printf(bp, "Error loading directory %s\n", CApath); printf("Error loading directory %s\n", CApath); @@ -811,7 +951,6 @@ } } else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT); *newX509_STORE = store; - // VS - ver 1.67 ERR_clear_error(); return ERR_OK; end: @@ -819,6 +958,87 @@ SET_LAST_ERROR_RETURN_CODE(ERR_CERT_STORE_READ); } +int verifyOcspCertId(OCSP_RESPONSE* pResp, X509* pCert, X509* pCaCert) +{ + OCSP_RESPBYTES *rb = NULL; + OCSP_BASICRESP *br = NULL; + OCSP_RESPDATA *rd = NULL; + OCSP_SINGLERESP *single = NULL; + OCSP_CERTID *cid = NULL; + int err = ERR_OK; + DigiDocMemBuf mbuf1, mbuf2, mbuf3; + + RETURN_IF_NULL_PARAM(pResp); + RETURN_IF_NULL_PARAM(pCert); + RETURN_IF_NULL_PARAM(pCaCert); + RETURN_IF_NULL_PARAM(pResp->responseBytes); + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + mbuf3.pMem = 0; + mbuf3.nLen = 0; + rb = pResp->responseBytes; + if(OBJ_obj2nid(rb->responseType) != NID_id_pkix_OCSP_basic) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_UNKNOWN_TYPE); + if((br = OCSP_response_get1_basic(pResp)) == NULL) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_NO_BASIC_RESP); + ddocCertGetSubjectDN(pCert, &mbuf2); + ddocCertGetSubjectDN(pCaCert, &mbuf3); + ddocDebug(4, "verifyOcspCertId", "for cert: %ld, cn: %s, ca: %s", X509_get_serialNumber(pCert), mbuf2.pMem, mbuf3.pMem); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + rd = br->tbsResponseData; + if(ASN1_INTEGER_get(rd->version) != 0) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_WRONG_VERSION); + if(sk_OCSP_SINGLERESP_num(rd->responses) != 1) + SET_LAST_ERROR_RETURN_CODE(ERR_OCSP_ONE_RESPONSE); + single = sk_OCSP_SINGLERESP_value(rd->responses, 0); + RETURN_IF_NULL(single); + cid = single->certId; + RETURN_IF_NULL(cid); + // check serial number + if(ASN1_INTEGER_get(cid->serialNumber) != ASN1_INTEGER_get(X509_get_serialNumber(pCert))) { + ddocDebug(4, "verifyOcspCertId", "Looking for cert-nr: %ld buf found %ld", + X509_get_serialNumber(pCert), ASN1_INTEGER_get(cid->serialNumber)); + return ERR_WRONG_CERT; + } + // check issuer name hash + err = ddocCertGetIssuerNameDigest(pCert, &mbuf1); + RETURN_IF_NOT(err == ERR_OK, err); + err = compareByteArrays((byte*)mbuf1.pMem, (unsigned int)mbuf1.nLen, + cid->issuerNameHash->data, cid->issuerNameHash->length); + mbuf2.pMem = cid->issuerNameHash->data; + mbuf2.nLen = cid->issuerNameHash->length; + ddocBin2Hex(&mbuf2, &mbuf3); + mbuf2.pMem = 0; + mbuf2.nLen = 0; + ddocBin2Hex(&mbuf1, &mbuf2); + ddocDebug(4, "verifyOcspCertId", "Looking for name-hash: %s found %s RC: %d", + (char*)mbuf2.pMem, (char*)mbuf3.pMem, err); + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + RETURN_IF_NOT(err == ERR_OK, ERR_WRONG_CERT); + // check issuer key hash + err = ddocCertGetPubkeyDigest(pCaCert, &mbuf1); + RETURN_IF_NOT(err == ERR_OK, err); + err = compareByteArrays((byte*)mbuf1.pMem, (unsigned int)mbuf1.nLen, + cid->issuerKeyHash->data, cid->issuerKeyHash->length); + mbuf2.pMem = cid->issuerKeyHash->data; + mbuf2.nLen = cid->issuerKeyHash->length; + ddocBin2Hex(&mbuf2, &mbuf3); + mbuf2.pMem = 0; + mbuf2.nLen = 0; + ddocBin2Hex(&mbuf1, &mbuf2); + ddocDebug(4, "verifyOcspCertId", "Looking for key-hash: %s found %s RC: %d", + (char*)mbuf2.pMem, (char*)mbuf3.pMem, err); + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + ddocMemBuf_free(&mbuf3); + return err; +} + //-------------------------------------------------- // Verfies NotaryInfo signature // pSigDoc - signed doc object @@ -828,19 +1048,35 @@ // notCertFile - Notary (e.g. OCSP responder) cert file //-------------------------------------------------- EXP_OPTION int verifyNotaryInfoCERT(const SignedDoc* pSigDoc, + const SignatureInfo* pSigInfo, + const NotaryInfo* pNotInfo, + const X509** caCerts, const char *CApath, + const X509* notCert) +{ + return verifyNotaryInfoCERT2(pSigDoc, pSigInfo, pNotInfo, caCerts, CApath, notCert, NULL); +} + +//-------------------------------------------------- +// Verfies NotaryInfo signature +// pSigDoc - signed doc object +// pNotInfo - NotaryInfo object +// caCerts - CA certificate pointer array terminated with NULL +// CApath - path to (directory) all certs +// notCertFile - Notary (e.g. OCSP responder) cert file +// pSigCa - signers ca cert +//-------------------------------------------------- +EXP_OPTION int verifyNotaryInfoCERT2(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, const NotaryInfo* pNotInfo, const X509** caCerts, const char *CApath, - const X509* notCert) + const X509* notCert, const X509* pSigCa) { X509_STORE *store; OCSP_RESPONSE* pResp = NULL; OCSP_BASICRESP* bs = NULL; STACK_OF(X509)* ver_certs = NULL; int err = ERR_OK, l1; - byte buf[DIGEST_LEN+2]; - X509* certNotaryDirectCA = 0; - const DigiDocMemBuf *pMBuf1 = 0; + X509 *certNotaryDirectCA = 0, *pCert = 0, *pCaCert = 0; DigiDocMemBuf mbuf1; mbuf1.pMem = 0; @@ -858,27 +1094,14 @@ certNotaryDirectCA = (X509*)caCerts[l1-1]; // do the signature values match? // not to be checked in format 1.4 -#ifdef WITH_TS - if(strcmp(pSigDoc->szFormatVer, DIGIDOC_XML_1_4_VER)) { -#endif - l1 = sizeof(buf); - pMBuf1 = ddocSigInfo_GetSignatureValue_Value((SignatureInfo*)pSigInfo); - RETURN_IF_NULL_PARAM(pMBuf1); - calculateDigest((byte*)pMBuf1->pMem, pMBuf1->nLen, DIGEST_SHA1, buf, &l1); - err = ddocNotInfo_GetOcspRealDigest(pNotInfo, &mbuf1); - if(compareByteArrays(buf, l1, (byte*)mbuf1.pMem, mbuf1.nLen)) { - SET_LAST_ERROR(ERR_NOTARY_SIG_MATCH); - err = ERR_NOTARY_SIG_MATCH; - } - ddocMemBuf_free(&mbuf1); -#ifdef WITH_TS - } -#endif if(err) return err; // now create an OCSP object and check its validity // VS - ver 1.66 pResp = ddocNotInfo_GetOCSPResponse_Value(pNotInfo); - RETURN_IF_NULL_PARAM(pResp); + if(!pResp) { + ddocDebug(3, "verifyNotaryInfoCERT", "OCSP missing"); + SET_LAST_ERROR_RETURN_CODE(ERR_NO_OCSP); + } // debug //WriteOCSPResponse("test2.resp", pResp); if((setup_verifyCERT(&store, CApath, caCerts)) == ERR_OK) { @@ -892,10 +1115,11 @@ if (ver_certs) { sk_X509_push(ver_certs, notCert); err = OCSP_basic_verify(bs, ver_certs, store, OCSP_TRUSTOTHER); //OCSP_NOCHAIN); + ddocDebug(3, "verifyNotaryInfoCERT", "OCSP verify: %d", err); if(err == ERR_LIB_NONE) { err = ERR_OK; } else { - err = ERR_OCSP_CERT_NOTFOUND; + err = ERR_NOTARY_SIG_MATCH; SET_LAST_ERROR(err); } // cleanup @@ -909,13 +1133,17 @@ SET_LAST_ERROR(err); } if(err == ERR_OK) { - if(!notCert) // ??? - notCert = ddocSigInfo_GetOCSPRespondersCert(pSigInfo); - if(notCert) { // VS: ver 1.66 - err = isCertValid((X509*)notCert, convertStringToTimeT(pSigDoc, pNotInfo->timeProduced)); + ddocDebug(9, "verifyNotaryInfoCERT", "ddocSigInfo_GetOCSPRespondersCert start"); + //if(!notCert) // ??? + notCert = ddocSigInfo_GetOCSPRespondersCert(pSigInfo); + ddocDebug(9, "verifyNotaryInfoCERT", "ddocSigInfo_GetOCSPRespondersCert end"); + if(notCert && pNotInfo->timeProduced) { // VS: ver 1.66 + ddocDebug(9, "verifyNotaryInfoCERT", "notCert exists"); + err = isCertValid((X509*)notCert, convertStringToTimeT(pSigDoc, pNotInfo->timeProduced)); //crash? if (err != ERR_OK) SET_LAST_ERROR(err); } else { + ddocDebug(9, "verifyNotaryInfoCERT", "notCert invalid"); err = ERR_CERT_INVALID; SET_LAST_ERROR(err); } @@ -931,12 +1159,31 @@ } if(err == ERR_OK) { err = verifyNotaryDigest(pSigDoc, pNotInfo); - if (err != ERR_OK) - SET_LAST_ERROR(err); + if (err != ERR_OK && err != ERR_OCSP_NONCE_SIGVAL_NOMATCH) + SET_LAST_ERROR(ERR_NOTARY_SIG_MATCH); } + if(err == ERR_OK) { + pCert = ddocSigInfo_GetSignersCert(pSigInfo); + pCaCert = (pSigCa != NULL) ? (X509*)pSigCa : certNotaryDirectCA; + err = verifyOcspCertId(pResp, pCert, pCaCert); + if (err != ERR_OK) + SET_LAST_ERROR(err); + } + if(err == ERR_OK) { + ddocDebug(3, "verifyNotaryInfoCERT", "Not: %s time-ocsp: %s time-xml: %s", + pNotInfo->szId, (pNotInfo->timeProduced ? pNotInfo->timeProduced : ""), + (pNotInfo->szProducedAt ? pNotInfo->szProducedAt : "")); + if(pNotInfo->timeProduced && pNotInfo->szProducedAt && + strcmp(pNotInfo->timeProduced, pNotInfo->szProducedAt) && + strcmp(pSigDoc->szFormat, SK_XML_1_NAME)) { + err = ERR_OCSP_MALFORMED; + SET_LAST_ERROR(err); + } + } } if(pResp) OCSP_RESPONSE_free(pResp); + ddocDebug(3, "verifyNotaryInfoCERT", "Ocsp verify: %d", err); return err; } @@ -947,10 +1194,14 @@ //-------------------------------------------------- EXP_OPTION int verifyNotaryDigest(const SignedDoc* pSigDoc, const NotaryInfo* pNotInfo) { - int err, l1; - byte buf1[DIGEST_LEN+2]; + int err, l1, l2, l3; + byte buf1[DIGEST_LEN256+2], buf2[40], buf3[40]; const DigiDocMemBuf *pMBuf; - + DigiDocMemBuf mbuf2; + SignatureInfo* pSigInf = 0; + + mbuf2.pMem = 0; + mbuf2.nLen = 0; l1 = sizeof(buf1); err = calculateNotaryInfoDigest(pSigDoc, pNotInfo, buf1, &l1); RETURN_IF_NOT(err == ERR_OK, err); @@ -958,6 +1209,27 @@ RETURN_IF_NULL(pMBuf); err = compareByteArrays(buf1, l1, (byte*)pMBuf->pMem, pMBuf->nLen); RETURN_IF_NOT(err == ERR_OK, err); + // verify ocsp nonce = signature value digest + pSigInf = ddocGetSignatureForNotary(pSigDoc, pNotInfo); + RETURN_IF_NULL(pSigInf); + pMBuf = ddocSigInfo_GetSignatureValue_Value(pSigInf); + RETURN_IF_NULL(pMBuf); + l1 = sizeof(buf1); + err = calculateDigest((const byte*)pMBuf->pMem, pMBuf->nLen, + DIGEST_SHA1, (byte*)buf1, &l1); + RETURN_IF_NOT(err == ERR_OK, err); + err = ddocNotInfo_GetOcspRealDigest(pNotInfo, &mbuf2); + RETURN_IF_NOT(err == ERR_OK, err); + err = compareByteArrays(buf1, l1, (byte*)mbuf2.pMem, mbuf2.nLen); + // debug output + l2 = sizeof(buf2); + l3 = sizeof(buf3); + encode((const byte*)buf1, l1, (byte*)buf2, &l2); + encode((const byte*)mbuf2.pMem, mbuf2.nLen, (byte*)buf3, &l3); + ddocDebug(3, "verifyNotaryDigest", "Signature: %s Notary: %s sig-val-dig: %s nonce: %s verify: %d", + pSigInf->szId, pNotInfo->szId, buf2, buf3, err); + RETURN_IF_NOT(err == ERR_OK, ERR_OCSP_NONCE_SIGVAL_NOMATCH); + return ERR_OK; } @@ -970,14 +1242,12 @@ // signerCA - direct signer CA certs filename // szDateFile - name of the digidoc file // bUseCA - use CA certs or not 1/0 -// pPaths - file name / path pairs for detatched files -// nPaths - number of file name / path pairs //============================================================ EXP_OPTION int verifySigDocCERT(const SignedDoc* pSigDoc, // VS - ver 1.66 const void* signerCA, const X509** caCerts, const char* caPath, const X509* notCert, - const char* szDataFile, int bUseCA, FilePath* pPaths, int nPaths) + const char* szDataFile, int bUseCA) { SignatureInfo* pSigInfo; int i, d, err = ERR_OK; @@ -988,10 +1258,10 @@ for(i = 0; i < d; i++) { pSigInfo = getSignature(pSigDoc, i); err = verifySignatureInfoCERT(pSigDoc, pSigInfo, signerCA, - szDataFile, bUseCA, pPaths, nPaths); - RETURN_IF_NOT(err == ERR_OK, err); + szDataFile, bUseCA); + //RETURN_IF_NOT(err == ERR_OK, err); err = verifyNotaryInfoCERT(pSigDoc, pSigInfo, pSigInfo->pNotary, caCerts, caPath, notCert); - RETURN_IF_NOT(err == ERR_OK, err); + //RETURN_IF_NOT(err == ERR_OK, err); } return err; } @@ -1007,16 +1277,12 @@ // another library and possibly formats these elements // differently. // bUseCA - use CA certs or not 1/0 -// pPaths - file name / path pairs for detatched files -// nPaths - number of file name / path pairs //============================================================ EXP_OPTION int verifySignatureInfoCERT(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const void* signerCACert, const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths) + const void* signerCACert, const char* szDataFile, int bUseCA) { - int err = ERR_OK; + int err = ERR_OK, err2 = ERR_OK; int j, k, i; - char* pFileName = NULL; X509* cert; DocInfo* pDocInfo = NULL; DataFile* pDf = NULL; @@ -1027,26 +1293,37 @@ RETURN_IF_NULL_PARAM(pMBuf1); pMBuf2 = ddocSigInfo_GetSignatureValue_Value((SignatureInfo*)pSigInfo); RETURN_IF_NULL_PARAM(pMBuf2); - err = verifyEstIDSignature((const byte*)pMBuf1->pMem, pMBuf1->nLen, DIGEST_SHA1, + ddocDebug(3, "verifySignatureInfoCERT", "Sig: %s, CA: %s", + ((pSigInfo && pSigInfo->szId) ? pSigInfo->szId : "NULL"), + (signerCACert ? "OK" : "NULL")); + if(pSigInfo->szDigestType){ + if(!strcmp(pSigInfo->szDigestType,DIGEST_SHA256_NAME)) + err = verifyEstIDSignature((const byte*)pMBuf1->pMem, pMBuf1->nLen, DIGEST_SHA256, + (byte*)pMBuf2->pMem, pMBuf2->nLen, ddocSigInfo_GetSignersCert(pSigInfo)); + else + err = verifyEstIDSignature((const byte*)pMBuf1->pMem, pMBuf1->nLen, DIGEST_SHA1, (byte*)pMBuf2->pMem, pMBuf2->nLen, ddocSigInfo_GetSignersCert(pSigInfo)); - RETURN_IF_NOT(err == ERR_OK, ERR_SIGNATURE); + }else{ + err = verifyEstIDSignature((const byte*)pMBuf1->pMem, pMBuf1->nLen, DIGEST_SHA1, + (byte*)pMBuf2->pMem, pMBuf2->nLen, ddocSigInfo_GetSignersCert(pSigInfo));} + //RETURN_IF_NOT(err == ERR_OK, ERR_SIGNATURE); // check that this signature signs all DataFiles for(i = 0; i < getCountOfDataFiles(pSigDoc); i++) { pDf = getDataFile(pSigDoc, i); - ddocDebug(4, "verifySignatureInfoCERT", "Check sig \'%s\' of doc: \'%s\'", pSigInfo->szId, pDf->szId); k = 0; // not found yet for(j = 0; j < getCountOfDocInfos(pSigInfo); j++) { pDocInfo = getDocInfo(pSigInfo, j); + ddocDebug(4, "verifySignatureInfoCERT", "Check sig \'%s\' of doc: \'%s\'", pSigInfo->szId, pDocInfo->szDocId); if(!strcmp(pDocInfo->szDocId, pDf->szId)) { k = 1; // found break; } } if(!k) { - ddocDebug(1, "verifySignatureInfoCERT", "Signature \'%s\' does not sign doc: \'%s\'", pSigInfo->szId, pDf->szId); + //ddocDebug(1, "verifySignatureInfoCERT", "Signature \'%s\' does not sign doc: \'%s\'", pSigInfo->szId, pDocInfo->szDocId); err = ERR_DOC_DIGEST; SET_LAST_ERROR(err); - return err; + //return err; } } // verify DataFile hashes @@ -1058,99 +1335,26 @@ RETURN_IF_NULL(pDocInfo); pDf = getDataFileWithId(pSigDoc, pDocInfo->szDocId); RETURN_IF_NULL(pDf); - // find data file path - for(i = 0; i < nPaths; i++) { - if(!strcmp(pDf->szFileName, pPaths->szFileName)) { - pFileName = pPaths->szPath; - break; - } - } - if(!pFileName) - pFileName = pDf->szFileName; - err = verifySigDocDigest(pSigDoc, pSigInfo, pDocInfo, pFileName, szDataFile); - ddocDebug(4, "verifySignatureInfoCERT", "Verify doc: %s - %d", pDocInfo->szDocId, err); - RETURN_IF_NOT(err == ERR_OK, err); + err = verifySigDocDigest(pSigDoc, pSigInfo, pDocInfo, szDataFile); + //ddocDebug(4, "verifySignatureInfoCERT", "Verify doc: %s - %d", pDocInfo->szDocId, err); + //RETURN_IF_NOT(err == ERR_OK, err); + if(!err) err = verifySigDocMimeDigest(pSigDoc, pSigInfo, pDocInfo, NULL); - RETURN_IF_NOT(err == ERR_OK, err); + //RETURN_IF_NOT(err == ERR_OK, err); } - - err = verifySigDocSigPropDigest(pSigInfo); - RETURN_IF_NOT(err == ERR_OK, err); - err = verifySigCert(pSigInfo); - RETURN_IF_NOT(err == ERR_OK, err); - + err2 = verifySigDocSigPropDigest(pSigInfo); + if(!err) err = err2; + err2 = verifySigCert(pSigInfo); + if(!err) err = err2; cert = getSignCertData(pSigInfo); // VS: ver 2.2.4 - removed this check as OCSP check is sufficient //err = isCertValid(cert, convertStringToTimeT(pSigDoc, pSigInfo->szTimeStamp)); - RETURN_IF_NOT(err == ERR_OK, err); if(bUseCA) - err = isCertSignedByCERT((const X509*)cert, (const X509*)signerCACert); - RETURN_IF_NOT(err == ERR_OK, err); - return ERR_OK; -} - -//-------------------------------------------------- -// Finds all detatched files and returns their -// names. The user can now set the path portion. -// Allocaes new memory that caller must free -// with FilePaths_free() -// pSigDoc - signed document -// pPaths - pointer to FilePaths array -// nPaths - pointer to number of paths -//-------------------------------------------------- -EXP_OPTION int findDetatchedDataFiles(SignedDoc* pSigDoc, FilePath** pPaths, int* nPaths) -{ - FilePath *pPath, *pTmp; - int err = ERR_OK, d; - - RETURN_IF_NULL_PARAM(pSigDoc); - RETURN_IF_NULL_PARAM(pPaths); - RETURN_IF_NULL_PARAM(nPaths); - *pPaths = NULL; - *nPaths = 0; - for(d = 0; d < pSigDoc->nDataFiles; d++) { - DataFile* pDf = pSigDoc->pDataFiles[d]; - if (!strcmp(pDf->szContentType, CONTENT_DETATCHED)) { - if (*pPaths && *nPaths) { - pTmp = (FilePath*)realloc(*pPaths, sizeof(FilePath) * (*nPaths+1)); - if (pTmp != NULL) { //malloc failure! - *pPaths = pTmp; - *nPaths = *nPaths + 1; - pPath = (*pPaths) + ((*nPaths) - 1); - } else - SET_LAST_ERROR_RETURN_CODE(ERR_BAD_ALLOC); - } else { - pTmp = (FilePath*)malloc(sizeof(FilePath)); - if (pTmp != NULL) { //malloc failure! - *pPaths = pTmp; - pPath = *pPaths; - *nPaths = 1; - } else - SET_LAST_ERROR_RETURN_CODE(ERR_BAD_ALLOC); - } - pPath->szFileName = pPath->szPath = NULL; - pPath->szFileName = strdup(pDf->szFileName); - } - } + err2 = isCertSignedByCERT((const X509*)cert, (const X509*)signerCACert); + if(!err) err = err2; return err; } - -//-------------------------------------------------- -// Frees file paths array -// pPaths - FilePaths array -// nPaths - number of paths -//-------------------------------------------------- -EXP_OPTION void FilePaths_free(FilePath* pPaths, int nPaths) -{ - int i; - for(i = 0; i < nPaths; i++) { - free(pPaths[i].szFileName); - free(pPaths[i].szPath); - } - free(pPaths); -} - //-------------------------------------------------- // Checks if this element tag contains the // required attributes with the given values diff -Nru libdigidoc-2.7.0/libdigidoc/DigiDocVerify.h libdigidoc-3.7.0.875/libdigidoc/DigiDocVerify.h --- libdigidoc-2.7.0/libdigidoc/DigiDocVerify.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DigiDocVerify.h 2012-12-13 22:05:47.000000000 +0000 @@ -34,29 +34,6 @@ extern "C" { #endif -// structure used to report paths of data files -typedef struct FilePath_st { - char* szFileName; - char* szPath; -} FilePath; - -//-------------------------------------------------- -// Frees file paths array -// pPaths - FilePaths array -// nPaths - number of paths -//-------------------------------------------------- -EXP_OPTION void FilePaths_free(FilePath* pPaths, int nPaths); - -//-------------------------------------------------- -// Finds all detatched files and returns their -// names. The user can now set the path portion. -// Allocaes new memory that caller must free -// with FilePaths_free() -// pSigDoc - signed document -// pPaths - pointer to FilePaths array -// nPaths - pointer to number of paths -//-------------------------------------------------- -EXP_OPTION int findDetatchedDataFiles(SignedDoc* pSigDoc, FilePath** pPaths, int* nPaths); // verifies files signature EXP_OPTION int verifyFileSignature(const char* szFileName, int nDigestType, @@ -69,21 +46,19 @@ // verifies one doc's check digests in this signature EXP_OPTION int verifySigDocDigest(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const DocInfo* pDocInfo, const char* szFileName, - const char* szDataFile); + const DocInfo* pDocInfo, const char* szDataFile); // verifies the mime digest of this doc in this signature EXP_OPTION int verifySigDocMimeDigest(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, const DocInfo* pDocInfo, const char* szFileName); // verifies this one signature EXP_OPTION int verifySignatureInfo(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const char* signerCA, const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths); + const char* signerCA, const char* szDataFile, int bUseCA); + // verifies the whole document (returns on first err) EXP_OPTION int verifySigDoc(const SignedDoc* pSigDoc, const char* signerCA, const char** caFiles, const char* caPath, const char* notCert, - const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths); + const char* szDataFile, int bUseCA); // Verifies the certificates signed attributes @@ -105,15 +80,14 @@ EXP_OPTION int verifySigDocCERT(const SignedDoc* pSigDoc, const void* signerCA, const X509** caCerts, const char* caPath, const X509* notCert, - const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths); + const char* szDataFile, int bUseCA); // Verifies this signature EXP_OPTION int verifySignatureInfoCERT(const SignedDoc* pSigDoc, const SignatureInfo* pSigInfo, - const void* signerCACert, const char* szDataFile, int bUseCA, - FilePath* pPaths, int nPaths); + const void* signerCACert, const char* szDataFile, int bUseCA); + // Checks if the cert has been signed by this CA-cert EXP_OPTION int isCertSignedByCERT(const X509* cert, const X509* caCert); @@ -124,6 +98,21 @@ const NotaryInfo* pNotInfo, const X509** caCerts, const char *CApath, const X509* notCert); + +//-------------------------------------------------- +// Verfies NotaryInfo signature +// pSigDoc - signed doc object +// pNotInfo - NotaryInfo object +// caCerts - CA certificate pointer array terminated with NULL +// CApath - path to (directory) all certs +// notCertFile - Notary (e.g. OCSP responder) cert file +// pSigCa - signers ca cert +//-------------------------------------------------- +EXP_OPTION int verifyNotaryInfoCERT2(const SignedDoc* pSigDoc, + const SignatureInfo* pSigInfo, + const NotaryInfo* pNotInfo, + const X509** caCerts, const char *CApath, + const X509* notCert, const X509* pSigCa); EXP_OPTION int verifySigDocSigPropDigest(const SignatureInfo* pSigInfo); @@ -144,6 +133,8 @@ EXP_OPTION int verifyEstIDSignature(const byte* digest, int digestLen, int nDigestType, byte* pSigBuf, int nSigLen, X509* cert); +EXP_OPTION int verifyEstIDSignature2(const byte* digest, int digestLen, int nDigestType, + byte* pSigBuf, int nSigLen, X509* cert); #ifdef __cplusplus } diff -Nru libdigidoc-2.7.0/libdigidoc/DlgUnit.manifest libdigidoc-3.7.0.875/libdigidoc/DlgUnit.manifest --- libdigidoc-2.7.0/libdigidoc/DlgUnit.manifest 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DlgUnit.manifest 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,23 @@ + + + +TestDlg + + + + + + + diff -Nru libdigidoc-2.7.0/libdigidoc/DlgUnit.rc libdigidoc-3.7.0.875/libdigidoc/DlgUnit.rc --- libdigidoc-2.7.0/libdigidoc/DlgUnit.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/DlgUnit.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,134 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS +#include "dlgunit.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Unknown language: 0x25, 0x1 resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ETI) +#ifdef _WIN32 +LANGUAGE 0x25, 0x1 +#pragma code_page(1257) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DLG_UNIT DIALOGEX 0, 0, 300, 155 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "DigiDoc" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,240,136,50,14 + GROUPBOX "Downloads:",IDC_GROUPBOX,2,2,296,126 + PUSHBUTTON "&Cancel",IDCANCEL,180,136,50,14 + CONTROL "List1",IDC_LISTVIEW,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + WS_BORDER | WS_TABSTOP,6,12,288,110,WS_EX_CLIENTEDGE +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""dlgunit.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,7,1,56 + PRODUCTVERSION 2,7,1,56 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "042504b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "AS Sertifitseerimiskeskus\0" + VALUE "FileDescription", "DigiDocLib\0" + VALUE "FileVersion", "2.7.1.56\0" + VALUE "InternalName", "DigiDocLib\0" + VALUE "LegalCopyright", "Copyright © 2010\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "DigiDocLib.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "AS Sertifitseerimiskeskus DigiDocLib\0" + VALUE "ProductVersion", "2.7.1.56\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x425, 1200 + END +END + +#endif // !_MAC + +#endif // Unknown language: 0x25, 0x1 resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -Nru libdigidoc-2.7.0/libdigidoc/cdigidoc.1.cmake libdigidoc-3.7.0.875/libdigidoc/cdigidoc.1.cmake --- libdigidoc-2.7.0/libdigidoc/cdigidoc.1.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/cdigidoc.1.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,244 @@ +.TH CDIGIDOC 1 "${BUILD_DATE}" "${VERSION}" "cdigidoc man page" +.SH NAME +cdigidoc \- read, digitally sign, verify files in XAdES format and encrypt, decrypt files in XMLENC format +.SH SYNOPSIS +.B cdigidoc [ +.I -in +.B ] [ +.I -out +.B ] [ +.I -config +.B ] +.SH DESCRIPTION +.B cdigidoc +is an utility which provides a command line interface to the CDigiDoc library, which is a library in C programming language offering the the functionality to create files in supported DigiDoc formats, sigitally sign the DigiDoc files using smart cards or other supported cryptographic tokens, add time marks and validity confirmations to digital signatures using OCSP protocol, verify the digital signatures, and digitally encrypt and decrypt the DigiDoc files. It is also possible to use cdigidoc utility as a CGI program in web applications created in environments that cannot easily use the JDigiDoc library or call the DigiDocService webservice for digital signature functionality. +.PP +For full documentation, see +.nf +https://svn.eesti.ee/projektid/idkaart_public/branches/3.6/libdigidoc/doc/SK-CDD-PRG-GUIDE.pdf +.PP +XAdES format +.nf +http://www.w3.org/TR/XAdES +.PP +XML-ENC format +http://www.w3.org/TR/xmlenc-core +.SH OPTIONS +.IP "-?, -help" +Displays help about command syntax. +.IP "-in " +Specifies the input file name. It is recommended to pass the full path to the file in this parameter. +.IP "-out " +Stores the newly created or modified document in a file. +.IP "-config " +Specifies the CDigiDoc configuration file name. If left unspecified, then the configuration file is looked up from default locations. +.IP "-check-cert " +Checks the certificate validity status. Used for checking the chosen certificate’s validity; returns an OCSP response from the certificate’s CA’s OCSP responder. Note that the command is currently not being tested. If the certificate is valid, then the return code’s (RC) value is 0. +.IP "-new [format] [version]" +Creates a new digidoc container with the specified format and version. The current digidoc format in CDigiDoc library is DIGIDOC-XML, default version is 1.3 (newest). By using the optional parameter - version - with this command, you can specify an alternative version to be created. Note: the older SK-XML format is supported only for backward compatibility. +.IP "-add [] []" +Adds a new data file to a digidoc document. If digidoc doesn't exist then creates one in the default format. +.RS +.TP +Input file (required) +Specifies the name of the data file (it is recommended to include full path in this parameter; the path is removed when writing to DigiDoc container file). +.TP +Mime type (required) +Represents the MIME type of the original file like "text/plain" or "application/msword". +.TP +Content type +Reflects how the original files are embedded in the container EMBEDDED_BASE64 (used by default). +In previous versions cdigidoc allowed content type EMBEDDED to sign pure xml or text. +.TP +Charset +UTF-8 encoding is supported and used by default. +.RE +.IP "-sign [[[manifest] [[city] [state] [zip] [country]] [slot(0)] [ocsp(1)] [token-type(PKCS11)] [pkcs12-file-name]]" +Adds a digital signature to the digidoc document. You can use it with following parameters: +.RS +.TP +pin code +In case of Estonian ID cards, pin code2 is used for digital signing. If signing with a software token (PKCS#12 file), then the password of PKCS#12 file should be entered here. +.TP +manifest +Role or resolution of the signer +.TP +city +City where the signature is created +.TP +state +State or province where the signature is created +.TP +zip +Postal code of the place where the signature is created +.TP +country +Country of origin. ISO 3166-type 2-character country codes are used (e.g. EE) +.TP +slot +Identifier of the signer’s private key’s slot on a smartcard. When operating for example with a single Estonian ID card, its signature key can be found in slot 1 - which is used by default. +The library makes some assumptions about PKCS#11 drivers and card layouts: + - you have signature and/or authentication keys on the card + - both key and certificate are in one slot + - if you have many keys like 1 signature and 1 authentication key then they are in different slots + - you can sign with signature key that has a corresponding certificate with "NonRepudiation" bit set. +You may need to specify a different slot to be used when for example operating with multiple smart cards on the same system. +If the slot needs to be specified during signing, then the 5 previous optional parameters (manifest, city, state, zip, country) should be filled first (either with the appropriate data or as "" for no value). +.TP +ocsp +Specifies whether an OCSP confirmation is added to the signature that is being created. Possible values are 0 - confirmation is not added; 1 - confirmation is added. By default, the value is set to 1. +Parameter value 0 can be used when creating a technical signature. Technical signature is a signature with no OCSP confirmation and no timestamp value. +.TP +token type +Speciafies type of signature token to be use. + - PKCS11 default value. Signs with a smart-card or software pkcs11 token + - CNG on windows platforms uses CSP/CNG for signing + - PKCS12 signs with a PKCS#12 key container that must be entered in the next parameter +. TP +pkcs12 file name +Name of the PKCS#12 key container file to be used for signing. +.RE +.IP "-mid-sign [[(EE)] [(EST)] [(Testing)] [] [ ]]" +Invokes mobile signing of a ddoc file using Mobile-ID and DigiDocService. +Mobile-ID is a service based on Wireless PKI providing for mobile authentication and digital signing, currently supported by all Estonian and some Lithuanian mobile operators. +The Mobile-ID user gets a special SIM card with private keys on it. Hash to be signed is sent over the GSM network to the phone and the user shall enter PIN code to sign. The signed result is sent back over the air. +DigiDocService is a SOAP-based web service, access to the service is IP-based and requires a written contract with provider of DigiDocService. +You can use Mobile-ID signing with the following parameters: +.RS +.TP +phone-no +Phone number of the signer with the country code in format +xxxxxxxxx (for example +3706234566) +.TP +per-code +Identification number of the signer (personal national ID number). +.TP +country +Country of origin. ISO 3166-type 2-character country codes are used (e.g. default is EE) +.TP +lang +Language for user dialog in mobile phone. 3-character capitalized acronyms are used (e.g. default is EST) +.TP +service +Name of the service – previously agreed with Application Provider and DigiDocService operator. Maximum length – 20 chars. (e.g. default is Testing) +.TP +manifest +Role or resolution of the signer +.TP +city +City where the signature is created +.TP +state +State or province where the signature is created +.TP +zip +Postal code of the place where the signature is created +.RE +.IP "-list" +Displays the data file and signature info of a DigiDoc document just read in; verifies all signatures. +.RS +.HP +Returns Digidoc container data, in format: SignedDoc | | +.HP +List of all data files, in format: DataFile | | | | | +.HP +List of all signatures (if existing), in format: Signature | | | | +.HP +Signer’s certificate information. +.HP +OCSP responder certificate information +.RE +.IP "-verify" +Returns signature verification results (if signatures exist): +.RS +.HP +Signature | | | | +.HP +Returns signer’s certificate and OCSP Responder certificate information. +.RE +.IP "-extract " +Extracts the selected data file from the DigiDoc container and stores it in a file. +Data file id represents the ID for data file to be extracted from inside the DigiDoc container (e.g. D0, D1…). Output file represents the name of the output file. + +.IP "-denc-list " +Displays the encrypted data and recipient’s info of an encrypted document just read in. +.IP "-encrecv [recipient] [KeyName] [CarriedKeyName]" +Adds a new recipient certificate and other metadata to an encrypted document. Certificate file (required) specifies the file from which the public key component is fetched for encrypting the data. The decryption can be performed only by using private key corresponding to that certificate. The input certificate files for encryption must come from the file system (PEM encodings are supported). Possible sources where the certificate files can be obtained from include: Windows Certificate Store ("Other Persons"), LDAP directories, ID-card in smart-card reader. For example the certificate files for Estonian ID card owners can be retrieved from a LDAP directory at ldap://ldap.sk.ee. The query can be made in following format through the web browser (IE): ldap://ldap.sk.ee:389/c=EE??sub?(serialNumber= xxxxxxxxxxx) where serial Number is the recipient’s personal identification number, e,g.38307240240). +Other parameters include: +.RS +.TP +recipient +If left unspecified, then the program assigns the CN value of the certificate passwed as first parameter. +This is later used as a command line option to identify the recipient whose key and smart card is used to decrypt the data. +Note: +Although this parameter is optional, it is recommended to pass on the entire CN value from the recipient’s certificate as the recipient identifier here, especially when dealing with multiple recipients. +.TP +KeyName +Sub-element can be added to better identify the key object. Optional, but can be used to search for the right recipient’s key or display its data in an application. +.TP +CarriedKeyName +Sub-element can be added to better identify the key object. Optional, but can be used to search for the right recipient’s key or display its data in an application. +.RE + +.IP "-encrypt-sk " +Encrypts the data from the given input file and writes the completed encrypted document in a file. Recommended for providing cross-usability with other DigiDoc software components. +This command places the data file to be encrypted in a new DigiDoc container. Therefore handling such encrypted documents later with other DigiDoc applications is fully supported (e.g. DigiDoc3 client). +Input file (required) specifies the original data file to be encrypted. +Note: There are also alternative encryption commands which are however not recommended for providing cross-usability with other DigiDoc software components: +.RS +.TP +.I "-encrypt " +Encrypts the data from the given input file and writes the completed encrypted document in a file. Should be used only for encrypting small documents, already in DIGIDOC-XML format. +Input file (required) specifies the original data file to be encrypted. +.TP +.I "-encrypt-file " +Encrypts the input file and writes to output file. Should be used only for encrypting large documents, already in DIGIDOC-XML format. Note that the command in not currently tested. +Input file (required) specifies the original data file to be encrypted. +Output file (required) specifies the name of the output file which will be created in the current encrypted document format (ENCDOC-XML ver 1.0), with file extension .cdoc. +.RE +.IP "-decrypt-sk [pkcs12-file] [slot(0)]" +Decrypts and possibly decompresses the encrypted file just read in and writes to output file. Expects the encrypted file to be inside a DigiDoc container. +Input file (required) specifies the input file’s name. +Pin (required) represents the recipient’s pin1 (in context of Estonian ID cards). +pkcs12-file (optional) specifies the PKCS#12 file if decrypting is done with a software token. +slot deafult is slot 0 containing Estonian ID cards authentication keypair. This parameter can be used to decrypt with a key from the second id card attached to the computer etc. +Note: There are also alternative commands for decryption, depending on the encrypted file’s format, size and the certificate type used for decrypting it. +.RS +.TP +.I "-decrypt [pkcs12-file] [slot(0)]" +Offers same functionality as -decrypt-sk, should be used for decrypting small files (which do not need to be inside a DigiDoc container). +Input file (required) specifies the input file’s name. +Pin (required) represents the recipient’s pin1 (in contexts of Estonian ID cards). +pkcs12-file (optional) specifies the PKCS#12 file if decrypting is done with a software token. +slot deafult is slot 0 containing Estonian ID cards authentication keypair. This parameter can be used to decrypt with a key from the second id card attached to the computer etc. +.TP +.I "-decrypt-file [pkcs12-file]" +Offers same functionality as -decrypt for decrypting documents, should be used for decrypting large files (which do not need to be inside a DigiDoc container). Expects the encrypted data not to be compressed. Note that the command is not currently tested. +Input file (required) specifies the encrypted file to be decrypted. +Output file (required) specifies the output file name. +Pin (required) represents the recipient’s pin1 (in contexts of Estonian ID cards). +pkcs12-file (optional) specifies the PKCS#12 file if decrypting is done with a software token. +.RE +.IP "-calc-sign [] [ ]" +Offers an alternative to \-sign command to be used in CGI pograms. Adds signers certificate in pem format and optionally manifest and signers address and calculates the final hash value to be signed. This value is hex-encoded and can now be sent to users computer to be signed using a web plugin. This command creates an incomplete signature that lacks the actual RSA signature value. It must be stored in a temporary file and later completed using the \-add-sign-value command. +-IP "-add-sign-value " +Offers an alternative to \-sign command to be used in CGI pograms. Adds an RSA signature hex-encoded value to an incomplete signature created using the \-calc-sign command. This signature is still lacking the ocsp timemark, that can now be obtained using the \-get-confirmation command producing a complete XAdES signature. +.IP "-get-confirmation " +Adds an OCSP confirmation to a DigiDoc file’s signature. +.SH EXAMPLES +.IP "cdigidoc -new DIGIDOC-XML 1.3 -add -sign -out +Creates a new signed document in DIGIDOC-XML 1.3 format, adds one input file, signs with smartcard using the default signature slot and writes to a signed document file. +.IP "cdigidoc -in -list" +Reads in a signed document, verifies signatures and prints the results to console. +.IP "cdigidoc -in -extract D0 " +Reads in a signed document, finds the first signed document and writes it to output file. +.IP "cdigidoc -encrecv -encrecv -encrypt-sk -out " +Creates a new encypted file by encrypting input file that is encrypted using AES-128 and encrypts the generated randome transport key using RSA for two possible recipients identified by their certificates. Transport key is encrypted using RSA1.5. +.IP "cdigidoc -decrypt-sk -out " +Reads in encrypted file and decrypts it with smartcards first keypair (Estonian ID cards authentication key) and writes decrypted data to given putput file. +.IP "cdigidoc -decrypt-sk -out " +Reads in encrypted file and decrypts it with a PKCS#12 key-container and writes decrypted data to given putput file. + +.SH AUTHORS +.B AS Sertifitseerimiskeskus (Certification Centre Ltd.) +.SH "SEE ALSO" +digidoc-tool(1), qesteidutil(1), qdigidocclient(1), qdigidoccrypto(1) diff -Nru libdigidoc-2.7.0/libdigidoc/cdigidoc.c libdigidoc-3.7.0.875/libdigidoc/cdigidoc.c --- libdigidoc-2.7.0/libdigidoc/cdigidoc.c 2009-12-15 11:14:28.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/cdigidoc.c 2012-12-13 22:05:47.000000000 +0000 @@ -21,6 +21,7 @@ // Creation //================================================== +#include "config.h" #include #include #include @@ -35,12 +36,18 @@ #include #include #include +#include #include #ifdef WITH_MSSP #include #endif +#ifdef WIN32 + #define snprintf _snprintf + #include +#endif + #include #include #include @@ -58,7 +65,7 @@ char* p_szConfigFile = 0; int p_parseMode = 1; -int g_cgiMode = 0; // 1=output in CGI mode, 0=normal e.g. human readable mode +int g_cgiMode = 1; // 1=output in CGI mode, 0=normal e.g. human readable mode char* g_szOutputSeparator = 0; char *errorClass[] = {"NO_ERRORS", "TECHNICAL", "USER", "LIBRARY"}; char* g_szProgNameVer = "cdigidoc/"DIGIDOC_VERSION; @@ -136,20 +143,28 @@ fprintf(stderr, "\t-add [] []\n"); fprintf(stderr, "\t-verify \n"); fprintf(stderr, "\t-list \n"); - fprintf(stderr, "\t-sign [] [ ]\n"); + fprintf(stderr, "\t-sign [[[] [ ]] [slot(0)] [ocsp(1)] [PKCS11/CNG/PKCS12] [pkcs12-file-name]]\n"); fprintf(stderr, "\t-extract [] []\n"); fprintf(stderr, "\t-encrypt \n"); + fprintf(stderr, "\t-encrypt-sk \n"); fprintf(stderr, "\t-encrecv [] [] []\n"); - fprintf(stderr, "\t-decrypt \n"); + fprintf(stderr, "\t-decrypt [pkcs12-file] [slot(0)]\n"); + fprintf(stderr, "\t-decrypt-sk [pkcs12-file] [slot(0)]\n"); fprintf(stderr, "\t-denc-list \n"); fprintf(stderr, "\t-encrypt-file []\n"); - fprintf(stderr, "\t-decrypt-file \n"); + fprintf(stderr, "\t-decrypt-file [pkcs12-file]\n"); fprintf(stderr, "\t-calc-sign [] [ ]\n"); fprintf(stderr, "\t-add-sign-value \n"); fprintf(stderr, "\t-del-sign \n"); fprintf(stderr, "\t-get-confirmation \n"); + fprintf(stderr, "\t-mid-sign [[(EE)] [(EST)] [(Testing)] [] [ ]]\n"); + + fprintf(stderr, "\t-in-mem \n"); + fprintf(stderr, "\t-add-mem []\n"); + fprintf(stderr, "\t-out-mem \n"); + #ifdef WITH_MSSP fprintf(stderr, "\t-mssp-sign (0=none) [] [ ]\n"); fprintf(stderr, "\t-mssp-status\n"); @@ -157,6 +172,7 @@ fprintf(stderr, "OPTIONS:\n"); fprintf(stderr, "\t-cgimode [ print usage - if(!err && hasCmdLineArg(argc, argv, "-?") || - hasCmdLineArg(argc, argv, "-help")) + if(!err && (hasCmdLineArg(argc, argv, "-?") || + hasCmdLineArg(argc, argv, "-help"))) printUsage(); // -in if(!err) if((err = checkCmdLineArg(argc, argv, "-in", &p_szInFile)) != ERR_OK) addError(err, __FILE__, __LINE__, "Missing or invalid input file name"); + // -in-mem + if(!err && hasCmdLineArg(argc, argv, "-in-mem")) { + if((err = checkCmdLineArg(argc, argv, "-in-mem", &p_szInFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid input file name"); + p_parseMode = 3; + } // -SAX -> use Sax parser (default) if(!err) if(hasCmdLineArg(argc, argv, "-SAX")) @@ -184,27 +206,41 @@ if(!err) if(hasCmdLineArg(argc, argv, "-XRDR")) p_parseMode = 2; - // -out + // -out if(!err) if((err = checkCmdLineArg(argc, argv, "-out", &p_szOutFile)) != ERR_OK) addError(err, __FILE__, __LINE__, "Missing or invalid output file name"); + if(!err && hasCmdLineArg(argc, argv, "-out-mem")) { + if((err = checkCmdLineArg(argc, argv, "-out-mem", &p_szOutFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid output file name"); + p_parseMode = 3; + } // -encrypt - if(!err) + if(!err && hasCmdLineArg(argc, argv, "-encrypt")) if((err = checkCmdLineArg(argc, argv, "-encrypt", &p_szInEncFile)) != ERR_OK) addError(err, __FILE__, __LINE__, "Missing or invalid encrypt input file name"); + // -encrypt-sk + if(!err && hasCmdLineArg(argc, argv, "-encrypt-sk")) + if((err = checkCmdLineArg(argc, argv, "-encrypt-sk", &p_szInEncFile)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid encrypt input file name"); // -config if(!err) if((err = checkCmdLineArg(argc, argv, "-config", &p_szConfigFile)) != ERR_OK) addError(err, __FILE__, __LINE__, "Missing or invalid configuration file name"); // -CGI -> use CGI output mode - if(!err) - if((err = checkCmdLineArg(argc, argv, "-cgimode", &g_szOutputSeparator)) != ERR_OK) - addError(err, __FILE__, __LINE__, "Missing or invalid cgi output separator"); - g_cgiMode = 1; - if(!g_szOutputSeparator || !g_szOutputSeparator[0] || err) { - g_szOutputSeparator = strdup("|"); - err = ERR_OK; - } + if(!err) + if(hasCmdLineArg(argc, argv, "-cgimode")) { + g_cgiMode = 1; + if((err = checkCmdLineArg(argc, argv, "-cgimode", &g_szOutputSeparator)) != ERR_OK) + addError(err, __FILE__, __LINE__, "Missing or invalid cgi output separator"); + if(!g_szOutputSeparator || !g_szOutputSeparator[0] || err) { + g_szOutputSeparator = strdup("|"); + err = ERR_OK; + } + } + if(hasCmdLineArg(argc, argv, "-consolemode")) { + g_cgiMode = 0; + } return err; } @@ -220,9 +256,12 @@ n = ConfigItem_lookup_bool("DIGIDOC_CGI_MODE", 0); if(!g_cgiMode && n) g_cgiMode = n; + s = ConfigItem_lookup("DIGIDOC_CGI_SEPARATOR"); if(!g_szOutputSeparator && s) g_szOutputSeparator = (char*)strdup(s); + if(!g_szOutputSeparator || !g_szOutputSeparator[0]) + g_szOutputSeparator = strdup("|"); } @@ -276,8 +315,7 @@ err = ddocConvertInput(file, &p); l1 = sizeof(buf1); getFullFileName(p, buf1, l1); - if(p) - free(p); + freeLibMem(p); // add a file err = DataFile_new(&pDataFile, *ppSigDoc, NULL, buf1, content, mime, 0, NULL, 0, NULL, charset); @@ -333,6 +371,62 @@ } //-------------------------------------------------- +// Adds a DataFile to signed doc +//-------------------------------------------------- +int cmdAddDataFileFromMem(SignedDoc** ppSigDoc, const char* file, + const char* mime, const char* content) +{ + int err = ERR_OK; + DataFile *pDf = NULL; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + + // if there was no new command then implicitly create a new document + if(!(*ppSigDoc)) { + err = cmdNew(ppSigDoc, NULL, NULL); + RETURN_IF_NOT(err == ERR_OK, err); + } + err = ddocReadFile(file, &mbuf1); + if(!err) + err = createDataFileInMemory(&pDf, *ppSigDoc, NULL, file, content, mime, mbuf1.pMem, mbuf1.nLen); + ddocMemBuf_free(&mbuf1); + return err; +} + +//-------------------------------------------------- +// Create digidoc and adds datafiles +//-------------------------------------------------- +int runAddMemCmds(int argc, char** argv, SignedDoc** ppSigDoc) +{ + int err = ERR_OK, i; + + for(i = 1; (err == ERR_OK) && (i < argc); i++) { + if(argv[i][0] == '-') { // all commands and options must start with - + // add a DataFile + if(!strcmp(argv[i], "-add-mem")) { + if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { + char* file = argv[i+1]; + char* mime = argv[i+2]; + char* content = CONTENT_EMBEDDED_BASE64; + i += 2; + // optional content and charset + checkArguments(argc, argv, &i, &content); + err = cmdAddDataFileFromMem(ppSigDoc, (const char*)file, (const char*)mime, + (const char*)content); + } else { + err = ERR_BAD_PARAM; + addError(err, __FILE__, __LINE__, "Missing and arguments of -add-mem command"); + } + } + + } + } + return err; +} + +//-------------------------------------------------- // Create digidoc and adds datafiles //-------------------------------------------------- /*int runAddSignValue(int argc, char** argv, SignedDoc** ppSigDoc) @@ -383,7 +477,10 @@ int err = ERR_OK, i; DEncEncryptedKey* pEncKey = 0; X509* pCert = 0; + DigiDocMemBuf mbuf1; + mbuf1.pMem = 0; + mbuf1.nLen = 0; for(i = 1; (err == ERR_OK) && (i < argc); i++) { if(argv[i][0] == '-') { // all commands and options must start with - // add a recipients key @@ -408,9 +505,14 @@ checkArguments(argc, argv, &i, &carriedkeyname); err = ReadCertificate(&pCert, certfile); if(err) return err; + if(!recipient) { + ddocCertGetSubjectCN(pCert, &mbuf1); + recipient = (char*)mbuf1.pMem; + } err = dencEncryptedKey_new(*ppEncData, &pEncKey, pCert, DENC_ENC_METHOD_RSA1_5, id, recipient, keyname, carriedkeyname); + ddocMemBuf_free(&mbuf1); } else { err = ERR_BAD_PARAM; addError(err, __FILE__, __LINE__, "Missing argument of -encrecv command"); @@ -455,12 +557,46 @@ } //-------------------------------------------------- +// reads in a signed doc +//-------------------------------------------------- +int cmdReadDigiDocFromMem(SignedDoc** ppSigDoc, DEncEncryptedData** ppEncData) +{ + int err = ERR_OK; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(!p_szInFile) { + err = ERR_BAD_PARAM; + addError(err, __FILE__, __LINE__, "No input file specified"); + return err; + } + //nMaxDfLen = ConfigItem_lookup_int("DATAFILE_MAX_CACHE", 0); + + if(strstr(p_szInFile, ".cdoc")) { + err = ddocReadFile(p_szInFile, &mbuf1); + if(!err) + err = dencSaxReadEncryptedDataFromMemory(ppEncData, &mbuf1); + } else { + err = ddocReadFile(p_szInFile, &mbuf1); + if(!err) + err = ddocSaxReadSignedDocFromMemory(ppSigDoc, mbuf1.pMem, mbuf1.nLen, mbuf1.nLen + 1); + ddocMemBuf_free(&mbuf1); + } + return err; +} + +//-------------------------------------------------- // writes a digidoc in file //-------------------------------------------------- int cmdWrite(SignedDoc* pSigDoc, DEncEncryptedData* pEncData) { int err = ERR_OK; FILE* hFile; +#ifdef WIN32 + wchar_t *convFileName = 0; + int l1 = 0; +#endif if(!p_szOutFile) { err = ERR_BAD_PARAM; @@ -474,7 +610,13 @@ pEncData->nDataStatus == DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) { err = dencGenEncryptedData_writeToFile(pEncData, p_szOutFile); } else { +#ifdef WIN32 + err = utf82unicode((const char*)p_szOutFile, (char**)&convFileName, &l1); + ddocDebug(3, "cmdWrite", "Writing file: %s, conv-file: %s len: %d", p_szOutFile, convFileName, l1); + if((hFile = _wfopen(convFileName, L"wb")) != NULL) { +#else if((hFile = fopen(p_szOutFile, "wb")) != NULL) { +#endif fwrite((pEncData)->mbufEncryptedData.pMem, 1, (pEncData)->mbufEncryptedData.nLen, hFile); fclose(hFile); @@ -488,6 +630,43 @@ return err; } +//-------------------------------------------------- +// writes a digidoc in file +//-------------------------------------------------- +int cmdWriteMem(SignedDoc* pSigDoc, DEncEncryptedData* pEncData) +{ + int err = ERR_OK; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(!p_szOutFile) { + err = ERR_BAD_PARAM; + addError(err, __FILE__, __LINE__, "No output file specified"); + return err; + } + if(pSigDoc) { + err = createSignedDocInMemory(pSigDoc, NULL, &mbuf1); + if(!err) + err = ddocWriteFile(p_szOutFile, &mbuf1); + ddocMemBuf_free(&mbuf1); + } + if(pEncData) { + if(pEncData->nDataStatus == DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED || + pEncData->nDataStatus == DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) { + err = dencGenEncryptedData_toXML(pEncData, &mbuf1); + if(!err) + err = ddocWriteFile(p_szOutFile, &mbuf1); + ddocMemBuf_free(&mbuf1); + } else { + err = ddocWriteFile(p_szOutFile, &(pEncData->mbufEncryptedData)); + } + } + if (err) + addError(err, __FILE__, __LINE__, "Error writing file\n"); + return err; +} + //----------------------------------------- // prints certificate info @@ -528,7 +707,7 @@ if(g_cgiMode) fprintf(stdout, "%s%s", g_szOutputSeparator, buf1); else - fprintf(stdout, "\n\tNotBefore: %s", buf1, sizeof(buf1)); + fprintf(stdout, "\n\tNotBefore: %s", buf1); // ValidTo memset(buf1, 0, sizeof(buf1)); err = getCertNotAfter(pSigDoc, pCert, buf1, sizeof(buf1)); @@ -569,6 +748,10 @@ mbuf.pMem = 0; mbuf.nLen = 0; + if(!pSigDoc) { + SET_LAST_ERROR(ERR_UNSUPPORTED_FORMAT); + return ERR_UNSUPPORTED_FORMAT; + } d = getCountOfSignatures(pSigDoc); for(s = 0; s < d; s++) { pSigInfo = getSignature(pSigDoc, s); @@ -598,8 +781,8 @@ fprintf(stdout, "\n\tClaimedRole: %s", getSignerRole(pSigInfo, 0, l)); } if(pSigInfo->sigProdPlace.szCity || pSigInfo->sigProdPlace.szStateOrProvince || - pSigInfo->sigProdPlace.szPostalCode || pSigInfo->sigProdPlace.szCountryName) - if(g_cgiMode) + pSigInfo->sigProdPlace.szPostalCode || pSigInfo->sigProdPlace.szCountryName) { + if(g_cgiMode) { fprintf(stdout, "\nSignatureProductionPlace%s%s%s%s%s%s%s%s", g_szOutputSeparator, (pSigInfo->sigProdPlace.szCountryName ? pSigInfo->sigProdPlace.szCountryName : ""), g_szOutputSeparator, @@ -608,14 +791,14 @@ (pSigInfo->sigProdPlace.szCity ? pSigInfo->sigProdPlace.szCity : ""), g_szOutputSeparator, (pSigInfo->sigProdPlace.szPostalCode ? pSigInfo->sigProdPlace.szPostalCode : "")); - else + } else { fprintf(stdout, "\n\tnSignatureProductionPlace - Country: %s, State: %s, City: %s, Postal code: %s", (pSigInfo->sigProdPlace.szCountryName ? pSigInfo->sigProdPlace.szCountryName : ""), (pSigInfo->sigProdPlace.szStateOrProvince ? pSigInfo->sigProdPlace.szStateOrProvince : ""), (pSigInfo->sigProdPlace.szCity ? pSigInfo->sigProdPlace.szCity : ""), (pSigInfo->sigProdPlace.szPostalCode ? pSigInfo->sigProdPlace.szPostalCode : "")); - //AM 24.09.08 RIK - //} + } + } // signers certificate if(ddocSigInfo_GetSignersCert(pSigInfo)) printCertificateInfo(pSigDoc, ddocSigInfo_GetSignersCert(pSigInfo)); @@ -647,8 +830,7 @@ printCertificateInfo(pSigDoc, ddocSigInfo_GetOCSPRespondersCert(pSigInfo)); } } - //AM 24.09.08 RIK - } + } return err; } @@ -657,13 +839,20 @@ // Signs the document and gets configrmation //-------------------------------------------------- int cmdSign(SignedDoc* pSigDoc, const char* pin, const char* manifest, - const char* city, const char* state, const char* zip, const char* country) + const char* city, const char* state, const char* zip, const char* country, + int nSlot, int nOcsp, int nSigner, const char* szPkcs12File) { int err = ERR_OK; SignatureInfo* pSigInfo = NULL; ddocDebug(3, "cmdSign", "Creating new digital signature"); - err = signDocument(pSigDoc, &pSigInfo, pin, manifest, city, state, zip, country); + err = cmdVerify(pSigDoc); + if(err) { + ddocDebug(1, "cmdSign", "Verification errors. Signing cancelled"); + return err; + } + err = signDocumentWithSlotAndSigner(pSigDoc, &pSigInfo, pin, manifest, + city, state, zip, country, nSlot, nOcsp, nSigner, szPkcs12File); RETURN_IF_NOT(err == ERR_OK, err); return ERR_OK; } @@ -671,43 +860,7 @@ -//-------------------------------------------------- -// Runs some test. This is used simply to test -// new features of the library and the functionality -// may change. -//-------------------------------------------------- -void cmdTest(const char* data) -{ -#ifdef WITH_TS - DigiDocMemBuf mbuf1, mbuf2; - int err = ERR_OK, l1; - TS_RESP *pResp = 0; - FILE *hFile; - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - ddocDebug(3, "cmdTest", "msg: %s", data); - err = ddocMemAssignData(&mbuf1, data, -1); - l1 =40; - ddocMemSetLength(&mbuf2, l1); - calculateDigest((const byte*)mbuf1.pMem, mbuf1.nLen, DIGEST_SHA1, (byte*)mbuf2.pMem, &l1); - mbuf2.nLen = l1; - if(!err) { - //err = ddocTsCreateTsReqBin(&mbuf2, &mbuf1, 0, 1, 0); - err = ddocSendTSRequest(&mbuf2, &pResp, 0, 1, 1, ConfigItem_lookup("TSA_URL"), - ConfigItem_lookup("DIGIDOC_PROXY_HOST"), ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - ddocDebug(3, "cmdTest", "err1: %d", err); - /*if((hFile = fopen("test1.tsq", "wb")) != NULL) { - fwrite(mbuf2.pMem, 1, mbuf2.nLen, hFile); - fclose(hFile); - }*/ - } - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); -#endif -} //#ifdef WITH_DEPRECATED_FUNCTIONS //-------------------------------------------------- @@ -718,10 +871,7 @@ void cmdTest2(const char* infile) { X509* pCert = 0; - /* - char buf1[X509_NAME_LEN + 10]; - int l1; - */ + //char buf1[X509_NAME_LEN + 10]; int err = ERR_OK, nPols = 0; PolicyIdentifier *pPolicies = 0; @@ -756,9 +906,15 @@ FILE* hFile; SignedDoc *pSigDoc = 0; DEncEncryptionProperty* pEncProperty = 0; - int len, err = ERR_OK; + int len, err = ERR_OK, nCompress, i = 0; char buf[2048], *p; +#ifdef WIN32 + wchar_t *convFileName = 0; + err = utf82unicode((const char*)szFileName, (char**)&convFileName, &i); +#endif + ddocDebug(3, "cmdEncrypt", "Encrypting %s rc: %d", szFileName, err); + nCompress = ConfigItem_lookup_int("DENC_COMPRESS_MODE", DENC_COMPRESS_ALLWAYS); err = dencEncryptedData_new(ppEncData, DENC_XMLNS_XMLENC, DENC_ENC_METHOD_AES128, 0, 0, 0); if(err) return err; err = dencMetaInfo_SetLibVersion(*ppEncData); @@ -772,15 +928,19 @@ if(strstr(p, ".ddoc")) { err = dencEncryptionProperty_new(*ppEncData, &pEncProperty, 0, 0, ENCPROP_ORIG_MIME, DENC_ENCDATA_TYPE_DDOC); } - free(p); + freeLibMem(p); if(err) return err; + ddocDebug(3, "cmdEncrypt", "Opening %s rc: %d", szFileName, err); +#ifdef WIN32 + if((hFile = _wfopen(convFileName, L"rb")) != NULL) { +#else if((hFile = fopen(szFileName, "rb")) != NULL) { +#endif do { memset(buf,0,sizeof(buf)); len = fread(buf, 1, sizeof(buf), hFile); - if(len) { - err = dencEncryptedData_AppendData(*ppEncData, buf, len); - } + if(len) + err = dencEncryptedData_AppendData(*ppEncData, buf, len); } while(len && !err); fclose(hFile); } @@ -792,13 +952,66 @@ if(pSigDoc) SignedDoc_free(pSigDoc); } + ddocDebug(3, "cmdEncrypt", "Enc data-len: %d rc: %d", (*ppEncData)->mbufEncryptedData.nLen, err); if(!err) - //err = dencEncryptedData_encryptData(*ppEncData, DENC_COMPRESS_NEVER); - err = dencEncryptedData_encryptData(*ppEncData, DENC_COMPRESS_BEST_EFFORT); + err = dencEncryptedData_encryptData(*ppEncData, nCompress); return err; } +//-------------------------------------------------- +// Encrypts a file and uses SK specific method of +// putting the file first in a ddoc container and then into +// cdoc +//-------------------------------------------------- +int cmdEncryptSk(DEncEncryptedData** ppEncData, const char* szFileName) +{ + SignedDoc *pSigDoc = 0; + DEncEncryptionProperty* pEncProperty = 0; + DataFile *pDf = 0; + int err = ERR_OK, nCompress; + long lSize; + char buf[256], *p; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + nCompress = ConfigItem_lookup_int("DENC_COMPRESS_MODE", DENC_COMPRESS_ALLWAYS); + err = dencEncryptedData_new(ppEncData, DENC_XMLNS_XMLENC, DENC_ENC_METHOD_AES128, 0, 0, 0); + if(err) return err; + err = dencMetaInfo_SetLibVersion(*ppEncData); + if(err) return err; + err = dencMetaInfo_SetFormatVersion(*ppEncData); + if(err) return err; + p = 0; + err = ddocConvertInput(szFileName, &p); + if(err) return err; + err = dencEncryptionProperty_new(*ppEncData, &pEncProperty, 0, 0, ENCPROP_FILENAME, getSimpleFileName(p)); + if(err) return err; + //sVer = (char*)ConfigItem_lookup_str("DENC_VERSION", DENC_VERSION_1_1); + //err = dencEncryptionProperty_new(*ppEncData, &pEncProperty, 0, 0, ENCPROP_ORIG_MIME, (!strcmp(sVer,DENC_VERSION_1_1) ? DENC_ENCDATA_TYPE_DDOC_11 : DENC_ENCDATA_TYPE_DDOC)); + freeLibMem(p); p = 0; + err = SignedDoc_new(&pSigDoc, "DIGIDOC-XML", "1.3"); + if(err) return err; + calculateFileSize(szFileName, &lSize); + err = DataFile_new(&pDf, pSigDoc, NULL, szFileName, "EMBEDDED_BASE64", "application/file", lSize, NULL, 0, NULL, NULL); + if(err) return err; + err = dencOrigContent_registerDigiDoc(*ppEncData, pSigDoc); + if(err) return err; + sprintf(buf, "%s.ddoc", szFileName); + err = createSignedDoc(pSigDoc, NULL, buf); + if(err) return err; + err = ddocReadFile(buf, &mbuf1); + if(err) return err; + err = dencEncryptedData_AppendData(*ppEncData, mbuf1.pMem, mbuf1.nLen); + SignedDoc_free(pSigDoc); + //ddocDebug(3, "EncTest", "Enc data: \"%s\"", mbuf1.pMem); + remove(buf); + ddocMemBuf_free(&mbuf1); + if(!err) + err = dencEncryptedData_encryptData(*ppEncData, nCompress); + return err; +} //-------------------------------------------------- @@ -813,7 +1026,7 @@ if(argv[i][0] == '-') { // all commands and options must start with - if(!strcmp(argv[i], "-test")) { // add a recipients key - cmdTest(argv[i+1]); + } //#ifdef WITH_DEPRECATED_FUNCTIONS if(!strcmp(argv[i], "-test2")) { @@ -876,12 +1089,19 @@ char* infile = NULL; char* outfile = NULL; char* pin = NULL; + char* pkcs12file = NULL; ddocConvertInput((const char*)argv[i+1], &infile); ddocConvertInput((const char*)argv[i+2], &outfile); ddocConvertInput((const char*)argv[i+3], &pin); - i += 3; + i += 3; + // optional arguments + checkArguments(argc, argv, &i, &pkcs12file); // decrypt the file - err = dencSaxReadDecryptFile(infile, outfile, pin); + err = dencSaxReadDecryptFile(infile, outfile, pin, pkcs12file); + if(infile) freeLibMem(infile); + if(outfile) freeLibMem(outfile); + if(pin) freeLibMem(pin); + if(pkcs12file) freeLibMem(pkcs12file); if(err) return err; } else { err = ERR_BAD_PARAM; @@ -894,6 +1114,139 @@ } //-------------------------------------------------- +// Generates and encrypts a block of data with specific +// length +//-------------------------------------------------- +int cmdEncryptTestSet(DEncEncryptedData** ppEncData, int nSize, char* dir, int nDdoc, int nDel) +{ + DEncEncryptionProperty* pEncProperty = 0; + int err = ERR_OK, i, nCompress, l2; + char *p = 0, fname1[256], fname2[256], c, *p2; + SignedDoc* pSigDoc = 0; + DataFile *pDf = 0; + FILE* hFile; + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + nCompress = ConfigItem_lookup_int("DENC_COMPRESS_MODE", DENC_COMPRESS_ALLWAYS); + ddocDebug(3, "EncTest", "Test: %d", nSize); + err = dencEncryptedData_new(ppEncData, DENC_XMLNS_XMLENC, DENC_ENC_METHOD_AES128, 0, 0, 0); + if(err) return err; + err = dencMetaInfo_SetLibVersion(*ppEncData); + if(err) return err; + err = dencMetaInfo_SetFormatVersion(*ppEncData); + if(err) return err; + sprintf(fname1, "%stest-%d.dat", dir, nSize); + err = dencEncryptionProperty_new(*ppEncData, &pEncProperty, 0, 0, ENCPROP_FILENAME, fname1); + if(err) return err; + p = (char*)malloc(nSize+1); + if(!p) return ERR_BAD_ALLOC; + memset(p, 0, nSize+1); + for(i = 0, c = 'A'; i < nSize; i++, c++) { + p[i] = c; + if(c >= 'z') c = 'A'; + } + // append x.923 padding if last block is full + if(nSize % 16 == 0) { + ddocDebug(3, "EncTest", "Full size: %d. Change last 8 bytes to X.923 padding", nSize); + p[nSize-1] = 8; + for(i = nSize -2; i > nSize - 9; i--) + p[i] = 0; + } + l2 = nSize * 2 + 1; + p2 = (char*)malloc(l2); + if(!p2) return ERR_BAD_ALLOC; + memset(p2, 0, l2); + bin2hex((const byte*)p, nSize, (byte*)p2, &l2); + ddocDebug(3, "EncTest", "Fil data hex: \"%s\" len: %d", p2, l2); + if((hFile = fopen(fname1, "w")) != NULL) { + fwrite(p, nSize, 1, hFile); + fclose(hFile); + } + if(nDdoc) { + err = dencEncryptionProperty_new(*ppEncData, &pEncProperty, 0, 0, ENCPROP_ORIG_MIME, DENC_ENCDATA_TYPE_DDOC); + err = SignedDoc_new(&pSigDoc, "DIGIDOC-XML", "1.3"); + if(err) return err; + err = DataFile_new(&pDf, pSigDoc, NULL, fname1, "EMBEDDED_BASE64", "text/txt", nSize, NULL, 0, NULL, NULL); + if(err) return err; + free(p); p = 0; + if(err) return err; + err = dencOrigContent_registerDigiDoc(*ppEncData, pSigDoc); + if(err) return err; + sprintf(fname2, "%stest-%d.ddoc", dir, nSize); + err = createSignedDoc(pSigDoc, NULL, fname2); + if(err) return err; + err = ddocReadFile(fname2, &mbuf1); + if(err) return err; + err = dencEncryptedData_AppendData(*ppEncData, mbuf1.pMem, mbuf1.nLen); + SignedDoc_free(pSigDoc); + //ddocDebug(3, "EncTest", "Enc data: \"%s\"", mbuf1.pMem); + if(nDel) + remove(fname2); + ddocMemBuf_free(&mbuf1); + } else { + err = dencEncryptedData_AppendData(*ppEncData, p, nSize); + } + if(nDel) + remove(fname1); + + if(!err) + err = dencEncryptedData_encryptData(*ppEncData, nCompress); + return err; +} + +//-------------------------------------------------- +// Encrypts generated test files +//-------------------------------------------------- +int runEncryptTestSetCmds(int argc, char** argv) +{ + int err = ERR_OK, i, j; + DEncEncryptedData* pEncData = 0; + DEncEncryptedKey* pEncKey = 0; + X509* pCert = 0; + char fname[128]; + + for(i = 1; (err == ERR_OK) && (i < argc); i++) { + if(argv[i][0] == '-') { // all commands and options must start with - + // add a recipients key + if(!strcmp(argv[i], "-encrypt-test-set")) { + if(argc > i+2 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { + char* certfile = argv[i+1]; + char* recipient = argv[i+2]; + char* outdir = argv[i+3]; + int nStart = atoi(argv[i+4]); + int nEnd = atoi(argv[i+5]); + int nDdoc = atoi(argv[i+6]); + int nDel = atoi(argv[i+7]); + + for(j = nStart; j < nEnd; j++) { + err = ReadCertificate(&pCert, certfile); + if(err) return err; + pEncData = 0; + err = cmdEncryptTestSet(&pEncData, j, outdir, nDdoc, nDel); + if(err) return err; + err = dencEncryptedKey_new(pEncData, &pEncKey, pCert, + DENC_ENC_METHOD_RSA1_5, + NULL, recipient, NULL, NULL); + sprintf(fname, "%stest-%d.cdoc", outdir, j); + err = dencGenEncryptedData_writeToFile(pEncData, fname); + dencEncryptedData_free(pEncData); + pEncKey = 0; + pEncData = 0; + } + } else { + err = ERR_BAD_PARAM; + addError(err, __FILE__, __LINE__, "Invalid parameters for -encrypt-test-set command"); + } + } + } + } + return err; +} + + +//-------------------------------------------------- // Lists SignedDoc objects //-------------------------------------------------- int cmdListSignedDoc(SignedDoc* pSigDoc) @@ -944,9 +1297,9 @@ g_szOutputSeparator, (pEncData->szType ? pEncData->szType : ""), g_szOutputSeparator, (pEncData->szMimeType ? pEncData->szMimeType : ""), g_szOutputSeparator, (pEncData->szEncryptionMethod ? pEncData->szEncryptionMethod : "")); - err = dencMetaInfo_GetLibVersion(pEncData, buf1, buf2); + err = dencMetaInfo_GetLibVersion(pEncData, buf1, sizeof(buf1), buf2, sizeof(buf2)); fprintf(stdout, "\nLIBRARY%s%s%s%s", g_szOutputSeparator, buf1, g_szOutputSeparator, buf2); - err = dencMetaInfo_GetFormatVersion(pEncData, buf1, buf2); + err = dencMetaInfo_GetFormatVersion(pEncData, buf1, sizeof(buf1), buf2, sizeof(buf2)); fprintf(stdout, "\nFORMAT%s%s%s%s", g_szOutputSeparator, buf1, g_szOutputSeparator, buf2); } else { fprintf(stdout, "\nEncryptedData - Id=%s Type=%s MimeType=%s EncryptionMethod=%s", @@ -954,9 +1307,9 @@ (pEncData->szType ? pEncData->szType : ""), (pEncData->szMimeType ? pEncData->szMimeType : ""), (pEncData->szEncryptionMethod ? pEncData->szEncryptionMethod : "")); - err = dencMetaInfo_GetLibVersion(pEncData, buf1, buf2); + err = dencMetaInfo_GetLibVersion(pEncData, buf1, sizeof(buf1), buf2, sizeof(buf2)); fprintf(stdout, "\n\tLIBRARY: %s VERSION: %s", buf1, buf2); - err = dencMetaInfo_GetFormatVersion(pEncData, buf1, buf2); + err = dencMetaInfo_GetFormatVersion(pEncData, buf1, sizeof(buf1), buf2, sizeof(buf2)); fprintf(stdout, "\n\tFORMAT: %s VERSION: %s", buf1, buf2); } for(k = 0; k < pEncData->nEncryptedKeys; k++) { @@ -1038,29 +1391,96 @@ //-------------------------------------------------- int runDecryptCmds(int argc, char** argv, DEncEncryptedData** ppEncData) { - int err = ERR_OK, i; + int err = ERR_OK, i, bDecSk = 0, nSlot = 0, nKey = 0; DEncEncryptedKey* pEncKey = 0; + FILE *hFile = 0; + SignedDoc *pSigDoc = 0; + DataFile *pDf = 0; + char fname1[256], *pkcs12file = 0, *infile = 0, *pin = 0, key[300]; + EVP_PKEY *pkey; +#ifdef WIN32 + wchar_t *convFileName = 0; + int l1 = 0; +#endif for(i = 1; (err == ERR_OK) && (i < argc); i++) { if(argv[i][0] == '-') { // all commands and options must start with - // decrypt file - if(!strcmp(argv[i], "-decrypt")) { + if(!strcmp(argv[i], "-decrypt") || + !strcmp(argv[i], "-decrypt-hex") || + !strcmp(argv[i], "-decrypt-sk")) { + if(!strcmp(argv[i], "-decrypt-sk")) bDecSk = 1; if(argc > i+3 && argv[i+1][0] != '-' && argv[i+2][0] != '-') { - char* infile = argv[i+1]; - char* pin = argv[i+2]; + ddocConvertInput(argv[i+1], &infile); + ddocConvertInput(argv[i+2], &pin); + nKey = 0; + memset(key, 0, sizeof(key)); + if(!strcmp(argv[i], "-decrypt-hex")) { + nKey = sizeof(key); + hex2bin(pin, (byte*)key, &nKey); + } i += 2; + checkArguments(argc, argv, &i, &pkcs12file); + if(argv[i+1][0] != '-') { + nSlot = atoi(argv[i+1]); + i++; + } err = dencSaxReadEncryptedData(ppEncData, infile); if(err) return err; - err = dencEncryptedData_findEncryptedKeyByPKCS11(*ppEncData, &pEncKey); - if(pEncKey) { - err = dencEncryptedData_decrypt(*ppEncData, pEncKey, pin); + // if using hex key + if(nKey > 0) { + ddocDebug(3, "runDecryptCmds", "Decrypt with key: %s len: %d", pin, nKey); + err = dencEncryptedData_decrypt_withKey(*ppEncData, key, nKey); + } + // if using pkcs12 + else if(pkcs12file != NULL && strlen(pkcs12file) > 0) { + ddocDebug(3, "runDecryptCmds", "Opening pkcs12 file: %s", pkcs12file); + err = dencEncryptedData_findEncryptedKeyByPKCS12(*ppEncData, &pEncKey, &pkey, pkcs12file, pin); + } else { + ddocDebug(3, "runDecryptCmds", "Connecting to pkcs11, slot: %d", nSlot); + err = dencEncryptedData_findEncryptedKeyByPKCS11UsingSlot(*ppEncData, &pEncKey, nSlot); + } + if(!nKey) { + if(pEncKey) { + if(pkcs12file != NULL && strlen(pkcs12file) > 0) + err = dencEncryptedData_decryptWithKey(*ppEncData, pEncKey, pkey); + else + err = dencEncryptedData_decryptUsingSlot(*ppEncData, pEncKey, pin, nSlot); if(err) return err; - } else { + } else { err = ERR_DENC_DECRYPT; addError(err, __FILE__, __LINE__, "No transport key found for your smartcard"); - } + } + } + // read in ddoc if necessary + if(bDecSk && p_szOutFile) { + sprintf(fname1, "%s.ddoc", p_szOutFile); + ddocDebug(3, "runDecryptCmds", "writing ddoc to: %s", fname1); +#ifdef WIN32 + err = utf82unicode((const char*)fname1, (char**)&convFileName, &l1); + ddocDebug(3, "ddocReadFile", "file: %s, conv-file: %s len: %d", fname1, convFileName, i); + if((hFile = _wfopen(convFileName, L"wb")) != NULL) { +#else + if((hFile = fopen(fname1, "wb")) != NULL) { +#endif + fwrite((*ppEncData)->mbufEncryptedData.pMem, (*ppEncData)->mbufEncryptedData.nLen, 1, hFile); + fclose(hFile); + ddocDebug(3, "runDecryptCmds", "Reading ddoc: %s", fname1); + err = ddocSaxReadSignedDocFromFile(&pSigDoc, fname1, 0, 0); + if(!err && getCountOfDataFiles(pSigDoc) > 0) { + pDf = getDataFile(pSigDoc, 0); + ddocDebug(3, "runDecryptCmds", "writing DF: %s to: %s", pDf->szId, p_szOutFile); + err = ddocExtractDataFile(pSigDoc, fname1, p_szOutFile, pDf->szId, "UTF-8"); + dencEncryptedData_free(*ppEncData); + *ppEncData = NULL; + p_szOutFile = NULL; + } + SignedDoc_free(pSigDoc); + remove(fname1); + } + } // p_szOutFile } else { err = ERR_BAD_PARAM; @@ -1117,7 +1537,7 @@ //-------------------------------------------------- // Verfys sigantures and notaries //-------------------------------------------------- -int runVerifyCmds(int argc, char** argv, SignedDoc** ppSigDoc) +int runVerifyCmds(int argc, char** argv, SignedDoc* pSigDoc, DEncEncryptedData* pEncData) { int err = ERR_OK, i; @@ -1125,7 +1545,10 @@ if(argv[i][0] == '-') { // all commands and options must start with - // create new digidoc if(!strcmp(argv[i], "-verify")) { - err = cmdVerify(*ppSigDoc); + if(pSigDoc) + err = cmdVerify(pSigDoc); + if(pEncData) + err = dencValidate(pEncData); } } } @@ -1138,7 +1561,7 @@ //-------------------------------------------------- int runSignCmds(int argc, char** argv, SignedDoc** ppSigDoc) { - int err = ERR_OK, i, nManif; + int err = ERR_OK, i, nManif, nSlot = 0, nOcsp = 1, nSigner = 1; for(i = 1; !err && (i < argc); i++) { if(argv[i][0] == '-') { // all commands and options must start with - @@ -1150,6 +1573,10 @@ char* state = NULL; char* zip = NULL; char* country = NULL; + char* sSlot = NULL; + char* sOcsp = NULL; + char* sSigner = NULL; + char* szPkcs12File = NULL; checkArguments(argc, argv, &i, &pin); // if pin is NULL check for autosign pin if(!pin) @@ -1174,15 +1601,34 @@ checkArguments(argc, argv, &i, &city); checkArguments(argc, argv, &i, &state); checkArguments(argc, argv, &i, &zip); - checkArguments(argc, argv, &i, &country); + checkArguments(argc, argv, &i, &country); + checkArguments(argc, argv, &i, &sSlot); + checkArguments(argc, argv, &i, &sOcsp); + checkArguments(argc, argv, &i, &sSigner); + if(sSlot) + nSlot = atoi(sSlot); + if(sOcsp) + nOcsp = atoi(sOcsp); + if(sSigner) { + if(!strcmp(sSigner, "PKCS11")) nSigner = 1; + if(!strcmp(sSigner, "PKCS12")) nSigner = 3; +#ifdef WIN32 + if(!strcmp(sSigner, "CNG")) nSigner = 2; +#endif + } + checkArguments(argc, argv, &i, &szPkcs12File); err = cmdSign(*ppSigDoc, (const char*)pin, (const char*)manifest, (const char*)city, (const char*)state, (const char*)zip, - (const char*)country); - if(manifest) free(manifest); - if(city) free(city); - if(state) free(state); - if(zip) free(zip); - if(country) free(country); + (const char*)country, nSlot, nOcsp, nSigner, szPkcs12File); + if(manifest) freeLibMem(manifest); + if(city) freeLibMem(city); + if(state) freeLibMem(state); + if(zip) freeLibMem(zip); + if(country) freeLibMem(country); + if(sSlot) freeLibMem(sSlot); + if(sOcsp) freeLibMem(sOcsp); + if(sSigner) freeLibMem(sSigner); + if(szPkcs12File) freeLibMem(szPkcs12File); } } } @@ -1667,6 +2113,135 @@ #endif // WITH_MSSP +//-------------------------------------------------- +// Signs the document and gets configrmation +//-------------------------------------------------- +int cmdMidSign(SignedDoc* pSigDoc, const char* szPhoneNo, + const char* szIdCode, const char* szLang, + const char* szService, + const char* manifest, const char* city, + const char* state, const char* zip, + const char* country) +{ + int err = ERR_OK, nPollFreq = 0, l1, nStatus = 0; + char* szUrl = 0, *szProxyHost = 0, *szProxyPort = 0; + long lSesscode = 0; + char buf1[10]; + DigiDocMemBuf mbuf1; +#ifdef WIN32 + time_t tNew, tOld; +#endif + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + nPollFreq = ConfigItem_lookup_int("DDS_POLLFREQ", 0); + szUrl = (char*)ConfigItem_lookup("DDS_URL"); + szProxyHost = (char*)ConfigItem_lookup("DDS_PROXY_HOST"); + szProxyPort = (char*)ConfigItem_lookup("DDS_PROXY_PORT"); + ddocDebug(3, "cmdMidSign", "Creating MID signature using: %s poll freq: %d", szPhoneNo, nPollFreq); + // send signature req + l1 = sizeof(buf1); + ddsSign(pSigDoc, szIdCode, szPhoneNo, szLang, szService, + manifest, city, state, zip, country, szUrl, szProxyHost, szProxyPort, + &lSesscode, buf1, l1); + + // report on success + if(g_cgiMode) + fprintf(stdout, "\nMIDSinatureReq%s%ld%s%d", + g_szOutputSeparator, lSesscode, + g_szOutputSeparator, err); + else + fprintf(stdout, "\nMIDSignatureReq session: %ld rc: %d", lSesscode, err); + // if we should keep on polling + if(!err && nPollFreq) { + // now check status + do { +#ifdef WIN32 + time(&tOld); + do { + time(&tNew); + } while(tNew - tOld < nPollFreq); +#else + ddocDebug(3, "cmdMidSign", "Sleep: %d", nPollFreq); + sleep(nPollFreq); +#endif + err = ddsGetStatus(pSigDoc, lSesscode, szUrl, szProxyHost, szProxyPort, &nStatus); + ddocDebug(3, "cmdMidSign", "Txn: %ld status: %d err: %d", lSesscode, nStatus, err); + } while(!err && nStatus == 1); + } + if(g_cgiMode) + fprintf(stdout, "\nMID session %s%ld%s%d", + g_szOutputSeparator, lSesscode, + g_szOutputSeparator, nStatus); + else + fprintf(stdout, "\nMID session %ld complete status: %d", lSesscode, nStatus); + + RETURN_IF_NOT(err == ERR_OK, err); + return ERR_OK; +} + + +//-------------------------------------------------- +// Handles MID signature commands +//-------------------------------------------------- +int runMidSignCmds(int argc, char** argv, SignedDoc* pSigDoc) +{ + int err = ERR_OK, i, nManif = 0; + + for(i = 1; !err && (i < argc); i++) { + if(argv[i][0] == '-') { // all commands and options must start with - + // create new digidoc + if(!strcmp(argv[i], "-mid-sign")) { + char* phoneNo = NULL; + char* idcode = NULL; + char* service = NULL; + char* lang = NULL; + char* manifest = NULL; + char* city = NULL; + char* state = NULL; + char* zip = NULL; + char* country = NULL; + checkArguments(argc, argv, &i, &phoneNo); + // check config file + nManif = ConfigItem_lookup_int("MANIFEST_MODE", 0); + if(nManif == 2) { + manifest = (char*)ConfigItem_lookup("DIGIDOC_ROLE_MANIFEST"); + country = (char*)ConfigItem_lookup("DIGIDOC_ADR_COUNTRY"); + state = (char*)ConfigItem_lookup("DIGIDOC_ADR_STATE"); + city = (char*)ConfigItem_lookup("DIGIDOC_ADR_CITY"); + zip = (char*)ConfigItem_lookup("DIGIDOC_ADR_ZIP"); + } + // optional mainfest argument + checkArguments(argc, argv, &i, &idcode); + checkArguments(argc, argv, &i, &country); + checkArguments(argc, argv, &i, &lang); + checkArguments(argc, argv, &i, &service); + checkArguments(argc, argv, &i, &manifest); + checkArguments(argc, argv, &i, &city); + checkArguments(argc, argv, &i, &state); + checkArguments(argc, argv, &i, &zip); + if(!phoneNo) { + err = ERR_BAD_PARAM; + addError(err, __FILE__, __LINE__, "Missing argument of -mid-sign command"); + } + else + cmdMidSign(pSigDoc, (const char*)phoneNo, (const char*)idcode, + (const char*)(lang ? lang : "EST"), + (const char*)(service ? service : "Testimine"), (const char*)manifest, + (const char*)city, (const char*)state, (const char*)zip, + (const char*)(country ? country : "EE")); + if(manifest) free(manifest); + if(city) free(city); + if(state) free(state); + if(zip) free(zip); + if(country) free(country); + if(phoneNo) free(phoneNo); + } + } + } + return err; +} + //-------------------------------------------------- @@ -1712,7 +2287,6 @@ err = readConfigFile(p_szConfigFile, ITEM_TYPE_PRIVATE); // read flags from config file readConfigParams(); - // display programm name and version if(g_cgiMode) { @@ -1728,18 +2302,28 @@ err = runCheckCertCmds(argc, argv); // read input file if necessary if(p_szInFile && !err) - err = cmdReadDigiDoc(&pSigDoc, &pEncData, p_parseMode); + if(p_parseMode != 3) + err = cmdReadDigiDoc(&pSigDoc, &pEncData, p_parseMode); + else + err = cmdReadDigiDocFromMem(&pSigDoc, &pEncData); // various tests if(!err) err = runTestCmds(argc, argv); - if(p_szInEncFile && !err) - err = cmdEncrypt(&pEncData, p_szInEncFile); + if(p_szInEncFile && !err) { + if(hasCmdLineArg(argc, argv, "-encrypt-sk")) + err = cmdEncryptSk(&pEncData, p_szInEncFile); + else + err = cmdEncrypt(&pEncData, p_szInEncFile); + } // list encrypted files if(!err) err = runDEncListCmds(argc, argv); // add data files if(!err) err = runAddCmds(argc, argv, &pSigDoc); + // add data files from mem + if(!err) + err = runAddMemCmds(argc, argv, &pSigDoc); // add recipients if(!err) err = runRecipientCmds(argc, argv, &pEncData); @@ -1763,9 +2347,11 @@ if(!err) err = runMsspStatusCmds(argc, argv, pSigDoc); #endif // WITH_MSSP + if(!err) + err = runMidSignCmds(argc, argv, pSigDoc); // verify signatures if(!err) - err = runVerifyCmds(argc, argv, &pSigDoc); + err = runVerifyCmds(argc, argv, pSigDoc, pEncData); // extract datafiles if(!err) err = runExtractCmds(argc, argv, &pSigDoc); @@ -1783,43 +2369,50 @@ if(!err) err = runGetConfirmationCmds(argc, argv, pSigDoc); + if(!err) + err = runEncryptTestSetCmds(argc, argv); // write output file if(p_szOutFile && !err) - err = cmdWrite(pSigDoc, pEncData); + if(p_parseMode != 3) + err = cmdWrite(pSigDoc, pEncData); + else + err = cmdWriteMem(pSigDoc, pEncData); // list digidoc or encrypted documents if(!err) err = runListCmds(argc, argv, pSigDoc, pEncData); time(&t2); - // display programm error code and elapsed time - if(g_cgiMode) { - if(ConfigItem_lookup_bool("DIGIDOC_CGI_PRINT_TRAILER", 1)) - fprintf(stdout, "\n%s%s%d%s%ld", getLibName(), g_szOutputSeparator, err, g_szOutputSeparator, (long)(t2-t1)); - - - } else { - fprintf(stdout, "\n%s - RC: %d - time: %ld [sek]", getLibName(), err, (long)(t2-t1)); - } + // list all errors while(hasUnreadErrors()) { ErrorInfo* pErr = getErrorInfo(); char* pErrStr = getErrorString(pErr->code); + if(!err) err = pErr->code; if(g_cgiMode) { fprintf(stdout, "\nERROR%s%d%s%s%s%s%s%d%s%s%s%s", - g_szOutputSeparator, pErr->code, - g_szOutputSeparator, pErrStr, - g_szOutputSeparator, pErr->fileName, - g_szOutputSeparator, pErr->line, - g_szOutputSeparator, pErr->assertion, - g_szOutputSeparator, errorClass[getErrorClass(pErr->code)]); + g_szOutputSeparator, pErr->code, + g_szOutputSeparator, pErrStr, + g_szOutputSeparator, pErr->fileName, + g_szOutputSeparator, pErr->line, + g_szOutputSeparator, pErr->assertion, + g_szOutputSeparator, errorClass[getErrorClass(pErr->code)]); } else { fprintf(stdout, "\nERROR: %d - %s - %s", - pErr->code, pErrStr, pErr->assertion); + pErr->code, pErrStr, pErr->assertion); } } + + // display programm error code and elapsed time + if(g_cgiMode) { + if(ConfigItem_lookup_bool("DIGIDOC_CGI_PRINT_TRAILER", 1)) + fprintf(stdout, "\n%s%s%d%s%ld", getLibName(), g_szOutputSeparator, err, g_szOutputSeparator, (long)(t2-t1)); + + + } else { + fprintf(stdout, "\n%s - time: %ld sec result: %s", getLibName(), (long)(t2-t1), (err ? "failure" : "success")); + } fprintf(stdout, "\n"); - // cleanup if(pSigDoc) SignedDoc_free(pSigDoc); @@ -1828,7 +2421,9 @@ if(g_szOutputSeparator) free(g_szOutputSeparator); // cleanup +#ifndef WIN32 // TODO: somehow this free gives invalid heap error on win32 cleanupConfigStore(NULL); +#endif finalizeDigiDocLib(); #ifdef WITH_MSSP diff -Nru libdigidoc-2.7.0/libdigidoc/cdigidoc.rc libdigidoc-3.7.0.875/libdigidoc/cdigidoc.rc --- libdigidoc-2.7.0/libdigidoc/cdigidoc.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/cdigidoc.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,43 @@ +#ifndef Q_CC_BOR +# if defined(UNDER_CE) && UNDER_CE >= 400 +# include +# else +# include +# endif +#endif + +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_COMMA + PRODUCTVERSION VERSION_COMMA + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE VFT_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Estonian ID Card\0" + VALUE "FileDescription", "cdigidoc\0" + VALUE "FileVersion", VERSION "\0" + VALUE "InternalName", "cdigidoc\0" + VALUE "LegalCopyright", "Copyright (C) 2009-2012 Estonian ID Card" + VALUE "OriginalFilename", "cdigidoc.exe\0" + VALUE "ProductName", "cdigidoc\0" + VALUE "ProductVersion", VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x425, 1200 + END +END +/* End of Version info */ diff -Nru libdigidoc-2.7.0/libdigidoc/libdigidoc.pc.cmake libdigidoc-3.7.0.875/libdigidoc/libdigidoc.pc.cmake --- libdigidoc-2.7.0/libdigidoc/libdigidoc.pc.cmake 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/libdigidoc.pc.cmake 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ + +Name: libdigidoc +Description: Libdigidoc library for handling digitally signed documents +Version: @VERSION@ +Libs: -L${libdir} -ldigidoc +Cflags: -I${includedir} diff -Nru libdigidoc-2.7.0/libdigidoc/libdigidoc.rc libdigidoc-3.7.0.875/libdigidoc/libdigidoc.rc --- libdigidoc-2.7.0/libdigidoc/libdigidoc.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/libdigidoc.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,43 @@ +#ifndef Q_CC_BOR +# if defined(UNDER_CE) && UNDER_CE >= 400 +# include +# else +# include +# endif +#endif + +#include + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_COMMA + PRODUCTVERSION VERSION_COMMA + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS_NT_WINDOWS32 + FILETYPE VFT_DLL + FILESUBTYPE VFT_UNKNOWN +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "Estonian ID Card\0" + VALUE "FileDescription", "libdigidoc\0" + VALUE "FileVersion", VERSION "\0" + VALUE "InternalName", "libdigidoc\0" + VALUE "LegalCopyright", "Copyright (C) 2009-2012 Estonian ID Card" + VALUE "OriginalFilename", "libdigidoc.dll\0" + VALUE "ProductName", "libdigidoc\0" + VALUE "ProductVersion", VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x425, 1200 + END +END +/* End of Version info */ diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/CMakeLists.txt libdigidoc-3.7.0.875/libdigidoc/mssp/CMakeLists.txt --- libdigidoc-2.7.0/libdigidoc/mssp/CMakeLists.txt 2009-06-16 07:59:14.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -install( FILES - DigiDocMsspGw.h - soapStub.h - MsspErrors.h - stdsoap2.h - DESTINATION ${DIGIDOC_INCLUDE_DIR}/mssp -) diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/DigiDocMsspGw.c libdigidoc-3.7.0.875/libdigidoc/mssp/DigiDocMsspGw.c --- libdigidoc-2.7.0/libdigidoc/mssp/DigiDocMsspGw.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/DigiDocMsspGw.c 2012-12-13 22:05:47.000000000 +0000 @@ -1,479 +1,482 @@ -//================================================== -// FILE: DigiDocMsspGw.c -// PROJECT: Digi Doc -// DESCRIPTION: Digi Doc functions for MSSP_GW client -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 25.09.2005 Veiko Sinivee -// Creation -//================================================== - -#include "DigiDocMsspGw.h" -#include "../DigiDocDefs.h" -#include "../DigiDocError.h" -#include "../DigiDocConfig.h" -#include "../DigiDocDebug.h" -#include "../DigiDocMem.h" -#include "../DigiDocCert.h" -#include "../DigiDocConvert.h" -#include "../DigiDocGen.h" -#include "../mssp/stdsoap2.h" -#include "MSSP_GW.nsmap" -#include "soapH.h" -#include "soapStub.h" - - -//-------------------------------------------------- -// Initializes MSSP connection -// pMssp - pointer to MSSP context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocMsspConnect(MSSP** ppMssp) -{ - int err = ERR_OK; - - RETURN_IF_NULL_PARAM(ppMssp); - // alloc new object only if there is none - if(!*ppMssp) { - // allocate new MSSP context object - *ppMssp = (MSSP*)malloc(sizeof(MSSP)); - RETURN_IF_BAD_ALLOC(*ppMssp); - memset(*ppMssp, 0, sizeof(MSSP)); - } - ddocDebug(3, "ddocMsspConnect", "Connecting to: %s", (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT")); - err = ddocMsspReconnect(*ppMssp); - return err; -} - -//-------------------------------------------------- -// Reconnects to MSSP service if necessary -// pMssp - pointer to MSSP context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocMsspReconnect(MSSP* pMssp) -{ - int err = SOAP_OK; - char buf1[250]; - - RETURN_IF_NULL_PARAM(pMssp); - if(!pMssp->endpoint) { - ddocDebug(3, "ddocMsspReconnect", "Reconnecting to: %s", (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT")); - pMssp->endpoint = (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT"); - pMssp->soap.proxy_host = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); - if(ConfigItem_lookup("DIGIDOC_PROXY_PORT")) - pMssp->soap.proxy_port = atoi(ConfigItem_lookup("DIGIDOC_PROXY_PORT")); - soap_init(&(pMssp->soap)); - pMssp->soap.namespaces = namespaces; - // if using HTTPS connection -#ifdef WIN32 - if(pMssp->endpoint && !_strnicmp(pMssp->endpoint, "https", 5)) { -#else - if(pMssp->endpoint && !strncasecmp(pMssp->endpoint, "https", 5)) { -#endif - // compose MSSP GW server cert path - strcpy(buf1, (char*)ConfigItem_lookup("CA_CERT_PATH")); -#ifdef WIN32 - strcat(buf1, "\\"); -#else - strcat(buf1, "/"); -#endif - if(ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT")) - strcat(buf1, (char*)ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT")); - ddocDebug(3, "ddocMsspReconnect", "Server cert: %s", (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? buf1 : "")); - if(soap_ssl_client_context(&(pMssp->soap), - (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? SOAP_SSL_DEFAULT : SOAP_SSL_NO_AUTHENTICATION), - NULL, // no client auth - NULL, // no client key passwd - (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? buf1 : NULL), // server ca - NULL, // optional capath - NULL // no randfile - )) { - soap_print_fault(&(pMssp->soap), stderr); - return ERR_GENERIC_SOAP_ERR; - } - } - } - ddocDebug(3, "ddocMsspReconnect", "RC: %d", err); - return err; -} - - - -//-------------------------------------------------- -// Cleanup MSSP connection -// pMssp - pointer to MSSP context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocMsspDisconnect(MSSP* pMssp) -{ - int err = ERR_OK; - //RETURN_IF_NULL_PARAM(pMssp); - ddocDebug(3, "ddocMsspDisconnect", "Disconnecting"); - if(pMssp && pMssp->endpoint) { - ddocDebug(3, "ddocMsspDisconnect", "Disconnecting from: %s", pMssp->endpoint); - soap_destroy(&(pMssp->soap)); - soap_end(&(pMssp->soap)); - soap_done(&(pMssp->soap)); - pMssp->endpoint = 0; // mark disconnected - } - if(pMssp) - free(pMssp); - return err; -} - -//-------------------------------------------------- -// Cleanup MSSP connection but don't disconnect -// pMssp - pointer to MSSP context structure -// returns ERR_OK on success -//-------------------------------------------------- -EXP_OPTION int ddocMsspCleanup(MSSP* pMssp) -{ - int err = ERR_OK; - //RETURN_IF_NULL_PARAM(pMssp); - ddocDebug(3, "ddocMsspCleanup", "cleanup"); - if(pMssp && pMssp->endpoint) { - ddocDebug(3, "ddocMsspCleanup", "cleanup: %s", (pMssp->endpoint ? pMssp->endpoint : "")); - soap_destroy(&(pMssp->soap)); - soap_end(&(pMssp->soap)); - soap_done(&(pMssp->soap)); - pMssp->endpoint = 0; // mark disconnected - } - return err; -} - -//-------------------------------------------------- -// Rerieves SOAP fault string -// pMssp - pointer to MSSP context structure -// returns SOAP fault string or NULL -//-------------------------------------------------- -EXP_OPTION char* ddocGetSoapFaultString(MSSP* pMssp) -{ - char *s = NULL, **p = NULL; - if(pMssp && pMssp->soap.error) { - ddocDebug(4, "ddocGetSoapFaultString", "Get fault for err: %d", pMssp->soap); - p = (char**)soap_faultstring(&(pMssp->soap)); - ddocDebug(4, "ddocGetSoapFaultString", "p: %s, s: %s", - (p ? "OK" : "NULL"), ((p && *p) ? *p : "NULL")); - if(p && *p) - s = (char*)*p; - } - return s; -} - -//-------------------------------------------------- -// Rerieves SOAP fault code -// pMssp - pointer to MSSP context structure -// returns SOAP fault code or NULL -//-------------------------------------------------- -EXP_OPTION char* ddocGetSoapFaultCode(MSSP* pMssp) -{ - char *s = NULL, **d = NULL; - if(pMssp && pMssp->soap.error) { - d = (char**)soap_faultcode(&(pMssp->soap)); - if(d && *d) - s = *d; - } - return s; -} - -//-------------------------------------------------- -// Rerieves SOAP fault detail -// pMssp - pointer to MSSP context structure -// returns SOAP fault detail or NULL -//-------------------------------------------------- -EXP_OPTION char* ddocGetSoapFaultDetail(MSSP* pMssp) -{ - char *s = NULL, **d = NULL; - if(pMssp && pMssp->soap.error) { - d = (char**)soap_faultdetail(&(pMssp->soap)); - if(d && *d) - s = *d; - } - return s; -} - - -//-------------------------------------------------- -// Sends an MSSP request to sign this data -// pMssp - pointer to MSSP context structure -// szPhoneNo - phone number on which to sign -// pHash - pointer to binary hash to sign -// nHashLen - length of hash data -// szDesc - description what user is signing (file name) -// returns error code or SOAP_OK -//-------------------------------------------------- -EXP_OPTION int ddocMsspSignatureReq(MSSP* pMssp, const char* szPhoneNo, - const char* pHash, int nHashLen, const char* szDesc) -{ - int err = SOAP_OK; - unsigned long lTimeout; - int nMsgMode, nB64HashLen, nB64ManifestLen; - struct mss__AP_InfoType apInfo; - struct mss__MSSP_InfoType msspInfo; - struct mss__MobileUserType mu; - struct mss__DataType DataToBeSigned, DataToBeDisplayed; - struct mss__MSS_USCORESignatureResp resp; - char szTimestamp[30], szTxnId[20], *pBase64Hash = 0, *pBase64Manifest = 0; - - RETURN_IF_NULL_PARAM(pMssp); - RETURN_IF_NULL_PARAM(szPhoneNo); - RETURN_IF_NULL_PARAM(pHash); - ddocDebug(3, "ddocMsspSignatureReq", "Signing: %s on phone: %s", - szDesc, szPhoneNo); - // init parameters - time(&pMssp->lApTxnId); - sprintf(szTxnId, "%ld", pMssp->lApTxnId); - createTimestamp(0, szTimestamp, sizeof(szTimestamp)); - apInfo.AP_USCOREID = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_USERID"); - apInfo.AP_USCORETransID = szTxnId; - apInfo.AP_USCOREPWD = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_PASSWD"); - apInfo.Instant = szTimestamp; - apInfo.AP_USCOREURL = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); - msspInfo.MSSP_USCOREID.mss__DNSName = 0; - msspInfo.MSSP_USCOREID.mss__IPAddress = 0; - msspInfo.MSSP_USCOREID.mss__IdentifierString = 0; - msspInfo.MSSP_USCOREID.mss__URI = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); - msspInfo.Instant = szTimestamp; - mu.mss__IdentityIssuer.mss__DNSName = 0; - mu.mss__IdentityIssuer.mss__IPAddress = 0; - mu.mss__IdentityIssuer.mss__URI = 0; - mu.mss__IdentityIssuer.mss__IdentifierString = 0; - mu.mss__UserIdentifier = 0; - mu.mss__HomeMSSP.mss__URI = 0; - mu.mss__HomeMSSP.mss__IPAddress = 0; - mu.mss__HomeMSSP.mss__DNSName = 0; - mu.mss__HomeMSSP.mss__IdentifierString = 0; - mu.mss__MSISDN = (char*)szPhoneNo; - nB64HashLen = nHashLen * 2 + 10; - pBase64Hash = (char*)malloc(nB64HashLen); - if(pBase64Hash) - encode((const byte*)pHash, nHashLen, (byte*)pBase64Hash, &nB64HashLen); - DataToBeSigned.__item = pBase64Hash; - DataToBeSigned.mss__MimeType = "Base64"; - DataToBeSigned.mss__Encoding = "UTF8"; - nB64ManifestLen = strlen(szDesc) * 2 + 10; - pBase64Manifest = (char*)malloc(nB64ManifestLen); - if(pBase64Manifest) { - memset(pBase64Manifest, 0, nB64ManifestLen); - encode((const byte*)szDesc, strlen(szDesc), (byte*)pBase64Manifest, &nB64ManifestLen); - } - DataToBeDisplayed.__item = pBase64Manifest; - DataToBeDisplayed.mss__MimeType = "Base64"; - DataToBeDisplayed.mss__Encoding = "UTF8"; - lTimeout = ConfigItem_lookup_int("DIGIDOC_MSSP_TIMEOUT", 0); - nMsgMode = ConfigItem_lookup_int("DIGIDOC_MSSP_MSG_MODE", 0); - - // reconnect if necessary - err = ddocMsspReconnect(pMssp); - // send MSSP request - ddocDebug(3, "ddocMsspSignatureReq", "Sending request!"); - memset(&resp, 0, sizeof(resp)); - err = soap_call_mss__MSS_USCORESignatureReq(&(pMssp->soap), - (const char*)pMssp->endpoint, "", - ConfigItem_lookup_int("DIGIDOC_MSSP_MAJOR", 0), - ConfigItem_lookup_int("DIGIDOC_MSSP_MINOR", 0), - 0, // no validity date, we use timeout instead - (lTimeout ? &lTimeout : 0), - (enum mss__MessagingModeType)nMsgMode, - apInfo,msspInfo, mu, - DataToBeSigned, &DataToBeDisplayed, - 0, 0, 0, 0, &resp); - ddocDebug(3, "ddocMsspSignatureReq", "Sent RC: %d err: %d", err, pMssp->soap.error); - // report error or success - if(err) { - ddocDebug(3, "ddocMsspSignatureReq", "RC: %d err: %d", - err, pMssp->soap.error); - } else { - ddocDebug(3, "ddocMsspSignatureReq", "RC: %d err: %d Status: %d - %s message: %s detail: %s trans-id: %ld", - err, pMssp->soap.error, resp.Status.StatusCode.Value, - (resp.Status.StatusCode.__item ? resp.Status.StatusCode.__item : ""), - (resp.Status.StatusMessage ? resp.Status.StatusMessage : ""), - (resp.Status.StatusDetail ? resp.Status.StatusDetail : ""), - (unsigned long)resp.MSSP_USCORETransID); - } - if(err) { - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultCode(pMssp)); - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultString(pMssp)); - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultDetail(pMssp)); - soap_print_fault(&(pMssp->soap), stdout); - } - pMssp->lMsspTxnId = (unsigned long)resp.MSSP_USCORETransID; - pMssp->nStatusCode = resp.Status.StatusCode.Value; - pMssp->endpoint = NULL; // force reconnect - // cleanup - free(pBase64Hash); - free(pBase64Manifest); - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - - -//-------------------------------------------------- -// Sends an MSSP request to find the status of signature -// operation and possibly it's value -// pMssp - pointer to MSSP context structure -// pMbufSignature - memory buffer to store signature value -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocMsspStatusReq(MSSP* pMssp, DigiDocMemBuf* pMbufSignature) -{ - int err = ERR_OK; - struct mss__AP_InfoType apInfo; - struct mss__MSSP_InfoType msspInfo; - struct mss__MSS_USCOREStatusResp resp; - char szTimestamp[30], szTxnId[20], *pBase64Hash = 0; - - RETURN_IF_NULL_PARAM(pMssp); - RETURN_IF_NULL_PARAM(pMbufSignature); - ddocDebug(3, "ddocMsspStatusReq", "Request status of txn: %ld", pMssp->lMsspTxnId); - // init parameters - time(&pMssp->lApTxnId); - sprintf(szTxnId, "%ld", pMssp->lApTxnId); - createTimestamp(0, szTimestamp, sizeof(szTimestamp)); - apInfo.AP_USCOREID = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_USERID"); - apInfo.AP_USCORETransID = szTxnId; - apInfo.AP_USCOREPWD = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_PASSWD"); - apInfo.Instant = szTimestamp; - apInfo.AP_USCOREURL = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); - msspInfo.MSSP_USCOREID.mss__DNSName = 0; - msspInfo.MSSP_USCOREID.mss__IPAddress = 0; - msspInfo.MSSP_USCOREID.mss__IdentifierString = 0; - msspInfo.MSSP_USCOREID.mss__URI = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); - msspInfo.Instant = szTimestamp; - - // reconnect if necessary - err = ddocMsspReconnect(pMssp); - // send MSSP request - ddocDebug(3, "ddocMsspStatusReq", "Sending request!"); - memset(&resp, 0, sizeof(resp)); - err = soap_call_mss__MSS_USCOREStatusReq(&(pMssp->soap), - (const char*)pMssp->endpoint, "", - ConfigItem_lookup_int("DIGIDOC_MSSP_MAJOR", 0), - ConfigItem_lookup_int("DIGIDOC_MSSP_MINOR", 0), - apInfo, msspInfo, pMssp->lMsspTxnId, &resp); - // report error or success - if(!err) { - pMssp->nStatusCode = resp.Status.StatusCode.Value; - ddocDebug(3, "ddocMsspStatusReq", "RC: %d Status: %d - %s message: %s detail: %s", - err, resp.Status.StatusCode.Value, - (resp.Status.StatusCode.__item ? resp.Status.StatusCode.__item : ""), - (resp.Status.StatusMessage ? resp.Status.StatusMessage : ""), - (resp.Status.StatusDetail ? resp.Status.StatusDetail : "")); - } else { - ddocDebug(3, "ddocMsspStatusReq", "RC: %d - no status", err); - pMssp->nStatusCode = INTERNAL_ERROR; - } - if(!err) - pMssp->nStatusCode = resp.Status.StatusCode.Value; - if(err) { - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultCode(pMssp)); - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultString(pMssp)); - addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultDetail(pMssp)); - soap_print_fault(&(pMssp->soap), stdout); - } - - // get signature value if it exists - if(err == SOAP_OK && resp.MSS_USCORESignature && - resp.MSS_USCORESignature->Base64Signature && - resp.MSS_USCORESignature->Base64Signature->__ptr && - resp.MSS_USCORESignature->Base64Signature->__size) { - ddocDebug(3, "ddocMsspStatusReq", "Received signature value of %d bytes", - resp.MSS_USCORESignature->Base64Signature->__size); - ddocMemAssignData(pMbufSignature, - (const char*)resp.MSS_USCORESignature->Base64Signature->__ptr, - resp.MSS_USCORESignature->Base64Signature->__size); - } - pMssp->endpoint = NULL; // force reconnect - if(err != SOAP_OK) - err = ERR_GENERIC_SOAP_ERR; - return err; -} - -char * g_szCertPrefix = "-----BEGIN CERTIFICATE-----"; -char * g_szCertSuffix = "-----END CERTIFICATE-----"; - -//-------------------------------------------------- -// Reads the signers certificate based on the signers -// phone number. -// szPhoneNo - phone number -// szCertUrl - full url where to get cert. Use NULL for default url -// ppCert - address to store the certificate -// bAuthCert - 1=auth cert, 0=sign cert -// returns error coder or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocMsspReadCertificate(const char* szPhoneNo, const char* szCertUrl, - X509 **ppCert, int bAuthCert) -{ - int err = ERR_OK; - DigiDocMemBuf mbuf1, mbuf2; - char *p1, *p2, *p3; - - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - *ppCert = 0; - RETURN_IF_NULL_PARAM(szPhoneNo); - ddocDebug(3, "ddocMsspReadCertificate", "Read certificate for No: %s auth: %d url: %s", - szPhoneNo, bAuthCert, (szCertUrl ? szCertUrl : "NULL")); - p3 = (char*)ConfigItem_lookup("DIGIDOC_MSSP_CERT_URL_HOST"); - p1 = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); - p2 = (char*)ConfigItem_lookup("DIGIDOC_PROXY_PORT"); - ddocMemAssignData(&mbuf1, "GET ", -1); - // if URL was given then use it - if(szCertUrl && strlen(szCertUrl)) { - ddocMemAppendData(&mbuf1, szCertUrl, -1); - } else { // compose default cert url based on phone no - if(p1 || p2) // if we use proxy then send the full URL of cert - ddocMemAppendData(&mbuf1, ConfigItem_lookup("DIGIDOC_MSSP_CERT_URL_HOST"), -1); - ddocMemAppendData(&mbuf1, ConfigItem_lookup((bAuthCert == 1) ? - "DIGIDOC_MSSP_AUTH_CERT_DIR" : "DIGIDOC_MSSP_SIGN_CERT_DIR"), -1); - ddocMemAppendData(&mbuf1, szPhoneNo, -1); - ddocMemAppendData(&mbuf1, ".pem", -1); - } - ddocMemAppendData(&mbuf1, " HTTP/1.0\r\n", -1); - ddocMemAppendData(&mbuf1, "User-Agent: cdigidoc\r\n", -1); - ddocMemAppendData(&mbuf1, "Host: www.sk.ee\r\n", -1); - ddocMemAppendData(&mbuf1, "Accept: */*\r\n", -1); - ddocMemAppendData(&mbuf1, "Connection: Close\r\n", -1); - if(p1 || p2) // if we use proxy then send also Proxy-Connection - ddocMemAppendData(&mbuf1, "Proxy-Connection: Close\r\n", -1); - ddocMemAppendData(&mbuf1, "\r\n", -1); - ddocDebug(4, "ddocMsspReadCertificate", "Send to host: %s request:\n------\n%s\n------\n", - p3, (char*)mbuf1.pMem); - err = ddocPullUrl(p3, &mbuf1, &mbuf2, p1, p2); - ddocDebug(4, "ddocMsspReadCertificate", "RC: %d RECEIVED: %d bytes\n-----------------------------------\n%s\n-----------------------------------", err, mbuf2.nLen, (const char*)mbuf2.pMem); - if(!err && mbuf2.pMem && mbuf2.nLen) { - p1 = strstr((char*)mbuf2.pMem, g_szCertPrefix); - if(p1) { - p1 += strlen(g_szCertPrefix); - while(*p1 && !isalnum(*p1)) p1++; - p2 = strstr(p1, g_szCertSuffix); - if(p2) { - *p2 = 0; - err = ddocDecodeX509PEMData(ppCert, p1, strlen(p1)); - ddocDebug(3, "ddocMsspReadCertificate", "Decoding cert rc: %d - %s ", - err, (*ppCert ? "OK" : "ERROR")); - } - } - } - // cleanup - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - RETURN_IF_NOT(*ppCert, ERR_CERT_READ); - return err; -} - +//================================================== +// FILE: DigiDocMsspGw.c +// PROJECT: Digi Doc +// DESCRIPTION: Digi Doc functions for MSSP_GW client +// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia +//================================================== +// Copyright (C) AS Sertifitseerimiskeskus +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// GNU Lesser General Public Licence is available at +// http://www.gnu.org/copyleft/lesser.html +//==========< HISTORY >============================= +// 25.09.2005 Veiko Sinivee +// Creation +//================================================== + +#include "DigiDocMsspGw.h" +#include "../DigiDocDefs.h" +#include "../DigiDocError.h" +#include "../DigiDocConfig.h" +#include "../DigiDocDebug.h" +#include "../DigiDocMem.h" +#include "../DigiDocCert.h" +#include "../DigiDocConvert.h" +#include "../DigiDocGen.h" +#include "../mssp/stdsoap2.h" +#include "MSSP_GW.nsmap" +#include "soapH.h" +#include "soapStub.h" + + +//-------------------------------------------------- +// Initializes MSSP connection +// pMssp - pointer to MSSP context structure +// returns ERR_OK on success +//-------------------------------------------------- +EXP_OPTION int ddocMsspConnect(MSSP** ppMssp) +{ + int err = ERR_OK; + + RETURN_IF_NULL_PARAM(ppMssp); + // alloc new object only if there is none + if(!*ppMssp) { + // allocate new MSSP context object + *ppMssp = (MSSP*)malloc(sizeof(MSSP)); + RETURN_IF_BAD_ALLOC(*ppMssp); + memset(*ppMssp, 0, sizeof(MSSP)); + } + ddocDebug(3, "ddocMsspConnect", "Connecting to: %s", (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT")); + err = ddocMsspReconnect(*ppMssp); + return err; +} + +//-------------------------------------------------- +// Reconnects to MSSP service if necessary +// pMssp - pointer to MSSP context structure +// returns ERR_OK on success +//-------------------------------------------------- +EXP_OPTION int ddocMsspReconnect(MSSP* pMssp) +{ + int err = SOAP_OK; + char buf1[250]; + + RETURN_IF_NULL_PARAM(pMssp); + if(!pMssp->endpoint) { + ddocDebug(3, "ddocMsspReconnect", "Reconnecting to: %s", (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT")); + pMssp->endpoint = (char*)ConfigItem_lookup("DIGIDOC_MSSP_ENDPOINT"); + pMssp->soap.proxy_host = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); + if(ConfigItem_lookup("DIGIDOC_PROXY_PORT")) + pMssp->soap.proxy_port = atoi(ConfigItem_lookup("DIGIDOC_PROXY_PORT")); + soap_init(&(pMssp->soap)); + pMssp->soap.namespaces = namespaces; + // if using HTTPS connection +#ifdef WIN32 + if(pMssp->endpoint && !_strnicmp(pMssp->endpoint, "https", 5)) { +#else + if(pMssp->endpoint && !strncasecmp(pMssp->endpoint, "https", 5)) { +#endif + // compose MSSP GW server cert path + strcpy(buf1, (char*)ConfigItem_lookup("CA_CERT_PATH")); +#ifdef WIN32 + strcat(buf1, "\\"); +#else + strcat(buf1, "/"); +#endif + if(ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT")) + strcat(buf1, (char*)ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT")); + ddocDebug(3, "ddocMsspReconnect", "Server cert: %s", (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? buf1 : "")); + if(soap_ssl_client_context(&(pMssp->soap), + (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? SOAP_SSL_DEFAULT : SOAP_SSL_NO_AUTHENTICATION), + NULL, // no client auth + NULL, // no client key passwd + (ConfigItem_lookup("DIGIDOC_MSSP_GW_CERT") ? buf1 : NULL), // server ca + NULL, // optional capath + NULL // no randfile + )) { + soap_print_fault(&(pMssp->soap), stderr); + return ERR_GENERIC_SOAP_ERR; + } + } + } + ddocDebug(3, "ddocMsspReconnect", "RC: %d", err); + return err; +} + + + +//-------------------------------------------------- +// Cleanup MSSP connection +// pMssp - pointer to MSSP context structure +// returns ERR_OK on success +//-------------------------------------------------- +EXP_OPTION int ddocMsspDisconnect(MSSP* pMssp) +{ + int err = ERR_OK; + ddocDebug(3, "ddocMsspDisconnect", "Disconnecting"); + if(pMssp && pMssp->endpoint) { + ddocDebug(3, "ddocMsspDisconnect", "Disconnecting from: %s", pMssp->endpoint); + soap_destroy(&(pMssp->soap)); + soap_end(&(pMssp->soap)); + soap_done(&(pMssp->soap)); + pMssp->endpoint = 0; // mark disconnected + } + if(pMssp) + free(pMssp); + return err; +} + +//-------------------------------------------------- +// Cleanup MSSP connection but don't disconnect +// pMssp - pointer to MSSP context structure +// returns ERR_OK on success +//-------------------------------------------------- +EXP_OPTION int ddocMsspCleanup(MSSP* pMssp) +{ + int err = ERR_OK; + ddocDebug(3, "ddocMsspCleanup", "cleanup"); + if(pMssp && pMssp->endpoint) { + ddocDebug(3, "ddocMsspCleanup", "cleanup: %s", (pMssp->endpoint ? pMssp->endpoint : "")); + soap_destroy(&(pMssp->soap)); + soap_end(&(pMssp->soap)); + soap_done(&(pMssp->soap)); + pMssp->endpoint = 0; // mark disconnected + } + return err; +} + +//-------------------------------------------------- +// Rerieves SOAP fault string +// pMssp - pointer to MSSP context structure +// returns SOAP fault string or NULL +//-------------------------------------------------- +EXP_OPTION char* ddocGetSoapFaultString(MSSP* pMssp) +{ + char *s = NULL, **p = NULL; + if(pMssp && pMssp->soap.error) { + ddocDebug(4, "ddocGetSoapFaultString", "Get fault for err: %d", pMssp->soap); + p = (char**)soap_faultstring(&(pMssp->soap)); + ddocDebug(4, "ddocGetSoapFaultString", "p: %s, s: %s", + (p ? "OK" : "NULL"), ((p && *p) ? *p : "NULL")); + if(p && *p) + s = (char*)*p; + } + return s; +} + +//-------------------------------------------------- +// Rerieves SOAP fault code +// pMssp - pointer to MSSP context structure +// returns SOAP fault code or NULL +//-------------------------------------------------- +EXP_OPTION char* ddocGetSoapFaultCode(MSSP* pMssp) +{ + char *s = NULL, **d = NULL; + if(pMssp && pMssp->soap.error) { + d = (char**)soap_faultcode(&(pMssp->soap)); + if(d && *d) + s = *d; + } + return s; +} + +//-------------------------------------------------- +// Rerieves SOAP fault detail +// pMssp - pointer to MSSP context structure +// returns SOAP fault detail or NULL +//-------------------------------------------------- +EXP_OPTION char* ddocGetSoapFaultDetail(MSSP* pMssp) +{ + char *s = NULL, **d = NULL; + if(pMssp && pMssp->soap.error) { + d = (char**)soap_faultdetail(&(pMssp->soap)); + if(d && *d) + s = *d; + } + return s; +} + + +//-------------------------------------------------- +// Sends an MSSP request to sign this data +// pMssp - pointer to MSSP context structure +// szPhoneNo - phone number on which to sign +// pHash - pointer to binary hash to sign +// nHashLen - length of hash data +// szDesc - description what user is signing (file name) +// returns error code or SOAP_OK +//-------------------------------------------------- +EXP_OPTION int ddocMsspSignatureReq(MSSP* pMssp, const char* szPhoneNo, + const char* pHash, int nHashLen, const char* szDesc) +{ + int err = SOAP_OK; + unsigned long lTimeout; + int nMsgMode, nB64HashLen, nB64ManifestLen; + struct mss__AP_InfoType apInfo; + struct mss__MSSP_InfoType msspInfo; + struct mss__MobileUserType mu; + struct mss__DataType DataToBeSigned, DataToBeDisplayed; + struct mss__MSS_USCORESignatureResp resp; + char szTimestamp[30], szTxnId[20], *pBase64Hash = 0, *pBase64Manifest = 0; + + RETURN_IF_NULL_PARAM(pMssp); + RETURN_IF_NULL_PARAM(szPhoneNo); + RETURN_IF_NULL_PARAM(pHash); + ddocDebug(3, "ddocMsspSignatureReq", "Signing: %s on phone: %s", + szDesc, szPhoneNo); + // init parameters + time(&pMssp->lApTxnId); + sprintf(szTxnId, "%ld", pMssp->lApTxnId); + createTimestamp(0, szTimestamp, sizeof(szTimestamp)); + apInfo.AP_USCOREID = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_USERID"); + apInfo.AP_USCORETransID = szTxnId; + apInfo.AP_USCOREPWD = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_PASSWD"); + apInfo.Instant = szTimestamp; + apInfo.AP_USCOREURL = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); + msspInfo.MSSP_USCOREID.mss__DNSName = 0; + msspInfo.MSSP_USCOREID.mss__IPAddress = 0; + msspInfo.MSSP_USCOREID.mss__IdentifierString = 0; + msspInfo.MSSP_USCOREID.mss__URI = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); + msspInfo.Instant = szTimestamp; + mu.mss__IdentityIssuer.mss__DNSName = 0; + mu.mss__IdentityIssuer.mss__IPAddress = 0; + mu.mss__IdentityIssuer.mss__URI = 0; + mu.mss__IdentityIssuer.mss__IdentifierString = 0; + mu.mss__UserIdentifier = 0; + mu.mss__HomeMSSP.mss__URI = 0; + mu.mss__HomeMSSP.mss__IPAddress = 0; + mu.mss__HomeMSSP.mss__DNSName = 0; + mu.mss__HomeMSSP.mss__IdentifierString = 0; + mu.mss__MSISDN = (char*)szPhoneNo; + nB64HashLen = nHashLen * 2 + 10; + pBase64Hash = (char*)malloc(nB64HashLen); + if(pBase64Hash) + encode((const byte*)pHash, nHashLen, (byte*)pBase64Hash, &nB64HashLen); + DataToBeSigned.__item = pBase64Hash; + DataToBeSigned.mss__MimeType = "Base64"; + DataToBeSigned.mss__Encoding = "UTF8"; + nB64ManifestLen = strlen(szDesc) * 2 + 10; + pBase64Manifest = (char*)malloc(nB64ManifestLen); + if(pBase64Manifest) { + memset(pBase64Manifest, 0, nB64ManifestLen); + encode((const byte*)szDesc, strlen(szDesc), (byte*)pBase64Manifest, &nB64ManifestLen); + } + DataToBeDisplayed.__item = pBase64Manifest; + DataToBeDisplayed.mss__MimeType = "Base64"; + DataToBeDisplayed.mss__Encoding = "UTF8"; + lTimeout = ConfigItem_lookup_int("DIGIDOC_MSSP_TIMEOUT", 0); + nMsgMode = ConfigItem_lookup_int("DIGIDOC_MSSP_MSG_MODE", 0); + + // reconnect if necessary + err = ddocMsspReconnect(pMssp); + // send MSSP request + ddocDebug(3, "ddocMsspSignatureReq", "Sending request!"); + memset(&resp, 0, sizeof(resp)); + err = soap_call_mss__MSS_USCORESignatureReq(&(pMssp->soap), + (const char*)pMssp->endpoint, "", + ConfigItem_lookup_int("DIGIDOC_MSSP_MAJOR", 0), + ConfigItem_lookup_int("DIGIDOC_MSSP_MINOR", 0), + 0, // no validity date, we use timeout instead + (lTimeout ? &lTimeout : 0), + (enum mss__MessagingModeType)nMsgMode, + apInfo,msspInfo, mu, + DataToBeSigned, &DataToBeDisplayed, + 0, 0, 0, 0, &resp); + ddocDebug(3, "ddocMsspSignatureReq", "Sent RC: %d err: %d", err, pMssp->soap.error); + // report error or success + if(err) { + ddocDebug(3, "ddocMsspSignatureReq", "RC: %d err: %d", + err, pMssp->soap.error); + } else { + ddocDebug(3, "ddocMsspSignatureReq", "RC: %d err: %d Status: %d - %s message: %s detail: %s trans-id: %ld", + err, pMssp->soap.error, resp.Status.StatusCode.Value, + (resp.Status.StatusCode.__item ? resp.Status.StatusCode.__item : ""), + (resp.Status.StatusMessage ? resp.Status.StatusMessage : ""), + (resp.Status.StatusDetail ? resp.Status.StatusDetail : ""), + (unsigned long)resp.MSSP_USCORETransID); + } + if(err) { + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultCode(pMssp)); + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultString(pMssp)); + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultDetail(pMssp)); + soap_print_fault(&(pMssp->soap), stdout); + } + pMssp->lMsspTxnId = (unsigned long)resp.MSSP_USCORETransID; + pMssp->nStatusCode = resp.Status.StatusCode.Value; + //pMssp->endpoint = NULL; // force reconnect + ddocMsspCleanup(pMssp); + // cleanup + free(pBase64Hash); + free(pBase64Manifest); + if(err != SOAP_OK) + err = ERR_GENERIC_SOAP_ERR; + return err; +} + + +//-------------------------------------------------- +// Sends an MSSP request to find the status of signature +// operation and possibly it's value +// pMssp - pointer to MSSP context structure +// pMbufSignature - memory buffer to store signature value +// returns error code or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddocMsspStatusReq(MSSP* pMssp, DigiDocMemBuf* pMbufSignature) +{ + int err = ERR_OK; + struct mss__AP_InfoType apInfo; + struct mss__MSSP_InfoType msspInfo; + struct mss__MSS_USCOREStatusResp resp; + char szTimestamp[30], szTxnId[20], *pBase64Hash = 0; + + RETURN_IF_NULL_PARAM(pMssp); + RETURN_IF_NULL_PARAM(pMbufSignature); + ddocDebug(3, "ddocMsspStatusReq", "Request status of txn: %ld", pMssp->lMsspTxnId); + // init parameters + time(&pMssp->lApTxnId); + sprintf(szTxnId, "%ld", pMssp->lApTxnId); + createTimestamp(0, szTimestamp, sizeof(szTimestamp)); + apInfo.AP_USCOREID = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_USERID"); + apInfo.AP_USCORETransID = szTxnId; + apInfo.AP_USCOREPWD = (char*)ConfigItem_lookup("DIGIDOC_MSSP_AP_PASSWD"); + apInfo.Instant = szTimestamp; + apInfo.AP_USCOREURL = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); + msspInfo.MSSP_USCOREID.mss__DNSName = 0; + msspInfo.MSSP_USCOREID.mss__IPAddress = 0; + msspInfo.MSSP_USCOREID.mss__IdentifierString = 0; + msspInfo.MSSP_USCOREID.mss__URI = (char*)ConfigItem_lookup("DIGIDOC_MSSP_URL"); + msspInfo.Instant = szTimestamp; + + // reconnect if necessary + err = ddocMsspReconnect(pMssp); + // send MSSP request + ddocDebug(3, "ddocMsspStatusReq", "Sending request!"); + memset(&resp, 0, sizeof(resp)); + err = soap_call_mss__MSS_USCOREStatusReq(&(pMssp->soap), + (const char*)pMssp->endpoint, "", + ConfigItem_lookup_int("DIGIDOC_MSSP_MAJOR", 0), + ConfigItem_lookup_int("DIGIDOC_MSSP_MINOR", 0), + apInfo, msspInfo, pMssp->lMsspTxnId, &resp); + // report error or success + if(!err) { + pMssp->nStatusCode = resp.Status.StatusCode.Value; + ddocDebug(3, "ddocMsspStatusReq", "RC: %d Status: %d - %s message: %s detail: %s", + err, resp.Status.StatusCode.Value, + (resp.Status.StatusCode.__item ? resp.Status.StatusCode.__item : ""), + (resp.Status.StatusMessage ? resp.Status.StatusMessage : ""), + (resp.Status.StatusDetail ? resp.Status.StatusDetail : "")); + } else { + ddocDebug(3, "ddocMsspStatusReq", "RC: %d - no status", err); + if (err == 1) {// a soap_sender_fault from mssp_gw + ddocDebug(3, "ddocMsspSatusReq", "Expired transaction"); + pMssp->nStatusCode = EXPIRED_TRANSACTION; + err = SOAP_OK; + } else // transport problem + pMssp->nStatusCode = INTERNAL_ERROR; + } + if(err) { + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultCode(pMssp)); + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultString(pMssp)); + addError(ERR_GENERIC_SOAP_ERR, __FILE__, __LINE__, ddocGetSoapFaultDetail(pMssp)); + soap_print_fault(&(pMssp->soap), stdout); + } + + // get signature value if it exists + if(err == SOAP_OK && resp.MSS_USCORESignature && + resp.MSS_USCORESignature->Base64Signature && + resp.MSS_USCORESignature->Base64Signature->__ptr && + resp.MSS_USCORESignature->Base64Signature->__size) { + ddocDebug(3, "ddocMsspStatusReq", "Received signature value of %d bytes", + resp.MSS_USCORESignature->Base64Signature->__size); + ddocMemAssignData(pMbufSignature, + (const char*)resp.MSS_USCORESignature->Base64Signature->__ptr, + resp.MSS_USCORESignature->Base64Signature->__size); + } + //pMssp->endpoint = NULL; // force reconnect + ddocMsspCleanup(pMssp); + if(err != SOAP_OK) + err = ERR_GENERIC_SOAP_ERR; + return err; +} + +char * g_szCertPrefix = "-----BEGIN CERTIFICATE-----"; +char * g_szCertSuffix = "-----END CERTIFICATE-----"; + +//-------------------------------------------------- +// Reads the signers certificate based on the signers +// phone number. +// szPhoneNo - phone number +// szCertUrl - full url where to get cert. Use NULL for default url +// ppCert - address to store the certificate +// bAuthCert - 1=auth cert, 0=sign cert +// returns error coder or ERR_OK +//-------------------------------------------------- +EXP_OPTION int ddocMsspReadCertificate(const char* szPhoneNo, const char* szCertUrl, + X509 **ppCert, int bAuthCert) +{ + int err = ERR_OK; + DigiDocMemBuf mbuf1, mbuf2; + char *p1, *p2, *p3; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + *ppCert = 0; + RETURN_IF_NULL_PARAM(szPhoneNo); + ddocDebug(3, "ddocMsspReadCertificate", "Read certificate for No: %s auth: %d url: %s", + szPhoneNo, bAuthCert, (szCertUrl ? szCertUrl : "NULL")); + p3 = (char*)ConfigItem_lookup("DIGIDOC_MSSP_CERT_URL_HOST"); + p1 = (char*)ConfigItem_lookup("DIGIDOC_PROXY_HOST"); + p2 = (char*)ConfigItem_lookup("DIGIDOC_PROXY_PORT"); + ddocMemAssignData(&mbuf1, "GET ", -1); + // if URL was given then use it + if(szCertUrl && strlen(szCertUrl)) { + ddocMemAppendData(&mbuf1, szCertUrl, -1); + } else { // compose default cert url based on phone no + if(p1 || p2) // if we use proxy then send the full URL of cert + ddocMemAppendData(&mbuf1, ConfigItem_lookup("DIGIDOC_MSSP_CERT_URL_HOST"), -1); + ddocMemAppendData(&mbuf1, ConfigItem_lookup((bAuthCert == 1) ? + "DIGIDOC_MSSP_AUTH_CERT_DIR" : "DIGIDOC_MSSP_SIGN_CERT_DIR"), -1); + ddocMemAppendData(&mbuf1, szPhoneNo, -1); + ddocMemAppendData(&mbuf1, ".pem", -1); + } + ddocMemAppendData(&mbuf1, " HTTP/1.0\r\n", -1); + ddocMemAppendData(&mbuf1, "User-Agent: cdigidoc\r\n", -1); + ddocMemAppendData(&mbuf1, "Host: www.sk.ee\r\n", -1); + ddocMemAppendData(&mbuf1, "Accept: */*\r\n", -1); + ddocMemAppendData(&mbuf1, "Connection: Close\r\n", -1); + if(p1 || p2) // if we use proxy then send also Proxy-Connection + ddocMemAppendData(&mbuf1, "Proxy-Connection: Close\r\n", -1); + ddocMemAppendData(&mbuf1, "\r\n", -1); + ddocDebug(4, "ddocMsspReadCertificate", "Send to host: %s request:\n------\n%s\n------\n", + p3, (char*)mbuf1.pMem); + err = ddocPullUrl(p3, &mbuf1, &mbuf2, p1, p2); + ddocDebug(4, "ddocMsspReadCertificate", "RC: %d RECEIVED: %d bytes\n-----------------------------------\n%s\n-----------------------------------", err, mbuf2.nLen, (const char*)mbuf2.pMem); + if(!err && mbuf2.pMem && mbuf2.nLen) { + p1 = strstr((char*)mbuf2.pMem, g_szCertPrefix); + if(p1) { + p1 += strlen(g_szCertPrefix); + while(*p1 && !isalnum(*p1)) p1++; + p2 = strstr(p1, g_szCertSuffix); + if(p2) { + *p2 = 0; + err = ddocDecodeX509PEMData(ppCert, p1, strlen(p1)); + ddocDebug(3, "ddocMsspReadCertificate", "Decoding cert rc: %d - %s ", + err, (*ppCert ? "OK" : "ERROR")); + } + } + } + // cleanup + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + RETURN_IF_NOT(*ppCert, ERR_CERT_READ); + return err; +} + diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/MsspErrors.h libdigidoc-3.7.0.875/libdigidoc/mssp/MsspErrors.h --- libdigidoc-2.7.0/libdigidoc/mssp/MsspErrors.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/MsspErrors.h 2012-12-13 22:05:47.000000000 +0000 @@ -53,7 +53,28 @@ #define ERROR_CERTIFICATE_DESC "Error during the Certificate verification. The platform does not assume if the certificate is revoked or not" #define INTERNAL_ERROR 900 #define INTERNAL_ERROR_CODE "INTERNAL_ERROR" -#define INTERNAL_ERROR_DESC "Unknown Error" +#define INTERNAL_ERROR_DESC "Unknown Error" + +/* Added by priitr */ +#define PHONE_ABSENT 426 +#define PHONE_ABSENT_CODE "PHONE_ABSENT" +#define PHONE_ABSENT_DESC "Phone unreachable" + +#define MID_NOT_READY 427 +#define MID_NOT_READY_CODE "MID_NOT_READY" +#define MID_NOT_READY_DESC "Mobile-ID is not yet usable. Try again in 15 minute" + +#define SENDING_ERROR 428 +#define SENDING_ERROR_CODE "SENDING_ERROR" +#define SENDING_ERROR_DESC "Sending failed" + +#define PHONE_TIMEOUT 429 +#define PHONE_TIMEOUT_CODE "PHONE_TIMEOUT" +#define PHONE_TIMEOUT_DESC "Phone did not answer within specified time limit" + +#define SIM_ERROR 430 +#define SIM_ERROR_CODE "SIM_ERROR" +#define SIM_ERROR_DESC "Error in SIM application" #define USER_SIGN 400 #define USER_SIGN_CODE "USER_SIGN" diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/soapC.c libdigidoc-3.7.0.875/libdigidoc/mssp/soapC.c --- libdigidoc-2.7.0/libdigidoc/mssp/soapC.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/soapC.c 2012-12-13 22:05:47.000000000 +0000 @@ -1,6 +1,6 @@ /* soapC.c - Generated by gSOAP 2.7.9b from /home/veiko/MSSP_GW/src/MSSP_GW.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. + Generated by gSOAP 2.7.8c from /home/veiko/MSSP_GW/src/MSSP_GW.h + Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. */ @@ -10,7 +10,7 @@ extern "C" { #endif -SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.9b 2007-01-13 14:49:33 GMT") +SOAP_SOURCE_STAMP("@(#) soapC.c ver 2.7.8c 2006-09-10 11:49:51 GMT") #ifndef WITH_NOGLOBAL @@ -406,7 +406,7 @@ return s ? *s : NULL; } t = soap->tag; - if (!soap_match_tag(soap, t, "xsd:QName")) + if (!soap_match_tag(soap, t, "QName")) { char **s; *type = SOAP_TYPE__QName; s = soap_in__QName(soap, NULL, NULL, NULL); @@ -560,7 +560,7 @@ case SOAP_TYPE_xsd__string: return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:string"); case SOAP_TYPE__QName: - return soap_out_string(soap, "xsd:QName", id, (char**)&ptr, NULL); + return soap_out_string(soap, "QName", id, (char**)&ptr, NULL); case SOAP_TYPE_string: return soap_out_string(soap, tag, id, (char**)&ptr, "xsd:string"); } @@ -1107,7 +1107,7 @@ return NULL; } else - { a = (enum mss__MessagingModeType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MessagingModeType, 0, sizeof(enum mss__MessagingModeType), 0, NULL); + { a = (enum mss__MessagingModeType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MessagingModeType, 0, sizeof(enum mss__MessagingModeType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1187,7 +1187,7 @@ return NULL; } else - { a = (enum mss__SignatureProfileComparisonType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__SignatureProfileComparisonType, 0, sizeof(enum mss__SignatureProfileComparisonType), 0, NULL); + { a = (enum mss__SignatureProfileComparisonType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__SignatureProfileComparisonType, 0, sizeof(enum mss__SignatureProfileComparisonType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1325,7 +1325,7 @@ return NULL; } else - { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); + { a = (struct SOAP_ENV__Fault *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_SOAP_ENV__Fault, 0, sizeof(struct SOAP_ENV__Fault), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1400,7 +1400,7 @@ return NULL; } else - { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); + { a = (struct SOAP_ENV__Reason *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_SOAP_ENV__Reason, 0, sizeof(struct SOAP_ENV__Reason), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1483,7 +1483,7 @@ return NULL; } else - { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); + { a = (struct SOAP_ENV__Detail *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_SOAP_ENV__Detail, 0, sizeof(struct SOAP_ENV__Detail), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1567,7 +1567,7 @@ return NULL; } else - { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); + { a = (struct SOAP_ENV__Code *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_SOAP_ENV__Code, 0, sizeof(struct SOAP_ENV__Code), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1637,7 +1637,7 @@ return NULL; } else - { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); + { a = (struct SOAP_ENV__Header *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_SOAP_ENV__Header, 0, sizeof(struct SOAP_ENV__Header), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1746,7 +1746,7 @@ return NULL; } else - { a = (struct mss__MSS_USCOREStatusReq *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSS_USCOREStatusReq, 0, sizeof(struct mss__MSS_USCOREStatusReq), 0, NULL); + { a = (struct mss__MSS_USCOREStatusReq *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MSS_USCOREStatusReq, 0, sizeof(struct mss__MSS_USCOREStatusReq), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -1863,7 +1863,7 @@ return NULL; } else - { a = (struct mss__MSS_USCOREStatusResp *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSS_USCOREStatusResp, 0, sizeof(struct mss__MSS_USCOREStatusResp), 0, NULL); + { a = (struct mss__MSS_USCOREStatusResp *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MSS_USCOREStatusResp, 0, sizeof(struct mss__MSS_USCOREStatusResp), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2033,7 +2033,7 @@ return NULL; } else - { a = (struct mss__MSS_USCORESignatureReq *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSS_USCORESignatureReq, 0, sizeof(struct mss__MSS_USCORESignatureReq), 0, NULL); + { a = (struct mss__MSS_USCORESignatureReq *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MSS_USCORESignatureReq, 0, sizeof(struct mss__MSS_USCORESignatureReq), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2166,7 +2166,7 @@ return NULL; } else - { a = (struct mss__MSS_USCORESignatureResp *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSS_USCORESignatureResp, 0, sizeof(struct mss__MSS_USCORESignatureResp), 0, NULL); + { a = (struct mss__MSS_USCORESignatureResp *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MSS_USCORESignatureResp, 0, sizeof(struct mss__MSS_USCORESignatureResp), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2253,7 +2253,7 @@ return NULL; } else - { a = (struct mss__SignatureType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__SignatureType, 0, sizeof(struct mss__SignatureType), 0, NULL); + { a = (struct mss__SignatureType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__SignatureType, 0, sizeof(struct mss__SignatureType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2344,7 +2344,7 @@ return NULL; } else - { a = (struct mss__StatusType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__StatusType, 0, sizeof(struct mss__StatusType), 0, NULL); + { a = (struct mss__StatusType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__StatusType, 0, sizeof(struct mss__StatusType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2489,7 +2489,7 @@ return NULL; } else - { a = (struct mss__KeyReferenceType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__KeyReferenceType, 0, sizeof(struct mss__KeyReferenceType), 0, NULL); + { a = (struct mss__KeyReferenceType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__KeyReferenceType, 0, sizeof(struct mss__KeyReferenceType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2569,7 +2569,7 @@ return NULL; } else - { a = (struct mss__MSSP_InfoType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MSSP_InfoType, 0, sizeof(struct mss__MSSP_InfoType), 0, NULL); + { a = (struct mss__MSSP_InfoType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MSSP_InfoType, 0, sizeof(struct mss__MSSP_InfoType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2656,7 +2656,7 @@ return NULL; } else - { a = (struct mss__AP_InfoType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__AP_InfoType, 0, sizeof(struct mss__AP_InfoType), 0, NULL); + { a = (struct mss__AP_InfoType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__AP_InfoType, 0, sizeof(struct mss__AP_InfoType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2735,7 +2735,7 @@ return NULL; } else - { a = (struct mss__mssURIType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__mssURIType, 0, sizeof(struct mss__mssURIType), 0, NULL); + { a = (struct mss__mssURIType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__mssURIType, 0, sizeof(struct mss__mssURIType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2819,7 +2819,7 @@ return NULL; } else - { a = (struct mss__DigestAlgAndValueType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__DigestAlgAndValueType, 0, sizeof(struct mss__DigestAlgAndValueType), 0, NULL); + { a = (struct mss__DigestAlgAndValueType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__DigestAlgAndValueType, 0, sizeof(struct mss__DigestAlgAndValueType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2886,7 +2886,7 @@ return NULL; } else - { a = (struct DigestMethodType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_DigestMethodType, 0, sizeof(struct DigestMethodType), 0, NULL); + { a = (struct DigestMethodType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_DigestMethodType, 0, sizeof(struct DigestMethodType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -2985,7 +2985,7 @@ return NULL; } else - { a = (struct mss__MobileUserType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MobileUserType, 0, sizeof(struct mss__MobileUserType), 0, NULL); + { a = (struct mss__MobileUserType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MobileUserType, 0, sizeof(struct mss__MobileUserType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -3080,7 +3080,7 @@ return NULL; } else - { a = (struct mss__MeshMemberType *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_mss__MeshMemberType, 0, sizeof(struct mss__MeshMemberType), 0, NULL); + { a = (struct mss__MeshMemberType *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_mss__MeshMemberType, 0, sizeof(struct mss__MeshMemberType), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } @@ -3200,7 +3200,7 @@ return NULL; } else - { a = (struct xsd__base64Binary *)soap_id_forward(soap, soap->href, (void*)a, 0, SOAP_TYPE_xsd__base64Binary, 0, sizeof(struct xsd__base64Binary), 0, NULL); + { a = (struct xsd__base64Binary *)soap_id_forward(soap, soap->href, (void**)a, 0, SOAP_TYPE_xsd__base64Binary, 0, sizeof(struct xsd__base64Binary), 0, NULL); if (soap->body && soap_element_end_in(soap, tag)) return NULL; } diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/soapClient.c libdigidoc-3.7.0.875/libdigidoc/mssp/soapClient.c --- libdigidoc-2.7.0/libdigidoc/mssp/soapClient.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/soapClient.c 2012-12-13 22:05:47.000000000 +0000 @@ -1,6 +1,6 @@ /* soapClient.c - Generated by gSOAP 2.7.9b from /home/veiko/MSSP_GW/src/MSSP_GW.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. + Generated by gSOAP 2.7.8c from /home/veiko/MSSP_GW/src/MSSP_GW.h + Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. */ @@ -9,7 +9,7 @@ extern "C" { #endif -SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.9b 2007-01-13 14:49:33 GMT") +SOAP_SOURCE_STAMP("@(#) soapClient.c ver 2.7.8c 2006-09-10 11:49:51 GMT") SOAP_FMAC5 int SOAP_FMAC6 soap_call_mss__MSS_USCORESignatureReq(struct soap *soap, const char *soap_endpoint, const char *soap_action, unsigned long MajorVersion, unsigned long MinorVersion, char *ValidityDate, unsigned long *TimeOut, enum mss__MessagingModeType MessagingMode, struct mss__AP_InfoType AP_USCOREInfo, struct mss__MSSP_InfoType MSSP_USCOREInfo, struct mss__MobileUserType MobileUser, struct mss__DataType DataToBeSigned, struct mss__DataType *DataToBeDisplayed, struct mss__mssURIType *SignatureProfile, struct mss__mssURIType *mssFormat, struct mss__KeyReferenceType *KeyReference, enum mss__SignatureProfileComparisonType *mss__SignatureProfileComparison, struct mss__MSS_USCORESignatureResp *resp) diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/soapClientLib.c libdigidoc-3.7.0.875/libdigidoc/mssp/soapClientLib.c --- libdigidoc-2.7.0/libdigidoc/mssp/soapClientLib.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/soapClientLib.c 2012-12-13 22:05:47.000000000 +0000 @@ -1,6 +1,6 @@ /* soapClientLib.c - Generated by gSOAP 2.7.9b from /home/veiko/MSSP_GW/src/MSSP_GW.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. + Generated by gSOAP 2.7.8c from /home/veiko/MSSP_GW/src/MSSP_GW.h + Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. */ diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/soapH.h libdigidoc-3.7.0.875/libdigidoc/mssp/soapH.h --- libdigidoc-2.7.0/libdigidoc/mssp/soapH.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/soapH.h 2012-12-13 22:05:47.000000000 +0000 @@ -1,6 +1,6 @@ /* soapH.h - Generated by gSOAP 2.7.9b from /home/veiko/MSSP_GW/src/MSSP_GW.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. + Generated by gSOAP 2.7.8c from /home/veiko/MSSP_GW/src/MSSP_GW.h + Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. */ diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/soapStub.h libdigidoc-3.7.0.875/libdigidoc/mssp/soapStub.h --- libdigidoc-2.7.0/libdigidoc/mssp/soapStub.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/soapStub.h 2012-12-13 22:05:47.000000000 +0000 @@ -1,6 +1,6 @@ /* soapStub.h - Generated by gSOAP 2.7.9b from /home/veiko/MSSP_GW/src/MSSP_GW.h - Copyright(C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. + Generated by gSOAP 2.7.8c from /home/veiko/MSSP_GW/src/MSSP_GW.h + Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc. All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. */ @@ -260,7 +260,7 @@ /* SOAP Fault Code: */ struct SOAP_ENV__Code { - char *SOAP_ENV__Value; /* optional element of type xsd:QName */ + char *SOAP_ENV__Value; /* optional element of type QName */ struct SOAP_ENV__Code *SOAP_ENV__Subcode; /* optional element of type SOAP-ENV:Code */ }; #endif @@ -290,7 +290,7 @@ /* SOAP Fault: */ struct SOAP_ENV__Fault { - char *faultcode; /* optional element of type xsd:QName */ + char *faultcode; /* optional element of type QName */ char *faultstring; /* optional element of type xsd:string */ char *faultactor; /* optional element of type xsd:string */ struct SOAP_ENV__Detail *detail; /* optional element of type SOAP-ENV:Detail */ diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/stdsoap2.c libdigidoc-3.7.0.875/libdigidoc/mssp/stdsoap2.c --- libdigidoc-2.7.0/libdigidoc/mssp/stdsoap2.c 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/stdsoap2.c 2012-12-13 22:05:47.000000000 +0000 @@ -1,11 +1,11 @@ /* -stdsoap2.c[pp] 2.7.9 +stdsoap2.c[pp] 2.7.9b gSOAP runtime gSOAP XML Web services tools -Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. -------------------------------------------------------------------------------- @@ -25,7 +25,7 @@ for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Robert A. van Engelen. -Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved. -------------------------------------------------------------------------------- GPL license. @@ -72,10 +72,10 @@ #endif #ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9 2006-10-24 12:00:00 GMT") +SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9b 2007-01-01 12:00:00 GMT") extern "C" { #else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9 2006-10-24 12:00:00 GMT") +SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9 2007-01-01 12:00:00 GMT") #endif /* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale with multibyte support enabled) */ @@ -92,7 +92,8 @@ #define soap_blank(c) ((c) >= 0 && (c) <= 32) #define soap_notblank(c) ((c) > 32) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) + +#define soap_hash_ptr(p) ((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1))) #ifdef SOAP_DEBUG static void soap_init_logs(struct soap*); @@ -131,7 +132,6 @@ static const char *soap_set_validation_fault(struct soap*, const char*, const char*); static int soap_isnumeric(struct soap*, const char*); static time_t soap_timegm(struct tm*); -static struct soap_nlist *soap_lookup_ns(struct soap *soap, const char *tag, size_t n); static struct soap_nlist *soap_push_ns(struct soap *soap, const char *id, const char *ns, short utilized); static void soap_pop_ns(struct soap *soap); static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n); @@ -1197,12 +1197,12 @@ SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 -soap_code(const struct soap_code_map *map, const char *str) -{ if (map && str) - { while (map->string) - { if (!strcmp(str, map->string)) /* case sensitive */ - return map; - map++; +soap_code(const struct soap_code_map *code_map, const char *str) +{ if (code_map && str) + { while (code_map->string) + { if (!strcmp(str, code_map->string)) /* case sensitive */ + return code_map; + code_map++; } } return NULL; @@ -1214,12 +1214,12 @@ SOAP_FMAC1 long SOAP_FMAC2 -soap_code_int(const struct soap_code_map *map, const char *str, long other) -{ if (map) - { while (map->string) - { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ - return map->code; - map++; +soap_code_int(const struct soap_code_map *code_map, const char *str, long other) +{ if (code_map) + { while (code_map->string) + { if (!soap_tag_cmp(str, code_map->string)) /* case insensitive */ + return code_map->code; + code_map++; } } return other; @@ -1231,12 +1231,12 @@ SOAP_FMAC1 const char* SOAP_FMAC2 -soap_code_str(const struct soap_code_map *map, long code) -{ if (!map) +soap_code_str(const struct soap_code_map *code_map, long code) +{ if (!code_map) return NULL; - while (map->code != code && map->string) - map++; - return map->string; + while (code_map->code != code && code_map->string) + code_map++; + return code_map->string; } #endif @@ -1245,12 +1245,12 @@ SOAP_FMAC1 long SOAP_FMAC2 -soap_code_bits(const struct soap_code_map *map, const char *str) +soap_code_bits(const struct soap_code_map *code_map, const char *str) { register long bits = 0; - if (map) + if (code_map) { while (str && *str) { const struct soap_code_map *p; - for (p = map; p->string; p++) + for (p = code_map; p->string; p++) { register size_t n = strlen(p->string); if (!strncmp(p->string, str, n) && soap_blank(str[n])) { bits |= p->code; @@ -1273,12 +1273,12 @@ SOAP_FMAC1 const char* SOAP_FMAC2 -soap_code_list(struct soap *soap, const struct soap_code_map *map, long code) +soap_code_list(struct soap *soap, const struct soap_code_map *code_map, long code) { register char *t = soap->tmpbuf; - if (map) - { while (map->string) - { if (map->code & code) - { register const char *s = map->string; + if (code_map) + { while (code_map->string) + { if (code_map->code & code) + { register const char *s = code_map->string; if (t != soap->tmpbuf) *t++ = ' '; while (*s && t < soap->tmpbuf + sizeof(soap->tmpbuf) - 1) @@ -1286,7 +1286,7 @@ if (t == soap->tmpbuf + sizeof(soap->tmpbuf) - 1) break; } - map++; + code_map++; } } *t = '\0'; @@ -2779,9 +2779,8 @@ soap->cafile = cafile; soap->capath = capath; soap->dhfile = dhfile; - soap->rsa = (dhfile == NULL); soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); + soap->ssl_flags = flags | (dhfile == NULL ? SOAP_SSL_RSA : 0); if (!(err = soap->fsslauth(soap))) { if (sid) SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, strlen(sid)); @@ -2801,9 +2800,8 @@ soap->cafile = cafile; soap->capath = capath; soap->dhfile = NULL; - soap->rsa = 0; + soap->ssl_flags = flags; soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); return soap->fsslauth(soap); } #endif @@ -2914,7 +2912,9 @@ #ifndef PALM_1 static int ssl_auth_init(struct soap *soap) -{ if (!ssl_init_done) +{ long flags; + int mode; + if (!ssl_init_done) soap_ssl_init(); if (!soap->ctx) { if (!(soap->ctx = SSL_CTX_new(SSLv23_method()))) @@ -2927,12 +2927,12 @@ if (soap->cafile || soap->capath) { if (!SSL_CTX_load_verify_locations(soap->ctx, soap->cafile, soap->capath)) return soap_set_receiver_error(soap, "SSL error", "Can't read CA file and directory", SOAP_SSL_ERROR); - if (soap->cafile && soap->require_client_auth) + if (soap->cafile && (soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) SSL_CTX_set_client_CA_list(soap->ctx, SSL_load_client_CA_file(soap->cafile)); } if (!SSL_CTX_set_default_verify_paths(soap->ctx)) return soap_set_receiver_error(soap, "SSL error", "Can't read default CA file and/or directory", SOAP_SSL_ERROR); -/* See below */ +/* This code assumes a typical scenario, see alternative code below */ if (soap->keyfile) { if (!SSL_CTX_use_certificate_chain_file(soap->ctx, soap->keyfile)) return soap_set_receiver_error(soap, "SSL error", "Can't read certificate key file", SOAP_SSL_ERROR); @@ -2957,7 +2957,7 @@ } } */ - if (soap->rsa) + if ((soap->ssl_flags & SOAP_SSL_RSA)) { RSA *rsa = RSA_generate_key(1024, RSA_F4, NULL, NULL); if (!SSL_CTX_set_tmp_rsa(soap->ctx, rsa)) { if (rsa) @@ -2981,8 +2981,19 @@ } DH_free(dh); } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, soap->fsslverify); + flags = (SSL_OP_ALL | SSL_OP_NO_SSLv2); + if ((soap->ssl_flags & SOAP_SSLv3)) + flags |= SSL_OP_NO_TLSv1; + if ((soap->ssl_flags & SOAP_TLSv1)) + flags |= SSL_OP_NO_SSLv3; + SSL_CTX_set_options(soap->ctx, flags); + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) + mode = (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT); + else if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) + mode = SSL_VERIFY_PEER; + else + mode = SSL_VERIFY_NONE; + SSL_CTX_set_verify(soap->ctx, mode, soap->fsslverify); #if (OPENSSL_VERSION_NUMBER < 0x00905100L) SSL_CTX_set_verify_depth(soap->ctx, 1); #else @@ -3090,7 +3101,7 @@ soap_closesock(soap); return SOAP_SSL_ERROR; } - if (soap->require_client_auth) + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION)) { X509 *peer; int err; if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) @@ -3144,6 +3155,7 @@ #endif if (soap_check_state(soap)) return; + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Done with context\n")); soap_free_temp(soap); while (soap->clist) { struct soap_clist *p = soap->clist->next; @@ -3784,74 +3796,94 @@ fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); #endif #endif - if (soap->require_server_auth) - { X509 *peer; - X509_NAME *subj; - int ext_count; - int err; - int ok = 0; + if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) + { int err; + // TODO: add callback to verify server if ((err = SSL_get_verify_result(soap->ssl)) != X509_V_OK) { soap_set_sender_error(soap, X509_verify_cert_error_string(err), "SSL certificate presented by peer cannot be verified in tcp_connect()", SOAP_SSL_ERROR); soap->fclosesocket(soap, (SOAP_SOCKET)fd); return SOAP_INVALID_SOCKET; } - peer = SSL_get_peer_certificate(soap->ssl); - if (!peer) - { soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - ext_count = X509_get_ext_count(peer); - if (ext_count > 0) - { int i; - for (i = 0; i < ext_count; i++) - { X509_EXTENSION *ext = X509_get_ext(peer, i); - const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); - if (ext_str && !strcmp(ext_str, "subjectAltName")) - { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext); - void *ext_data; - unsigned char *data; - STACK_OF(CONF_VALUE) *val; - int j; - if (!meth) - break; - data = ext->value->data; + if (!(soap->ssl_flags & SOAP_SSL_SKIP_HOST_CHECK)) + { X509_NAME *subj; + int ext_count; + int ok = 0; + X509 *peer; + peer = SSL_get_peer_certificate(soap->ssl); + if (!peer) + { soap_set_sender_error(soap, "SSL error", "No SSL certificate was presented by the peer in tcp_connect()", SOAP_SSL_ERROR); + soap->fclosesocket(soap, (SOAP_SOCKET)fd); + return SOAP_INVALID_SOCKET; + } + ext_count = X509_get_ext_count(peer); + if (ext_count > 0) + { int i; + for (i = 0; i < ext_count; i++) + { X509_EXTENSION *ext = X509_get_ext(peer, i); + const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext))); + if (ext_str && !strcmp(ext_str, "subjectAltName")) + { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext); + void *ext_data; + unsigned char *data; + STACK_OF(CONF_VALUE) *val; + int j; + if (!meth) + break; + data = ext->value->data; #if (OPENSSL_VERSION_NUMBER > 0x00907000L) - if (meth->it) - ext_data = ASN1_item_d2i(NULL, &data, ext->value->length, ASN1_ITEM_ptr(meth->it)); - else - { /* OpenSSL not perfectly portable at this point (?): - Some compilers appear to prefer - meth->d2i(NULL, (const unsigned char**)&data, ... - */ - ext_data = meth->d2i(NULL, &data, ext->value->length); - } + if (meth->it) + ext_data = ASN1_item_d2i(NULL, &data, ext->value->length, ASN1_ITEM_ptr(meth->it)); + else + { /* OpenSSL not perfectly portable at this point (?): + Some compilers appear to prefer + meth->d2i(NULL, (const unsigned char**)&data, ... + */ + ext_data = meth->d2i(NULL, &data, ext->value->length); + } #else - ext_data = meth->d2i(NULL, &data, ext->value->length); + ext_data = meth->d2i(NULL, &data, ext->value->length); #endif - val = meth->i2v(meth, ext_data, NULL); - for (j = 0; j < sk_CONF_VALUE_num(val); j++) - { CONF_VALUE *nval = sk_CONF_VALUE_value(val, j); - if (nval && !strcmp(nval->name, "DNS") && !strcmp(nval->value, host)) - { ok = 1; - break; + val = meth->i2v(meth, ext_data, NULL); + for (j = 0; j < sk_CONF_VALUE_num(val); j++) + { CONF_VALUE *nval = sk_CONF_VALUE_value(val, j); + if (nval && !strcmp(nval->name, "DNS") && !strcmp(nval->value, host)) + { ok = 1; + break; + } } } + if (ok) + break; } - if (ok) - break; } - } - if (!ok && (subj = X509_get_subject_name(peer))) - { X509_NAME_get_text_by_NID(subj, NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - if (soap_tag_cmp(soap->msgbuf, host)) + if (!ok && (subj = X509_get_subject_name(peer))) + { int i = -1; + do + { ASN1_STRING *name; + i = X509_NAME_get_index_by_NID(subj, NID_commonName, i); + if (i == -1) + break; + name = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subj, i)); + if (name && !soap_tag_cmp((const char*)name, host)) + ok = 1; + else + { unsigned char *tmp = NULL; + ASN1_STRING_to_UTF8(&tmp, name); + if (tmp) + { if (!soap_tag_cmp((const char*)tmp, host)) + ok = 1; + OPENSSL_free(tmp); + } + } + } while (!ok); + } + X509_free(peer); + if (!ok) { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); soap->fclosesocket(soap, (SOAP_SOCKET)fd); - X509_free(peer); return SOAP_INVALID_SOCKET; } } - X509_free(peer); } #else soap->fclosesocket(soap, (SOAP_SOCKET)fd); @@ -4554,7 +4586,7 @@ int SOAP_FMAC2 soap_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, int n, int type, struct soap_plist **ppp) -{ register int h; +{ register size_t h; register struct soap_plist *pp; if (!soap->pblk || soap->pidx >= SOAP_PTRBLK) { register struct soap_pblk *pb = (struct soap_pblk*)SOAP_MALLOC(soap, sizeof(struct soap_pblk)); @@ -5191,7 +5223,7 @@ soap_track_malloc(struct soap *soap, const char *file, int line, size_t size) { register void *p = malloc(size); if (soap) - { register int h = soap_hash_ptr(p); + { register size_t h = soap_hash_ptr(p); register struct soap_mlist *mp = (struct soap_mlist*)malloc(sizeof(struct soap_mlist)); if (soap->fdebug[SOAP_INDEX_TEST]) DBGLOG(TEST, SOAP_MESSAGE(fdebug, "%s(%d): malloc(%lu) = %p\n", file, line, (unsigned long)size, p)); @@ -5212,7 +5244,7 @@ void SOAP_FMAC2 soap_track_free(struct soap *soap, const char *file, int line, void *p) -{ register int h = soap_hash_ptr(p); +{ register size_t h = soap_hash_ptr(p); register struct soap_mlist *mp; for (mp = soap->mht[h]; mp; mp = mp->next) if (mp->ptr == p) @@ -5236,7 +5268,7 @@ #ifdef SOAP_MEM_DEBUG static void soap_track_unlink(struct soap *soap, const void *p) -{ register int h = soap_hash_ptr(p); +{ register size_t h = soap_hash_ptr(p); register struct soap_mlist *mp; for (mp = soap->mht[h]; mp; mp = mp->next) if (mp->ptr == p) @@ -6256,9 +6288,7 @@ soap->bio = NULL; soap->ssl = NULL; soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; + soap->ssl_flags = SOAP_SSL_DEFAULT; soap->keyfile = NULL; soap->password = NULL; soap->dhfile = NULL; @@ -6288,9 +6318,6 @@ #ifdef SOAP_DEBUG soap_init_mht(soap); soap_init_logs(soap); - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, NULL); #endif #ifdef WMW_RPM_IO soap->rpmreqid = NULL; @@ -6302,10 +6329,13 @@ soap_init_iht(soap); soap_init_pht(soap); #endif - soap_begin(soap); #ifdef SOAP_DEBUG + soap_set_recv_logfile(soap, "RECV.log"); + soap_set_sent_logfile(soap, "SENT.log"); soap_set_test_logfile(soap, "TEST.log"); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); #endif + soap_begin(soap); } #endif @@ -6337,7 +6367,7 @@ void SOAP_FMAC2 soap_begin(struct soap *soap) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing\n")); +{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reinitializing context\n")); if (!soap->keep_alive) { soap->buflen = 0; soap->bufidx = 0; @@ -6501,7 +6531,10 @@ /******************************************************************************/ #ifndef WITH_LEAN -static struct soap_nlist * +#ifndef PALM_1 +SOAP_FMAC1 +struct soap_nlist * +SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n) { register struct soap_nlist *np; for (np = soap->nlist; np; np = np->next) @@ -6511,6 +6544,7 @@ return NULL; } #endif +#endif /******************************************************************************/ #ifndef WITH_LEAN @@ -6520,19 +6554,19 @@ size_t n, k; if (soap_strsearch(soap->c14nexclude, id)) return NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns?ns:"")); if (!utilized) { for (np = soap->nlist; np; np = np->next) { if (!strcmp(np->id, id) && (!np->ns || !strcmp(np->ns, ns))) break; } if (np) - { if (np->index == 1) - utilized = np->index; + { if ((np->level < soap->level || !np->ns) && np->index == 1) + utilized = 1; else return NULL; } } + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Adding namespace binding (level=%u) '%s' '%s' utilized=%d\n", soap->level, id, ns?ns:"(null)", utilized)); n = strlen(id); if (ns) k = strlen(ns); @@ -6563,11 +6597,12 @@ static void soap_utilize_ns(struct soap *soap, const char *tag, size_t n) { register struct soap_nlist *np = soap_lookup_ns(soap, tag, n); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Utilizing namespace of '%s'\n", tag)); if (np) { if (np->index == 0) soap_push_ns(soap, np->id, np->ns, 1); } - else + else if (strncmp(tag, "xml", 3)) { strncpy(soap->tmpbuf, tag, n); soap->tmpbuf[n] = '\0'; soap_push_ns(soap, soap->tmpbuf, NULL, 1); @@ -6595,6 +6630,14 @@ #endif DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); #ifdef WITH_DOM + if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL) && !(soap->mode & SOAP_DOM_ASIS)) + { register struct soap_nlist *np; + /* wsu:Id found: clear xmlns renderings, so re-emit them for exc-c14n */ + for (np = soap->nlist; np; np = np->next) + { if (np->index == 2) + np->index = 0; + } + } if (soap->mode & SOAP_XML_DOM) { register struct soap_dom_element *elt = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); if (!elt) @@ -6734,6 +6777,8 @@ } soap->null = 0; soap->position = 0; + if (soap->part == SOAP_BEGIN_SECURITY && (soap->mode & SOAP_XML_CANONICAL)) + soap->part = SOAP_IN_SECURITY; return SOAP_OK; } #endif @@ -6920,6 +6965,7 @@ for (np = soap->nlist; np; np = np->next) { if (np->index == 1 && np->ns) { sprintf(soap->tmpbuf, "xmlns:%s", np->id); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enabling utilized binding (level=%u) %s='%s'\n", np->level, soap->tmpbuf, np->ns)); soap_set_attr(soap, soap->tmpbuf, np->ns); np->index = 2; } @@ -7282,8 +7328,11 @@ } } while (n--); s = soap->tag; + n = sizeof(soap->tag); while (soap_notblank(c = soap_get(soap))) - *s++ = (char)c; + { if (--n > 0) + *s++ = (char)c; + } *s = '\0'; if ((int)c == EOF) return soap->error = SOAP_EOF; @@ -7402,7 +7451,7 @@ { tp->size = strlen(value) + 1; if (!(tp->value = (char*)SOAP_MALLOC(soap, tp->size))) return soap->error = SOAP_EOM; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value of %s (%p)\n", tp->name, tp->value)); + DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value for %s (%p)\n", tp->name, tp->value)); } strcpy(tp->value, value); if (!strncmp(tp->name, "xmlns:", 6)) @@ -9725,13 +9774,14 @@ SOAP_FMAC2 soap_s2QName(struct soap *soap, const char *s, char **t) { if (s) - { struct soap_nlist *np; + { struct soap_nlist *np = soap->nlist; const char *p; - if (!strncmp(s, "xml:", 4)) + /* if there is no namespace stack, or prefix is "xml" then pass string */ + if (!np || !strncmp(s, "xml:", 4)) { *t = soap_strdup(soap, s); return SOAP_OK; } - np = soap->nlist; + /* else we normalize the QName by replacing its prefix */ p = strchr(s, ':'); if (p) { register int n = p - s; @@ -12634,7 +12684,7 @@ { #ifndef WITH_LEANER size_t n = 0; - if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start) + if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && strlen(soap->mime.boundary) + strlen(soap->mime.start) < sizeof(soap->tmpbuf) - 80 ) { const char *s; if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) s = "application/dime"; @@ -13196,7 +13246,7 @@ else s = "application/dime"; } - if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->status != SOAP_GET) + if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->status != SOAP_GET && strlen(soap->mime.boundary) + strlen(soap->mime.start ? soap->mime.start : SOAP_STR_EOS) < sizeof(soap->tmpbuf) - 80) { register const char *t = strchr(s, ';'); sprintf(soap->tmpbuf, "multipart/related; boundary=\"%s\"; type=\"", soap->mime.boundary); if (t) @@ -13273,6 +13323,8 @@ if (!endpoint || (soap_tag_cmp(endpoint, "http:*") && soap_tag_cmp(endpoint, "https:*") && strncmp(endpoint, "httpg:", 6))) #endif return SOAP_OK; + if (strlen(endpoint) + strlen(soap->http_version) > sizeof(soap->tmpbuf) - 80) + return soap->error = SOAP_EOM; if (soap->proxy_host && soap_tag_cmp(endpoint, "https:*")) sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); else @@ -13320,7 +13372,7 @@ return soap->error; #endif #endif - if (soap->version == 1 || (action && *action)) + if (soap->version == 1 || (action && *action && strlen(action) < sizeof(soap->tmpbuf) - 2)) { sprintf(soap->tmpbuf, "\"%s\"", action?action:""); if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) return err; @@ -13375,9 +13427,11 @@ if (soap->rpmreqid) httpOutputEnable(soap->rpmreqid); #endif + if (strlen(soap->http_version) > 4) + return soap->error = SOAP_EOM; if (!status || status == SOAP_HTML || status == SOAP_FILE) { const char *s; - if (count || ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK)) + if (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) s = "200 OK"; else s = "202 ACCEPTED"; @@ -13400,7 +13454,7 @@ return err; #ifndef WITH_LEAN if (status == 401) - { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", soap->authrealm ? soap->authrealm : "gSOAP Web Service"); + { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", strlen(soap->authrealm) < sizeof(soap->tmpbuf) - 14 ? soap->authrealm : "gSOAP Web Service"); if ((err = soap->fposthdr(soap, "WWW-Authenticate", soap->tmpbuf))) return err; } @@ -13839,7 +13893,7 @@ #ifndef UNDER_CE DWORD len; *soap->msgbuf = '\0'; - len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL); + len = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)soap->msgbuf, (DWORD)sizeof(soap->msgbuf), NULL); #else DWORD i, len; *soap->msgbuf = '\0'; @@ -13986,7 +14040,7 @@ { #ifndef WITH_LEAN int i, j, c1, c2; - if (soap->error && soap->buflen > 0) + if (soap->error && soap->bufidx <= soap->buflen && soap->buflen > 0 && soap->buflen <= SOAP_BUFLEN) { i = (int)soap->bufidx - 1; if (i <= 0) i = 0; diff -Nru libdigidoc-2.7.0/libdigidoc/mssp/stdsoap2.h libdigidoc-3.7.0.875/libdigidoc/mssp/stdsoap2.h --- libdigidoc-2.7.0/libdigidoc/mssp/stdsoap2.h 2009-05-31 11:05:33.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/mssp/stdsoap2.h 2012-12-13 22:05:47.000000000 +0000 @@ -1,11 +1,11 @@ /* -stdsoap2.h 2.7.9 +stdsoap2.h 2.7.9b gSOAP runtime gSOAP XML Web services tools -Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved. This part of the software is released under one of the following licenses: GPL, the gSOAP public license, or Genivia's license for commercial use. -------------------------------------------------------------------------------- @@ -25,7 +25,7 @@ for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Robert A. van Engelen. -Copyright (C) 2000-2006, Robert van Engelen, Genivia Inc., All Rights Reserved. +Copyright (C) 2000-2007, Robert van Engelen, Genivia Inc., All Rights Reserved. -------------------------------------------------------------------------------- GPL license. @@ -266,7 +266,7 @@ # define HAVE_LOCALTIME_R # define HAVE_WCTOMB # define HAVE_MBTOWC -# elif defined(FREEBSD) || defined(__FreeBSD__) || defined(__APPLE__) +# elif defined(FREEBSD) || defined(__FreeBSD__) # define HAVE_STRRCHR # define HAVE_STRTOD # define HAVE_SSCANF @@ -596,7 +596,7 @@ # define SOAP_SOCKLEN_T socklen_t #elif defined(SOCKLEN_T) # define SOAP_SOCKLEN_T SOCKLEN_T -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__QNX__) || defined(QNX) +#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) || defined(FREEBSD) || defined(__FreeBSD__) || defined(__QNX__) || defined(QNX) # define SOAP_SOCKLEN_T socklen_t #elif defined(IRIX) || defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) # define SOAP_SOCKLEN_T int @@ -1004,8 +1004,13 @@ #define SOAP_SSL_NO_AUTHENTICATION 0x00 /* for testing purposes */ #define SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION 0x01 /* client requires server to authenticate */ #define SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION 0x02 /* server requires client to authenticate */ +#define SOAP_SSL_SKIP_HOST_CHECK 0x04 /* client does not check the common name of the host in certificate */ +#define SOAP_SSL_RSA 0x06 /* use RSA */ +#define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ +#define SOAP_SSLv3 0x10 /* SSL v3 only */ +#define SOAP_TLSv1 0x20 /* TLS v1 only */ -#define SOAP_SSL_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION +#define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) /* state */ @@ -1548,7 +1553,7 @@ size_t lablen; /* look-aside buffer allocated length */ size_t labidx; /* look-aside buffer index to available part */ char buf[SOAP_BUFLEN];/* send and receive buffer */ - char tmpbuf[1024]; /* in/output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */ + char tmpbuf[1024]; /* in/output buffer for HTTP/MIME headers, simpleType values, attribute names, and DIME must be >=1024 bytes */ char msgbuf[1024]; /* in/output buffer for messages >=1024 bytes */ char tag[SOAP_TAGLEN]; char id[SOAP_TAGLEN]; @@ -1623,9 +1628,7 @@ BIO *bio; SSL *ssl; SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ + unsigned short ssl_flags; const char *keyfile; const char *password; const char *dhfile; @@ -1857,11 +1860,11 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_begin_send(struct soap*); SOAP_FMAC1 int SOAP_FMAC2 soap_end_send(struct soap*); -SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_code_int(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_str(const struct soap_code_map*, long code); -SOAP_FMAC1 long SOAP_FMAC2 soap_code_bits(const struct soap_code_map *map, const char *str); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_list(struct soap*, const struct soap_code_map *map, long code); +SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char*); +SOAP_FMAC1 long SOAP_FMAC2 soap_code_int(const struct soap_code_map*, const char*, long); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_str(const struct soap_code_map*, long); +SOAP_FMAC1 long SOAP_FMAC2 soap_code_bits(const struct soap_code_map*, const char*); +SOAP_FMAC1 const char* SOAP_FMAC2 soap_code_list(struct soap*, const struct soap_code_map*, long); SOAP_FMAC1 int SOAP_FMAC2 soap_getline(struct soap*, char*, int); SOAP_FMAC1 int SOAP_FMAC2 soap_begin_recv(struct soap*); @@ -1971,6 +1974,8 @@ SOAP_FMAC1 int SOAP_FMAC2 soap_push_namespace(struct soap*, const char *,const char *); SOAP_FMAC1 const char* SOAP_FMAC2 soap_current_namespace(struct soap *soap, const char *tag); +SOAP_FMAC1 struct soap_nlist* SOAP_FMAC2 soap_lookup_ns(struct soap *soap, const char *tag, size_t n); + SOAP_FMAC1 int SOAP_FMAC2 soap_store_lab(struct soap*, const char*, size_t); SOAP_FMAC1 int SOAP_FMAC2 soap_append_lab(struct soap*, const char*, size_t); diff -Nru libdigidoc-2.7.0/libdigidoc/pkcs11/CMakeLists.txt libdigidoc-3.7.0.875/libdigidoc/pkcs11/CMakeLists.txt --- libdigidoc-2.7.0/libdigidoc/pkcs11/CMakeLists.txt 2009-06-16 07:59:14.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/pkcs11/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -install( FILES - pkcs11.h - pkcs11f.h - pkcs11t.h - unix.h - cryptoki.h - DESTINATION ${DIGIDOC_INCLUDE_DIR}/pkcs11 -) diff -Nru libdigidoc-2.7.0/libdigidoc/pkcs11/cryptoki.h libdigidoc-3.7.0.875/libdigidoc/pkcs11/cryptoki.h --- libdigidoc-2.7.0/libdigidoc/pkcs11/cryptoki.h 2009-05-20 13:24:52.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/pkcs11/cryptoki.h 2012-12-13 22:05:47.000000000 +0000 @@ -1,96 +1,96 @@ -/* cryptoki.h include file for PKCS #11. 2001 June 25 */ - - - -/* This is a sample file containing the top level include directives - - * for building Win32 Cryptoki libraries and applications. - - */ - - - -#ifndef ___CRYPTOKI_H_INC___ - -#define ___CRYPTOKI_H_INC___ - - - -#pragma pack(push, cryptoki, 1) - - - -/* Specifies that the function is a DLL entry point. */ - -#define CK_IMPORT_SPEC __declspec(dllimport) - - - -/* Define CRYPTOKI_EXPORTS during the build of cryptoki libraries. Do - - * not define it in applications. - - */ - -#ifdef CRYPTOKI_EXPORTS - -/* Specified that the function is an exported DLL entry point. */ - -#define CK_EXPORT_SPEC __declspec(dllexport) - -#else - -#define CK_EXPORT_SPEC CK_IMPORT_SPEC - -#endif - - - -/* Ensures the calling convention for Win32 builds */ - -#define CK_CALL_SPEC __cdecl - - - -#define CK_PTR * - - - -#define CK_DEFINE_FUNCTION(returnType, name) \ - returnType CK_EXPORT_SPEC CK_CALL_SPEC name - - - -#define CK_DECLARE_FUNCTION(returnType, name) \ - returnType CK_EXPORT_SPEC CK_CALL_SPEC name - - - -#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ - returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name) - - - -#define CK_CALLBACK_FUNCTION(returnType, name) \ - returnType (CK_CALL_SPEC CK_PTR name) - - - -#ifndef NULL_PTR - -#define NULL_PTR 0 - -#endif - - - -#include "pkcs11.h" - - - -#pragma pack(pop, cryptoki) - - - -#endif /* ___CRYPTOKI_H_INC___ */ - +/* cryptoki.h include file for PKCS #11. 2001 June 25 */ + + + +/* This is a sample file containing the top level include directives + + * for building Win32 Cryptoki libraries and applications. + + */ + + + +#ifndef ___CRYPTOKI_H_INC___ + +#define ___CRYPTOKI_H_INC___ + + + +#pragma pack(push, cryptoki, 1) + + + +/* Specifies that the function is a DLL entry point. */ + +#define CK_IMPORT_SPEC __declspec(dllimport) + + + +/* Define CRYPTOKI_EXPORTS during the build of cryptoki libraries. Do + + * not define it in applications. + + */ + +#ifdef CRYPTOKI_EXPORTS + +/* Specified that the function is an exported DLL entry point. */ + +#define CK_EXPORT_SPEC __declspec(dllexport) + +#else + +#define CK_EXPORT_SPEC CK_IMPORT_SPEC + +#endif + + + +/* Ensures the calling convention for Win32 builds */ + +#define CK_CALL_SPEC __cdecl + + + +#define CK_PTR * + + + +#define CK_DEFINE_FUNCTION(returnType, name) \ + returnType CK_EXPORT_SPEC CK_CALL_SPEC name + + + +#define CK_DECLARE_FUNCTION(returnType, name) \ + returnType CK_EXPORT_SPEC CK_CALL_SPEC name + + + +#define CK_DECLARE_FUNCTION_POINTER(returnType, name) \ + returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name) + + + +#define CK_CALLBACK_FUNCTION(returnType, name) \ + returnType (CK_CALL_SPEC CK_PTR name) + + + +#ifndef NULL_PTR + +#define NULL_PTR 0 + +#endif + + + +#include "pkcs11.h" + + + +#pragma pack(pop, cryptoki) + + + +#endif /* ___CRYPTOKI_H_INC___ */ + Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/libdigidoc/rc.rct and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/libdigidoc/rc.rct differ diff -Nru libdigidoc-2.7.0/libdigidoc/res.rc libdigidoc-3.7.0.875/libdigidoc/res.rc --- libdigidoc-2.7.0/libdigidoc/res.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/res.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,94 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.K.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DLG_UNIT34 DIALOGEX 0, 0, 300, 155 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "DigiDoc" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,240,136,50,14 + GROUPBOX "Select certificate:",IDC_GROUPBOX,2,2,296,126 + PUSHBUTTON "&Cancel",IDCANCEL,180,136,50,14 + CONTROL "List1",IDC_LISTVIEW,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + WS_BORDER | WS_TABSTOP,6,12,288,110,WS_EX_CLIENTEDGE +END + +#endif // English (U.K.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Unknown language: 0x25, 0x1 resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ETI) +#ifdef _WIN32 +LANGUAGE 0x25, 0x1 +#pragma code_page(1257) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Unknown language: 0x25, 0x1 resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -Nru libdigidoc-2.7.0/libdigidoc/resource.h libdigidoc-3.7.0.875/libdigidoc/resource.h --- libdigidoc-2.7.0/libdigidoc/resource.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/resource.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by DlgUnit.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff -Nru libdigidoc-2.7.0/libdigidoc/ts/CMakeLists.txt libdigidoc-3.7.0.875/libdigidoc/ts/CMakeLists.txt --- libdigidoc-2.7.0/libdigidoc/ts/CMakeLists.txt 2009-06-16 07:59:14.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/ts/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -install( FILES - DigiDocTS.h - DESTINATION ${DIGIDOC_INCLUDE_DIR}/ts -) diff -Nru libdigidoc-2.7.0/libdigidoc/ts/DigiDocTS.c libdigidoc-3.7.0.875/libdigidoc/ts/DigiDocTS.c --- libdigidoc-2.7.0/libdigidoc/ts/DigiDocTS.c 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/ts/DigiDocTS.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,1606 +0,0 @@ -//================================================== -// FILE: DigiDocTS.c -// PROJECT: Digi Doc Encryption -// DESCRIPTION: DigiDoc timestamping routines -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 10.04.2006 Veiko Sinivee -// Creation -//================================================== - -#include -#include -#include -#include -#include -#include -#include - -//#include -//#include -//#include -#include -#include - -#include - -#define NONCE_LENGTH 64 -#define ERR_LIB_NONE 1 - -//==========< validation >======================== - - -//-------------------------------------------------- -// Validates the timestamp type. -// szType - value to be checked -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsValidateTimestampType(const char* szType) -{ - if(!szType || - (strcmp(szType, TS_TYPE_ALL_DATA_OBJECTS) && - strcmp(szType, TS_TYPE_INDIVIDUAL_DATA_OBJECTS) && - strcmp(szType, TS_TYPE_SIGNATURE) && - strcmp(szType, TS_TYPE_SIG_AND_REFS) && - strcmp(szType, TS_TYPE_REFS_ONLY) && - strcmp(szType, TS_TYPE_ARCHIVE))) - SET_LAST_ERROR_RETURN(ERR_TS_TIMESTAMPINFO_TYPE, ERR_TS_TIMESTAMPINFO_TYPE) - else - return ERR_OK; -} - -//==========< IncludeInfo >======================== - -//-------------------------------------------------- -// "Constructor" of IncludeInfo object -// pTimestampInfo - parent object [REQUIRED] -// ppIncludeInfo - address of buffer for newly allocated object [REQUIRED] -// szURI - hashed object uri [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_new(TimestampInfo* pTimestampInfo, - IncludeInfo** ppIncludeInfo, const char* szURI) -{ - int err = ERR_OK, nHashes; - IncludeInfo **ppHashes, *pHash; - - // check input parameters - ddocDebug(3, "ddocIncludeInfo_new", "URI: %s", (szURI ? szURI : "NULL")); - RETURN_IF_NULL_PARAM(pTimestampInfo); - RETURN_IF_NULL_PARAM(ppIncludeInfo); - RETURN_IF_NULL_PARAM(szURI); - - *ppIncludeInfo = 0; // mark as not yet allocated - // allocate memory for pointer array - nHashes = pTimestampInfo->nIncludeInfos + 1; - ppHashes = (IncludeInfo **)realloc(pTimestampInfo->pIncludeInfos, - sizeof(IncludeInfo *) * nHashes); - if(!ppHashes) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - pTimestampInfo->pIncludeInfos = ppHashes; - ppHashes[pTimestampInfo->nIncludeInfos] = 0; - // allocate memory for new property - pHash = (IncludeInfo*)malloc(sizeof(IncludeInfo)); - if(!pHash) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - memset(pHash, 0, sizeof(IncludeInfo)); - ppHashes[pTimestampInfo->nIncludeInfos] = pHash; - *ppIncludeInfo = pHash; - pTimestampInfo->nIncludeInfos = nHashes; - // set required fields - if(szURI) { - err = ddocMemAssignString((char**)&((*ppIncludeInfo)->szURI), szURI); - if(err) return err; - } - return err; -} - -//-------------------------------------------------- -// "Destructor" of IncludeInfo object -// pIncludeInfo - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_free(IncludeInfo* pIncludeInfo) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pIncludeInfo) - // cleanup this object - if(pIncludeInfo->szURI) - free(pIncludeInfo->szURI); - free(pIncludeInfo); - return err; -} - -//-------------------------------------------------- -// Accessor for URI atribute of IncludeInfo object. -// pIncludeInfo - address of object to be deleted [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocIncludeInfo_GetURI(const IncludeInfo* pIncludeInfo) -{ - RETURN_OBJ_IF_NULL(pIncludeInfo, NULL) - return pIncludeInfo->szURI; -} - -//-------------------------------------------------- -// Mutatoror for Id atribute of IncludeInfo object. -// pIncludeInfo - address of object to be deleted [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_SetURI(IncludeInfo* pIncludeInfo, const char* value) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pIncludeInfo) - RETURN_IF_NULL_PARAM(value) - err = ddocMemAssignString((char**)&(pIncludeInfo->szURI), value); - return err; -} - -//-------------------------------------------------- -// Generates XML for element -// pIncludeInfo - IncludeInfo object [REQUIRED] -// pBuf - memory buffer for storing xml [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocIncludeInfo_toXML(const IncludeInfo* pIncludeInfo, DigiDocMemBuf* pBuf) -{ - int err = ERR_OK; - char* p; - - RETURN_IF_NULL_PARAM(pBuf) - RETURN_IF_NULL_PARAM(pIncludeInfo) - // start of element - err = ddocGen_startElemBegin(pBuf, "Include"); - if(err) return err; - // uri atribute - p = (char*)ddocIncludeInfo_GetURI(pIncludeInfo); - if(p) - err = ddocGen_addAtribute(pBuf, "URI", p); - if(err) return err; - // referencedData - if(pIncludeInfo->referencedData) - err = ddocGen_addAtribute(pBuf, "referencedData", "TRUE"); - if(err) return err; - // end of element start tag - err = ddocGen_startElemEnd(pBuf); - if(err) return err; - err = ddocGen_endElem(pBuf, "Include"); - return err; -} - -//==========< TimestampInfo >======================== - - -//-------------------------------------------------- -// "Constructor" of TimestampInfo object -// pTimestampInfoList - parent object [REQUIRED] -// ppTimestampInfo - address of buffer for newly allocated object [REQUIRED] -// szId - timestamp id [OPTIONAL] -// szType - timestamp type [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_new(TimestampInfoList* pTimestampInfoList, - TimestampInfo** ppTimestampInfo, - const char* szId, const char* szType) -{ - int err = ERR_OK, nInfos; - TimestampInfo **ppInfos, *pInfo; - - // check input parameters - ddocDebug(3, "ddocTimestampInfo_new", "ID: %s: Type: %s", - (szId ? szId : "NULL"), (szType ? szType : "NULL")); - RETURN_IF_NULL_PARAM(pTimestampInfoList); - RETURN_IF_NULL_PARAM(ppTimestampInfo); - err = ddocTsValidateTimestampType(szType); - if(err) return err; - *ppTimestampInfo = 0; // mark as not yet allocated - // allocate memory for pointer array - nInfos = pTimestampInfoList->nTimestampInfos + 1; - ppInfos = (TimestampInfo **)realloc(pTimestampInfoList->pTimestampInfos, - sizeof(TimestampInfo *) * nInfos); - if(!ppInfos) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - pTimestampInfoList->pTimestampInfos = ppInfos; - ppInfos[pTimestampInfoList->nTimestampInfos] = 0; - // allocate memory for new property - pInfo = (TimestampInfo*)malloc(sizeof(TimestampInfo)); - if(!pInfo) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - memset(pInfo, 0, sizeof(TimestampInfo)); - ppInfos[pTimestampInfoList->nTimestampInfos] = pInfo; - *ppTimestampInfo = pInfo; - pTimestampInfoList->nTimestampInfos = nInfos; - // set required fields - if(szType) { - err = ddocMemAssignString((char**)&((*ppTimestampInfo)->szType), szType); - if(err) return err; - } - // set optional fields - if(szId) { - err = ddocMemAssignString((char**)&((*ppTimestampInfo)->szId), szId); - if(err) return err; - } - return err; -} - -//-------------------------------------------------- -// "Destructor" of TimestampInfo object -// pTimestampInfo - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_free(TimestampInfo* pTimestampInfo) -{ - int i, err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfo) - // cleanup this object - if(pTimestampInfo->szId) - free(pTimestampInfo->szId); - if(pTimestampInfo->szType) - free(pTimestampInfo->szType); - ddocMemBuf_free(&(pTimestampInfo->mbufTS)); - ddocMemBuf_free(&(pTimestampInfo->mbufRealDigest)); - // free hash-data-infos - for(i = 0; i < pTimestampInfo->nIncludeInfos; i++) { - if(pTimestampInfo->pIncludeInfos[i]) { - err = ddocIncludeInfo_free(pTimestampInfo->pIncludeInfos[i]); - if(err) return err; - } - } - free(pTimestampInfo->pIncludeInfos); - free(pTimestampInfo); - return err; -} - -//-------------------------------------------------- -// Accessor for Id atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocTimestampInfo_GetId(const TimestampInfo* pTimestampInfo) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - return pTimestampInfo->szId; -} - -//-------------------------------------------------- -// Mutatoror for Id atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetId(TimestampInfo* pTimestampInfo, const char* value) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfo) - RETURN_IF_NULL_PARAM(value) - err = ddocMemAssignString((char**)&(pTimestampInfo->szId), value); - return err; -} - -//-------------------------------------------------- -// Accessor for Type atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocTimestampInfo_GetType(const TimestampInfo* pTimestampInfo) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - return pTimestampInfo->szType; -} - -//-------------------------------------------------- -// Mutatoror for Type atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetType(TimestampInfo* pTimestampInfo, const char* value) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfo) - RETURN_IF_NULL_PARAM(value) - err = ddocTsValidateTimestampType(value); - if(err) return err; - err = ddocMemAssignString((char**)&(pTimestampInfo->szType), value); - return err; -} - -//-------------------------------------------------- -// Accessor for Timestamp data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const DigiDocMemBuf* ddocTimestampInfo_GetTS(const TimestampInfo* pTimestampInfo) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - return &(pTimestampInfo->mbufTS); -} - -//-------------------------------------------------- -// Mutatoror for Timestamp data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// len - length of value in bytes [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetTS(TimestampInfo* pTimestampInfo, - const char* value, long len) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfo) - RETURN_IF_NULL_PARAM(value) - err = ddocMemAssignData(&(pTimestampInfo->mbufTS), value, len); - return err; -} - -//-------------------------------------------------- -// Accessor for real digest value of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const DigiDocMemBuf* ddocTimestampInfo_GetRealDigest(const TimestampInfo* pTimestampInfo) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - return &(pTimestampInfo->mbufRealDigest); -} - -//-------------------------------------------------- -// Mutatoror for real digest data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// len - length of value in bytes [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetRealDigest(TimestampInfo* pTimestampInfo, - const char* value, long len) -{ - int err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfo) - RETURN_IF_NULL_PARAM(value) - err = ddocMemAssignData(&(pTimestampInfo->mbufRealDigest), value, len); - return err; -} - -//-------------------------------------------------- -// Accessor for count of IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// returns count or -1 for error. Then use error API to check errors -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_GetIncludeInfosCount(const TimestampInfo* pTimestampInfo) -{ - SET_LAST_ERROR_RETURN_IF_NOT(pTimestampInfo, ERR_NULL_POINTER, -1) - return pTimestampInfo->nIncludeInfos; -} - -//-------------------------------------------------- -// Accessor for IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// nIdx - index of IncludeInfo object [REQUIRED] -// returns IncludeInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION IncludeInfo* ddocTimestampInfo_GetIncludeInfo(const TimestampInfo* pTimestampInfo, int nIdx) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - SET_LAST_ERROR_RETURN_IF_NOT(nIdx >= 0 && nIdx < pTimestampInfo->nIncludeInfos, ERR_TS_BAD_INCLUDEINFO_IDX, NULL); - RETURN_OBJ_IF_NULL(pTimestampInfo->pIncludeInfos[nIdx], 0); - return pTimestampInfo->pIncludeInfos[nIdx]; -} - -//-------------------------------------------------- -// Accessor for last IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// returns IncludeInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION IncludeInfo* ddocTimestampInfo_GetLastIncludeInfo(const TimestampInfo* pTimestampInfo) -{ - RETURN_OBJ_IF_NULL(pTimestampInfo, NULL) - RETURN_OBJ_IF_NULL(pTimestampInfo->pIncludeInfos[pTimestampInfo->nIncludeInfos-1], 0); - return pTimestampInfo->pIncludeInfos[pTimestampInfo->nIncludeInfos-1]; -} - - -//-------------------------------------------------- -// Deletes IncludeInfo subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// nIdx - index of IncludeInfo object to be removed [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_DeleteIncludeInfo(TimestampInfo* pTimestampInfo, int nIdx) -{ - int err = ERR_OK, i; - - RETURN_IF_NULL_PARAM(pTimestampInfo) - SET_LAST_ERROR_RETURN_IF_NOT(nIdx >= 0 && nIdx < pTimestampInfo->nIncludeInfos, ERR_TS_BAD_INCLUDEINFO_IDX, ERR_TS_BAD_INCLUDEINFO_IDX); - RETURN_IF_NULL_PARAM(pTimestampInfo->pIncludeInfos[nIdx]); - // delete the given object - err = ddocIncludeInfo_free(pTimestampInfo->pIncludeInfos[nIdx]); - if(err) return err; - pTimestampInfo->pIncludeInfos[nIdx] = 0; - // move other objects 1 step close to array start - for(i = nIdx; i < pTimestampInfo->nIncludeInfos-1; i++) - pTimestampInfo->pIncludeInfos[i] = pTimestampInfo->pIncludeInfos[i+1]; - pTimestampInfo->pIncludeInfos[pTimestampInfo->nIncludeInfos - 1] = 0; - pTimestampInfo->nIncludeInfos--; - return err; -} - -//-------------------------------------------------- -// Adds an IncludeInfo subelement to TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// szURI - URI atribute of IncludeInfo object to be added [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_AddIncludeInfo(TimestampInfo* pTimestampInfo, const char* szURI) -{ - IncludeInfo *pIncInfo = 0; - - RETURN_IF_NULL_PARAM(pTimestampInfo) - return ddocIncludeInfo_new(pTimestampInfo, &pIncInfo, szURI); -} - - -//-------------------------------------------------- -// Generates XML for element -// pTimestampInfo - TimestampInfo object [REQUIRED] -// pBuf - memory buffer for storing xml [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTimestampInfo_toXML(const TimestampInfo* pTimestampInfo, DigiDocMemBuf* pBuf) -{ - int err = ERR_OK, i; - char* p, *name; - IncludeInfo* pHash; - - RETURN_IF_NULL_PARAM(pBuf) - RETURN_IF_NULL_PARAM(pTimestampInfo) - // start of element - name = (char*)ddocTimestampInfo_GetType(pTimestampInfo); - RETURN_IF_NULL_PARAM(name) - err = ddocGen_startElemBegin(pBuf, name); - if(err) return err; - // uri atribute - p = (char*)ddocTimestampInfo_GetId(pTimestampInfo); - if(p) - err = ddocGen_addAtribute(pBuf, "Id", p); - if(err) return err; - err = ddocGen_startElemEnd(pBuf); - if(err) return err; - // IncludeInfo-s - for(i = 0; !err && (i < ddocTimestampInfo_GetIncludeInfosCount(pTimestampInfo)); i++) { - pHash = ddocTimestampInfo_GetIncludeInfo(pTimestampInfo, i); - err = ddocIncludeInfo_toXML(pHash, pBuf); - } - if(err) return err; - // timestamp data - i = 2 * pTimestampInfo->mbufTS.nLen; - p = (char*)malloc(i); - if(!p) - SET_LAST_ERROR_RETURN(ERR_BAD_ALLOC, ERR_BAD_ALLOC) - memset(p, 0, i); - encode((const byte*)pTimestampInfo->mbufTS.pMem, - pTimestampInfo->mbufTS.nLen, (byte*)p, &i); - if(p && i) { - err = ddocGen_startElem(pBuf, "EncapsulatedTimeStamp"); - if(err) return err; - err = ddocMemAppendData(pBuf, p, -1); - free(p); - p = 0; - if(err) return err; - err = ddocGen_endElem(pBuf, "EncapsulatedTimeStamp"); - if(err) return err; - } - err = ddocGen_endElem(pBuf, name); - return err; -} - -//==========< TimestampInfoList >==================== - -//-------------------------------------------------- -// "Constructor" of TimestampInfoList object -// ppTimestampInfoList - address of buffer for newly allocated object [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_new(TimestampInfoList** ppTimestampInfoList) -{ - int err = ERR_OK; - - // check input parameters - ddocDebug(3, "ddocTimestampInfoList_new", "Create new timestamp info list"); - RETURN_IF_NULL_PARAM(ppTimestampInfoList); - *ppTimestampInfoList = (TimestampInfoList*)malloc(sizeof(TimestampInfoList)); - // allocate new object - RETURN_IF_BAD_ALLOC(*ppTimestampInfoList); - memset(*ppTimestampInfoList, 0, sizeof(TimestampInfoList)); - return err; -} - -//-------------------------------------------------- -// "Destructor" of TimestampInfoList object -// pTimestampInfoList - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_free(TimestampInfoList* pTimestampInfoList) -{ - int i, err = ERR_OK; - RETURN_IF_NULL_PARAM(pTimestampInfoList) - // free timestamp-infos - for(i = 0; i < pTimestampInfoList->nTimestampInfos; i++) { - if(pTimestampInfoList->pTimestampInfos[i]) { - err = ddocTimestampInfo_free(pTimestampInfoList->pTimestampInfos[i]); - if(err) return err; - } - } - free(pTimestampInfoList->pTimestampInfos); - free(pTimestampInfoList); - return err; -} - -//-------------------------------------------------- -// Accessor for count of TimestampInfos subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// returns count or -1 for error. Then use error API to check errors -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_GetTimestampInfosCount(const TimestampInfoList* pTimestampInfoList) -{ - SET_LAST_ERROR_RETURN_IF_NOT(pTimestampInfoList, ERR_NULL_POINTER, -1) - return pTimestampInfoList->nTimestampInfos; -} - -//-------------------------------------------------- -// Accessor for TimestampInfos subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// nIdx - index of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetTimestampInfo(const TimestampInfoList* pTimestampInfoList, int nIdx) -{ - RETURN_OBJ_IF_NULL(pTimestampInfoList, NULL) - SET_LAST_ERROR_RETURN_IF_NOT(nIdx >= 0 && nIdx < pTimestampInfoList->nTimestampInfos, ERR_TS_BAD_TIMESTAMPINFO_IDX, NULL); - RETURN_OBJ_IF_NULL(pTimestampInfoList->pTimestampInfos[nIdx], 0); - return pTimestampInfoList->pTimestampInfos[nIdx]; -} - -//-------------------------------------------------- -// Returns the TimestampInfo with required type -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// szType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetTimestampInfoOfType(const TimestampInfoList* pTimestampInfoList, const char* szType) -{ - int i; - RETURN_OBJ_IF_NULL(pTimestampInfoList, NULL) - for(i = 0; i < pTimestampInfoList->nTimestampInfos; i++) { - if(pTimestampInfoList->pTimestampInfos[i]->szType && szType && - !strcmp(pTimestampInfoList->pTimestampInfos[i]->szType, szType)) { - return pTimestampInfoList->pTimestampInfos[i]; - } - } - return NULL; -} - -//-------------------------------------------------- -// Returns the TimestampInfo with required type. -// Creates one if it doesn't exist yet. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// szType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetOrCreateTimestampInfoOfType(TimestampInfoList* pTimestampInfoList, const char* szId, const char* szType) -{ - TimestampInfo* pTS = NULL; - - RETURN_OBJ_IF_NULL(pTimestampInfoList, NULL); - pTS = ddocTimestampInfoList_GetTimestampInfoOfType(pTimestampInfoList, szType); - if(!pTS) - ddocTimestampInfo_new(pTimestampInfoList, &pTS, szId, szType); - return pTS; -} - -//-------------------------------------------------- -// Deletes TimestampInfo subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// nIdx - index of TimestampInfo object to be removed [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_DeleteTimestampInfo(TimestampInfoList* pTimestampInfoList, int nIdx) -{ - int err = ERR_OK, i; - - RETURN_IF_NULL_PARAM(pTimestampInfoList) - SET_LAST_ERROR_RETURN_IF_NOT(nIdx >= 0 && nIdx < pTimestampInfoList->nTimestampInfos, ERR_TS_BAD_TIMESTAMPINFO_IDX, ERR_TS_BAD_TIMESTAMPINFO_IDX); - RETURN_IF_NULL_PARAM(pTimestampInfoList->pTimestampInfos[nIdx]); - // delete the given object - err = ddocTimestampInfo_free(pTimestampInfoList->pTimestampInfos[nIdx]); - if(err) return err; - pTimestampInfoList->pTimestampInfos[nIdx] = 0; - // move other objects 1 step close to array start - for(i = nIdx; i < pTimestampInfoList->nTimestampInfos-1; i++) - pTimestampInfoList->pTimestampInfos[i] = pTimestampInfoList->pTimestampInfos[i+1]; - pTimestampInfoList->pTimestampInfos[pTimestampInfoList->nTimestampInfos - 1] = 0; - pTimestampInfoList->nTimestampInfos--; - return err; -} - - - - - - -//==========< utility functions >======================== - -//-------------------------------------------------- -// Helper function to read TS_REQ from binary input data -// ppReq - address of newly allocated TS_REQ object -// pMBufInData - input data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsReadTsReq(TS_REQ** ppReq, DigiDocMemBuf* pMBufInData) -{ - int err = ERR_OK; - unsigned char* p1; - - RETURN_IF_NULL_PARAM(ppReq); - RETURN_IF_NULL_PARAM(pMBufInData); - RETURN_IF_NULL_PARAM(pMBufInData->pMem); - ddocDebug(4, "ddocTsReadTsReq", "converting: %d bytes to TS_REQ", pMBufInData->nLen); - p1 = (unsigned char*)pMBufInData->pMem; - d2i_TS_REQ(ppReq, (const unsigned char**)&p1, pMBufInData->nLen); - ddocDebug(4, "ddocTsReadTsReq", "TS_REQ: %s", (*ppReq ? "OK" : "ERR")); - return err; -} - -//-------------------------------------------------- -// Helper function to write TS_REQ to binary output data -// pReq - address of TS_REQ object -// pMBufOutData - output data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsWriteTsReq(TS_REQ* pReq, DigiDocMemBuf* pMBufOutData) -{ - int err = ERR_OK, l1; - unsigned char* p1; - - RETURN_IF_NULL_PARAM(pReq); - RETURN_IF_NULL_PARAM(pMBufOutData); - pMBufOutData->pMem = NULL; - pMBufOutData->nLen = 0; - // find out how big a buffer we need - l1 = i2d_TS_REQ(pReq, NULL); - ddocDebug(4, "ddocTsReadTsReq", "converting: %d bytes from TS_REQ", l1); - // alloc mem - err = ddocMemSetLength(pMBufOutData, l1 + 50); - p1 = (unsigned char*)pMBufOutData->pMem; - l1 = i2d_TS_REQ(pReq, &p1); - pMBufOutData->nLen = l1; - ddocDebug(4, "ddocTsReadTsReq", "Converted data: %d", l1); - return err; -} - -//-------------------------------------------------- -// Helper function to read TS_RESP from binary input data -// ppResp - address of newly allocated TS_RESP object -// pMBufInData - input data -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTsReadTsResp(TS_RESP** ppResp, DigiDocMemBuf* pMBufInData) -{ - int err = ERR_OK; - unsigned char* p1; - - RETURN_IF_NULL_PARAM(ppResp); - RETURN_IF_NULL_PARAM(pMBufInData); - RETURN_IF_NULL_PARAM(pMBufInData->pMem); - ddocDebug(4, "ddocTsReadTsResp", "converting: %d bytes to TS_RESP", pMBufInData->nLen); - p1 = (unsigned char*)pMBufInData->pMem; - d2i_TS_RESP(ppResp, (const unsigned char**)&p1, pMBufInData->nLen); - ddocDebug(4, "ddocTsReadTsResp", "TS_RESP: %s", (*ppResp ? "OK" : "ERR")); - return err; -} - -//-------------------------------------------------- -// Helper function to write TS_RESP to binary output data -// pResp - address of TS_RESP object -// pMBufOutData - output data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsWriteTsResp(TS_RESP* pResp, DigiDocMemBuf* pMBufOutData) -{ - int err = ERR_OK, l1; - unsigned char* p1; - - RETURN_IF_NULL_PARAM(pResp); - RETURN_IF_NULL_PARAM(pMBufOutData); - pMBufOutData->pMem = NULL; - pMBufOutData->nLen = 0; - // find out how big a buffer we need - l1 = i2d_TS_RESP(pResp, NULL); - ddocDebug(4, "ddocTsReadTsResp", "converting: %d bytes from TS_RESP", l1); - // alloc mem - err = ddocMemSetLength(pMBufOutData, l1 + 50); - p1 = (unsigned char*)pMBufOutData->pMem; - l1 = i2d_TS_RESP(pResp, &p1); - pMBufOutData->nLen = l1; - ddocDebug(4, "ddocTsReadTsResp", "Converted data: %d", l1); - return err; -} - - -//-------------------------------------------------- -// Helper function to create a nonce value -// ppNonce - address for new ASN1_INTEGER pointer -// bits - length of nonce in bits -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocCreateNonce(ASN1_INTEGER** ppNonce, int bits) -{ - int err = ERR_CREATE_NONCE; - unsigned char buf[20], buf2[50]; - int len = (bits - 1) / 8 + 1; - int i, l2; - - RETURN_IF_NULL_PARAM(ppNonce); - *ppNonce = 0; // mark as not created yet - // Generating random byte sequence. - if(len <= (int)sizeof(buf)) { - if(RAND_bytes(buf, len)) { - // Find the first non-zero byte and creating ASN1_INTEGER object. - for(i = 0; i < len && !buf[i]; ++i); - if((*ppNonce = ASN1_INTEGER_new())) { - OPENSSL_free((*ppNonce)->data); - // Allocate at least one byte. - (*ppNonce)->length = len - i; - l2 = sizeof(buf2); - bin2hex((const byte*)buf, len, buf2, &l2); - ddocDebug(3, "ddocCreateNonce", "nonce: %s", buf2); - if(((*ppNonce)->data = OPENSSL_malloc((*ppNonce)->length + 1))) { - memcpy((*ppNonce)->data, buf + i, (*ppNonce)->length); - err = ERR_OK; - } - } - } - } - return err; -} - - -//-------------------------------------------------- -// Helper function to convert text/name to OID -// ppObj - address for new ASN1_OBJECT pointer -// oid - stringified oid value -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTxt2Obj(ASN1_OBJECT **ppObj, const char *oid) -{ - RETURN_IF_NULL_PARAM(ppObj); - *ppObj = 0; // mark as not allocated - if(!(*ppObj = OBJ_txt2obj(oid, 0))) - SET_LAST_ERROR_RETURN_CODE(ERR_TXT2OID); - return ERR_OK; -} - -//-------------------------------------------------- -// Helper function to create a new TS_REQ from XML data objects -// that will be digested. -// ppReq - address of newly allocated TS_REQ object -// pMBufDigest - digest data to timestamp (xml) -// policy - oilicy oid in stringform. Use NULL if not necessary -// bNonce - 1=send nonce, 0=no nonce -// bCert - request req_cert property 1/0 -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsCreateTsReq(TS_REQ** ppReq, DigiDocMemBuf* pMBufDigest, - const char* policy, int bNonce, int bCert) -{ - int err = ERR_TS_CREATE_TS_REQ, l2; - EVP_MD *md = NULL; - TS_MSG_IMPRINT *msg_imprint = NULL; - X509_ALGOR *algo = NULL; - unsigned char *data = NULL; - ASN1_OBJECT *policy_obj = NULL; - ASN1_INTEGER *nonce_asn1 = NULL; - char buf2[100]; - - RETURN_IF_NULL_PARAM(ppReq); - RETURN_IF_NULL_PARAM(pMBufDigest); - RETURN_IF_NULL_PARAM(pMBufDigest->pMem); - ddocDebug(4, "ddocTsCreateTsReq", "timestamp dig: %d bytes, policy: %s, nonce: %d cert: %d", - pMBufDigest->nLen, (policy ? policy : "NONE"), bNonce, bCert); - - *ppReq = 0; // mark as not allocated - // Setting default message digest. - if ((md = (EVP_MD*)EVP_get_digestbyname("sha1")) != NULL) { - // Creating request object. - if((*ppReq = TS_REQ_new()) != NULL) { - // Setting version. - if(TS_REQ_set_version(*ppReq, 1)) { - // Creating and adding MSG_IMPRINT object. - if((msg_imprint = TS_MSG_IMPRINT_new())) { - // Adding algorithm. - if((algo = X509_ALGOR_new())) { - if((algo->algorithm = OBJ_nid2obj(EVP_MD_type(md)))) { - if((algo->parameter = ASN1_TYPE_new())) { - algo->parameter->type = V_ASN1_NULL; - if(TS_MSG_IMPRINT_set_algo(msg_imprint, algo)) { - // Adding message digest. - err = ERR_OK; - l2 = sizeof(buf2); - bin2hex((const byte*)pMBufDigest->pMem, pMBufDigest->nLen, buf2, &l2); - ddocDebug(3, "ddocTsCreateTsReq", "msg-imprint: %s", buf2); - if(TS_MSG_IMPRINT_set_msg(msg_imprint, (unsigned char*)pMBufDigest->pMem, pMBufDigest->nLen)) { - if(TS_REQ_set_msg_imprint(*ppReq, msg_imprint)) { - // Setting policy if requested. - if(policy && strlen(policy) && - !(err = ddocTxt2Obj(&policy_obj, policy)) && - TS_REQ_set_policy_id(*ppReq, policy_obj)) - err = ERR_OK; - // Setting nonce if requested. - if(bNonce && - !(err = ddocCreateNonce(&nonce_asn1, NONCE_LENGTH)) && - TS_REQ_set_nonce(*ppReq, nonce_asn1)) - err = ERR_OK; - // Setting certificate request flag if requested. - if(!TS_REQ_set_cert_req(*ppReq, bCert)) - err = ERR_TS_CREATE_TS_REQ; - } - } - } - } - } - } - } - } - } - } - // if error then free result object - if(err) { - TS_REQ_free(*ppReq); - *ppReq = NULL; - SET_LAST_ERROR(err); - } - TS_MSG_IMPRINT_free(msg_imprint); - X509_ALGOR_free(algo); - OPENSSL_free(data); - ASN1_OBJECT_free(policy_obj); - ASN1_INTEGER_free(nonce_asn1); - ddocDebug(4, "ddocTsCreateTsReq", "RC: %d", err); - return err; -} - -//-------------------------------------------------- -// Helper function to create a new TS_REQ from XML data objects -// that will be digested. Stores the result in DER form -// in a DigiDocMemBuf object. -// pMBufReq - memory buffer to store new request in PEM format -// pMBufInData - data to timestamp (xml) -// policy - oilicy oid in stringform. Use NULL if not necessary -// bNonce - 1=send nonce, 0=no nonce -// bCert - request req_cert property 1/0 -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsCreateTsReqBin(DigiDocMemBuf* pMBufReq, DigiDocMemBuf* pMBufInData, - const char* policy, int bNonce, int bCert) -{ - int err = ERR_OK; - TS_REQ *pReq = 0; - - RETURN_IF_NULL_PARAM(pMBufReq); - RETURN_IF_NULL_PARAM(pMBufInData); - RETURN_IF_NULL_PARAM(pMBufInData->pMem); - ddocDebug(4, "ddocTsCreateTsReqBin", "timestamping: %d bytes, policy: %s, nonce: %d cert: %d", - pMBufInData->nLen, (policy ? policy : "NONE"), bNonce, bCert); - err = ddocTsCreateTsReq(&pReq, pMBufInData, policy, bNonce, bCert); - if(!err && pReq) - err = ddocTsWriteTsReq(pReq, pMBufReq); - if(pReq) - TS_REQ_free(pReq); - ddocDebug(4, "ddocTsCreateTsReqBin", "RC: %d", err); - return err; -} - -//-------------------------------------------------- -// Returns HTTP return code -// pBuf- buffer with HTTP response -// returns error code or HTTP response code -//-------------------------------------------------- -int ddocGetHttpResponseCode(DigiDocMemBuf* pBuf) -{ - int rc = ERR_OK; - char *p = (char*)pBuf->pMem; - RETURN_IF_NULL_PARAM(pBuf); - if(p && !strncmp(p, "HTTP", 4)) { - while(*p && *p != ' ') p++; - while(*p && !isdigit(*p)) p++; - rc = atoi(p); - } else - return ERR_HTTP_ERR; - return rc; -} - -//-------------------------------------------------- -// Returns HTTP response body -// pInBuf- buffer with HTTP response -// pOutBuf - buffer for response body -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocGetHttpPayload(DigiDocMemBuf* pInBuf, DigiDocMemBuf* pOutBuf) -{ - int err = ERR_OK; - char *p; - RETURN_IF_NULL_PARAM(pInBuf); - RETURN_IF_NULL_PARAM(pOutBuf); - if((p = strstr((char*)pInBuf->pMem, "\r\n\r\n")) != NULL) { - p += 4; - err = ddocMemAssignData(pOutBuf, p, pInBuf->nLen - (int)((int)p - (int)pInBuf->pMem)); - } else - return ERR_HTTP_ERR; - return err; -} - -//-------------------------------------------------- -// Divides URL into parts with just protocoll+host+port -// and path/application -// url - input URL -// szHost - buffer for host+port+protocoll -// lHost - length of host buffer -// szPath - buffer for path/application -// lPath -length of path buffer -//-------------------------------------------------- -int ddocFindHostAndPathFromUrl(const char* url, char* szHost, int lHost, - char* szPath, int lPath) -{ - int err = ERR_OK/*, i*/; - char* p1; - - RETURN_IF_NULL_PARAM(url); - RETURN_IF_NULL_PARAM(szHost); - RETURN_IF_NULL_PARAM(szPath); - szHost[0] = szPath[0] = 0; - p1 = (char*)url; - if(!strncmp(p1, "http://", 7)) - p1 += 7; - if(!strncmp(p1, "https://", 8)) - p1 += 8; - p1 = strchr(p1, '/'); - if(p1 && (int)(p1 - url) < lHost) { - strncpy(szHost, url, (int)(p1 - url)); - szHost[(int)(p1 - url)] = 0; - if(strlen(p1) < (unsigned int)lPath) - strcpy(szPath, p1); - } else { - strncpy(szHost, url, lHost); - } - return err; -} - -//-------------------------------------------------- -// sends a Timestamp request to TSA server -// retrieves the TS_RESP object -// pMBufDigest - digest of data to be timestamped [REQUIRED] -// ppResp - address for TS_RESP [REQUIRED] -// policy - policy OID [OPTIONAL] -// bNonce - flag use nonce: 1/0 [REQUIRED] -// bCert - flag send cert: 1/0 [REQUIRED] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocSendTSRequest(DigiDocMemBuf* pMBufDigest, TS_RESP** ppResp, - const char* policy, int bNonce, int bCert, const char* url, - const char* proxyHost, const char* proxyPort) -{ - char buf1[100], buf2[100]; - int err = ERR_OK, l1; - int connResult = 0; - DigiDocMemBuf mbuf1, mbuf2, mbuf3; - X509 *pCert = 0; - - RETURN_IF_NULL_PARAM(pMBufDigest); - RETURN_IF_NULL_PARAM(url); - RETURN_IF_NULL_PARAM(ppResp); - mbuf1.pMem = 0; - mbuf1.nLen = 0; - mbuf2.pMem = 0; - mbuf2.nLen = 0; - mbuf3.pMem = 0; - mbuf3.nLen = 0; - // create TS request - l1 = sizeof(buf1); - bin2hex((const byte*)pMBufDigest->pMem, pMBufDigest->nLen, buf1, &l1); - ddocDebug(3, "ddocSendTSRequest", "timestamp: \'%s\' url: %s proxy: %s/%s nonce: %d ask-cert: %d", - buf1, (url ? url : "NULL"), - (proxyHost ? proxyHost : ""), - (proxyPort ? proxyPort : ""), bNonce, bCert); - // find host and path - err = ddocFindHostAndPathFromUrl(url, buf1, sizeof(buf1), buf2, sizeof(buf2)); - if(err || !strlen(buf1) /*|| !strlen(buf2)*/) { - ddocDebug(3, "ddocSendTSRequest", "url: %s host: %s path: %s err: %d", url, buf1, buf2, err); - SET_LAST_ERROR(ERR_TS_REQUEST); - return ERR_TS_REQUEST; - } - ddocDebug(3, "ddocSendTSRequest", "url: %s host: %s path: %s", url, buf1, buf2); - // create HTTP request - err = ddocTsCreateTsReqBin(&mbuf1, pMBufDigest, policy, bNonce, bCert); - // compose HTTP message - ddocMemAppendData(&mbuf2, "POST ", -1); - if(proxyHost && strlen(proxyHost)) - ddocMemAppendData(&mbuf2, buf1, -1); - ddocMemAppendData(&mbuf2, buf2, -1); - ddocMemAppendData(&mbuf2, " HTTP/1.0\r\n", -1); - ddocMemAppendData(&mbuf2, "User-Agent: cdigidoc\r\n", -1); - ddocMemAppendData(&mbuf2, "Content-Type: application/timestamp-query\r\n", -1); - ddocMemAppendData(&mbuf2, "Accept: application/timestamp-reply\r\n", -1); - ddocMemAppendData(&mbuf2, "Connection: Close\r\n", -1); - ddocMemAppendData(&mbuf2, "Cache-Control: no-cache\r\n", -1); - ddocMemAppendData(&mbuf2, "Content-Length: ", -1); - sprintf(buf1, "%ld", mbuf1.nLen); - ddocMemAppendData(&mbuf2, buf1, -1); - ddocMemAppendData(&mbuf2, "\r\n\r\n", -1); - ddocMemAppendData(&mbuf2, mbuf1.pMem, mbuf1.nLen); - ddocMemBuf_free(&mbuf1); - // send & receive - ddocDebug(3, "ddocSendTSRequest", "Send to: %s req: %d bytes", url, mbuf2.nLen); - ddocDebugWriteFile(5, "tsreq.txt", &mbuf2); - err = ddocPullUrl(url, &mbuf2, &mbuf3, proxyHost, proxyPort); - SET_LAST_ERROR_IF_NOT(err == ERR_OK, ERR_TS_REQUEST); - ddocDebug(3, "ddocSendTSRequest", "RC: %d RECEIVED: %d bytes HTTP: %d", - err, mbuf3.nLen, ddocGetHttpResponseCode(&mbuf3)); - ddocDebugWriteFile(5, "tsresp.txt", &mbuf3); - ddocMemBuf_free(&mbuf2); - // parse reply - if(!err && ((l1 = ddocGetHttpResponseCode(&mbuf3)) == 200)) { - err = ddocGetHttpPayload(&mbuf3, &mbuf2); - ddocDebugWriteFile(4, "tsresp.bin", &mbuf2); - if(!err) - err = ddocTsReadTsResp(ppResp, &mbuf2); - // DEBUG - /* - if(*ppResp) { - // debug - ddocMemBuf_free(&mbuf1); - ddocTSResp_GetPolicyId(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "policy id: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocTSResp_GetStatus(*ppResp, &l1); - ddocDebug(3, "ddocSendTSRequest", "status: %d", l1); - ddocTSResp_GetSerial(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "serial: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocTSResp_GetNonce(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "nonce: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocTSResp_GetTime(*ppResp, &t1); - time_t2str(t1, buf1); - ddocDebug(3, "ddocSendTSRequest", "time: %s", buf1); - ddocTSResp_GetTsaName(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "tsa: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - - ddocTSResp_GetMsgImprint(*ppResp, &mbuf1); - l1 = mbuf1.nLen * 2 + 20; - ddocMemSetLength(&mbuf2, l1); - bin2hex((const byte*)mbuf1.pMem, mbuf1.nLen, (char*)mbuf2.pMem, &l1); - mbuf2.nLen = l1; - ddocDebug(3, "ddocSendTSRequest", "msg-imprint: %s", (mbuf2.pMem ? (char*)mbuf2.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocMemBuf_free(&mbuf2); - - ddocTSResp_GetMsgImprint_Algoritm(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "algoritm: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocTsResp_GetSignerCertSerial(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "signer cert-serial: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - ddocTsResp_GetSignerCertIssuer(*ppResp, &mbuf1); - ddocDebug(3, "ddocSendTSRequest", "signer cert-issuer: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - // test - ddocTsResp_GetSignerCert(*ppResp, &pCert); - if(pCert) { - ddocMemSetLength(&mbuf1, 100); - ReadCertSerialNumber((char*)mbuf1.pMem, 100, pCert); - ddocDebug(3, "ddocSendTSRequest", "signer cert-serial2: %s", (mbuf1.pMem ? (char*)mbuf1.pMem : "")); - ddocMemBuf_free(&mbuf1); - X509_free(pCert); - } - - } - */ - } - ddocMemBuf_free(&mbuf2); - ddocMemBuf_free(&mbuf3); - if(l1 != 200) { - SET_LAST_ERROR(ERR_TS_REQUEST); - err = ERR_TS_REQUEST; - } - return(err); -} - - -//-------------------------------------------------- -// Verifies a Timestamp response to TSA. -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - digest of timestamped data [REQUIRED] -// pCACerts - CA certs array [REQUIRED] -// szCAPath - path to dir with CA certs [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocVerifyTSResponse(TS_RESP* pResp, const DigiDocMemBuf* pMBufDigest, - X509** pCACerts, char* szCAPath) -{ - TS_VERIFY_CTX *ctx = NULL; - int err = ERR_OK, l1; - DigiDocMemBuf mbuf1; - X509 *pTsaCert = NULL, *pTsaCACert = NULL; - EVP_PKEY* pubkey = NULL; - //char *p1 = 0, *p2 = 0; - RETURN_IF_NULL_PARAM(pResp); - RETURN_IF_NULL_PARAM(pMBufDigest); - RETURN_IF_NULL_PARAM(pCACerts); - mbuf1.pMem = 0; - mbuf1.nLen = 0; - // find CA cert as the last in this chain - for(l1 = 0; pCACerts[l1]; l1++) - pTsaCACert = pCACerts[l1]; - RETURN_IF_NULL(pTsaCACert); // must find direct CA cert - // create TS request - l1 = 60; - ddocMemSetLength(&mbuf1, l1); - bin2hex((const byte*)pMBufDigest->pMem, pMBufDigest->nLen, (char*)mbuf1.pMem, &l1); - mbuf1.nLen = l1; - ddocDebug(3, "ddocVerifyTSResponse", "timestamp digest: \'%s\' len: %d", - (char*)mbuf1.pMem, pMBufDigest->nLen); - ddocMemBuf_free(&mbuf1); - // setup context - ctx = TS_VERIFY_CTX_new(); - RETURN_IF_NULL(ctx); - // debug import - //p1 = p2; - //i2d_TS_MSG_IMPRINT(pResp->tst_info->msg_imprint, &p2); - - ctx->flags |= TS_VFY_IMPRINT; - ctx->imprint = pMBufDigest->pMem; // who should release this ??? - ctx->imprint_len = pMBufDigest->nLen; - ctx->flags |= TS_VFY_SIGNATURE; - // Initialising the X509_STORE object. - err = setup_verifyCERT(&(ctx->store), szCAPath, (const X509**)pCACerts); - if(!err) - err = TS_RESP_verify_response(ctx, pResp); - ddocDebug(3, "ddocVerifyTSResponse", "RC: %d", err); - if(err == 1) { - err = ERR_OK; - } else { - err = ERR_TS_VERIFY; - checkErrors(); - } - if(!err) { - err = ddocTSResp_GetStatus(pResp, &l1); - if(l1 != TS_STATUS_GRANTED && - l1 != TS_STATUS_GRANTED_WITH_MODS) { - ddocDebug(3, "ddocVerifyTSResponse", "invalid timestamp status: %d", l1); - err = ERR_TS_VERIFY; - } - } - if(ctx) { - ctx->imprint = 0; - ctx->imprint_len = 0; - TS_VERIFY_CTX_free(ctx); - } - // check signers cert - if(!err) { - err = ddocTsResp_GetSignerCert(pResp, &pTsaCert); - if(pTsaCert) { - ddocCertGetSubjectCN(pTsaCert, &mbuf1); - ddocDebug(3, "ddocVerifyTSResponse", "TSA Cert: %s", (const char*)mbuf1.pMem); - ddocMemBuf_free(&mbuf1); - ddocCertGetSubjectCN(pTsaCACert, &mbuf1); - ddocDebug(3, "ddocVerifyTSResponse", "TSA CA Cert: %s", (const char*)mbuf1.pMem); - ddocMemBuf_free(&mbuf1); - err = GetPublicKey(&pubkey, pTsaCACert); - if(!err && pubkey) { - err = X509_verify(pTsaCert, pubkey); - ddocDebug(3, "ddocVerifyTSResponse", "verify RC: %d", err); - if(err == ERR_LIB_NONE) - err = ERR_OK; - else - err = ERR_CERT_ISSUER; - } - X509_free(pTsaCert); - } - } - return(err); -} - -//-------------------------------------------------- -// Verifies a TimestampInfo -// pTS - TimestampInfo object [REQUIRED] -// pCACerts - CA certs array [REQUIRED] -// szCAPath - path to dir with CA certs [OPTIONAL] -// pTime - address of time_t to store timestamping time [OPTIONAL] -// ppTsaCert - address of TSA cert to return it[OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocVerifyTimestampInfo(TimestampInfo *pTS, - X509** pCACerts, char* szCAPath, - time_t *pTime, X509** ppTsaCert) -{ - TS_RESP *pResp = NULL; - int err = ERR_OK; - DigiDocMemBuf* pMBuf = NULL; - - RETURN_IF_NULL_PARAM(pTS); - ddocDebug(3, "ddocVerifyTSResponse", "timestamp %s type: %s", pTS->szId, pTS->szType); - pMBuf = (DigiDocMemBuf*)ddocTimestampInfo_GetTS(pTS); - RETURN_IF_NULL(pMBuf); - err = ddocTsReadTsResp(&pResp, pMBuf); - err = ddocVerifyTSResponse(pResp, ddocTimestampInfo_GetRealDigest(pTS), pCACerts, szCAPath); - ddocDebug(3, "ddocVerifyTSResponse", "timestamp %s RC: %d", pTS->szId, err); - if(pResp && pTime && !err) - err = ddocTSResp_GetTime(pResp, pTime); - if(pResp && ppTsaCert && !err) - err = ddocTsResp_GetSignerCert(pResp, ppTsaCert); - if(pResp) - TS_RESP_free(pResp); - return err; -} - - -//-------------------------------------------------- -// Returns TS_RESP policy id. -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetPolicyId(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - TS_VERIFY_CTX *ctx = NULL; - int err = ERR_OK, l1; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - // find length - ddocMemSetLength(pMBuf, 100); - l1 = i2t_ASN1_OBJECT(pMBuf->pMem, 100, pResp->tst_info->policy_id); - ddocDebug(3, "ddocTSResp_GetPolicyId", "policy: %d - %s", l1, (pMBuf->pMem ? (char*)pMBuf->pMem : "")); - return err; -} - - -//-------------------------------------------------- -// Returns TS_RESP status code as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pStatus - address of variable for status [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetStatus(TS_RESP* pResp, int* pStatus) -{ - BIGNUM* bn; - char* str = 0; - int err = ERR_OK; - - RETURN_IF_NULL_PARAM(pStatus); - RETURN_IF_NULL_PARAM(pResp); - *pStatus = -1; - bn = ASN1_INTEGER_to_BN(pResp->status_info->status, NULL); - if(bn) { - str = BN_bn2dec(bn); - if(str) - *pStatus = atoi(str); - } - // create TS request - if(str) - OPENSSL_free(str); - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP serial number as a string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetSerial(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - BIGNUM* bn; - char* str = 0; - int err = ERR_OK; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - bn = ASN1_INTEGER_to_BN(pResp->tst_info->serial, NULL); - if(bn) { - str = BN_bn2dec(bn); - if(str) - ddocMemAssignData(pMBuf, str, -1); - } - // create TS request - if(str) - OPENSSL_free(str); - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP nonce as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetNonce(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - BIGNUM* bn; - char* str = 0; - int err = ERR_OK; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - bn = ASN1_INTEGER_to_BN(pResp->tst_info->nonce, NULL); - if(bn) { - str = BN_bn2dec(bn); - if(str) - ddocMemAssignData(pMBuf, str, -1); - } - // create TS request - if(str) - OPENSSL_free(str); - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP time as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pTime - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetTime(TS_RESP* pResp, time_t* pTime) -{ - int err = ERR_OK; - struct tm tm1; - int dmz = 0; - - RETURN_IF_NULL_PARAM(pTime); - RETURN_IF_NULL_PARAM(pResp); - *pTime = 0; - err = decodeGeneralizedTime(pResp->tst_info->time, - &tm1.tm_year, &tm1.tm_mon, - &tm1.tm_mday, &tm1.tm_hour, &tm1.tm_min, &tm1.tm_sec); - //tm1.tm_year -= 1900; - tm1.tm_mon -= 1; - tm1.tm_isdst = _daylight; - *pTime = mktime(&tm1); - if(_daylight != 0) { - if(_timezone<0){ - dmz = (_timezone / 3600) - _daylight; - }else{ - dmz = (_timezone / 3600) + _daylight; - } - }else{ - dmz=_timezone / 3600; - } - (*pTime) = (*pTime) - (dmz * 3600); - - return err; -} - - -//-------------------------------------------------- -// Returns TS_RESP tsa name as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetTsaName(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - int err = ERR_OK, i, n, t, l, b = 0; - X509_NAME_ENTRY *pNe = 0; - char *p, *s; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - if(pResp->tst_info->tsa) { - ddocDebug(3, "ddocTSResp_GetTsaName", "type: %d", pResp->tst_info->tsa->type); - switch(pResp->tst_info->tsa->type) { - case GEN_DIRNAME: - for(i = 0; i < sk_X509_NAME_ENTRY_num(pResp->tst_info->tsa->d.directoryName->entries); i++) { - pNe = sk_X509_NAME_ENTRY_value(pResp->tst_info->tsa->d.directoryName->entries, i); - n = OBJ_obj2nid(pNe->object); - s = (char*)OBJ_nid2sn(n); - t = pNe->value->type; - if(n != NID_undef && s != NULL) { - // convert to UTF8 only - p = 0; - if(t == V_ASN1_UTF8STRING) { - p = pNe->value->data; - l = pNe->value->length; - } else - l = ASN1_STRING_to_UTF8((unsigned char **)&p, pNe->value); - // append separator if necessary - if(b) - err = ddocMemAppendData(pMBuf, "/", -1); - else - b = 1; - // print the entry - err = ddocMemAppendData(pMBuf, s, -1); - err = ddocMemAppendData(pMBuf, "=", -1); - err = ddocMemAppendData(pMBuf, (const char*)p, l); - // cleanup - if(p && t != V_ASN1_UTF8STRING) - OPENSSL_free(p); - } - } - break; - } - } - return err; -} - - -//-------------------------------------------------- -// Returns TS_RESP message imprint as binary data -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetMsgImprint(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - int err = ERR_OK, l1; - unsigned char *p1; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - if(pResp->tst_info && pResp->tst_info->msg_imprint) { - l1 = i2d_ASN1_OCTET_STRING(pResp->tst_info->msg_imprint->hashed_msg, NULL); - ddocDebug(4, "ddocTsReadTsReq", "converting: %d bytes from MSG_IMPRINT", l1); - // alloc mem - err = ddocMemSetLength(pMBuf, l1 + 50); - p1 = (unsigned char*)pMBuf->pMem; - l1 = i2d_ASN1_OCTET_STRING(pResp->tst_info->msg_imprint->hashed_msg, &p1); - pMBuf->nLen = l1; - } - return err; -} - - -//-------------------------------------------------- -// Returns TS_RESP message imprint algoritm as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetMsgImprint_Algoritm(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - int err = ERR_OK, i; - - RETURN_IF_NULL_PARAM(pMBuf); - RETURN_IF_NULL_PARAM(pResp); - pMBuf->pMem = 0; - pMBuf->nLen = 0; - if(pResp->tst_info && pResp->tst_info->msg_imprint) { - i = OBJ_obj2nid(pResp->tst_info->msg_imprint->hash_algo->algorithm); - err = ddocMemSetLength(pMBuf, 50); - strncpy((char*)pMBuf->pMem, ((i == NID_undef) ? "UNKNOWN" : OBJ_nid2ln(i)), pMBuf->nLen); - pMBuf->nLen = strlen((char*)pMBuf->pMem); - } - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert serial. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTsResp_GetSignerCertSerial(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - int err = ERR_OK; - PKCS7 *pPkcs7; - PKCS7_SIGNER_INFO *si; - STACK_OF(PKCS7_SIGNER_INFO) *sinfos = NULL; - char *p1; - BIGNUM* bn; - - RETURN_IF_NULL_PARAM(pResp); - RETURN_IF_NULL_PARAM(pMBuf); - pPkcs7 = TS_RESP_get_token(pResp); - RETURN_IF_NULL(pPkcs7); - if(PKCS7_type_is_signed(pPkcs7)) { - sinfos = PKCS7_get_signer_info(pPkcs7); - if(sinfos && sk_PKCS7_SIGNER_INFO_num(sinfos) == 1) { - si = sk_PKCS7_SIGNER_INFO_value(sinfos, 0); - bn = ASN1_INTEGER_to_BN(si->issuer_and_serial->serial, NULL); - p1 = BN_bn2dec(bn); - ddocMemAssignData(pMBuf, p1, -1); - ddocDebug(3, "ddocTsResp_GetSignerCertSerial", "Signer cert serial: %s", p1); - OPENSSL_free(p1); - } - } - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert issuer DN. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsResp_GetSignerCertIssuer(TS_RESP* pResp, DigiDocMemBuf* pMBuf) -{ - int err = ERR_OK; - PKCS7 *pPkcs7; - PKCS7_SIGNER_INFO *si; - STACK_OF(PKCS7_SIGNER_INFO) *sinfos = NULL; - - - RETURN_IF_NULL_PARAM(pResp); - RETURN_IF_NULL_PARAM(pMBuf); - pPkcs7 = TS_RESP_get_token(pResp); - RETURN_IF_NULL(pPkcs7); - if(PKCS7_type_is_signed(pPkcs7)) { - sinfos = PKCS7_get_signer_info(pPkcs7); - if(sinfos && sk_PKCS7_SIGNER_INFO_num(sinfos) == 1) { - si = sk_PKCS7_SIGNER_INFO_value(sinfos, 0); - err = ddocMemSetLength(pMBuf, 300); - X509_NAME_oneline(si->issuer_and_serial->issuer, (char*)pMBuf->pMem, pMBuf->nLen); - ddocDebug(3, "ddocTsResp_GetSignerCertIssuer", "Signer cert issuer: %s", (char*)pMBuf->pMem); - } - } - return err; -} - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// ppCert - address of signers cert pointer [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsResp_GetSignerCert(TS_RESP* pResp, X509** ppCert) -{ - int err = ERR_OK; - PKCS7 *pPkcs7; - STACK_OF(X509) *signers = NULL; - - RETURN_IF_NULL_PARAM(pResp); - RETURN_IF_NULL_PARAM(ppCert); - // mark as not found - *ppCert = 0; - pPkcs7 = TS_RESP_get_token(pResp); - RETURN_IF_NULL(pPkcs7); - ddocDebug(3, "ddocTsResp_GetSignerCert", "PKCS7 signed: %d signed-and-envloped: %d", - PKCS7_type_is_signed(pPkcs7), PKCS7_type_is_signedAndEnveloped(pPkcs7)); - if(PKCS7_type_is_signed(pPkcs7)) { - signers = PKCS7_get0_signers(pPkcs7, NULL, 0); - if(signers && sk_X509_num(signers) == 1) { - *ppCert = sk_X509_value(signers, 0); - if(*ppCert) - CRYPTO_add(&(*ppCert)->references, 1, CRYPTO_LOCK_X509); - } - } - return err; -} diff -Nru libdigidoc-2.7.0/libdigidoc/ts/DigiDocTS.h libdigidoc-3.7.0.875/libdigidoc/ts/DigiDocTS.h --- libdigidoc-2.7.0/libdigidoc/ts/DigiDocTS.h 2009-05-13 21:44:33.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc/ts/DigiDocTS.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,489 +0,0 @@ -#ifndef __DIGIDOC_TS_H__ -#define __DIGIDOC_TS_H__ -//================================================== -// FILE: DigiDocTS.h -// PROJECT: Digi Doc Encryption -// DESCRIPTION: DigiDoc timestamping routines -// AUTHOR: Veiko Sinivee, S|E|B IT Partner Estonia -//================================================== -// Copyright (C) AS Sertifitseerimiskeskus -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// GNU Lesser General Public Licence is available at -// http://www.gnu.org/copyleft/lesser.html -//==========< HISTORY >============================= -// 10.04.2006 Veiko Sinivee -// Creation -//================================================== - -#include -#include -//#include - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -//==========< glocal constants >============= - -#define TS_TYPE_ALL_DATA_OBJECTS "AllDataObjectsTimeStamp" -#define TS_TYPE_INDIVIDUAL_DATA_OBJECTS "IndividualDataObjectsTimeStamp" -#define TS_TYPE_SIGNATURE "SignatureTimeStamp" -#define TS_TYPE_SIG_AND_REFS "SigAndRefsTimeStamp" -#define TS_TYPE_REFS_ONLY "RefsOnlyTimeStamp" -#define TS_TYPE_ARCHIVE "ArchiveTimeStamp" - -#define ID_TS_TYPE_ALL_DATA_OBJECTS 1 -#define ID_TS_TYPE_INDIVIDUAL_DATA_OBJECTS 2 -#define ID_TS_TYPE_SIGNATURE 3 -#define ID_TS_TYPE_SIG_AND_REFS 4 -#define ID_TS_TYPE_REFS_ONLY 5 -#define ID_TS_TYPE_ARCHIVE 6 - -//==========< structures >=================== - -typedef struct IncludeInfo_st { - char* szURI; // URI atribute value - int referencedData; // referencedData atribute value - // no Transforms used currently -} IncludeInfo; - -typedef struct TimestampInfo_st { - char* szId; // Id atribute value if present - char* szType; // Type atribute value if present - char* szCanonicalizationMethod; // CanonicalizationMethod element - DigiDocMemBuf mbufTS; // timestamp data - DigiDocMemBuf mbufRealDigest; // digest calculated over xml as read from file - // list of IncludeInfo-s - int nIncludeInfos; - IncludeInfo** pIncludeInfos; -} TimestampInfo; - -typedef struct TimestampInfoList_st { - int nTimestampInfos; - TimestampInfo** pTimestampInfos; -} TimestampInfoList; - -//==========< IncludeInfo >======================== - -//-------------------------------------------------- -// "Constructor" of IncludeInfo object -// pTimestampInfo - parent object [REQUIRED] -// ppIncludeInfo - address of buffer for newly allocated object [REQUIRED] -// szURI - hashed object uri [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_new(TimestampInfo* pTimestampInfo, - IncludeInfo** ppIncludeInfo, const char* szURI); - -//-------------------------------------------------- -// "Destructor" of IncludeInfo object -// pIncludeInfo - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_free(IncludeInfo* pIncludeInfo); - -//-------------------------------------------------- -// Accessor for URI atribute of IncludeInfo object. -// pIncludeInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocIncludeInfo_GetURI(const IncludeInfo* pIncludeInfo); - -//-------------------------------------------------- -// Mutatoror for Id atribute of IncludeInfo object. -// pIncludeInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocIncludeInfo_SetURI(IncludeInfo* pIncludeInfo, const char* value); - -//==========< TimestampInfo >======================== - -//-------------------------------------------------- -// "Constructor" of TimestampInfo object -// pTimestampInfoList - parent object [REQUIRED] -// ppTimestampInfo - address of buffer for newly allocated object [REQUIRED] -// szId - timestamp id [OPTIONAL] -// szType - timestamp type [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_new(TimestampInfoList* pTimestampInfoList, - TimestampInfo** ppTimestampInfo, - const char* szId, const char* szType); - -//-------------------------------------------------- -// "Destructor" of TimestampInfo object -// pTimestampInfo - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_free(TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Accessor for Id atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocTimestampInfo_GetId(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Mutatoror for Id atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetId(TimestampInfo* pTimestampInfo, const char* value); - -//-------------------------------------------------- -// Accessor for Type atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const char* ddocTimestampInfo_GetType(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Mutatoror for Type atribute of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetType(TimestampInfo* pTimestampInfo, const char* value); - -//-------------------------------------------------- -// Accessor for Timestamp data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const DigiDocMemBuf* ddocTimestampInfo_GetTS(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Mutatoror for Timestamp data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// len - length of value in bytes [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetTS(TimestampInfo* pTimestampInfo, - const char* value, long len); - -//-------------------------------------------------- -// Accessor for real digest value of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// returns value of atribute or NULL. -//-------------------------------------------------- -EXP_OPTION const DigiDocMemBuf* ddocTimestampInfo_GetRealDigest(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Mutatoror for real digest data of TimestampInfo object. -// pTimestampInfo - address of object [REQUIRED] -// value - new value for atribute [REQUIRED] -// len - length of value in bytes [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_SetRealDigest(TimestampInfo* pTimestampInfo, - const char* value, long len); - -//-------------------------------------------------- -// Accessor for count of IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// returns count or -1 for error. Then use error API to check errors -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_GetIncludeInfosCount(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Accessor for IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// nIdx - index of IncludeInfo object [REQUIRED] -// returns IncludeInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION IncludeInfo* ddocTimestampInfo_GetIncludeInfo(const TimestampInfo* pTimestampInfo, int nIdx); - -//-------------------------------------------------- -// Accessor for last IncludeInfos subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// returns IncludeInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION IncludeInfo* ddocTimestampInfo_GetLastIncludeInfo(const TimestampInfo* pTimestampInfo); - -//-------------------------------------------------- -// Deletes IncludeInfo subelement of TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// nIdx - index of IncludeInfo object to be removed [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_DeleteIncludeInfo(TimestampInfo* pTimestampInfo, int nIdx); - -//-------------------------------------------------- -// Adds an IncludeInfo subelement to TimestampInfo object. -// pTimestampInfo - pointer to TimestampInfo object [REQUIRED] -// szURI - URI atribute of IncludeInfo object to be added [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfo_AddIncludeInfo(TimestampInfo* pTimestampInfo, const char* szURI); - -//-------------------------------------------------- -// Generates XML for element -// pTimestampInfo - TimestampInfo object [REQUIRED] -// pBuf - memory buffer for storing xml [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTimestampInfo_toXML(const TimestampInfo* pTimestampInfo, DigiDocMemBuf* pBuf); - -//==========< TimestampInfoList >==================== - -//-------------------------------------------------- -// "Constructor" of TimestampInfoList object -// ppTimestampInfoList - address of buffer for newly allocated object [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_new(TimestampInfoList** ppTimestampInfoList); - -//-------------------------------------------------- -// "Destructor" of TimestampInfoList object -// pTimestampInfoList - address of object to be deleted [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_free(TimestampInfoList* pTimestampInfoList); - -//-------------------------------------------------- -// Accessor for count of TimestampInfos subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// returns count or -1 for error. Then use error API to check errors -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_GetTimestampInfosCount(const TimestampInfoList* pTimestampInfoList); - -//-------------------------------------------------- -// Accessor for TimestampInfos subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// nIdx - index of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetTimestampInfo(const TimestampInfoList* pTimestampInfoList, int nIdx); - -//-------------------------------------------------- -// Deletes TimestampInfo subelement of TimestampInfoList object. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// nIdx - index of TimestampInfo object to be removed [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTimestampInfoList_DeleteTimestampInfo(TimestampInfoList* pTimestampInfoList, int nIdx); - -//-------------------------------------------------- -// Returns the TimestampInfo with required type -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// szType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- -EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetTimestampInfoOfType(const TimestampInfoList* pTimestampInfoList, const char* szType); - -//-------------------------------------------------- -// Returns the TimestampInfo with required type. -// Creates one if it doesn't exist yet. -// pTimestampInfoList - pointer to TimestampInfoList object [REQUIRED] -// szType - type of TimestampInfo object [REQUIRED] -// returns TimestampInfo pointer or NULL for error -//-------------------------------------------------- - EXP_OPTION TimestampInfo* ddocTimestampInfoList_GetOrCreateTimestampInfoOfType(TimestampInfoList* pTimestampInfoList, const char* szId, const char* szType); - - - -//==========< general functions >============ - -//-------------------------------------------------- -// Helper function to create a new TS_REQ from XML data objects -// that will be digested. Stores the result in PEM form -// in a DigiDocMemBuf object. -// pMBufReq - memory buffer to store new request in PEM format -// pMBufDigest - digest data to timestamp (xml) -// policy - oilicy oid in stringform. Use NULL if not necessary -// bNonce - 1=send nonce, 0=no nonce -// bCert - request req_cert property 1/0 -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsCreateTsReqBin(DigiDocMemBuf* pMBufReq, DigiDocMemBuf* pMBufDigest, - const char* policy, int bNonce, int bCert); - -//-------------------------------------------------- -// sends a Timestamp request to TSA server -// retrieves the TS_RESP object -// pMBufDigest - digest of data to be timestamped [REQUIRED] -// ppResp - address for TS_RESP [REQUIRED] -// policy - policy OID [OPTIONAL] -// bNonce - flag use nonce: 1/0 [REQUIRED] -// bCert - flag send cert: 1/0 [REQUIRED] -// url - TSA url [REQUIRED] -// proxyHost - http proxy host [OPTIONAL] -// proxyPort - http proxy port [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocSendTSRequest(DigiDocMemBuf* pMBufDigest, TS_RESP** ppResp, - const char* policy, int bNonce, int bCert, const char* url, - const char* proxyHost, const char* proxyPort); - - -//==========< utility functions >======================== - -//-------------------------------------------------- -// Helper function to read TS_REQ from binary input data -// ppReq - address of newly allocated TS_REQ object -// pMBufInData - input data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsReadTsReq(TS_REQ** ppReq, DigiDocMemBuf* pMBufInData); - -//-------------------------------------------------- -// Helper function to write TS_REQ to binary output data -// pReq - address of TS_REQ object -// pMBufOutData - output data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsWriteTsReq(TS_REQ* pReq, DigiDocMemBuf* pMBufOutData); - -//-------------------------------------------------- -// Helper function to read TS_RESP from binary input data -// ppResp - address of newly allocated TS_RESP object -// pMBufInData - input data -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTsReadTsResp(TS_RESP** ppResp, DigiDocMemBuf* pMBufInData); - -//-------------------------------------------------- -// Helper function to write TS_RESP to binary output data -// pResp - address of TS_RESP object -// pMBufOutData - output data -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsWriteTsResp(TS_RESP* pResp, DigiDocMemBuf* pMBufOutData); - -//-------------------------------------------------- -// Returns TS_RESP policy id. -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetPolicyId(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP status code as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pStatus - address of variable for status [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetStatus(TS_RESP* pResp, int* pStatus); - -//-------------------------------------------------- -// Returns TS_RESP serial number as a string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetSerial(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP nonce as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTSResp_GetNonce(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP time as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pTime - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetTime(TS_RESP* pResp, time_t* pTime); - -//-------------------------------------------------- -// Returns TS_RESP tsa name as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetTsaName(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP message imprint as binary data -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetMsgImprint(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP message imprint algoritm as string -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTSResp_GetMsgImprint_Algoritm(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Verifies a Timestamp response to TSA. -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBufDigest - digest of timestamped data [REQUIRED] -// pCACerts - CA certs array [REQUIRED] -// szCAPath - path to dir with CA certs [OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocVerifyTSResponse(TS_RESP* pResp, const DigiDocMemBuf* pMBufDigest, - X509** pCACerts, char* szCAPath); - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert serial. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTsResp_GetSignerCertSerial(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert issuer DN. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// pMBuf - buffer for returned data [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocTsResp_GetSignerCertIssuer(TS_RESP* pResp, DigiDocMemBuf* pMBuf); - -//-------------------------------------------------- -// Returns TS_RESP signers (e.g. TSA) cert. -// Assumes that there's only 1 signer -// pResp - TS_RESP timestamp response [REQUIRED] -// ppCert - address of signers cert pointer [REQUIRED] -// returns error code or ERR_OK -//-------------------------------------------------- -EXP_OPTION int ddocTsResp_GetSignerCert(TS_RESP* pResp, X509** ppCert); - -//-------------------------------------------------- -// Verifies a TimestampInfo -// pTS - TimestampInfo object [REQUIRED] -// pCACerts - CA certs array [REQUIRED] -// szCAPath - path to dir with CA certs [OPTIONAL] -// pTime - address of time_t to store timestamping time [OPTIONAL] -// ppTsaCert - address of TSA cert to return it[OPTIONAL] -// returns error code or ERR_OK -//-------------------------------------------------- -int ddocVerifyTimestampInfo(TimestampInfo *pTS, - X509** pCACerts, char* szCAPath, - time_t *pTime, X509** ppTsaCert); - -int ddocTsResp_GetSignerCert(TS_RESP* pResp, X509** ppCert); - -#ifdef __cplusplus -} -#endif - - -#endif // __DIGIDOC_TS_H__ - diff -Nru libdigidoc-2.7.0/libdigidoc.pc.cmake libdigidoc-3.7.0.875/libdigidoc.pc.cmake --- libdigidoc-2.7.0/libdigidoc.pc.cmake 2009-06-16 07:59:14.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoc.pc.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -prefix=@CMAKE_INSTALL_PREFIX@ -exec_prefix=@CMAKE_INSTALL_PREFIX@ -libdir=@LIB_INSTALL_DIR@ -includedir=@CMAKE_INSTALL_PREFIX@/include - -Name: libdigidoc -Description: Libdigidoc library for handling digitally signed documents -Version: @DIGIDOC_VERSION@ -Libs: -L${libdir} -ldigidoc -Cflags: -I${includedir} diff -Nru libdigidoc-2.7.0/libdigidoccom/CMakeLists.txt libdigidoc-3.7.0.875/libdigidoccom/CMakeLists.txt --- libdigidoc-2.7.0/libdigidoccom/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/CMakeLists.txt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,22 @@ +add_definitions( + -D_CRT_NONSTDC_NO_DEPRECATE + -D_CRT_SECURE_NO_DEPRECATE + -D_CRT_SECURE_NO_WARNINGS + -D_SCL_SECURE_NO_WARNINGS +) +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +ADD_CUSTOM_COMMAND( + OUTPUT "DigiDocLibCOM_i.c" "DigiDocLibCOM_p.c" "DigiDocLibCOM.tlb" "dlldata.c" + COMMAND midl.exe ${CMAKE_CURRENT_SOURCE_DIR}/DigiDocLibCOM.idl /header DigiDocLibCOM_h.h + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/DigiDocLibCOM.idl" +) + +FILE( GLOB SOURCES *.cpp ) +add_library( DigiDocLibCOM SHARED DigiDocLibCOM.rc DigiDocLibCOM_i.c DigiDocLibCOM_p.c dlldata.c ${SOURCES} ) +target_link_libraries( DigiDocLibCOM digidoc RpcRT4 ) + +install( TARGETS DigiDocLibCOM + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertArray.cpp libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.cpp --- libdigidoc-2.7.0/libdigidoccom/ComCertArray.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,87 @@ +// ComCertArray.cpp : Implementation of CComCertArray +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComCertArray.h" +#include "ComCertificate.h" +#include "Converters.h" +#include "ComCertSearchStore.h" + + +///////////////////////////////////////////////////////////////////////////// +// CComCertArray + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// +STDMETHODIMP CComCertArray::get_nCerts(long *pVal) +{ + *pVal = m_nCertCount; + + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// +STDMETHODIMP CComCertArray::getCertByIndex(long nIndex, IComCertificate *pStoreTo) +{ + ((CComCertificate*)pStoreTo)->shiftStructPointer(m_pX509Array[nIndex]); + + return S_OK; +} + +STDMETHODIMP CComCertArray::clear() +{ + freeStruct_soft(); + + return S_OK; +} + +STDMETHODIMP CComCertArray::searchBySearchStore(IComCertSearchStore *pSearchStore, long *nRetCode) +{ + + freeStruct_soft(); + *nRetCode = ::findAllCertificates( + ((CComCertSearchStore*)pSearchStore)->getCertSearchStore(), + &m_pX509Array, &m_nCertCount); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComCertArray::CComCertArray() { + m_pX509Array = (X509**)0; + m_nCertCount = 0; +} + + +CComCertArray::~CComCertArray() { + freeStruct_soft(); +} + + +void CComCertArray::freeStruct_soft() { + if (m_pX509Array) + freeStruct_hard(); +} + + +void CComCertArray::freeStruct_hard() { + for (int i = 0; i < m_nCertCount; i++) + ::X509_free(m_pX509Array[i]); + m_nCertCount = 0; +} + + + +X509 * CComCertArray::getArray(void) +{ +if (m_pX509Array != NULL) + return(m_pX509Array[0]); +else + return NULL; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertArray.h libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.h --- libdigidoc-2.7.0/libdigidoccom/ComCertArray.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,68 @@ +/* + +Handles X509 certificates if findAllCertificates +returns more than one cert. +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComCertArray.h : Declaration of the CComCertArray + +#ifndef __COMCERTARRAY_H_ +#define __COMCERTARRAY_H_ + +#include "resource.h" // main symbols + +//#include "DigiDocCsp.h" +///////////////////////////////////////////////////////////////////////////// +// CComCertArray +class ATL_NO_VTABLE CComCertArray : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComCertArray(); + ~CComCertArray(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMCERTARRAY) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComCertArray) + COM_INTERFACE_ENTRY(IComCertArray) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComCertArray +public: + STDMETHOD(searchBySearchStore)(/*[in]*/ IComCertSearchStore* pSearchStore, /*[out, retval]*/ long* nRetCode); + STDMETHOD(clear)(); + STDMETHOD(getCertByIndex)(/*[in]*/ long nIndex, /*[in]*/ IComCertificate* pStoreTo); + STDMETHOD(get_nCerts)(/*[out, retval]*/ long *pVal); + + + void freeStruct_soft(); + void freeStruct_hard(); + + +protected: + X509** m_pX509Array; + int m_nCertCount; +public: + X509 * getArray(void); +}; + +#endif //__COMCERTARRAY_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertArray.rgs libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.rgs --- libdigidoc-2.7.0/libdigidoccom/ComCertArray.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertArray.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComCertArray.1 = s 'ComCertArray Class' + { + CLSID = s '{DFA0A5BA-EB46-11D6-AF18-420005574701}' + } + DigiDocLibCOM.ComCertArray = s 'ComCertArray Class' + { + CLSID = s '{DFA0A5BA-EB46-11D6-AF18-420005574701}' + CurVer = s 'DigiDocLibCOM.ComCertArray.1' + } + NoRemove CLSID + { + ForceRemove {DFA0A5BA-EB46-11D6-AF18-420005574701} = s 'ComCertArray Class' + { + ProgID = s 'DigiDocLibCOM.ComCertArray.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComCertArray' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearch.cpp libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.cpp --- libdigidoc-2.7.0/libdigidoccom/ComCertSearch.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,180 @@ +// ComCertSearch.cpp : Implementation of CComCertSearch +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComCertSearch.h" +#include "Converters.h" + +///////////////////////////////////////////////////////////////////////////// +// CComCertSearch + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComCertSearch::get_nCertSearchBy(long *pVal) +{ + if(m_pCertSearch) + *pVal = m_pCertSearch->searchType; + return S_OK; +} + +STDMETHODIMP CComCertSearch::put_nCertSearchBy(long newVal) +{ + if(m_pCertSearch) + m_pCertSearch->searchType = newVal; + return S_OK; +} + +STDMETHODIMP CComCertSearch::get_szX509FileName(BSTR *pVal) +{ + if(m_pCertSearch && m_pCertSearch->x509FileName) + Convert::copysz2BSTR_withAlloc(m_pCertSearch->x509FileName, pVal); + return S_OK; +} + +STDMETHODIMP CComCertSearch::put_szX509FileName(BSTR newVal) +{ + if(m_pCertSearch) + CertSearch_setX509FileName(m_pCertSearch, GetBSTR(newVal)); + return S_OK; +} + + +STDMETHODIMP CComCertSearch::get_szKeyFileName(BSTR *pVal) +{ + if(m_pCertSearch && m_pCertSearch->keyFileName) + Convert::copysz2BSTR_withAlloc(m_pCertSearch->keyFileName, pVal); + return S_OK; +} + +STDMETHODIMP CComCertSearch::put_szKeyFileName(BSTR newVal) +{ + if(m_pCertSearch) + CertSearch_setKeyFileName(m_pCertSearch, GetBSTR(newVal)); + return S_OK; +} + +STDMETHODIMP CComCertSearch::get_szPkcs12FileName(BSTR *pVal) +{ + if(m_pCertSearch && m_pCertSearch->pkcs12FileName) + Convert::copysz2BSTR_withAlloc(m_pCertSearch->pkcs12FileName, pVal); + return S_OK; +} + +STDMETHODIMP CComCertSearch::put_szPkcs12FileName(BSTR newVal) +{ + if(m_pCertSearch) + CertSearch_setPkcs12FileName(m_pCertSearch, GetBSTR(newVal)); + return S_OK; +} + +STDMETHODIMP CComCertSearch::get_pswd(BSTR *pVal) +{ + if(m_pCertSearch && m_pCertSearch->pswd) + Convert::copysz2BSTR_withAlloc(m_pCertSearch->pswd, pVal); + return S_OK; +} + +STDMETHODIMP CComCertSearch::put_pswd(BSTR newVal) +{ + if(m_pCertSearch) + CertSearch_setPasswd(m_pCertSearch, GetBSTR(newVal)); + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComCertSearch::getCertSearchStore(IComCertSearchStore* pStoreTo) +{ + if (m_pCertSearch->certSearchStore == (CertSearchStore*)0) + m_pCertSearch->certSearchStore = ::CertSearchStore_new(); + ((CComCertSearchStore*)pStoreTo)->shiftStructPointer( + m_pCertSearch->certSearchStore); + + return S_OK; +} + +STDMETHODIMP CComCertSearch::lookup(VARIANT* pRetBool) +{ + + VariantInit(pRetBool); + V_VT(pRetBool) = VT_BOOL; + if(m_pCertSearch) { + X509* pCert = findCertificate(m_pCertSearch); + V_BOOL(pRetBool) = ((pCert == NULL) ? FALSE : TRUE); + if (pCert != NULL) + ::X509_free(pCert); // TODO: delete!!! + } + int toDbg = V_BOOL(pRetBool) ? 1 : 0; + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// helpers +////////////////////////////////////////////////////////////// +CComCertSearch::CComCertSearch() { + m_pointerMode = false; + m_pCertSearch = ::CertSearch_new(); +} + +CComCertSearch::~CComCertSearch() { + if (!m_pointerMode) + freeStruct(); +} + +CertSearch* CComCertSearch::getCertSearch() { + return m_pCertSearch; +} + +void CComCertSearch::shiftStructPointer(CertSearch* pNew) { + if (!m_pointerMode) + freeStruct(); + m_pCertSearch = pNew; + m_pointerMode = true; +} + +// frees memory allocated for struct +void CComCertSearch::freeStruct() { + if(!m_pointerMode && m_pCertSearch) { + ::CertSearch_free(m_pCertSearch); + m_pCertSearch = NULL; + } +} + +void CComCertSearch::reset() { + m_pCertSearch->searchType = 0; + if (m_pCertSearch->x509FileName != (char*)0) + delete m_pCertSearch->x509FileName; + if (m_pCertSearch->keyFileName != (char*)0) + delete m_pCertSearch->keyFileName; + if (m_pCertSearch->pkcs12FileName != (char*)0) + delete m_pCertSearch->pkcs12FileName; + if (m_pCertSearch->pswd != (char*)0) + delete m_pCertSearch->pswd; + if (m_pCertSearch->certSearchStore != (CertSearchStore*)0) + delete m_pCertSearch->certSearchStore; +} + + +////////////////////////////////////////////////////////////// +// helper class +////////////////////////////////////////////////////////////// + +CertHolderInScope::CertHolderInScope(CComCertSearch& lookup) { + cert = ::findCertificate(lookup.getCertSearch()); +} + +CertHolderInScope::CertHolderInScope(X509* rememberCert) { + cert = rememberCert; +} + +CertHolderInScope::~CertHolderInScope() { + if (cert) + ::X509_free(cert); +} + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearch.h libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.h --- libdigidoc-2.7.0/libdigidoccom/ComCertSearch.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,94 @@ +/* + +Wrap of DigiCoc library CertSearch structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComCertSearch.h : Declaration of the CComCertSearch + +#ifndef __COMCERTSEARCH_H_ +#define __COMCERTSEARCH_H_ + +#include "resource.h" // main symbols + +#include "Converters.h" +#include "ComCertSearchStore.h" + +///////////////////////////////////////////////////////////////////////////// +// CComCertSearch +class ATL_NO_VTABLE CComCertSearch : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComCertSearch(); + ~CComCertSearch(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMCERTSEARCH) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComCertSearch) + COM_INTERFACE_ENTRY(IComCertSearch) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComCertSearch +public: + STDMETHOD(lookup)(/*[out, retval]*/ VARIANT* pRetBool); + STDMETHOD(getCertSearchStore)(/*[in]*/ IComCertSearchStore* pStoreTo); + STDMETHOD(get_pswd)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_pswd)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szPkcs12FileName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szPkcs12FileName)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szKeyFileName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szKeyFileName)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szX509FileName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szX509FileName)(/*[in]*/ BSTR newVal); + STDMETHOD(get_nCertSearchBy)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_nCertSearchBy)(/*[in]*/ long newVal); + + CertSearch* getCertSearch(); + void shiftStructPointer(CertSearch* pNew); + + // frees memory allocated for struct + void freeStruct(); + +protected: + CertSearch* m_pCertSearch; + bool m_pointerMode; + + void reset(); +}; + + + +////////////////////////////////////////////////////////////// +// helper class +////////////////////////////////////////////////////////////// +class CertHolderInScope { +public: + X509* cert; + + CertHolderInScope(CComCertSearch& lookup); + CertHolderInScope(X509* rememberCert); + ~CertHolderInScope(); + + bool isAvailable() { return (cert ? true : false); } +}; + +#endif //__COMCERTSEARCH_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearch.rgs libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.rgs --- libdigidoc-2.7.0/libdigidoccom/ComCertSearch.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearch.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComCertSearch.1 = s 'ComCertSearch Class' + { + CLSID = s '{41B66A18-BE72-11D6-AEF5-420005574701}' + } + DigiDocLibCOM.ComCertSearch = s 'ComCertSearch Class' + { + CLSID = s '{41B66A18-BE72-11D6-AEF5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComCertSearch.1' + } + NoRemove CLSID + { + ForceRemove {41B66A18-BE72-11D6-AEF5-420005574701} = s 'ComCertSearch Class' + { + ProgID = s 'DigiDocLibCOM.ComCertSearch.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComCertSearch' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.cpp libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.cpp --- libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,137 @@ +// ComCertSearchStore.cpp : Implementation of CComCertSearchStore +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComCertSearchStore.h" + +///////////////////////////////////////////////////////////////////////////// +// CComCertSearchStore + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComCertSearchStore::get_szStoreName(BSTR *pVal) +{ + Convert::copysz2BSTR_withAlloc(m_pCertSearchStore->storeName, pVal); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::put_szStoreName(BSTR newVal) +{ + Convert::in_BSTR2sz(newVal, &(m_pCertSearchStore->storeName)); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::get_nCertSerial(long *pVal) +{ + + *pVal = m_pCertSearchStore->certSerial; + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::put_nCertSerial(long newVal) +{ + m_pCertSearchStore->certSerial = newVal; + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::get_saSubDNCriterias(VARIANT *pVal) +{ + Convert::out_szarr2VARIANT(m_pCertSearchStore->subDNCriterias, pVal, + m_pCertSearchStore->numberOfSubDNCriterias); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::put_saSubDNCriterias(VARIANT newVal) +{ + Convert::in_VARIANT2szarr(newVal, + m_pCertSearchStore->subDNCriterias, + &(m_pCertSearchStore->numberOfSubDNCriterias)); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::get_saIssuerDNCriterias(VARIANT *pVal) +{ + Convert::out_szarr2VARIANT(m_pCertSearchStore->issDNCriterias, pVal, + m_pCertSearchStore->numberOfIssDNCriterias); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::put_saIssuerDNCriterias(VARIANT newVal) +{ + Convert::in_VARIANT2szarr(newVal, + m_pCertSearchStore->issDNCriterias, + &(m_pCertSearchStore->numberOfIssDNCriterias)); + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::get_nSubDNCriterias(long *pVal) +{ + *pVal = m_pCertSearchStore->numberOfSubDNCriterias; + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::get_nIssuerDNCriterias(long *pVal) +{ + *pVal = m_pCertSearchStore->numberOfIssDNCriterias; + + return S_OK; +} + + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// +STDMETHODIMP CComCertSearchStore::addSearchType(long nCertSearchStoreType) +{ + m_pCertSearchStore->searchType |= nCertSearchStoreType; + + return S_OK; +} + +STDMETHODIMP CComCertSearchStore::removeSearchType(long nCertSearchStoreType) +{ + m_pCertSearchStore->searchType &= (~nCertSearchStoreType); + + return S_OK; +} + + + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComCertSearchStore::CComCertSearchStore() { + m_pointerMode = false; + m_pCertSearchStore = ::CertSearchStore_new(); +} +CComCertSearchStore::~CComCertSearchStore() { + if (!m_pointerMode) + freeStruct(); +} + +CertSearchStore* CComCertSearchStore::getCertSearchStore() { + return m_pCertSearchStore; +} + +void CComCertSearchStore::shiftStructPointer(CertSearchStore* pNew) { + if (!m_pointerMode) + freeStruct(); + m_pCertSearchStore = pNew; + m_pointerMode = true; +} + +void CComCertSearchStore::freeStruct() { + ::CertSearchStore_free(m_pCertSearchStore); +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.h libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.h --- libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,74 @@ +/* + +Wrap of DigiCoc library CertSearchStore structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComCertSearchStore.h : Declaration of the CComCertSearchStore + +#ifndef __COMCERTSEARCHSTORE_H_ +#define __COMCERTSEARCHSTORE_H_ + +#include "resource.h" // main symbols + +#include "libdigidoc/DigiDocCsp.h" +#include "Converters.h" + +///////////////////////////////////////////////////////////////////////////// +// CComCertSearchStore +class ATL_NO_VTABLE CComCertSearchStore : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComCertSearchStore(); + ~CComCertSearchStore(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMCERTSEARCHSTORE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComCertSearchStore) + COM_INTERFACE_ENTRY(IComCertSearchStore) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComCertSearchStore +public: + STDMETHOD(removeSearchType)(/*[in]*/ long nCertSearchStoreType); + STDMETHOD(addSearchType)(/*[in]*/ long nCertSearchStoreType); + STDMETHOD(get_nIssuerDNCriterias)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_nSubDNCriterias)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_saIssuerDNCriterias)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(put_saIssuerDNCriterias)(/*[in]*/ VARIANT newVal); + STDMETHOD(get_saSubDNCriterias)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(put_saSubDNCriterias)(/*[in]*/ VARIANT newVal); + STDMETHOD(get_nCertSerial)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_nCertSerial)(/*[in]*/ long newVal); + STDMETHOD(get_szStoreName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szStoreName)(/*[in]*/ BSTR newVal); + + CertSearchStore* getCertSearchStore(); + void shiftStructPointer(CertSearchStore* pNew); + void freeStruct(); + +protected: + CertSearchStore* m_pCertSearchStore; + bool m_pointerMode; +}; + +#endif //__COMCERTSEARCHSTORE_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.rgs libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.rgs --- libdigidoc-2.7.0/libdigidoccom/ComCertSearchStore.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertSearchStore.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComCertSearchStore.1 = s 'ComCertSearchStore Class' + { + CLSID = s '{41B66A16-BE72-11D6-AEF5-420005574701}' + } + DigiDocLibCOM.ComCertSearchStore = s 'ComCertSearchStore Class' + { + CLSID = s '{41B66A16-BE72-11D6-AEF5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComCertSearchStore.1' + } + NoRemove CLSID + { + ForceRemove {41B66A16-BE72-11D6-AEF5-420005574701} = s 'ComCertSearchStore Class' + { + ProgID = s 'DigiDocLibCOM.ComCertSearchStore.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComCertSearchStore' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertificate.cpp libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.cpp --- libdigidoc-2.7.0/libdigidoccom/ComCertificate.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,138 @@ +// ComCertificate.cpp : Implementation of CComCertificate +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComCertificate.h" +#include "Converters.h" +#include "libdigidoc/DigiDocMem.h" +#include "libdigidoc/DigiDocCert.h" +#include "libdigidoc/DigiDocConvert.h" + +///////////////////////////////////////////////////////////////////////////// +// CComCertificate + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// +STDMETHODIMP CComCertificate::get_hHandle(long *pVal) +{ + *pVal = (long)m_pX509; + + return S_OK; +} + +STDMETHODIMP CComCertificate::get_containsCert(VARIANT *pVal) +{ + VariantInit(pVal); + V_VT(pVal) = VT_BOOL; + V_BOOL(pVal) = ((m_pX509 == NULL) ? FALSE : TRUE); + + return S_OK; +} + +STDMETHODIMP CComCertificate::get_szPropSubjectName(BSTR *pVal) +{ + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + USES_CONVERSION; + if (::ddocCertGetSubjectDN(m_pX509, &mbuf1) != 0) { + SetBSTR(pVal,""); //*pVal = SysAllocString(A2OLE("")); + } else { + ddocMemSetLength(&mbuf2, mbuf1.nLen + 10); + utf82oem((const char*)mbuf1.pMem, (char*)mbuf2.pMem, mbuf2.nLen); + SetBSTR(pVal, (char*)mbuf2.pMem); //*pVal = SysAllocStringLen(A2OLE(buf), bLen); + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + return S_OK; +} + +STDMETHODIMP CComCertificate::get_szPropIssuerName(BSTR *pVal) +{ + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + USES_CONVERSION; + if (::ddocCertGetIssuerDN((X509*)m_pX509, &mbuf1) != 0) { + SetBSTR(pVal,""); //*pVal = SysAllocString(A2OLE("")); + } else { + ddocMemSetLength(&mbuf2, mbuf1.nLen + 10); + utf82oem((const char*)mbuf1.pMem, (char*)mbuf2.pMem, mbuf2.nLen); + SetBSTR(pVal, (char*)mbuf2.pMem); //*pVal = SysAllocStringLen(A2OLE(buf), bLen); + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + return S_OK; +} + +STDMETHODIMP CComCertificate::get_nPropSerialNumber(BSTR *pVal) +{ + char buf[X509_NAME_BUF_LEN]; + //AA-Viimase minuti jama + ::ReadCertSerialNumber(buf,sizeof(buf),m_pX509); + USES_CONVERSION; + *pVal = SysAllocString(A2OLE(buf)); + //*pVal = atol(buf); + //if (::getCertSerialNumber((void*)m_pX509, (int*)pVal) != 0) { + //*pVal = 0; + //} + + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComCertificate::CComCertificate() { + m_pointerMode = true; + m_pX509 = (X509*)0; +} + +CComCertificate::~CComCertificate() { + freeStruct_soft(); +} + +X509* CComCertificate::getX509() { + return m_pX509; +} + +void CComCertificate::shiftStructPointer(X509* pNew) { + freeStruct_soft(); + m_pX509 = pNew; + m_pointerMode = true; // I don't own this cert +} + +void CComCertificate::takeOwnershipOn(X509* pNew) { + freeStruct_soft(); + m_pX509 = pNew; + m_pointerMode = false; // now I have this cert +} + +void CComCertificate::freeStruct_soft() { + if (!m_pointerMode && m_pX509) { + freeStruct_hard(); + } + m_pX509 = (X509*)0; +} + +void CComCertificate::freeStruct_hard() { + ::X509_free(m_pX509); + m_pX509 = (X509*)0; +} + + + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertificate.h libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.h --- libdigidoc-2.7.0/libdigidoccom/ComCertificate.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,71 @@ +/* + +Wraps X509 certificate for using with ComCertArray class. +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComCertificate.h : Declaration of the CComCertificate + +#ifndef __COMCERTIFICATE_H_ +#define __COMCERTIFICATE_H_ + +#include "resource.h" // main symbols + + +///////////////////////////////////////////////////////////////////////////// +// CComCertificate +class ATL_NO_VTABLE CComCertificate : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComCertificate(); + ~CComCertificate(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMCERTIFICATE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComCertificate) + COM_INTERFACE_ENTRY(IComCertificate) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComCertificate +public: + STDMETHOD(get_nPropSerialNumber)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szPropIssuerName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szPropSubjectName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_containsCert)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_hHandle)(/*[out, retval]*/ long *pVal); + + + X509* getX509(); + + void shiftStructPointer(X509* pNew); + void takeOwnershipOn(X509* pNew); + + void freeStruct_soft(); + void freeStruct_hard(); + + +protected: + X509* m_pX509; + bool m_pointerMode; +}; + +#endif //__COMCERTIFICATE_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComCertificate.rgs libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.rgs --- libdigidoc-2.7.0/libdigidoccom/ComCertificate.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComCertificate.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComCertificate.1 = s 'ComCertificate Class' + { + CLSID = s '{8544D544-EB32-11D6-AF18-420005574701}' + } + DigiDocLibCOM.ComCertificate = s 'ComCertificate Class' + { + CLSID = s '{8544D544-EB32-11D6-AF18-420005574701}' + CurVer = s 'DigiDocLibCOM.ComCertificate.1' + } + NoRemove CLSID + { + ForceRemove {8544D544-EB32-11D6-AF18-420005574701} = s 'ComCertificate Class' + { + ProgID = s 'DigiDocLibCOM.ComCertificate.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComCertificate' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDataFile.cpp libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.cpp --- libdigidoc-2.7.0/libdigidoccom/ComDataFile.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,212 @@ +// ComDataFile.cpp : Implementation of CComDataFile +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComDataFile.h" + +#include "Converters.h" +#include "libdigidoc/DigiDocConvert.h" +#include "libdigidoc/DigiDocMem.h" +//#include "DigiDocLib.h" + +///////////////////////////////////////////////////////////////////////////// +// CComDataFile + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComDataFile::get_szId(BSTR *pVal) +{ + if(m_pDataFile) + Convert::out_retval_sz2BSTR(m_pDataFile->szId, pVal); + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szFileName(BSTR *pVal) +{ + DigiDocMemBuf mbuf1; + int err = 0; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(m_pDataFile && m_pDataFile->szFileName) { + ddocMemSetLength(&mbuf1, strlen(m_pDataFile->szFileName)+1); + err = getDataFileFileName(m_pSignedDoc, m_pDataFile, + (char*)mbuf1.pMem, mbuf1.nLen); + } + Convert::out_retval_sz2BSTR((char*)mbuf1.pMem, pVal); + ddocMemBuf_free(&mbuf1); + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szMimeType(BSTR *pVal) +{ + if(m_pDataFile) + Convert::out_retval_sz2BSTR(m_pDataFile->szMimeType, pVal); + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szContentType(BSTR *pVal) +{ + if(m_pDataFile) + Convert::out_retval_sz2BSTR(m_pDataFile->szContentType, pVal); + return S_OK; +} + +STDMETHODIMP CComDataFile::get_nSize(long *pVal) +{ + if(m_pDataFile) + *pVal = m_pDataFile->nSize; + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szDigestType(BSTR *pVal) +{ + if(m_pDataFile) + Convert::out_retval_sz2BSTR(m_pDataFile->szDigestType, pVal); + return S_OK; +} + +STDMETHODIMP CComDataFile::get_baDigest(VARIANT *pVal) +{ + DigiDocMemBuf *pMBuf; + + if(m_pDataFile) { + pMBuf = ddocDataFile_GetDigestValue(m_pDataFile); + Convert::out_retval_ac2VARIANT((const char*)pMBuf->pMem, pMBuf->nLen, pVal); + } + return S_OK; +} + +STDMETHODIMP CComDataFile::get_nDigestLen(long *pVal) +{ + DigiDocMemBuf *pMBuf; + + if(m_pDataFile) { + pMBuf = ddocDataFile_GetDigestValue(m_pDataFile); + *pVal = pMBuf->nLen; + } + return S_OK; +} + +STDMETHODIMP CComDataFile::get_nAttributes(long *pVal) +{ + if(m_pDataFile) + *pVal = m_pDataFile->nAttributes; + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szaAttNames(VARIANT *pVal) +{ + if(!m_pDataFile || (m_pDataFile && m_pDataFile->pAttNames == (char**)0)) { + V_VT(pVal)= VT_EMPTY; + } else { + SAFEARRAY* pArr = SafeArrayCreateVector(VT_BSTR, 0, m_pDataFile->nAttributes); + + V_ARRAY(pVal) = pArr; + V_VT(pVal) = (VT_ARRAY | VT_BSTR); + + BSTR HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + USES_CONVERSION; + for(int i = 0; i < m_pDataFile->nAttributes; i++) { + SetBSTR(&pData[i], m_pDataFile->pAttNames[i]); //pData[i] = SysAllocString(A2OLE(getDataFile()->pAttNames[i])); // TODO it's slow, use func call + } + SafeArrayUnaccessData(pArr); + } + return S_OK; +} + +STDMETHODIMP CComDataFile::get_szaAttValues(VARIANT *pVal) +{ + if (!m_pDataFile || (m_pDataFile && m_pDataFile->pAttValues == (char**)0)) { + V_VT(pVal)= VT_EMPTY; + } else { + SAFEARRAY* pArr = SafeArrayCreateVector(VT_BSTR, 0, m_pDataFile->nAttributes); + + V_ARRAY(pVal) = pArr; + V_VT(pVal) = (VT_ARRAY | VT_BSTR); + + BSTR HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + USES_CONVERSION; + for(int i = 0; i < m_pDataFile->nAttributes; i++) { + SetBSTR(&pData[i], m_pDataFile->pAttValues[i]); //pData[i] = SysAllocString(A2OLE(getDataFile()->pAttValues[i])); // TODO it's slow, use func call + } + SafeArrayUnaccessData(pArr); + } + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComDataFile::addAttribute(BSTR szAttrName, BSTR szAttrValue) +{ + USES_CONVERSION; + + if(m_pDataFile) + ::addDataFileAttribute(m_pDataFile, GetBSTR(szAttrName), GetBSTR(szAttrValue)); + return S_OK; +} + +STDMETHODIMP CComDataFile::getAttributeName(long nIndex, BSTR *szRetName) +{ + char* pName = NULL; + char* pValue = NULL; + USES_CONVERSION; + + if(m_pDataFile) { + ::getDataFileAttribute(m_pDataFile, nIndex, &pName, &pValue); + if(pName) + SetBSTR(szRetName, pName); //*szRetName = SysAllocString(A2OLE(pName)); + } + return S_OK; +} + +STDMETHODIMP CComDataFile::getAttributeValue(long nIndex, BSTR *szRetValue) +{ + char* pName = NULL; + char* pValue = NULL; + USES_CONVERSION; + + if(m_pDataFile) { + ::getDataFileAttribute(m_pDataFile, nIndex, &pName, &pValue); + if(pValue) + SetBSTR(szRetValue, pValue); //*szRetValue = SysAllocString(A2OLE(pValue)); + } + return S_OK; +} + + + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComDataFile::CComDataFile() { + m_pDataFile = NULL; + m_pSignedDoc = NULL; +} + +CComDataFile::~CComDataFile() { + /*if(m_pDataFile) { + ::DataFile_free(m_pDataFile); + m_pDataFile = NULL; + }*/ +} + + +void CComDataFile::shiftStructPointer(DataFile* pNew) { + /*if(m_pDataFile) { + ::DataFile_free(m_pDataFile); + m_pDataFile = NULL; + }*/ + m_pDataFile = pNew; +} + + + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDataFile.h libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.h --- libdigidoc-2.7.0/libdigidoccom/ComDataFile.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,75 @@ +/* + +Wrap of DigiCoc library DataFile structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComDataFile.h : Declaration of the CComDataFile + +#ifndef __COMDATAFILE_H_ +#define __COMDATAFILE_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CComDataFile +#include "ComSignedDoc.h" + +class ATL_NO_VTABLE CComDataFile : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComDataFile(); + ~CComDataFile(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMDATAFILE) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComDataFile) + COM_INTERFACE_ENTRY(IComDataFile) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComDataFile +public: + STDMETHOD(getAttributeValue)(/*[in]*/ long nIndex, /*[out, retval]*/ BSTR* szRetValue); + STDMETHOD(getAttributeName)(/*[in]*/ long nIndex, /*[out, retval]*/ BSTR* szRetName); + STDMETHOD(addAttribute)(/*[in]*/ BSTR szAttrName, /*[in]*/ BSTR szAttrValue); + STDMETHOD(get_szaAttValues)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_szaAttNames)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_nAttributes)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_nDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baDigest)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_szDigestType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_nSize)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szContentType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szMimeType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szFileName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szId)(/*[out, retval]*/ BSTR *pVal); + + + void shiftStructPointer(DataFile* pNew); + void setSignedDoc(SignedDoc* pSigDoc) { m_pSignedDoc = pSigDoc; } + +protected: + DataFile* m_pDataFile; + SignedDoc* m_pSignedDoc; // this object is not owned by this interface! +}; + +#endif //__COMDATAFILE_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDataFile.rgs libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.rgs --- libdigidoc-2.7.0/libdigidoccom/ComDataFile.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDataFile.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComDataFile.1 = s 'ComDataFile Class' + { + CLSID = s '{2A54186E-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComDataFile = s 'ComDataFile Class' + { + CLSID = s '{2A54186E-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComDataFile.1' + } + NoRemove CLSID + { + ForceRemove {2A54186E-9A3E-11D6-AEE5-420005574701} = s 'ComDataFile Class' + { + ProgID = s 'DigiDocLibCOM.ComDataFile.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComDataFile' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.cpp libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.cpp --- libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,583 @@ +// ComDigiDocLib.cpp : Implementation of CComDigiDocLib +#include "stdafx.h" +#include "libdigidoc/DigiDocConvert.h" +#include "libdigidoc/DigiDocGlobals.h" +#include "libdigidoc/DigiDocDfExtract.h" +#include "libdigidoc/DigiDocDebug.h" +#include "DigiDocLibCOM_h.h" +#include "ComDigiDocLib.h" +#include "ComCertificate.h" +#include +#include "config.h" + + +///////////////////////////////////////////////////////////////////////////// +// CComDigiDocLib + +CComDigiDocLib :: CComDigiDocLib() + : m_pProfile(0) +{ + m_pProfile = TSAProfile_init(); +} + +CComDigiDocLib :: ~CComDigiDocLib() +{ + TSAProfile_free(); +} + +STDMETHODIMP CComDigiDocLib::getLibName(BSTR *ret) +{ + USES_CONVERSION; + SetBSTR(ret, (char *)::getLibName()); //*ret = SysAllocString(A2OLE(::getLibName())); + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getLibVersion(BSTR *ret) +{ + USES_CONVERSION; + + //KERT + SetBSTR(ret,DIGIDOC_VERSION); + //SetBSTR(ret, (char *)::getLibVersion()); //*ret = SysAllocString(A2OLE(::getLibVersion())); + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::getComVersion(BSTR *ret){ + // TODO: Add your implementation code here + SetBSTR(ret,DIGIDOC_VERSION); + return S_OK; +} + + + + +// http://www.devguy.com/fp/Tips/COM/bstr.htm + +STDMETHODIMP CComDigiDocLib::get_TsaUrl(BSTR *pVal) +{ + USES_CONVERSION; + + if(m_pProfile) + Convert::copysz2BSTR_withAlloc(m_pProfile->g_szTsaUrl, pVal); + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::put_TsaUrl(BSTR newVal) +{ + USES_CONVERSION; + + if(m_pProfile) + strncpy(m_pProfile->g_szTsaUrl, OLE2T(newVal), sizeof(m_pProfile->g_szTsaUrl)); + + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::get_DebugFilePath(BSTR *pVal) +{ + USES_CONVERSION; + + if(m_pProfile) + Convert::copysz2BSTR_withAlloc(m_pProfile->m_szDebugFilePath, pVal); + + + return S_OK; +} + + + +STDMETHODIMP CComDigiDocLib::put_DebugFilePath(BSTR newVal) +{ + USES_CONVERSION; + + if(m_pProfile) + { + strncpy(m_pProfile->m_szDebugFilePath, OLE2T(newVal), sizeof(m_pProfile->m_szDebugFilePath)); + createOrReplacePrivateConfigItem(NULL, "DEBUG_FILE", m_pProfile->m_szDebugFilePath); + } + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::get_DebugLevel(LONG *pVal) +{ + if(m_pProfile) + *pVal = m_pProfile->m_nDebugLevel; + return S_OK; +} + + + +STDMETHODIMP CComDigiDocLib::put_DebugLevel(LONG newVal) +{ + if(m_pProfile) { + m_pProfile->m_nDebugLevel = newVal; + char _stack_buffer[30]; + sprintf(_stack_buffer, "%ld", newVal); + createOrReplacePrivateConfigItem(NULL, "DEBUG_LEVEL", _stack_buffer); + } + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::get_AddTimeStamp(VARIANT_BOOL *pVal) +{ + //USES_CONVERSION; + if(m_pProfile) + *pVal = (VARIANT_BOOL)m_pProfile->g_bAddSignatureTimeStamp; + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::put_AddTimeStamp(VARIANT_BOOL newVal) +{ + //USES_CONVERSION; + + if(m_pProfile) + m_pProfile->g_bAddSignatureTimeStamp = (int) newVal; + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::get_AddSigAndRefsTimeStamp(VARIANT_BOOL *pVal) +{ + if(m_pProfile) + *pVal = (VARIANT_BOOL)m_pProfile->g_bAddSigAndRefsTimeStamp; + return S_OK; +} + + + +STDMETHODIMP CComDigiDocLib::put_AddSigAndRefsTimeStamp(VARIANT_BOOL newVal) +{ + if(m_pProfile) + m_pProfile->g_bAddSigAndRefsTimeStamp = (int) newVal; + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::get_TimeStampMaxInterval(LONG *pVal) +{ + if(m_pProfile) + *pVal = m_pProfile->g_nTsaMaxTsInterval; + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::put_TimeStampMaxInterval(LONG newVal) +{ + if(m_pProfile) + m_pProfile->g_nTsaMaxTsInterval = newVal; + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getSetting(BSTR szName, BSTR* pVal) +{ + USES_CONVERSION; + const char *psVal = NULL; + char *psName = GetBSTR(szName); + + if(psName) { + psVal = ::ConfigItem_lookup(psName); + if(psVal) + Convert::copysz2BSTR_withAlloc((char*)psVal, pVal); + } + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::putSetting(BSTR szName, BSTR szVal) +{ + USES_CONVERSION; + char *psName = GetBSTR(szName); + char *psVal = GetBSTR(szVal); + if(psName && psVal) + ::createOrReplacePrivateConfigItem(NULL, psName, psVal); + return S_OK; +} + + + + + +STDMETHODIMP CComDigiDocLib::getSupportedFormats(VARIANT *ret) +{ + const char** pArr = ::getSupportedFormats(); + unsigned int nElems = 0; + SAFEARRAY* pSArr; + BSTR HUGEP* pData; + + // detect number of elements + for(; *pArr != NULL; pArr++, nElems++); + + // initialize SAFEARRAY + pSArr = SafeArrayCreateVector(VT_BSTR, 0, nElems); + if (pSArr == NULL) { + return E_OUTOFMEMORY; + } + + // init variant + V_ARRAY(ret) = pSArr; + V_VT(ret) = (VT_ARRAY | VT_BSTR); + + // copy data to variant + pArr = ::getSupportedFormats(); + SafeArrayAccessData(pSArr, (void HUGEP**)&pData); + long lArr[1]; + USES_CONVERSION; + ddocDebug(1, "getSupportedFormats", "num formats: %d", nElems); + for(lArr[0] = 0; lArr[0] < (long)nElems; lArr[0]++) { + ddocDebug(1, "getSupportedFormats", "format: %d - %s", lArr[0], pArr[lArr[0]]); + pData[lArr[0]] = SysAllocString(A2OLE(pArr[lArr[0]])); + } + SafeArrayUnaccessData(pSArr); + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::extractDataFile(IComSignedDoc* pSignedDoc, BSTR szFileName, BSTR szDataFileName, BSTR szDocId, BSTR szCharset, long* nRetResult) +{ + USES_CONVERSION; + char *psFileName; + char *psDataFileName; + SignedDoc *pSigDoc = NULL; + psFileName = GetBSTR(szFileName); + psDataFileName = GetBSTR(szDataFileName); + if (pSignedDoc != NULL) + pSigDoc = ((CComSignedDoc*)pSignedDoc)->getSignedDoc(); + *nRetResult = ddocExtractDataFile(pSigDoc, psFileName, psDataFileName, GetBSTR(szDocId), GetBSTR(szCharset)); + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::getCertSubjectName(long hCertHandle, BSTR *pCopyTo, long *nRetResult) +{ + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + *nRetResult = ::ddocCertGetSubjectDN((X509* )hCertHandle, &mbuf1); + if (*nRetResult == 0) { + // allocate as much mem in mbuf2 plus some extra. + // Converting to 8 bit makes string shorter so this will be enought + ddocMemSetLength(&mbuf2, mbuf1.nLen + 10); + utf82oem((const char*)mbuf1.pMem, (char*)mbuf2.pMem, mbuf2.nLen); + USES_CONVERSION; + SetBSTR(pCopyTo, (char*)mbuf2.pMem); //*pCopyTo = SysAllocString(A2OLE(buf)); + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getCertIssuerName(long hCert, BSTR *pszStoreTo, long *nRetResult) +{ + DigiDocMemBuf mbuf1, mbuf2; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + mbuf2.pMem = 0; + mbuf2.nLen = 0; + *nRetResult = ::ddocCertGetIssuerDN((X509*)hCert, &mbuf1); + if (*nRetResult == 0) { + // allocate as much mem in mbuf2 plus some extra. + // Converting to 8 bit makes string shorter so this will be enought + ddocMemSetLength(&mbuf2, mbuf1.nLen + 10); + utf82oem((const char*)mbuf1.pMem, (char*)mbuf2.pMem, mbuf2.nLen); + USES_CONVERSION; + SetBSTR(pszStoreTo, (char*)mbuf2.pMem); //*pszStoreTo = SysAllocString(A2OLE(buf)); + } + ddocMemBuf_free(&mbuf1); + ddocMemBuf_free(&mbuf2); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getCertSerialNumber(long hCert, BSTR *pCopyTo, long *nRetResult) +{ + char buf[X509_NAME_BUF_LEN]; + //AA-Viimase minuti jama + *nRetResult = ::ReadCertSerialNumber(buf,sizeof(buf),(X509 *)hCert); + USES_CONVERSION; + if (*nRetResult == 0) + *pCopyTo = SysAllocString(A2OLE(buf)); + +// *nRetResult = ::getCertSerialNumber((void*)hCert, &nTmp); +// if (*nRetResult == 0) +// *nCopyTo = nTmp; + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getCertNotBefore(IComSignedDoc* pUseFormatOf, long hCert, BSTR* szTimeStamp, long *nRetResult) +{ + char buf[X509_NAME_BUF_LEN]; + *nRetResult = ::getCertNotBefore(((CComSignedDoc*)pUseFormatOf)->getSignedDoc(), (X509*)hCert, buf, sizeof(buf)); + if (*nRetResult == ERR_OK) { + USES_CONVERSION; + SetBSTR(szTimeStamp,buf); //*szTimeStamp = ::SysAllocString(A2OLE(buf)); + } + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::getCertNotAfter(IComSignedDoc* pUseFormatOf, long hCert, BSTR* szTimeStamp, long *nRetResult) +{ + char buf[X509_NAME_BUF_LEN]; + *nRetResult = ::getCertNotAfter(((CComSignedDoc*)pUseFormatOf)->getSignedDoc(), (X509*)hCert, buf, sizeof(buf)); + if (*nRetResult == 0) { + USES_CONVERSION; + SetBSTR(szTimeStamp,buf); //*szTimeStamp = SysAllocString(A2OLE(buf)); + } + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::saveCert(long hCert, BSTR szSaveToFile, long nFormat, long *nRetResult) +{ + USES_CONVERSION; + *nRetResult = ::saveCert((X509*)hCert, GetBSTR(szSaveToFile), nFormat); + + return S_OK; +} +//Changed by AA 22.09.2003 +STDMETHODIMP CComDigiDocLib::isCertValid(long hCert, IComTimestamp* TimeValue, long *nRetResult) +{ + struct tm oTime; + time_t oTimeVal; + long lTemp; + TimeValue->get_year(&lTemp); + oTime.tm_year = lTemp; + TimeValue->get_month(&lTemp); + oTime.tm_mon = lTemp; + TimeValue->get_day(&lTemp); + oTime.tm_mday = lTemp; + // + oTimeVal = mktime(&oTime); + *nRetResult = ::isCertValid((X509*)hCert,oTimeVal); + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::isCertSignedBy(long hCert, BSTR szCAFile, long *nRetResult) +{ + USES_CONVERSION; + *nRetResult = ::isCertSignedBy((X509*)hCert, GetBSTR(szCAFile)); + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::isCertSignedByCERT(IComCertSearch *searchCert, IComCertSearch *searchCACert, long *nRetResult) +{ + CertHolderInScope certHolder(*(CComCertSearch*)searchCert); + CertHolderInScope caCertHolder(*(CComCertSearch*)searchCACert); + + if (certHolder.isAvailable() && caCertHolder.isAvailable()) { + *nRetResult = ::isCertSignedByCERT( + certHolder.cert, caCertHolder.cert); + } else { + *nRetResult = ERR_CERT_STORE_READ; + } + + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::findIssuerCertificatefromMsStore(IComCertificate *cert, IComCertificate *storeTo) +{ + X509* pCert = ((CComCertificate*)cert)->getX509(); + X509* pIssuerCert = ::findIssuerCertificatefromMsStore(pCert); + ((CComCertificate*)storeTo)->freeStruct_soft(); + if (pIssuerCert) + ((CComCertificate*)storeTo)->takeOwnershipOn(pIssuerCert); + + return S_OK; +} + +//AA 19/09/2003 +STDMETHODIMP CComDigiDocLib::readCertificateByPKCS12OnlyCert(BSTR szPKCS12File, BSTR szPassword, LONG* hX509Handle) +{ +USES_CONVERSION; +X509* pX509 = 0; // VS: 26.01.2010 - initialize with zero +_bstr_t bsFile(szPKCS12File); +_bstr_t bsPsw(szPassword); +if (::Digi_readCertificateByPKCS12OnlyCertHandle((char *)bsFile,(char *)bsPsw,&pX509) == ERR_OK) + *hX509Handle = (long)pX509; +else + *hX509Handle = 0; +SysFreeString(bsFile); +SysFreeString(bsPsw); +return S_OK; +} + +extern "C" int RunDialogTestLow(void); +extern "C" int DialogUnitSetTexts(char *psCaption, char *psHeader, char *psOkButton, char *psCancelButton); +extern "C" int DialogUnitSetHeaders(char *psCol1, char *psCol2, char *psCol3, char *psCol4, char *psCol5); +extern "C" int DialogUnitSetToolTips(char *psCommon, char *psListView, char *psOkButton, char *psCancelButton); + +STDMETHODIMP CComDigiDocLib::RunDialogTest(long* nRetResult) +{ +int iRes = RunDialogTestLow(); +*nRetResult = 0; +return S_OK; +} + +STDMETHODIMP CComDigiDocLib::dialogUnitSetTexts(BSTR szCaption, BSTR szHeader, BSTR szOkButton, BSTR szCancelButton) +{ + USES_CONVERSION; +DialogUnitSetTexts(OLE2A(szCaption),OLE2A(szHeader),OLE2A(szOkButton),OLE2A(szCancelButton)); +return S_OK; +} + +STDMETHODIMP CComDigiDocLib::dialogUnitSetHeaders(BSTR szCol1, BSTR szCol2, BSTR szCol3, BSTR szCol4, BSTR szCol5) +{ + USES_CONVERSION; + DialogUnitSetHeaders(OLE2A(szCol1),OLE2A(szCol2),OLE2A(szCol3),OLE2A(szCol4),OLE2A(szCol5)); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::dialogUnitSetToolTips(BSTR szCommon, BSTR szListView, BSTR szOkButton, BSTR szCancelButton) +{ + USES_CONVERSION; + DialogUnitSetToolTips(OLE2A(szCommon),OLE2A(szListView),OLE2A(szOkButton),OLE2A(szCancelButton)); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::oem2unicode(BSTR szOem, BSTR* pVal) +{ + char *psBuf; + int iLen; + int iErr; + _bstr_t bsTemp(szOem); + USES_CONVERSION; + char *psVal = (char *)bsTemp; + iErr = ::oem2unicode(psVal, &psBuf,&iLen); + *pVal = SysAllocString(W2OLE((wchar_t *)psBuf)); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::longnum2hex(BSTR longNumber, BSTR* pVal) +{ + char *psBuf; + int iLen; + int iErr; + + BIGNUM *bn=NULL; + char* str; + + _bstr_t bsTemp(longNumber); + char *inputt = bsTemp; + + BN_dec2bn(&bn, inputt); + str = BN_bn2hex(bn); + BN_free(bn); + + iErr = ::oem2unicode(str, &psBuf,&iLen); + OPENSSL_free(str); + + *pVal = SysAllocString(W2OLE((wchar_t *)psBuf)); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::unicode2utf8(BSTR szUnicode, BSTR* pVal) +{ + USES_CONVERSION; + char *psBuf = NULL; + int iLen; + int iErr; + if(szUnicode && *szUnicode) { + _bstr_t bsTemp(szUnicode); + + + wchar_t *pswVal = (wchar_t *)bsTemp; + iErr = ::unicode2utf8((char *)pswVal, &psBuf,&iLen); + if (!iErr) { + *pVal = SysAllocString(A2OLE(psBuf)); + } else { + *pVal = SysAllocString(A2OLE("")); + } + if (psBuf != NULL) + freeLibMem(psBuf); + } + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::utf82unicode(BSTR szUtf8, BSTR* pVal) +{ + USES_CONVERSION; + char *psBuf; + int iLen; + int iErr; + + if(szUtf8 && *szUtf8) { + _bstr_t bsTemp(szUtf8); + char *psVal = (char *)bsTemp; + iErr = ::utf82unicode(psVal, &psBuf,&iLen); + if (!iErr) { + *pVal = SysAllocString(W2OLE((wchar_t *)psBuf)); + } else { + *pVal = SysAllocString(W2OLE((wchar_t *)"")); + } + if (psBuf != NULL) + freeLibMem(psBuf); + } + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::unicode2oem(BSTR szUnicode, BSTR* pVal) +{ + char *psBuf; + int iLen; + int iErr; + + if(szUnicode && *szUnicode) { + _bstr_t bsTemp(szUnicode); + USES_CONVERSION; + wchar_t *pswVal = (wchar_t *)bsTemp; + iErr = ::unicode2oem((char *)pswVal, &psBuf,&iLen); + *pVal = SysAllocString(A2OLE(psBuf)); + if (psBuf != NULL) + freeLibMem(psBuf); + } + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::DigiDocErrors(BSTR *retVal) +{ + bstr_t strVal = error_buf.c_str(); + *retVal = strVal.copy(); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::ClearDigiDocErrors() +{ + error_buf = ""; + clearErrors(); + return S_OK; +} + +STDMETHODIMP CComDigiDocLib::CollectErrors() +{ + char *errorClass[] = {"NO_ERRORS", "TECHNICAL", "USER", "LIBRARY"}; + int err = ERR_OK; + string sz_ret = ""; + char buf[3000]; + + while(hasUnreadErrors()) { + ErrorInfo* pErr = getErrorInfo(); + char* pErrStr = getErrorString(pErr->code); + if (pErr->code > 0) { + sprintf(buf,"ERROR: %d - %s; file: %s line: %d; failed condition: %s; error class : %s|", + pErr->code, pErrStr, PathFindFileName(pErr->fileName), pErr->line, pErr->assertion, errorClass[getErrorClass(pErr->code)]); + error_buf += buf; + } + } + return S_OK; +} + + +STDMETHODIMP CComDigiDocLib::SetClientNameVersion(BSTR content){ + string sz_content = _bstr_t(content); + setGUIVersion(sz_content.c_str()); + return S_OK; +} + + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.h libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.h --- libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,122 @@ +/* + +Wrap of DigiCoc library general functions to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComDigiDocLib.h : Declaration of the CComDigiDocLib + +#ifndef __COMDIGIDOCLIB_H_ +#define __COMDIGIDOCLIB_H_ + +#include "resource.h" // main symbols +#include "libdigidoc/DigiDocDefs.h" +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocSAXParser.h" +#include "libdigidoc/DigiDocCSP.h" +#include "libdigidoc/DigiDocGlobals.h" + +///////////////////////////////////////////////////////////////////////////// +// CComDigiDocLib + +#include "ComSignedDoc.h" +#include "ComSignatureInfo.h" +#include "ComDocInfo.h" +#include "ComNotaryInfo.h" +//#include "ComSignatureProdPlace.h" +#include "ComCertSearch.h" + +class ATL_NO_VTABLE CComDigiDocLib : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComDigiDocLib(); + ~CComDigiDocLib(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMDIGIDOCLIB) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComDigiDocLib) + COM_INTERFACE_ENTRY(IComDigiDocLib) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComDigiDocLib +public: + STDMETHOD(SetClientNameVersion)(BSTR content); + STDMETHOD(getComVersion)(BSTR *ret); + + + + STDMETHOD(CollectErrors)(); + STDMETHOD(ClearDigiDocErrors)(); + string error_buf; + STDMETHOD(DigiDocErrors)(BSTR *retVal); + STDMETHOD(findIssuerCertificatefromMsStore)(/*[in]*/ IComCertificate* cert, /*[in]*/ IComCertificate* storeTo); + STDMETHOD(isCertSignedByCERT)(/*[in]*/ IComCertSearch* searchCert, /*[in]*/ IComCertSearch* searchCACert, /*[out, retval]*/ long* nRetResult); + STDMETHOD(isCertSignedBy)(/*[in]*/ long hCert, /*[in]*/ BSTR szCAFile, /*[out, retval]*/ long* nRetResult); + STDMETHOD(isCertValid)(/*[in]*/ long hCert, /*[in]*/ IComTimestamp* TimeValue, /*[out, retval]*/ long* nRetResult); + STDMETHOD(saveCert)(/*[in]*/ long hCert, /*[in]*/ BSTR szSaveToFile, /*[in]*/ long nFormat, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getCertNotAfter)(/*[in]*/ IComSignedDoc* pUseFormatOf, /*[in]*/ long hCert, /*[out]*/ BSTR* szTimeStamp, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getCertNotBefore)(/*[in]*/ IComSignedDoc* pUseFormatOf, /*[in]*/ long hCert, /*[out]*/ BSTR* szTimeStamp, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getCertSerialNumber)(/*[in]*/ long hCert, /*[out]*/ BSTR* pCopyTo, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getCertIssuerName)(/*[in]*/ long hCert, /*[out]*/ BSTR* pszStoreTo, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getCertSubjectName)(/*[in]*/ long hCertHandle, /*[out]*/ BSTR* pCopyTo, /*[out, retval]*/ long* nRetResult); + STDMETHOD(extractDataFile)(/*[in]*/ IComSignedDoc* pSignedDoc,/*[in]*/ BSTR szFileName, /*[in]*/ BSTR szDataFileName, /*[in]*/ BSTR szDocId, /*[in]*/ BSTR szCharset, /*[out, retval]*/ long* nRetResult); + STDMETHOD(getSupportedFormats)(/*[out, retval]*/ VARIANT* ret); + STDMETHOD(getLibVersion)(/*[out, retval]*/ BSTR* ret); + STDMETHOD(getLibName)(/*[out, retval]*/ BSTR* ret); + STDMETHOD(readCertificateByPKCS12OnlyCert)(BSTR szPKCS12File, BSTR szPassword, LONG* hX509Handle); + STDMETHOD(RunDialogTest)( /*[out, retval]*/ long* nRetResult); + STDMETHOD(dialogUnitSetTexts)(BSTR szCaption, BSTR szHeader, BSTR szOkButton, BSTR szCancelButton); + STDMETHOD(dialogUnitSetHeaders)(BSTR szCol1, BSTR szCol2, BSTR szCol3, BSTR szCol4, BSTR szCol5); + STDMETHOD(dialogUnitSetToolTips)(BSTR szCommon, BSTR szListView, BSTR szOkButton, BSTR szCancelButton); + STDMETHOD(oem2unicode)(BSTR szOem, BSTR* pVal); + STDMETHOD(longnum2hex)(BSTR longNumber, BSTR* pVal); + STDMETHOD(unicode2utf8)(BSTR szUnicode, BSTR* pVal); + STDMETHOD(utf82unicode)(BSTR szUtf8, BSTR* pVal); + STDMETHOD(unicode2oem)(BSTR szUnicode, BSTR* pVal); + + // WITH_TS update + STDMETHOD(get_TsaUrl)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_TsaUrl)(/*[in]*/ BSTR newVal); + + STDMETHOD(get_AddTimeStamp)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(put_AddTimeStamp)(/*[in]*/ VARIANT_BOOL newVal); + + STDMETHOD(get_TimeStampMaxInterval)(/*[out, retval]*/ LONG *pVal); + STDMETHOD(put_TimeStampMaxInterval)(/*[in]*/ LONG newVal); + + STDMETHOD(get_DebugFilePath)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_DebugFilePath)(/*[in]*/ BSTR newVal); + + STDMETHOD(get_DebugLevel)(/*[out, retval]*/ LONG *pVal); + STDMETHOD(put_DebugLevel)(/*[in]*/ LONG newVal); + + STDMETHOD(get_AddSigAndRefsTimeStamp)(/*[out, retval]*/ VARIANT_BOOL *pVal); + STDMETHOD(put_AddSigAndRefsTimeStamp)(/*[in]*/ VARIANT_BOOL newVal); + + STDMETHOD(getSetting)(/*[in]*/ BSTR szName, /*[out, retval]*/ BSTR *pVal); + STDMETHOD(putSetting)(/*[in]*/ BSTR szName, /*[in]*/ BSTR szValue); + +private: + TSAProfile * m_pProfile; +}; + +#endif //__COMDIGIDOCLIB_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.rgs libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.rgs --- libdigidoc-2.7.0/libdigidoccom/ComDigiDocLib.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDigiDocLib.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,26 @@ +HKCR +{ + DigiDocLibCOM.ComDigiDocLib.1 = s 'ComDigiDocLib Class' + { + CLSID = s '{2A541862-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComDigiDocLib = s 'ComDigiDocLib Class' + { + CLSID = s '{2A541862-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComDigiDocLib.1' + } + NoRemove CLSID + { + ForceRemove {2A541862-9A3E-11D6-AEE5-420005574701} = s 'ComDigiDocLib Class' + { + ProgID = s 'DigiDocLibCOM.ComDigiDocLib.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComDigiDocLib' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDocInfo.cpp libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.cpp --- libdigidoc-2.7.0/libdigidoccom/ComDocInfo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,201 @@ +// ComDocInfo.cpp : Implementation of CComDocInfo +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComDocInfo.h" +#include "Converters.h" + +///////////////////////////////////////////////////////////////////////////// +// CComDocInfo + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComDocInfo::get_szDocId(BSTR *pVal) +{ + USES_CONVERSION; + if (getDocInfo()->szDocId == (char*)0) { + SetBSTR(pVal, ""); //*pVal = SysAllocString(A2OLE("")); + } else { + SetBSTR(pVal, getDocInfo()->szDocId); //*pVal = SysAllocString(A2OLE(getDocInfo()->szDocId)); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::put_szDocId(BSTR newVal) +{ + unsigned int newLen = SysStringLen(newVal); + + if (getDocInfo()->szDocId != (char*)0) + delete getDocInfo()->szDocId; + + if (newLen > 0) { + USES_CONVERSION; + getDocInfo()->szDocId = new char[newLen + 1]; + strcpy(getDocInfo()->szDocId, GetBSTR(newVal)); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::get_szDigestType(BSTR *pVal) +{ + USES_CONVERSION; + if (getDocInfo()->szDigestType == (char*)0) { + SetBSTR(pVal, ""); //*pVal = SysAllocString(A2OLE("")); + } else { + SetBSTR(pVal, getDocInfo()->szDigestType); //*pVal = SysAllocString(A2OLE(getDocInfo()->szDigestType)); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::put_szDigestType(BSTR newVal) +{ + unsigned int newLen = SysStringLen(newVal); + + if (getDocInfo()->szDigestType != (char*)0) + delete getDocInfo()->szDigestType; + + if (newLen > 0) { + USES_CONVERSION; + getDocInfo()->szDigestType = new char[newLen + 1]; + strcpy(getDocInfo()->szDigestType, GetBSTR(newVal)); + } + + return S_OK; +} + + +STDMETHODIMP CComDocInfo::get_baDigest(VARIANT *pVal) +{ + if (getDocInfo()->szDigest == (byte*)0) { + V_VT(pVal)= VT_EMPTY; + } else { + SAFEARRAY* pArr = SafeArrayCreateVector(VT_UI1, 0, getDocInfo()->nDigestLen); + + V_ARRAY(pVal) = pArr; + V_VT(pVal) = (VT_ARRAY | VT_UI1); + + byte HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + memcpy(pData, getDocInfo()->szDigest, getDocInfo()->nDigestLen); + SafeArrayUnaccessData(pArr); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::put_baDigest(VARIANT newVal) +{ + if (getDocInfo()->szDigest != (byte*)0) + delete getDocInfo()->szDigest; + + SAFEARRAY* pArr = V_ARRAY(&newVal); + byte HUGEP* pData; + + getDocInfo()->nDigestLen = pArr->rgsabound->cElements; + if (getDocInfo()->nDigestLen > 0) { + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + getDocInfo()->szDigest = new unsigned char[getDocInfo()->nDigestLen]; + memcpy(getDocInfo()->szDigest, pData, getDocInfo()->nDigestLen); + SafeArrayUnaccessData(pArr); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::get_baMimeDigest(VARIANT *pVal) +{ + if (getDocInfo()->szMimeDigest == (byte*)0) { + V_VT(pVal)= VT_EMPTY; + } else { + SAFEARRAY* pArr = SafeArrayCreateVector(VT_UI1, 0, getDocInfo()->nMimeDigestLen); + + V_ARRAY(pVal) = pArr; + V_VT(pVal) = (VT_ARRAY | VT_UI1); + + byte HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + memcpy(pData, getDocInfo()->szMimeDigest, getDocInfo()->nMimeDigestLen); + SafeArrayUnaccessData(pArr); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::put_baMimeDigest(VARIANT newVal) +{ + if (getDocInfo()->szMimeDigest != (byte*)0) + delete getDocInfo()->szMimeDigest; + + SAFEARRAY* pArr = V_ARRAY(&newVal); + byte HUGEP* pData; + + getDocInfo()->nMimeDigestLen = pArr->rgsabound->cElements; + if (getDocInfo()->nMimeDigestLen > 0) { + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + getDocInfo()->szMimeDigest = new unsigned char[getDocInfo()->nMimeDigestLen]; + memcpy(getDocInfo()->szMimeDigest, pData, getDocInfo()->nMimeDigestLen); + SafeArrayUnaccessData(pArr); + } + + return S_OK; +} + +STDMETHODIMP CComDocInfo::get_nDigestLen(long *pVal) +{ + *pVal = getDocInfo()->nDigestLen; + + return S_OK; +} + +STDMETHODIMP CComDocInfo::get_nMimeDigestLen(long *pVal) +{ + *pVal = getDocInfo()->nMimeDigestLen; + + return S_OK; +} + + + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + + + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComDocInfo::CComDocInfo() { + m_pointerMode = false; + m_pDocInfo = new DocInfo; + memset(m_pDocInfo, 0, sizeof(DocInfo)); +} + +CComDocInfo::~CComDocInfo() { + if (!m_pointerMode) + freeStruct(); +} + +DocInfo* CComDocInfo::getDocInfo() { + return m_pDocInfo; +} + + +void CComDocInfo::shiftStructPointer(DocInfo* pNew) { + if (!m_pointerMode) + freeStruct(); + m_pDocInfo = pNew; + m_pointerMode = true; +} + +void CComDocInfo::freeStruct() { + DocInfo_free(m_pDocInfo); +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDocInfo.h libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.h --- libdigidoc-2.7.0/libdigidoccom/ComDocInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,72 @@ +/* + +Wrap of DigiCoc library DocInfo structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComDocInfo.h : Declaration of the CComDocInfo + +#ifndef __COMDOCINFO_H_ +#define __COMDOCINFO_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CComDocInfo + +#include "libdigidoc/DigiDocLib.h" + +class ATL_NO_VTABLE CComDocInfo : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComDocInfo(); + ~CComDocInfo(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMDOCINFO) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComDocInfo) + COM_INTERFACE_ENTRY(IComDocInfo) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComDocInfo +public: + STDMETHOD(get_szDocId)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szDocId)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szDigestType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szDigestType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_baDigest)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(put_baDigest)(/*[in]*/ VARIANT newVal); + STDMETHOD(get_nDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baMimeDigest)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(put_baMimeDigest)(/*[in]*/ VARIANT newVal); + STDMETHOD(get_nMimeDigestLen)(/*[out, retval]*/ long *pVal); + + DocInfo* getDocInfo(); + void shiftStructPointer(DocInfo* pNew); + void freeStruct(); + +protected: + DocInfo* m_pDocInfo; + bool m_pointerMode; +}; + +#endif //__COMDOCINFO_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComDocInfo.rgs libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.rgs --- libdigidoc-2.7.0/libdigidoccom/ComDocInfo.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComDocInfo.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComDocInfo.1 = s 'ComDocInfo Class' + { + CLSID = s '{2A541866-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComDocInfo = s 'ComDocInfo Class' + { + CLSID = s '{2A541866-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComDocInfo.1' + } + NoRemove CLSID + { + ForceRemove {2A541866-9A3E-11D6-AEE5-420005574701} = s 'ComDocInfo Class' + { + ProgID = s 'DigiDocLibCOM.ComDocInfo.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComDocInfo' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.cpp libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.cpp --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,849 @@ +// ComEncryptedData.cpp : Implementation of CComEncryptedData + +#include "stdafx.h" +#include "ComEncryptedData.h" +#include "ComEncryptionProperty.h" +#include "ComEncryptedKey.h" +#include "Converters.h" + +#include "libdigidoc/DigiDocConvert.h" + + +// CComEncryptedData + + CComEncryptedData::CComEncryptedData() + { + m_pEncryptedData = NULL; + } + + CComEncryptedData::~CComEncryptedData() + { + if(m_pEncryptedData != NULL) + dencEncryptedData_free(m_pEncryptedData); + } + + DEncEncryptedData* CComEncryptedData::getEncryptedData() + { + return(m_pEncryptedData); + } + + void CComEncryptedData::shiftStructPointer(DEncEncryptedData* pNew) + { + if(m_pEncryptedData != NULL) + dencEncryptedData_free(m_pEncryptedData); + m_pEncryptedData = pNew; + } + + + STDMETHODIMP CComEncryptedData::GetId(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetId(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetType(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetType(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetMimeType(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetMimeType(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetXmlNs(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetXmlNs(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptionMethod(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetEncryptionMethod(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptionPropertiesId(BSTR* lpEncData) + { + if(m_pEncryptedData != NULL) + Convert::out_retval_sz2BSTR((char *)dencEncryptedData_GetEncryptionPropertiesId(m_pEncryptedData), lpEncData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptionPropertiesCount(LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_GetEncryptionPropertiesCount(m_pEncryptedData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptedKeyCount(LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_GetEncryptedKeyCount(m_pEncryptedData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptedDataStatus(LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_GetEncryptedDataStatus(m_pEncryptedData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetId(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetId(m_pEncryptedData,GetBSTR(szValue)); + + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetType(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetType(m_pEncryptedData,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetMimeType(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetMimeType(m_pEncryptedData,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetXmlNs(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetXmlNs(m_pEncryptedData,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetEncryptionMethod(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetEncryptionMethod(m_pEncryptedData,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::AppendData(BSTR szData, LONG nDataLen, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_AppendData(m_pEncryptedData,GetBSTR(szData),nDataLen); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::SetEncryptionPropertiesId(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_SetEncryptionPropertiesId(m_pEncryptedData,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::DeleteEncryptionProperty(LONG nIdx, LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_DeleteEncryptionProperty(m_pEncryptedData,nIdx); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::DeleteEncryptedKey(LONG nIdx, LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_DeleteEncryptedKey(m_pEncryptedData,nIdx); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::EncryptData(LONG nCompressionOption, LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_encryptData(m_pEncryptedData,nCompressionOption); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::DecryptData(LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_decryptData(m_pEncryptedData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::CompressData(LONG nCompressOption, LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_compressData(m_pEncryptedData,nCompressOption); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::DecompressData(LONG* nRetResult) + { + if(m_pEncryptedData != NULL) + *nRetResult = dencEncryptedData_decompressData(m_pEncryptedData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptionProperty(LONG nIdx, IComEncryptionProperty * pEncProperty) + { + if(m_pEncryptedData != NULL) { + DEncEncryptionProperty *pProperty = dencEncryptedData_GetEncryptionProperty(m_pEncryptedData,nIdx); + if (pProperty != NULL) + ((CComEncryptionProperty *)pEncProperty)->shiftStructPointer(pProperty); + } + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetLastEncryptionProperty(IComEncryptionProperty * pEncProperty) + { + if(m_pEncryptedData != NULL) { + DEncEncryptionProperty *pProperty = dencEncryptedData_GetLastEncryptionProperty(m_pEncryptedData); + if (pProperty != NULL) + ((CComEncryptionProperty *)pEncProperty)->shiftStructPointer(pProperty); + } + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetEncryptedKey(LONG nIdx, IComEncryptedKey * lpEncryptedKey) + { + if(m_pEncryptedData != NULL) { + DEncEncryptedKey *pKey = dencEncryptedData_GetEncryptedKey(m_pEncryptedData,nIdx); + if (pKey != NULL) + ((CComEncryptedKey *)lpEncryptedKey)->shiftStructPointer(pKey); + } + return S_OK; + } + + STDMETHODIMP CComEncryptedData::GetLastEncryptedKey(IComEncryptedKey * lpEncryptedKey) + { + if(m_pEncryptedData != NULL) { + DEncEncryptedKey *pKey = dencEncryptedData_GetLastEncryptedKey(m_pEncryptedData); + if (pKey != NULL) + ((CComEncryptedKey *)lpEncryptedKey)->shiftStructPointer(pKey); + } + return S_OK; + } + + STDMETHODIMP CComEncryptedData::Decrypt(IComEncryptedKey * lpEncKey, BSTR szPin, + BSTR clib_conffilepath, BSTR out_file, LONG* nRetResult) + { + USES_CONVERSION; + DEncEncryptedKey *pKey = NULL; + FILE* hFile; + pKey = ((CComEncryptedKey *)lpEncKey)->getEncryptedKey(); + DEncEncryptedData *pData = getEncryptedData(); + + //int err = readConfigFile(GetBSTR(clib_conffilepath), ITEM_TYPE_GLOBAL); + *nRetResult = dencEncryptedData_decrypt(pData, pKey ,GetBSTR(szPin)); + + if((hFile = fopen(GetBSTR(out_file), "wb")) != NULL) { + fwrite((pData)->mbufEncryptedData.pMem, 1, (pData)->mbufEncryptedData.nLen, hFile); + fclose(hFile); + } + + return S_OK; + } + + STDMETHODIMP CComEncryptedData::Create(BSTR szXmlNs, BSTR szEncMode, BSTR szId, BSTR szType, BSTR szMimeType, LONG* nRetResult) + { + USES_CONVERSION; + DEncEncryptedData *pData = NULL; + *nRetResult = dencEncryptedData_new(&pData,GetBSTR(szXmlNs),GetBSTR(szEncMode), GetBSTR(szId), GetBSTR(szType),GetBSTR(szMimeType)); + if (pData != NULL) + shiftStructPointer(pData); + return S_OK; + } + + STDMETHODIMP CComEncryptedData::FindEncryptionPropertyByName(IComEncryptionProperty * lpEncProperty, BSTR szName) + { + USES_CONVERSION; + if(m_pEncryptedData != NULL) { + DEncEncryptionProperty *pProperty = dencEncryptedData_FindEncryptionPropertyByName(m_pEncryptedData,GetBSTR(szName)); + if (pProperty != NULL) + ((CComEncryptionProperty *)lpEncProperty)->shiftStructPointer(pProperty); + } + return S_OK; + } +BOOL ExportPlainSessionBlob(HCRYPTKEY hPublicKey, + HCRYPTKEY hSessionKey, + LPBYTE *pbKeyMaterial , + DWORD *dwKeyMaterial ) +{ + BOOL fReturn = FALSE; + BOOL fResult; + DWORD dwSize, n; + LPBYTE pbSessionBlob = NULL; + DWORD dwSessionBlob; + LPBYTE pbPtr; + + __try + { + *pbKeyMaterial = NULL; + *dwKeyMaterial = 0; + + fResult = CryptExportKey(hSessionKey, hPublicKey, SIMPLEBLOB, + 0, NULL, &dwSessionBlob ); + if (!fResult) __leave; + + pbSessionBlob = (LPBYTE)LocalAlloc(LPTR, dwSessionBlob ); + if (!pbSessionBlob) __leave; + + fResult = CryptExportKey(hSessionKey, hPublicKey, SIMPLEBLOB, + 0, pbSessionBlob , &dwSessionBlob ); + if (!fResult) __leave; + + // Get session key size in bits + dwSize = sizeof(DWORD); + fResult = CryptGetKeyParam(hSessionKey, KP_KEYLEN, (LPBYTE)dwKeyMaterial, &dwSize, 0); + if (!fResult) __leave; + + // Get the number of bytes and allocate buffer + *dwKeyMaterial /= 8; + *pbKeyMaterial = (LPBYTE)LocalAlloc(LPTR, *dwKeyMaterial); + if (!*pbKeyMaterial) __leave; + + // Skip the header + pbPtr = pbSessionBlob; + pbPtr += sizeof(BLOBHEADER); + pbPtr += sizeof(ALG_ID); + + // We are at the beginning of the key + // but we need to start at the end since + // it's reversed + pbPtr += (*dwKeyMaterial - 1); + + // Copy the raw key into our return buffer + for (n = 0; n < *dwKeyMaterial; n++) + { + (*pbKeyMaterial)[n] = *pbPtr; + pbPtr--; + } + + fReturn = TRUE; + } + __finally + { + if (pbSessionBlob) LocalFree(pbSessionBlob); + + if ((!fReturn) && (*pbKeyMaterial )) + { + LocalFree(*pbKeyMaterial ); + *pbKeyMaterial = NULL; + *dwKeyMaterial = 0; + } + } + + return fReturn; +} + + +BOOL ImportPlainSessionBlob(HCRYPTPROV hProv, + HCRYPTKEY hPrivateKey, + ALG_ID dwAlgId, + LPBYTE pbKeyMaterial , + DWORD dwKeyMaterial , + HCRYPTKEY *hSessionKey) +{ + BOOL fResult; + BOOL fReturn = FALSE; + BOOL fFound = FALSE; + LPBYTE pbSessionBlob = NULL; + DWORD dwSessionBlob, dwSize, n; + DWORD dwPublicKeySize; + DWORD dwProvSessionKeySize; + ALG_ID dwPrivKeyAlg; + LPBYTE pbPtr; + DWORD dwFlags = CRYPT_FIRST; + PROV_ENUMALGS_EX ProvEnum; + HCRYPTKEY hTempKey = 0; + + __try + { + // Double check to see if this provider supports this algorithm + // and key size + do + { + dwSize = sizeof(ProvEnum); + fResult = CryptGetProvParam(hProv, PP_ENUMALGS_EX, (LPBYTE)&ProvEnum, + &dwSize, dwFlags); + if (!fResult) break; + + dwFlags = 0; + + if (ProvEnum.aiAlgid == dwAlgId) fFound = TRUE; + + } while (!fFound); + + if (!fFound) __leave; + + // We have to get the key size(including padding) + // from an HCRYPTKEY handle. PP_ENUMALGS_EX contains + // the key size without the padding so we can't use it. + fResult = CryptGenKey(hProv, dwAlgId, 0, &hTempKey); + if (!fResult) __leave; + + dwSize = sizeof(DWORD); + fResult = CryptGetKeyParam(hTempKey, KP_KEYLEN, (LPBYTE)&dwProvSessionKeySize, + &dwSize, 0); + if (!fResult) __leave; + CryptDestroyKey(hTempKey); + hTempKey = 0; + + // Our key is too big, leave + if ((dwKeyMaterial * 8) > dwProvSessionKeySize) __leave; + + // Get private key's algorithm + dwSize = sizeof(ALG_ID); + fResult = CryptGetKeyParam(hPrivateKey, KP_ALGID, (LPBYTE)&dwPrivKeyAlg, &dwSize, 0); + if (!fResult) __leave; + + // Get private key's length in bits + dwSize = sizeof(DWORD); + fResult = CryptGetKeyParam(hPrivateKey, KP_KEYLEN, (LPBYTE)&dwPublicKeySize, &dwSize, 0); + if (!fResult) __leave; + + // calculate Simple blob's length + dwSessionBlob = (dwPublicKeySize/8) + sizeof(ALG_ID) + sizeof(BLOBHEADER); + + // allocate simple blob buffer + pbSessionBlob = (LPBYTE)LocalAlloc(LPTR, dwSessionBlob); + if (!pbSessionBlob) __leave; + + pbPtr = pbSessionBlob; + + // SIMPLEBLOB Format is documented in SDK + // Copy header to buffer + ((BLOBHEADER *)pbPtr)->bType = SIMPLEBLOB; + ((BLOBHEADER *)pbPtr)->bVersion = 2; + ((BLOBHEADER *)pbPtr)->reserved = 0; + ((BLOBHEADER *)pbPtr)->aiKeyAlg = dwAlgId; + pbPtr += sizeof(BLOBHEADER); + + // Copy private key algorithm to buffer + *((DWORD *)pbPtr) = dwPrivKeyAlg; + pbPtr += sizeof(ALG_ID); + + // Place the key material in reverse order + for (n = 0; n < dwKeyMaterial; n++) + { + pbPtr[n] = pbKeyMaterial[dwKeyMaterial-n-1]; + } + + // 3 is for the first reserved byte after the key material + the 2 reserved bytes at the end. + dwSize = dwSessionBlob - (sizeof(ALG_ID) + sizeof(BLOBHEADER) + dwKeyMaterial + 3); + pbPtr += (dwKeyMaterial+1); + + // Generate random data for the rest of the buffer + // (except that last two bytes) + fResult = CryptGenRandom(hProv, dwSize, pbPtr); + if (!fResult) __leave; + + for (n = 0; n < dwSize; n++) + { + if (pbPtr[n] == 0) pbPtr[n] = 1; + } + + pbSessionBlob[dwSessionBlob - 2] = 2; + + fResult = CryptImportKey(hProv, pbSessionBlob , dwSessionBlob, + hPrivateKey, CRYPT_EXPORTABLE, hSessionKey); + if (!fResult) __leave; + + fReturn = TRUE; + } + __finally + { + if (hTempKey) CryptDestroyKey(hTempKey); + if (pbSessionBlob) LocalFree(pbSessionBlob); + } + + return fReturn; +} + + STDMETHODIMP CComEncryptedData::Decrypt_WithKey(IComEncryptedKey * lpEncKey, BSTR out_file, LONG* nRetResult) + { + USES_CONVERSION; + + DEncEncryptedKey *pKey = NULL; + unsigned char *key = NULL; + DWORD key_len = 0; + HCRYPTPROV hProv; + HCRYPTKEY hPrivKey; + FILE* hFile; + DEncEncryptedData *pData = getEncryptedData(); + BOOL success; + HCERTSTORE hStore; + char storeName[] = "My"; + DWORD location = CERT_SYSTEM_STORE_CURRENT_USER; + PCCERT_CONTEXT pCertContext = NULL; + PCCERT_CONTEXT pCertFindContext = NULL; + int i = 0; + DWORD keySpec; + BOOL mustFree; + unsigned char* certBlob; + int certBlobLen; + DWORD nerr = 0; + HCRYPTKEY hPubKey; + HCRYPTKEY hSesKey; + BYTE *pbKeyBlob; + DWORD dwBlobLen; + HCRYPTHASH hHash = 0; + int fResult; + + + pKey = ((CComEncryptedKey *)lpEncKey)->getEncryptedKey(); + if (!pKey) { + *nRetResult = ERR_DENC_KEY_STATUS; + goto cleanup; + } + + key = (unsigned char*)pKey->mbufTransportKey.pMem; + key_len = pKey->mbufTransportKey.nLen; + + hStore = CertOpenStore(CERT_STORE_PROV_SYSTEM_A,X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,NULL, + CERT_STORE_OPEN_EXISTING_FLAG | location, storeName); + + if (!hStore) { + TRACE("CertOpenStore open failed with 0x%0lx ", GetLastError()); + *nRetResult = ERR_DENC_DECRYPT; + SET_LAST_ERROR(1000 + GetLastError()); + goto cleanup; + } + + certBlobLen = i2d_X509((X509*)pKey->pCert, NULL); + certBlob = new unsigned char[certBlobLen]; + + encodeCert(pKey->pCert,(char *)certBlob,&certBlobLen); + if (!certBlob) { + TRACE("encodeCert failed with 0x%0lx ", GetLastError()); + *nRetResult = ERR_DENC_DECRYPT; + goto cleanup; + } + + pCertFindContext = CertCreateCertificateContext(X509_ASN_ENCODING|PKCS_7_ASN_ENCODING,certBlob,certBlobLen); + if (!pCertFindContext) { + TRACE("CertCreateCertificateContext open failed with 0x%0lx ", GetLastError()); + *nRetResult = ERR_DENC_DECRYPT; + SET_LAST_ERROR(GetLastError()); + SET_LAST_ERROR(1000 + GetLastError()); + goto cleanup; + } + + pCertContext = CertFindCertificateInStore(hStore, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, + 0, CERT_FIND_EXISTING, + pCertFindContext, NULL); + + if (pCertContext) { //cert found + + TRACE("pCertContext cert found", ""); + success = CryptAcquireCertificatePrivateKey(pCertContext, + NULL,NULL,&hProv,&keySpec, &mustFree); + if (success) { + +// if(hProv) CryptReleaseContext(hProv,0); + +/* success = CryptAcquireCertificatePrivateKey(pCertContext, //not silent csp handle + NULL,NULL,&hProv,&keySpec, &mustFree); */ + + if (success) { + + TRACE("CryptAcquireCertificatePrivateKey success", ""); + if(RCRYPT_FAILED(CryptGetUserKey(hProv, AT_KEYEXCHANGE, &hPrivKey))) { + TRACE("CryptGetUserKey failed with 0x%0lx ", GetLastError()); + *nRetResult = ERR_DENC_DECRYPT; + SET_LAST_ERROR(GetLastError()); + SET_LAST_ERROR(1000 + GetLastError()); + goto cleanup; + } + + /*{ //endian-fix + LPBYTE tmp = new BYTE[key_len] ; + for(int f=0;fpCertInfo->SubjectPublicKeyInfo, + &hPubKey); + + if(CryptExportKey( + hPrivKey, + NULL, + PRIVATEKEYBLOB, + 0, + NULL, + &dwBlobLen)) +{ + printf("Size of the BLOB for the public key determined. \n"); +} + +//------------------------------------------------------------------- +// Allocate memory for the pbKeyBlob. + +if(pbKeyBlob = (BYTE*)malloc(dwBlobLen)) +{ + printf("Memory has been allocated for the BLOB. \n"); +} + + if(CryptExportKey( + hPrivKey, + NULL, + PRIVATEKEYBLOB, + 0, + pbKeyBlob, + &dwBlobLen)) +{ + printf("Contents have been written to the BLOB. \n"); +} + +*/ + if(CryptImportKey(hProv, key, key_len,hPrivKey,CRYPT_NO_SALT,&hSesKey)) + { + printf("The key has been imported.\n"); + } + else + { + printf("Public key import failed.\n"); + nerr = GetLastError(); + TRACE("CryptDecrypt failed with 0x%0lx ", nerr); + //return FALSE; // VS: try without? This doesn't work on softcertificates (pkcs12 key containers), but is also not necessary + } + // Get the public key information for the certificate. + + + //CryptImportKey(hProv,pbKeyBlob,dwBlobLen,hPrivKey,0,&hSesKey); + +// Import this key and get an HCRYPTKEY handle + /* if (!ImportPlainSessionBlob(hProv, hPrivKey, CALG_AES_128, key, key_len, &hSesKey)) + { + TRACE("CryptDecrypt failed with 0x%0lx ", GetLastError()); + printf("ImportPlainSessionBlob failed with %x\n", GetLastError()); + //__leave; + } + + //LocalFree(pbKeyMaterial); + //pbKeyMaterial = NULL; + key = NULL; + + printf("Exporting 3DES key. We should get back 1,2,3,...\n"); + // Export it and get the key material back + // It should be 1,2,3, ... + fResult = ExportPlainSessionBlob(hPrivKey, hSesKey, + &key, &key_len ); + if (!fResult) + { + printf("ExportPlainSessionBlob failed with %x\n", GetLastError()); + TRACE("CryptDecrypt failed with 0x%0lx ", GetLastError()); + //__leave; + } +*/ + + if(RCRYPT_FAILED(CryptDecrypt(hPrivKey, 0, TRUE, 0, key, &key_len))) { + nerr = GetLastError(); + + if (nerr == NTE_BAD_DATA || nerr == NTE_FAIL || nerr == NTE_BAD_KEY) { //special case to rev array + + /* this code can be used to reaquire context for special flags or something */ + { + BYTE cspname[MAX_PATH]; + DWORD dwLen = sizeof(cspname); + BYTE contname[MAX_PATH]; + + SET_LAST_ERROR(1000 + nerr); + + success = CryptGetProvParam(hProv, PP_NAME, cspname, &dwLen,0); + if (!success) goto cleanup; + + dwLen = sizeof(contname); + success= CryptGetProvParam(hProv, PP_CONTAINER, contname, &dwLen,0); + if (!success) goto cleanup; + + if (hPrivKey) CryptDestroyKey(hPrivKey); + if(hProv) CryptReleaseContext(hProv,0); + + success = CryptAcquireContext(&hProv, (PCHAR )contname, (PCHAR) cspname, PROV_RSA_FULL,0); + if (!success) goto cleanup; + + success = CryptGetUserKey(hProv, AT_KEYEXCHANGE, &hPrivKey); + if (!success) goto cleanup; + + clearErrors(); + } + /**/ + + { //endian-fix again for EstEID CSP + LPBYTE tmp = new BYTE[key_len] ; + for(int f=0;fmbufEncryptedData.pMem, 1, (pData)->mbufEncryptedData.nLen, hFile); + fclose(hFile); + } + + } else { + TRACE("ERR_PRIV_CERT_NOT_FOUND", ""); + *nRetResult = ERR_PRIV_CERT_NOT_FOUND; + SET_LAST_ERROR(1000 + GetLastError()); + goto cleanup; + } + +cleanup: + + if(hProv) CryptReleaseContext(hProv,0); + if(hPrivKey) CryptDestroyKey(hPrivKey); + if(certBlob) delete certBlob; + if(pCertContext) CertFreeCertificateContext(pCertContext); + if(pCertFindContext) CertFreeCertificateContext(pCertFindContext); + + + CertCloseStore(hStore, CERT_CLOSE_STORE_CHECK_FLAG); + + return S_OK; + } + + + STDMETHODIMP CComEncryptedData::SaveCDOC(/*UTF8 */BSTR save_path, long *pVal){ + string sz_savepath = _bstr_t(save_path); + FILE* hFile; + *pVal = ERR_OK; + + if (m_pEncryptedData && sz_savepath.length() > 0) { + if(m_pEncryptedData->nDataStatus == DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED || + m_pEncryptedData->nDataStatus == DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED) { + + *pVal = dencGenEncryptedData_writeToFile(m_pEncryptedData, sz_savepath.c_str()); + + } else { + + //FIX: fopen wants non-utf8 + DWORD bufSz = lstrlenW(save_path) * 4; + char *convFileName = new char[bufSz]; + ddocConvertFileName( convFileName, bufSz, GetBSTR(save_path) ); + sz_savepath = convFileName; + + + if((hFile = fopen(sz_savepath.c_str(), "wb")) != NULL) { + fwrite((m_pEncryptedData)->mbufEncryptedData.pMem, 1, (m_pEncryptedData)->mbufEncryptedData.nLen, hFile); + fclose(hFile); + } else { + *pVal = ERR_FILE_WRITE; + } + + } + } else { + *pVal = ERR_FILE_WRITE; + } + + return S_OK; + } + + STDMETHODIMP CComEncryptedData::OpenCDOC(/*UTF8 */ BSTR file_path, long *pVal){ + *pVal = ERR_OK; + string sz_file_path = _bstr_t(file_path); + + //if (PathFileExists(sz_file_path.c_str())) { + *pVal = dencSaxReadEncryptedData(&m_pEncryptedData, sz_file_path.c_str()); + //} else { + // *pVal = ERR_FILE_READ; + //} + + return S_OK; + } + + STDMETHODIMP CComEncryptedData::AppendFile(/*UTF8 */BSTR file_path, long *pVal){ + DWORD bufSz = lstrlenW(file_path) * 4; + char *convFileName = new char[bufSz]; + ddocConvertFileName( convFileName, bufSz, GetBSTR(file_path) ); + + string sz_filepath = convFileName;//_bstr_t(file_path); + FILE *hSource; + long lSize; + char *buffer; + *pVal = ERR_FILE_READ; + + if (!PathFileExists(sz_filepath.c_str())) goto cleanup; + + if(!(hSource = fopen(sz_filepath.c_str(),"rb"))) goto cleanup; + if(fseek(hSource, 0, SEEK_END)) goto cleanup; + + lSize = ftell(hSource); + if (lSize == -1L) goto cleanup; + rewind(hSource); + + buffer = new char[lSize]; + fread(buffer, 1, lSize, hSource); + if(ferror(hSource)) goto cleanup; + + *pVal = dencEncryptedData_AppendData(m_pEncryptedData, buffer, lSize); + +cleanup: + delete [] convFileName; + if(hSource) fclose(hSource); + if (buffer) delete buffer; + + return S_OK; + } + + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.h libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.h --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,85 @@ +// ComEncryptedData.h : Declaration of the CComEncryptedData + +#pragma once +#include "resource.h" // main symbols + +#include "DigiDocLibCOM_h.h" +#include "libdigidoc/DigiDocEnc.h" +#include "libdigidoc/DigiDocEncSAXParser.h" + + +// CComEncryptedData + +class ATL_NO_VTABLE CComEncryptedData : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComEncryptedData(); + ~CComEncryptedData(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMENCRYPTEDDATA) + + +BEGIN_COM_MAP(CComEncryptedData) + COM_INTERFACE_ENTRY(IComEncryptedData) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + } + +public: + + STDMETHOD(GetId)(BSTR* lpEncData); + STDMETHOD(GetType)(BSTR* lpEncData); + STDMETHOD(GetMimeType)(BSTR* lpEncData); + STDMETHOD(GetXmlNs)(BSTR* lpEncData); + STDMETHOD(GetEncryptionMethod)(BSTR* lpEncData); + STDMETHOD(GetEncryptionPropertiesId)(BSTR* lpEncData); + STDMETHOD(GetEncryptionPropertiesCount)(LONG* nRetResult); + STDMETHOD(GetEncryptedKeyCount)(LONG* nRetResult); + STDMETHOD(GetEncryptedDataStatus)(LONG* nRetResult); + STDMETHOD(SetId)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetType)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetMimeType)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetXmlNs)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetEncryptionMethod)(BSTR szValue, LONG* nRetResult); + STDMETHOD(AppendData)(BSTR szData, LONG nDataLen, LONG* nRetResult); + STDMETHOD(SetEncryptionPropertiesId)(BSTR szValue, LONG* nRetResult); + STDMETHOD(DeleteEncryptionProperty)(LONG nIdx, LONG* nRetResult); + STDMETHOD(DeleteEncryptedKey)(LONG nIdx, LONG* nRetResult); + STDMETHOD(EncryptData)(LONG nCompressionOption, LONG* nRetResult); + STDMETHOD(DecryptData)(LONG* nRetResult); + STDMETHOD(CompressData)(LONG nCompressOption, LONG* nRetResult); + STDMETHOD(DecompressData)(LONG* nRetResult); + STDMETHOD(GetEncryptionProperty)(LONG nIdx, IComEncryptionProperty * lpEncProperty); + STDMETHOD(GetLastEncryptionProperty)(IComEncryptionProperty * lpEncproperty); + STDMETHOD(GetEncryptedKey)(LONG nIdx, IComEncryptedKey * lpEncryptedKey); + STDMETHOD(GetLastEncryptedKey)(IComEncryptedKey * lpEncryptedKey); + STDMETHOD(Decrypt)(IComEncryptedKey * lpEncKey, BSTR szPin, BSTR clib_conffilepath, BSTR out_file, LONG* nRetResult); + DEncEncryptedData* getEncryptedData(); + void shiftStructPointer(DEncEncryptedData* pNew); +private: + DEncEncryptedData* m_pEncryptedData; + +public: + STDMETHOD(AppendFile)(BSTR file_path, long *pVal); + STDMETHOD(OpenCDOC)(BSTR file_path, long *pVal); + STDMETHOD(SaveCDOC)(BSTR save_path, long *pVal); + STDMETHOD(Create)(BSTR szXmlNs, BSTR szEncMode, BSTR szId, BSTR szType, BSTR szMimeType, LONG* nRetResult); + STDMETHOD(FindEncryptionPropertyByName)(IComEncryptionProperty * lpEncProperty, BSTR szName); + STDMETHOD(Decrypt_WithKey)(IComEncryptedKey * lpEncKey, BSTR out_file, LONG* nRetResult); +}; + +//OBJECT_ENTRY_AUTO(__uuidof(ComEncryptedData), CComEncryptedData) diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.rgs libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.rgs --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedData.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedData.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,26 @@ +HKCR +{ + DigiDocLibCOM.ComEncryptedData.1 = s 'ComEncryptedData Class' + { + CLSID = s '{D1EDCE5D-8BF9-4B00-AD7B-0420C5C24F4F}' + } + DigiDocLibCOM.ComEncryptedData = s 'ComEncryptedData Class' + { + CLSID = s '{D1EDCE5D-8BF9-4B00-AD7B-0420C5C24F4F}' + CurVer = s 'DigiDocLibCOM.ComEncryptedData.1' + } + NoRemove CLSID + { + ForceRemove {D1EDCE5D-8BF9-4B00-AD7B-0420C5C24F4F} = s 'ComEncryptedData Class' + { + ProgID = s 'DigiDocLibCOM.ComEncryptedData.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComEncryptedData' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.cpp libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.cpp --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,213 @@ +// ComEncryptedKey.cpp : Implementation of CComEncryptedKey + +#include "stdafx.h" +#include "ComEncryptedKey.h" +#include "ComEncryptedData.h" +#include "Converters.h" +#include "libdigidoc/DigiDocConvert.h" + +// CComEncryptedKey + + CComEncryptedKey::CComEncryptedKey(){ + m_pEncryptedKey = NULL; + } + + CComEncryptedKey::~CComEncryptedKey(){ + } + + DEncEncryptedKey* CComEncryptedKey::getEncryptedKey(){ + return(m_pEncryptedKey); + } + + void CComEncryptedKey::shiftStructPointer(DEncEncryptedKey* pNew){ + m_pEncryptedKey = pNew; + } + + STDMETHODIMP CComEncryptedKey::GetId(BSTR* lpEncKey){ + if(m_pEncryptedKey) + Convert::out_retval_sz2BSTR((char *)dencEncryptedKey_GetId(m_pEncryptedKey), lpEncKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetRecipient(BSTR* lpEncKey){ + if(m_pEncryptedKey) + Convert::out_retval_sz2BSTR((char *)dencEncryptedKey_GetRecipient(m_pEncryptedKey), lpEncKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetEncryptionMethod(BSTR* lpEncKey){ + if(m_pEncryptedKey) + Convert::out_retval_sz2BSTR((char *)dencEncryptedKey_GetEncryptionMethod(m_pEncryptedKey), lpEncKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetKeyName(BSTR* lpEncKey){ + if(m_pEncryptedKey) + Convert::out_retval_sz2BSTR((char *)dencEncryptedKey_GetKeyName(m_pEncryptedKey), lpEncKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetCarriedKeyName(BSTR* lpEncKey){ + if(m_pEncryptedKey) + Convert::out_retval_sz2BSTR((char *)dencEncryptedKey_GetCarriedKeyName(m_pEncryptedKey), lpEncKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetIssuer(BSTR* issuer) + { + DigiDocMemBuf mbuf1; + if(m_pEncryptedKey) { + X509* pCert = dencEncryptedKey_GetCertificate(m_pEncryptedKey); + char buf[X509_NAME_BUF_LEN]; + int bLen = sizeof(buf); + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(pCert) { + ddocCertGetIssuerDN((X509*)pCert, &mbuf1); + utf82oem((const char*)mbuf1.pMem, buf, bLen); + Convert::out_retval_sz2BSTR((char *)buf, issuer); + } + ddocMemBuf_free(&mbuf1); + } + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetNotAfter(BSTR *notafter) + { + if(m_pEncryptedKey) { + X509* cert = dencEncryptedKey_GetCertificate(m_pEncryptedKey); + char buf[X509_NAME_BUF_LEN]; + int bLen = sizeof(buf); + +// ASN1_TIME *tm = 0; + time_t t2; + struct tm *pT; + + //KERT. changed because asn1time2time_t is not exported anymore +/* tm = X509_get_notAfter((X509*)cert); + asn1time2time_t(tm, &t2); +*/ + t2 = getCertNotAfterTimeT(cert); + pT = localtime(&t2); + + sprintf(buf, "%02d.%02d.%04d %02d:%02d:%02d%", + pT->tm_mday, pT->tm_mon + 1, + pT->tm_year + 1900, pT->tm_hour, pT->tm_min, pT->tm_sec); + + Convert::out_retval_sz2BSTR((char *)buf, notafter); + } + return S_OK; + } + + + STDMETHODIMP CComEncryptedKey::SetId(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetId(m_pEncryptedKey,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::SetRecipient(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetRecipient(m_pEncryptedKey,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::SetEncryptionMethod(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetEncryptionMethod(m_pEncryptedKey,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::SetKeyName(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetKeyName(m_pEncryptedKey,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::SetCarriedKeyName(BSTR szValue, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetCarriedKeyName(m_pEncryptedKey,GetBSTR(szValue)); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::GetCertificate(LONG* hx509Handle) + { + if(m_pEncryptedKey) + *hx509Handle = (long)dencEncryptedKey_GetCertificate(m_pEncryptedKey); + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::SetCertificate(LONG hx509Handle, LONG* nRetResult) + { + USES_CONVERSION; + if(m_pEncryptedKey) + *nRetResult = dencEncryptedKey_SetCertificate(m_pEncryptedKey,(X509 *)hx509Handle); + + return S_OK; + } + + STDMETHODIMP CComEncryptedKey::Create(IComEncryptedData * pEncData, BSTR hX509_path, BSTR szEncMethod, + BSTR szId, BSTR szRecipient, BSTR szKeyName, BSTR szCarriedKeyname, LONG* nRetResult) + { + USES_CONVERSION; + DEncEncryptedKey *pKey = NULL; + DEncEncryptedData *pData = NULL; + pData = ((CComEncryptedData *)pEncData)->getEncryptedData(); + X509* pCert = 0; + LONG ret = 0; + + string cert_path = _bstr_t(hX509_path); + if (!PathFileExists(cert_path.c_str())) { + *nRetResult = ERR_CERT_READ; + } else { + + *nRetResult = ReadCertFile(pCert, cert_path.c_str()); + if (!*nRetResult) + *nRetResult = dencEncryptedKey_new(pData, &pKey, pCert, GetBSTR(szEncMethod), GetBSTR(szId), GetBSTR(szRecipient),GetBSTR(szKeyName),GetBSTR(szCarriedKeyname)); + } + + if (pKey != NULL) shiftStructPointer(pKey); + return S_OK; + } + + + int CComEncryptedKey::ReadCertFile(X509* &pCert, string cert_path) + { + int ret = ERR_CERT_READ; + FILE *hSource; + long lSize; + unsigned char *buffer; + + if(!(hSource = fopen(cert_path.c_str(),"rb"))) goto cleanup; + if(fseek(hSource, 0, SEEK_END)) goto cleanup; + + lSize = ftell(hSource); + if (lSize == -1L) goto cleanup; + rewind(hSource); + + buffer = new unsigned char[lSize]; + fread(buffer, 1, lSize, hSource); + if(ferror(hSource)) goto cleanup; + + ret = ddocDecodeX509Data(&pCert, buffer, lSize); + +cleanup: + if(hSource) fclose(hSource); + if (buffer) delete buffer; + + return ret; + } + + + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.h libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.h --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,67 @@ +// ComEncryptedKey.h : Declaration of the CComEncryptedKey + +#pragma once +#include "resource.h" // main symbols + +#include "DigiDocLibCOM_h.h" +#include "libdigidoc/DigiDocEnc.h" +#include "libdigidoc/DigiDocEncGen.h" + +// CComEncryptedKey + +class ATL_NO_VTABLE CComEncryptedKey : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComEncryptedKey(); + ~CComEncryptedKey(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMENCRYPTEDKEY) + + +BEGIN_COM_MAP(CComEncryptedKey) + COM_INTERFACE_ENTRY(IComEncryptedKey) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + } + +public: + + STDMETHOD(GetId)(BSTR* lpEncKey); + STDMETHOD(GetRecipient)(BSTR* lpEncKey); + STDMETHOD(GetEncryptionMethod)(BSTR* lpEncKey); + STDMETHOD(GetKeyName)(BSTR* lpEncKey); + STDMETHOD(GetCarriedKeyName)(BSTR* lpEncKey); + STDMETHOD(SetId)(BSTR lpValue, LONG* nRetResult); + STDMETHOD(SetRecipient)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetEncryptionMethod)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetKeyName)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetCarriedKeyName)(BSTR szValue, LONG* nRetResult); + STDMETHOD(GetCertificate)(LONG* hx509Handle); + STDMETHOD(SetCertificate)(LONG hx509Handle, LONG* hRetResult); + void shiftStructPointer(DEncEncryptedKey* pNew); + DEncEncryptedKey* getEncryptedKey(); + +private: + DEncEncryptedKey* m_pEncryptedKey; +public: + STDMETHOD(GetNotAfter)(BSTR* notafter); + STDMETHOD(GetIssuer)(BSTR* issuer); + int ReadCertFile(X509* &pCert, string cert_path); + STDMETHOD(Create)(IComEncryptedData * pEncData, BSTR hX509_path, BSTR szEncMethod, BSTR szId, BSTR szRecipient, BSTR szKeyName, BSTR szCarriedKeyname, LONG* nRetResult); +}; + +//OBJECT_ENTRY_AUTO(__uuidof(ComEncryptedKey), CComEncryptedKey) diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.rgs libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.rgs --- libdigidoc-2.7.0/libdigidoccom/ComEncryptedKey.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptedKey.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,26 @@ +HKCR +{ + DigiDocLibCOM.ComEncryptedKey.1 = s 'ComEncryptedKey Class' + { + CLSID = s '{47D7B23D-BB86-46D2-BBEE-8D3AFB0566D9}' + } + DigiDocLibCOM.ComEncryptedKey = s 'ComEncryptedKey Class' + { + CLSID = s '{47D7B23D-BB86-46D2-BBEE-8D3AFB0566D9}' + CurVer = s 'DigiDocLibCOM.ComEncryptedKey.1' + } + NoRemove CLSID + { + ForceRemove {47D7B23D-BB86-46D2-BBEE-8D3AFB0566D9} = s 'ComEncryptedKey Class' + { + ProgID = s 'DigiDocLibCOM.ComEncryptedKey.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComEncryptedKey' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.cpp libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.cpp --- libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,113 @@ +// ComEncryptionProperty.cpp : Implementation of CComEncryptionProperty + +#include "stdafx.h" +#include "ComEncryptionProperty.h" +#include "ComEncryptedData.h" +#include "Converters.h" + + +// CComEncryptionProperty + +CComEncryptionProperty::CComEncryptionProperty() +{ + m_pEncryptionProperty = NULL; +} + +CComEncryptionProperty::~CComEncryptionProperty() +{ +//freeStruct(); +} + +DEncEncryptionProperty* CComEncryptionProperty::getEncryptionProperty() +{ + return(m_pEncryptionProperty); +} + +void CComEncryptionProperty::shiftStructPointer(DEncEncryptionProperty* pNew) +{ + m_pEncryptionProperty = pNew; +} + + + +STDMETHODIMP CComEncryptionProperty::SetId(BSTR szValue, LONG* nRetResult) +{ + USES_CONVERSION; + if(m_pEncryptionProperty) + *nRetResult = dencEncryptionProperty_SetId(m_pEncryptionProperty,GetBSTR(szValue)); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::SetTarget(BSTR szValue, LONG* nRetResult) +{ + USES_CONVERSION; + if(m_pEncryptionProperty) + *nRetResult = dencEncryptionProperty_SetTarget(m_pEncryptionProperty,GetBSTR(szValue)); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::SetName(BSTR szValue, LONG* nRetResult) +{ + USES_CONVERSION; + if(m_pEncryptionProperty) + *nRetResult = dencEncryptionProperty_SetName(m_pEncryptionProperty,GetBSTR(szValue)); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::SetContent(BSTR szValue, LONG* nRetResult) +{ + USES_CONVERSION; + if(m_pEncryptionProperty) + *nRetResult = dencEncryptionProperty_SetContent(m_pEncryptionProperty,GetBSTR(szValue)); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::GetId(BSTR* lpEncProp) +{ + if(m_pEncryptionProperty) + Convert::out_retval_sz2BSTR((char *)dencEncryptionProperty_GetId(m_pEncryptionProperty), lpEncProp); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::GetTarget(BSTR* lpEncProp) +{ + if(m_pEncryptionProperty) + Convert::out_retval_sz2BSTR((char *)dencEncryptionProperty_GetTarget(m_pEncryptionProperty), lpEncProp); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::GetName(BSTR* lpEncProp) +{ + if(m_pEncryptionProperty) + Convert::out_retval_sz2BSTR((char *)dencEncryptionProperty_GetName(m_pEncryptionProperty), lpEncProp); + return S_OK; +} + +STDMETHODIMP CComEncryptionProperty::GetContent(BSTR* lpEncProp) +{ + if(m_pEncryptionProperty) + Convert::out_retval_sz2BSTR((char *)dencEncryptionProperty_GetContent(m_pEncryptionProperty), lpEncProp); + return S_OK; +} + + STDMETHODIMP CComEncryptionProperty::Create(IComEncryptedData * pEncData, BSTR szId, BSTR szTarget, BSTR szName, BSTR szContent, LONG* nRetResult){ + USES_CONVERSION; + DEncEncryptionProperty *pProperty = NULL; + DEncEncryptedData *pData = NULL; + + pData = ((CComEncryptedData *)pEncData)->getEncryptedData(); + + char *pId = GetBSTR(szId); + char *pTarget = GetBSTR(szTarget); + char *pName = GetBSTR(szName); + char *pContent = GetBSTR(szContent); + + *nRetResult = dencEncryptionProperty_new(pData, &pProperty, + pId, + pTarget, + pName, + pContent); + + if (pProperty != NULL) shiftStructPointer(pProperty); + return S_OK; + } diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.h libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.h --- libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,62 @@ +// ComEncryptionProperty.h : Declaration of the CComEncryptionProperty + +#pragma once +#include "resource.h" // main symbols + +#include "DigiDocLibCOM_h.h" +#include "libdigidoc/DigiDocEnc.h" + + + +// CComEncryptionProperty + +class ATL_NO_VTABLE CComEncryptionProperty : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComEncryptionProperty(); + ~CComEncryptionProperty(); + + +DECLARE_REGISTRY_RESOURCEID(IDR_COMENCRYPTIONPROPERTY) + + +BEGIN_COM_MAP(CComEncryptionProperty) + COM_INTERFACE_ENTRY(IComEncryptionProperty) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + } + +public: + + STDMETHOD(SetId)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetTarget)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetName)(BSTR szValue, LONG* nRetResult); + STDMETHOD(SetContent)(BSTR szValue, LONG* nRetResult); + STDMETHOD(GetId)(BSTR* lpEncProp); + STDMETHOD(GetTarget)(BSTR* lpEncProp); + STDMETHOD(GetName)(BSTR* lpEncProp); + STDMETHOD(GetContent)(BSTR* lpEncProp); + void shiftStructPointer(DEncEncryptionProperty* pNew); + DEncEncryptionProperty* getEncryptionProperty(); + +private: + DEncEncryptionProperty* m_pEncryptionProperty; +public: + STDMETHOD(Create)(IComEncryptedData * pEncData, BSTR szId, BSTR szTarget, BSTR szName, BSTR szContent, LONG* nRetResult); +}; + +//OBJECT_ENTRY_AUTO(__uuidof(ComEncryptionProperty), CComEncryptionProperty) diff -Nru libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.rgs libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.rgs --- libdigidoc-2.7.0/libdigidoccom/ComEncryptionProperty.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComEncryptionProperty.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,26 @@ +HKCR +{ + DigiDocLibCOM.ComEncryptionProperty.1 = s 'ComEncryptionProperty Class' + { + CLSID = s '{249E93E5-5723-4A7C-BA6A-940BDBC86200}' + } + DigiDocLibCOM.ComEncryptionProperty = s 'ComEncryptionProperty Class' + { + CLSID = s '{249E93E5-5723-4A7C-BA6A-940BDBC86200}' + CurVer = s 'DigiDocLibCOM.ComEncryptionProperty.1' + } + NoRemove CLSID + { + ForceRemove {249E93E5-5723-4A7C-BA6A-940BDBC86200} = s 'ComEncryptionProperty Class' + { + ProgID = s 'DigiDocLibCOM.ComEncryptionProperty.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComEncryptionProperty' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.cpp libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.cpp --- libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,128 @@ +// ComErrorInfo.cpp : Implementation of CComErrorInfo +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComErrorInfo.h" + +///////////////////////////////////////////////////////////////////////////// +// CComErrorInfo + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComErrorInfo::get_nCode(long *pVal) +{ + if (hasContent_Internal()) + *pVal = m_pErrInfo->code; + else + *pVal = ERR_OK; + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::get_szFileName(BSTR *pVal) +{ + USES_CONVERSION; + if (hasContent_Internal() && (m_pErrInfo->fileName != (char*)0)) + SetBSTR(pVal, m_pErrInfo->fileName); //*pVal = SysAllocString(A2OLE(m_pErrInfo->fileName)); + else + SetBSTR(pVal, ""); //*pVal = SysAllocString(A2OLE("")); + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::get_nFileLine(long *pVal) +{ + if (hasContent_Internal()) + *pVal = m_pErrInfo->line; + else + *pVal = 0; + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::get_szAssertion(BSTR *pVal) +{ + USES_CONVERSION; + if (hasContent_Internal() && (m_pErrInfo->assertion != (char*)0)) + SetBSTR(pVal, m_pErrInfo->assertion); //*pVal = SysAllocString(A2OLE(m_pErrInfo->assertion)); + else + SetBSTR(pVal,""); //*pVal = SysAllocString(A2OLE("")); + + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComErrorInfo::hasContent(VARIANT *pRetBool) +{ + VariantInit(pRetBool); + V_VT(pRetBool) = VT_BOOL; + V_BOOL(pRetBool) = (hasContent_Internal() ? TRUE : FALSE); + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::getErrorString(BSTR *pszRetText) +{ + USES_CONVERSION; + if (hasContent_Internal()) { + SetBSTR(pszRetText, ::getErrorString(m_pErrInfo->code)); //*pszRetText = SysAllocString(A2OLE(::getErrorString(m_pErrInfo->code, nLanguage))); + } else { + SetBSTR(pszRetText, ""); //*pszRetText = SysAllocString(A2OLE("")); + } + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::getNextUnreadError(VARIANT *pbRetResult) +{ + VariantInit(pbRetResult); + V_VT(pbRetResult) = VT_BOOL; + + m_pErrInfo = getErrorInfo(); + V_BOOL(pbRetResult) = (m_pErrInfo ? TRUE : FALSE); + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::clearErrorInfo() +{ + m_pErrInfo = (ErrorInfo*)0; + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::clearAllUnreadErrors() +{ + m_pErrInfo = (ErrorInfo*)0; + ::clearErrors(); + + return S_OK; +} + +STDMETHODIMP CComErrorInfo::getErrorStringByCode(long nCode, BSTR *pszRetString) +{ + USES_CONVERSION; + SetBSTR(pszRetString, ::getErrorString(nCode)); //*pszRetString = SysAllocString(A2OLE(::getErrorString(nCode, nLanguage))); + + return S_OK; +} + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +bool CComErrorInfo::hasContent_Internal() { + return ((m_pErrInfo == (ErrorInfo*)0) ? false : true); +} + + +STDMETHODIMP CComErrorInfo::getErrorClass(LONG nCode, LONG* nClass) +{ +*nClass = ::getErrorClass(nCode); +return S_OK; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.h libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.h --- libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,71 @@ +/* + +Wrap of DigiCoc library ErrorInfo structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComErrorInfo.h : Declaration of the CComErrorInfo + +#ifndef __COMERRORINFO_H_ +#define __COMERRORINFO_H_ + +#include "resource.h" // main symbols +#include "ComDigiDocLib.h" + +///////////////////////////////////////////////////////////////////////////// +// CComErrorInfo + +class ATL_NO_VTABLE CComErrorInfo : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComErrorInfo() + { + m_pErrInfo = (ErrorInfo*)0; + } + +DECLARE_REGISTRY_RESOURCEID(IDR_COMERRORINFO) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComErrorInfo) + COM_INTERFACE_ENTRY(IComErrorInfo) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComErrorInfo +public: + STDMETHOD(getErrorStringByCode)(/*[in]*/ long nCode, /*[out, retval]*/ BSTR* pszRetString); + STDMETHOD(clearAllUnreadErrors)(); + STDMETHOD(clearErrorInfo)(); + STDMETHOD(getNextUnreadError)(/*[out, retval]*/ VARIANT* pbRetResult); + STDMETHOD(getErrorString)(/*[out, retval]*/ BSTR* pszRetText); + STDMETHOD(hasContent)(/*[out, retval]*/ VARIANT* pRetBool); + STDMETHOD(get_szAssertion)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_nFileLine)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szFileName)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_nCode)(/*[out, retval]*/ long *pVal); + + bool hasContent_Internal(); +protected: + ErrorInfo* m_pErrInfo; +public: + STDMETHOD(getErrorClass)(LONG nCode, LONG* nClass); +}; + +#endif //__COMERRORINFO_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.rgs libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.rgs --- libdigidoc-2.7.0/libdigidoccom/ComErrorInfo.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComErrorInfo.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComErrorInfo.1 = s 'ComErrorInfo Class' + { + CLSID = s '{E9C5A5DA-9E25-11D6-AEE6-420005574701}' + } + DigiDocLibCOM.ComErrorInfo = s 'ComErrorInfo Class' + { + CLSID = s '{E9C5A5DA-9E25-11D6-AEE6-420005574701}' + CurVer = s 'DigiDocLibCOM.ComErrorInfo.1' + } + NoRemove CLSID + { + ForceRemove {E9C5A5DA-9E25-11D6-AEE6-420005574701} = s 'ComErrorInfo Class' + { + ProgID = s 'DigiDocLibCOM.ComErrorInfo.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComErrorInfo' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.cpp libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.cpp --- libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,396 @@ +// ComNotaryInfo.cpp : Implementation of CComNotaryInfo +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComNotaryInfo.h" +#include "ComSignedDoc.h" +#include "Converters.h" + +///////////////////////////////////////////////////////////////////////////// +// CComNotaryInfo + + + +STDMETHODIMP CComNotaryInfo::get_szId(BSTR *pVal) +{ + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR(m_pNotaryInfo->szId, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szId(BSTR newVal) +{ + if(m_pNotaryInfo) + Convert::in_BSTR2sz(newVal, &(m_pNotaryInfo->szId)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_szSigId(BSTR *pVal) +{ + // TODO - no way ? + if(m_pSigInfo) + Convert::out_retval_sz2BSTR(m_pSigInfo->szId, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szSigId(BSTR newVal) +{ + // TODO - no way ? + //Convert::in_BSTR2sz(newVal, &(getNotaryInfo()->szSigId)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_szNotType(BSTR *pVal) +{ + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR(m_pNotaryInfo->szNotType, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szNotType(BSTR newVal) +{ + if(m_pNotaryInfo) + Convert::in_BSTR2sz(newVal, &(m_pNotaryInfo->szNotType)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_timeProduced(BSTR *pVal) +{ + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR(m_pNotaryInfo->timeProduced, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_timeProduced(BSTR newVal) +{ + if(m_pNotaryInfo) + Convert::in_BSTR2sz(newVal, &(m_pNotaryInfo->timeProduced)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_szRespIdType(BSTR *pVal) +{ + // can't set this + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR((char*)ddocNotInfo_GetResponderId_Type(m_pNotaryInfo), pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szRespIdType(BSTR newVal) +{ + // can't set this + //Convert::in_BSTR2sz(newVal, &(getNotaryInfo()->szRespIdType)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_baRespId(VARIANT *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetResponderId(m_pNotaryInfo); + if(pMBuf) + Convert::out_retval_ac2VARIANT((char*)pMBuf->pMem, pMBuf->nLen, pVal); + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nRespIdLen(long *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + *pVal = 0; + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetResponderId(getNotaryInfo()); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_thisUpdate(BSTR *pVal) +{ + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(m_pNotaryInfo) { + ddocNotInfo_GetThisUpdate(m_pNotaryInfo, &mbuf1); + if(mbuf1.pMem) { + Convert::out_retval_sz2BSTR((char*)mbuf1.pMem, pVal); + ddocMemBuf_free(&mbuf1); + } + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_thisUpdate(BSTR newVal) +{ + // can't set this + //Convert::in_BSTR2sz(newVal, &(getNotaryInfo()->thisUpdate)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nextUpdate(BSTR *pVal) +{ + DigiDocMemBuf mbuf1; + + mbuf1.pMem = 0; + mbuf1.nLen = 0; + if(m_pNotaryInfo) { + ddocNotInfo_GetNextUpdate(getNotaryInfo(), &mbuf1); + if(mbuf1.pMem) { + Convert::out_retval_sz2BSTR((char*)mbuf1.pMem, pVal); + ddocMemBuf_free(&mbuf1); + } + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_nextUpdate(BSTR newVal) +{ + // can't set this + //Convert::in_BSTR2sz(newVal, &(getNotaryInfo()->nextUpdate)); + + return S_OK; +} + + +STDMETHODIMP CComNotaryInfo::get_nCertNr(long *pVal) +{ + CertID* pCertID = 0; + + *pVal = 0; + if(m_pSigInfo) { + pCertID = ddocSigInfo_GetOrCreateCertIDOfType(m_pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); + if(pCertID) { + try { + _bstr_t tmp = ddocCertID_GetIssuerSerial(pCertID); + _variant_t vart = tmp; + *pVal = vart; + } catch ( exception ){}; + } + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_nCertNr(long newVal) +{ + _bstr_t tmp = newVal; + //getNotaryInfo()->certNr = newVal; + // cant't do this! + //Convert::in_BSTR2sz(tmp,&(getNotaryInfo()->szIssuerSerial)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_szDigestType(BSTR *pVal) +{ + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR(m_pNotaryInfo->szDigestType, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szDigestType(BSTR newVal) +{ + if(m_pNotaryInfo) + Convert::in_BSTR2sz(newVal, &(m_pNotaryInfo->szDigestType)); + + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_szSigType(BSTR *pVal) +{ + if(m_pNotaryInfo) + Convert::out_retval_sz2BSTR(m_pNotaryInfo->szSigType, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::put_szSigType(BSTR newVal) +{ + if(m_pNotaryInfo) + Convert::in_BSTR2sz(newVal, &(m_pNotaryInfo->szSigType)); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_baSigValue(VARIANT *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetOcspDigest(m_pNotaryInfo); + if(pMBuf) + Convert::out_retval_ac2VARIANT((const char*)pMBuf->pMem, pMBuf->nLen, pVal); + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nSigLen(long *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + *pVal = 0; + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetOcspDigest(m_pNotaryInfo); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nIssuerSerial(BSTR *pVal) +{ + CertID* pCertID = 0; + + if(m_pSigInfo) { + pCertID = ddocSigInfo_GetOrCreateCertIDOfType(m_pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); + if(pCertID) + Convert::out_retval_sz2BSTR((char*)ddocCertID_GetIssuerSerial(pCertID), pVal); + } + return S_OK; +} + + +STDMETHODIMP CComNotaryInfo::get_baCertDigest(VARIANT *pVal) +{ + CertID* pCertID = 0; + DigiDocMemBuf* pMBuf = 0; + + if(m_pSigInfo) { + pCertID = ddocSigInfo_GetOrCreateCertIDOfType(m_pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); + if(pCertID) { + pMBuf = ddocCertID_GetDigestValue(pCertID); + if(pMBuf && pMBuf->pMem) + Convert::out_retval_ac2VARIANT((const char*)pMBuf->pMem, pMBuf->nLen, pVal); + } + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nCertDigestLen(long *pVal) +{ + CertID* pCertID = 0; + DigiDocMemBuf* pMBuf = 0; + + *pVal = 0; + if(m_pSigInfo) { + pCertID = ddocSigInfo_GetOrCreateCertIDOfType(m_pSigInfo, CERTID_TYPE_RESPONDERS_CERTID); + if(pCertID) { + pMBuf = ddocCertID_GetDigestValue(pCertID); + if(pMBuf && pMBuf->pMem) + *pVal = pMBuf->nLen; + } + } + return S_OK; +} + + +STDMETHODIMP CComNotaryInfo::get_baOcspDigest(VARIANT *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetOcspDigest(m_pNotaryInfo); + if(pMBuf) + Convert::out_retval_ac2VARIANT((const char*)pMBuf->pMem, pMBuf->nLen, pVal); + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::get_nOcspDigestLen(long *pVal) +{ + const DigiDocMemBuf* pMBuf = 0; + + *pVal = 0; + if(m_pNotaryInfo) { + pMBuf = ddocNotInfo_GetOcspDigest(m_pNotaryInfo); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComNotaryInfo::verifyNotCert(long *nRetResult) +{ + if(m_pNotaryInfo && m_pSigInfo) + *nRetResult = ::verifyNotCert(getSignatureInfo(), m_pNotaryInfo); + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::getNotCertData(long *hRetCertHandle) +{ + X509* pCert = 0; + + if(m_pSigInfo) { + pCert = ddocSigInfo_GetOCSPRespondersCert(m_pSigInfo); + if(pCert) + *hRetCertHandle = (long)pCert; + } + return S_OK; +} + +STDMETHODIMP CComNotaryInfo::verifyNotaryDigest(IComSignedDoc* pUseFormatOf, long *nRetCode) +{ + if(m_pNotaryInfo) + *nRetCode = ::verifyNotaryDigest(((CComSignedDoc*)pUseFormatOf)->getSignedDoc(), m_pNotaryInfo); + return S_OK; +} + + + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// +CComNotaryInfo::CComNotaryInfo() { + m_pNotaryInfo = NULL; + m_pSigInfo = NULL; +} + +CComNotaryInfo::~CComNotaryInfo() { + // m_pNotaryInfo is freed by lib +} + + +NotaryInfo* CComNotaryInfo::getNotaryInfo() { + return m_pNotaryInfo; +} + + +void CComNotaryInfo::shiftStructPointer(NotaryInfo* pNew) { + m_pNotaryInfo = pNew; +} + + +SignatureInfo* CComNotaryInfo::getSignatureInfo() +{ + return m_pSigInfo; +} + +void CComNotaryInfo::setSignatureInfo(SignatureInfo* pSigInfo) +{ + m_pSigInfo = pSigInfo; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.h libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.h --- libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,96 @@ +/* + +Wrap of DigiCoc library NotaryInfo structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComNotaryInfo.h : Declaration of the CComNotaryInfo + +#ifndef __COMNOTARYINFO_H_ +#define __COMNOTARYINFO_H_ + +#include "resource.h" // main symbols + +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocObj.h" + +///////////////////////////////////////////////////////////////////////////// +// CComNotaryInfo +class ATL_NO_VTABLE CComNotaryInfo : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComNotaryInfo(); + ~CComNotaryInfo(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMNOTARYINFO) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComNotaryInfo) + COM_INTERFACE_ENTRY(IComNotaryInfo) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComNotaryInfo +public: + STDMETHOD(verifyNotaryDigest)(/*[in]*/ IComSignedDoc* pUseFormatOf, /*[out, retval]*/ long* nRetCode); + STDMETHOD(get_nOcspDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baOcspDigest)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(getNotCertData)(/*[out, retval]*/ long* hRetCertHandle); + STDMETHOD(verifyNotCert)(/*[out, retval]*/ long* nRetResult); + STDMETHOD(get_nCertDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baCertDigest)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_nIssuerSerial)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_nSigLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baSigValue)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_szSigType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szSigType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szDigestType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szDigestType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_nCertNr)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_nCertNr)(/*[in]*/ long newVal); + STDMETHOD(get_nextUpdate)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_nextUpdate)(/*[in]*/ BSTR newVal); + STDMETHOD(get_thisUpdate)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_thisUpdate)(/*[in]*/ BSTR newVal); + STDMETHOD(get_nRespIdLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_baRespId)(/*[out, retval]*/ VARIANT *pVal); + STDMETHOD(get_szRespIdType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szRespIdType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_timeProduced)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_timeProduced)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szNotType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szNotType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szSigId)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szSigId)(/*[in]*/ BSTR newVal); + STDMETHOD(get_szId)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szId)(/*[in]*/ BSTR newVal); + + NotaryInfo* getNotaryInfo(); + SignatureInfo* getSignatureInfo(); + + void shiftStructPointer(NotaryInfo* pNew); + void setSignatureInfo(SignatureInfo* pSigInfo); + +protected: + NotaryInfo* m_pNotaryInfo; + SignatureInfo* m_pSigInfo; +}; + +#endif //__COMNOTARYINFO_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.rgs libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.rgs --- libdigidoc-2.7.0/libdigidoccom/ComNotaryInfo.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComNotaryInfo.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComNotaryInfo.1 = s 'ComNotaryInfo Class' + { + CLSID = s '{2A541870-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComNotaryInfo = s 'ComNotaryInfo Class' + { + CLSID = s '{2A541870-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComNotaryInfo.1' + } + NoRemove CLSID + { + ForceRemove {2A541870-9A3E-11D6-AEE5-420005574701} = s 'ComNotaryInfo Class' + { + ProgID = s 'DigiDocLibCOM.ComNotaryInfo.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComNotaryInfo' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.cpp libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.cpp --- libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,105 @@ +// ComPolicyIdentifierArray.cpp : Implementation of CComPolicyIdentifierArray + +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComPolicyIdentifierArray.h" +#include "Converters.h" +#include "libdigidoc/DigiDocMem.h" +#include "libdigidoc/DigiDocCert.h" +#include "libdigidoc/DigiDocConvert.h" + + + +// CComPolicyIdentifierArray + + +STDMETHODIMP CComPolicyIdentifierArray::get_m_nPolicyIdentifierCount(LONG *pVal) +{ + *pVal = iPolicyIdentifierCount; + return S_OK; +} + +STDMETHODIMP CComPolicyIdentifierArray::get_szUserNotice(LONG iIndex, BSTR *lpResult) +{ + DigiDocMemBuf mbuf1, mbuf2; + char * p1 = GetItemValue(iIndex,dPolicIdent_UserNotice); + if(!p1) + p1 = ""; + mbuf1.pMem = p1; + mbuf1.nLen = strlen((char*)mbuf1.pMem); + mbuf2.pMem = 0; + mbuf2.nLen = 0; + USES_CONVERSION; + ddocMemSetLength(&mbuf2, mbuf1.nLen + 10); + utf82oem((const char*)mbuf1.pMem, (char*)mbuf2.pMem, mbuf2.nLen); + SetBSTR(lpResult, (char*)mbuf2.pMem); + ddocMemBuf_free(&mbuf2); + return S_OK; +} + +STDMETHODIMP CComPolicyIdentifierArray::read_CertPolicies(long lX509, LONG *lpCounter) +{ + int iResult; + X509 *pX509; + pX509 = (X509 *)lX509; + ReleaseAllMem(); + iResult = readCertPolicies(pX509,&pPolicyIdentifierList, &iPolicyIdentifierCount); + *lpCounter = iPolicyIdentifierCount; + return S_OK; +} + +STDMETHODIMP CComPolicyIdentifierArray::get_szCPS(LONG iIndex, BSTR *lpResult) +{ + char *psVal = GetItemValue(iIndex,dPolicIdent_CPS); + if(!psVal) psVal = ""; + USES_CONVERSION; + SetBSTR(lpResult, psVal); //*lpResult = SysAllocString(A2OLE(psVal)); + return S_OK; +} + +STDMETHODIMP CComPolicyIdentifierArray::get_szOID(LONG iIndex, BSTR *lpResult) +{ + char *psVal = GetItemValue(iIndex,dPolicIdent_OID); + if(!psVal) psVal = ""; + USES_CONVERSION; + SetBSTR(lpResult, psVal); //*lpResult = SysAllocString(A2OLE(psVal)); + return S_OK; +} + +void CComPolicyIdentifierArray::ReleaseAllMem(void) +{ + if(pPolicyIdentifierList != NULL) + PolicyIdentifiers_free(pPolicyIdentifierList,iPolicyIdentifierCount); + pPolicyIdentifierList = NULL; + iPolicyIdentifierCount = 0; +} + +char * CComPolicyIdentifierArray::GetItemValue(int iIndex, int iType) +{ + char *psRes = NULL; + PolicyIdentifier *pPolicyItem; + if (iIndex >= 0 && iIndex < iPolicyIdentifierCount) + { + pPolicyItem = pPolicyIdentifierList+iIndex; + if(iType == dPolicIdent_UserNotice) + psRes = pPolicyItem->szUserNotice; + if(iType == dPolicIdent_CPS) + psRes = pPolicyItem->szCPS; + if(iType == dPolicIdent_OID) + psRes = pPolicyItem->szOID; + } + return(psRes); +} + +STDMETHODIMP CComPolicyIdentifierArray::isCompanyPolicy(LONG iIndex, LONG * lpResult) +{ + int iRes = 0; + PolicyIdentifier *pPolicyItem; + if (iIndex >= 0 && iIndex < iPolicyIdentifierCount) + { + pPolicyItem = pPolicyIdentifierList+iIndex; + iRes = isCompanyCPSPolicy(pPolicyItem); + } + *lpResult = iRes; + return S_OK; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.h libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.h --- libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,64 @@ +// ComPolicyIdentifierArray.h : Declaration of the CComPolicyIdentifierArray + +#pragma once +#include "resource.h" // main symbols + +#include "libdigidoc/DigiDocLib.h" + +#define dPolicIdent_UserNotice 0 +#define dPolicIdent_CPS 1 +#define dPolicIdent_OID 2 + +// CComPolicyIdentifierArray + +class ATL_NO_VTABLE CComPolicyIdentifierArray : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComPolicyIdentifierArray() + : iPolicyIdentifierCount(0) + , pPolicyIdentifierList(NULL) + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_COMPOLICYIDENTIFIERARRAY) + + +BEGIN_COM_MAP(CComPolicyIdentifierArray) + COM_INTERFACE_ENTRY(IComPolicyIdentifierArray) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + HRESULT FinalConstruct() + { + return S_OK; + } + + void FinalRelease() + { + ReleaseAllMem(); + } + +public: + STDMETHOD(get_m_nPolicyIdentifierCount)(LONG *pVal); + STDMETHOD(get_szUserNotice)(LONG iIndex, BSTR *lpResult); + STDMETHOD(read_CertPolicies)(long lX509, LONG *lpCounter); + STDMETHOD(get_szCPS)(LONG iIndex, BSTR *lpResult); + STDMETHOD(get_szOID)(LONG iIndex, BSTR *lpResult); + +private: + int iPolicyIdentifierCount; + PolicyIdentifier *pPolicyIdentifierList; +private: + void ReleaseAllMem(void); + char * GetItemValue(int iIndex, int iType); +public: + STDMETHOD(isCompanyPolicy)(LONG iIndex, LONG * lpResult); +}; + +//OBJECT_ENTRY_AUTO(__uuidof(ComPolicyIdentifierArray), CComPolicyIdentifierArray) diff -Nru libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.rgs libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.rgs --- libdigidoc-2.7.0/libdigidoccom/ComPolicyIdentifierArray.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComPolicyIdentifierArray.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,26 @@ +HKCR +{ + DigiDocLibCOM.ComPolicyIdentifierArra.1 = s 'ComPolicyIdentifierArray Class' + { + CLSID = s '{9E1F83EF-9743-11D7-AF64-420005574701}' + } + DigiDocLibCOM.ComPolicyIdentifierArray = s 'ComPolicyIdentifierArray Class' + { + CLSID = s '{9E1F83EF-9743-11D7-AF64-420005574701}' + CurVer = s 'DigiDocLibCOM.ComPolicyIdentifierArra.1' + } + NoRemove CLSID + { + ForceRemove {9E1F83EF-9743-11D7-AF64-420005574701} = s 'ComPolicyIdentifierArray Class' + { + ProgID = s 'DigiDocLibCOM.ComPolicyIdentifierArra.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComPolicyIdentifierArray' + ForceRemove 'Programmable' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.cpp libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.cpp --- libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,346 @@ +// ComSignatureInfo.cpp : Implementation of CComSignatureInfo +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "libdigidoc/DigiDocVerify.h" +#include "libdigidoc/DigiDocPKCS11.h" + +#include "ComSignatureInfo.h" +#include "Converters.h" + +///////////////////////////////////////////////////////////////////////////// +// CComSignatureInfo + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComSignatureInfo::get_szId(BSTR *pVal) +{ + if(m_pSignatureInfo && m_pSignatureInfo->szId) + Convert::out_retval_sz2BSTR(m_pSignatureInfo->szId, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + + +STDMETHODIMP CComSignatureInfo::get_nDocs(long *pVal) +{ + if(m_pSignatureInfo) + *pVal = m_pSignatureInfo->nDocs; + else + *pVal = 0; + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::get_szTimeStamp(BSTR *pVal) +{ + if(m_pSignatureInfo) + Convert::out_retval_sz2BSTR(m_pSignatureInfo->szTimeStamp, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::put_szTimeStamp(BSTR newVal) +{ + if(m_pSignatureInfo) + Convert::in_BSTR2sz(newVal, &(m_pSignatureInfo->szTimeStamp)); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::get_nSigPropDigestLen(long *pVal) +{ + DigiDocMemBuf* pMBuf = 0; + *pVal = 0; + if(m_pSignatureInfo) { + pMBuf = ddocSigInfo_GetSigPropDigest(m_pSignatureInfo); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::get_szSigType(BSTR *pVal) +{ + if(m_pSignatureInfo && m_pSignatureInfo->pSigValue) + Convert::out_retval_sz2BSTR((char*)ddocSignatureValue_GetType(m_pSignatureInfo->pSigValue), pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::put_szSigType(BSTR newVal) +{ + //if(getSignatureInfo()->pSigValue) + //Convert::in_BSTR2sz(newVal, &(getSignatureInfo()->szSigType)); + // don't do it! + return S_OK; +} + + +STDMETHODIMP CComSignatureInfo::get_nSigLen(long *pVal) +{ + DigiDocMemBuf* pMBuf = 0; + *pVal = 0; + if(m_pSignatureInfo && m_pSignatureInfo->pSigValue) { + pMBuf = ddocSignatureValue_GetSignatureValue(m_pSignatureInfo->pSigValue); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::get_nIssuerSerial(BSTR *pVal) +{ + if(m_pSignatureInfo && ddocSigInfo_GetSignersCert_IssuerSerial(m_pSignatureInfo)) + Convert::out_retval_sz2BSTR((char*)ddocSigInfo_GetSignersCert_IssuerSerial(m_pSignatureInfo), pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + + +STDMETHODIMP CComSignatureInfo::get_nCertDigestLen(long *pVal) +{ + DigiDocMemBuf* pMBuf = 0; + *pVal = 0; + if(m_pSignatureInfo) { + pMBuf = ddocSigInfo_GetSignersCert_DigestValue(m_pSignatureInfo); + if(pMBuf) + *pVal = pMBuf->nLen; + } + return S_OK; +} + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComSignatureInfo::verifySigPropDigest(IComSignedDoc* pSigDoc,BSTR szDataFile, long *nRetResult) +{ + USES_CONVERSION; + + + *nRetResult = 0; //::verifySigDocSigPropDigest(((CComSignedDoc*)pSigDoc)->getSignedDoc(),getSignatureInfo(), GetBSTR(szDataFile)); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::addDocInfo(BSTR szDocId, BSTR szDigType, + VARIANT baDigest, long nDigLen, VARIANT baMimeDig, long nMimeDigLen, IComDocInfo* pStoreTo) +{ + SAFEARRAY* pArrDig = V_ARRAY(&baDigest); + SAFEARRAY* pArrMDig = V_ARRAY(&baMimeDig); + byte HUGEP* pDataDig; + byte HUGEP* pDataMDig; + + SafeArrayAccessData(pArrDig, (void HUGEP**)&pDataDig); + SafeArrayAccessData(pArrMDig, (void HUGEP**)&pDataMDig); + USES_CONVERSION; + DocInfo* pDI = NULL; + ::addDocInfo(&pDI, m_pSignatureInfo, GetBSTR(szDocId), GetBSTR(szDigType), + pDataDig, nDigLen, pDataMDig, nMimeDigLen); + SafeArrayUnaccessData(pArrMDig); + SafeArrayUnaccessData(pArrDig); + + if (pDI != (DocInfo*)0) + ((CComDocInfo*)pStoreTo)->shiftStructPointer(pDI); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::calculateSignatureWithEstID(IComSignedDoc* pSigDoc,long nSlot, BSTR szPasswd, long *nRetResult) +{ + // test + ::createOrReplacePrivateConfigItem(NULL, "DIGIDOC_DEFAULT_DRIVER", "1"); + ::createOrReplacePrivateConfigItem(NULL, "DIGIDOC_DRIVER_1_FILE", "opensc-pkcs11.dll"); + ::createOrReplacePrivateConfigItem(NULL, "DEBUG_LEVEL", "3"); + ::createOrReplacePrivateConfigItem(NULL, "DEBUG_FILE", "y:\\digidoc.log"); + + if(m_pSignatureInfo) + *nRetResult = ::calculateSignatureWithEstID(((CComSignedDoc*)pSigDoc)->getSignedDoc(), m_pSignatureInfo, nSlot, GetBSTR(szPasswd)); + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::calculateSignatureWithCSPEstID(IComSignedDoc* pSigDoc, long fByKeyContainer, BSTR szPin, long *pRetErr) +{ + if(m_pSignatureInfo) + *pRetErr = ::calculateSigInfoSignatureWithCSPEstID(((CComSignedDoc*)pSigDoc)->getSignedDoc(),m_pSignatureInfo,fByKeyContainer, GetBSTR(szPin)); + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::addSignerRole(VARIANT tfCertified, BSTR szRole, VARIANT tfEncode) +{ + int nCertified = (V_BOOL(&tfCertified) ? 1 : 0); + int nEncode = (V_BOOL(&tfEncode) ? 1 : 0); + const char* pRoleAsUTF8 = GetBSTR(szRole); + int nRoleLen = strlen(pRoleAsUTF8) + 1; + + USES_CONVERSION; + if(m_pSignatureInfo) + ::addSignerRole(m_pSignatureInfo, nCertified, pRoleAsUTF8, nRoleLen, nEncode); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::countSignerRoles(VARIANT tfCertified, long *nRetCnt) +{ + + int nCertified = (V_BOOL(&tfCertified) ? 1 : 0); + if(m_pSignatureInfo) + *nRetCnt = ::getCountOfSignerRoles(m_pSignatureInfo, nCertified); + else + *nRetCnt = 0; + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::getSignerRole(VARIANT tfCertified, long nIndex, BSTR *pRetRole) +{ + const char* pPtr = 0; + int nCertified = (V_BOOL(&tfCertified) ? 1 : 0); + if(m_pSignatureInfo) { + pPtr = ::getSignerRole(m_pSignatureInfo, nCertified, nIndex); + if(pPtr) + Convert::out_retval_sz2BSTR((char*)pPtr, pRetRole); + } + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::createXMLSignedProperties(IComSignedDoc* pSigDoc,BSTR *pRetProperties) +{ + USES_CONVERSION; + + + //char* pTmp = ::createXMLSignedProperties(((CComSignedDoc*)pSigDoc)->getSignedDoc(),getSignatureInfo(), 0); + SetBSTR(pRetProperties, ""); //*pRetProperties = SysAllocString(A2OLE(pTmp)); + //free(pTmp); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::setSignatureCertFile(BSTR szCertFile, long *nRetResult) +{ + USES_CONVERSION; + if(m_pSignatureInfo) + *nRetResult = ::setSignatureCertFile(m_pSignatureInfo, GetBSTR(szCertFile)); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::calculateSignedPropertiesDigest(IComSignedDoc* pSigDoc,long *nRetResult) +{ + if(m_pSignatureInfo) + *nRetResult = ::calculateSignedPropertiesDigest(((CComSignedDoc*)pSigDoc)->getSignedDoc(),m_pSignatureInfo); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::getSignCertData(long *hRetCertHandle) +{ + if(m_pSignatureInfo) + *hRetCertHandle = (long)::getSignCertData(m_pSignatureInfo); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::getDocInfo(long nIndex, IComDocInfo* pStoreTo) +{ + DocInfo* pDI = 0; + if(m_pSignatureInfo) + pDI = ::getDocInfo(m_pSignatureInfo, nIndex); + if (pDI != (DocInfo*)0) { + ((CComDocInfo*)pStoreTo)->shiftStructPointer(pDI); + } + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::getDocInfoWithId(BSTR szId, IComDocInfo* pStoreTo) +{ + USES_CONVERSION; + DocInfo* pDI = 0; + if(m_pSignatureInfo) + pDI = ::getDocInfoWithId(m_pSignatureInfo, GetBSTR(szId)); + if (pDI != (DocInfo*)0) { + ((CComDocInfo*)pStoreTo)->shiftStructPointer(pDI); + } + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::calculateSigInfoSignature(IComSignedDoc* pSigDoc,long nSigType, BSTR szKeyFile, + BSTR szPasswd, BSTR szCertfile, long* nRetErr) +{ + USES_CONVERSION; + if(m_pSignatureInfo) + *nRetErr = ::calculateSigInfoSignature(((CComSignedDoc*)pSigDoc)->getSignedDoc(),m_pSignatureInfo, nSigType, + GetBSTR(szKeyFile), GetBSTR(szPasswd), GetBSTR(szCertfile)); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::verifySigCert(long *nRetResult) +{ + if(m_pSignatureInfo) + *nRetResult = ::verifySigCert(m_pSignatureInfo); + + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::setSignatureProductionPlace(BSTR szCity, BSTR szState, BSTR szZipCode, BSTR szCountry) +{ + USES_CONVERSION; + + char *p1 = (szCity ? GetBSTR(szCity) : NULL); + char *p2 = (szState ? GetBSTR(szState) : NULL); + char *p3 = (szZipCode ? GetBSTR(szZipCode) : NULL); + char *p4 = (szCountry ? GetBSTR(szCountry) : NULL); + if(m_pSignatureInfo) + ::setSignatureProductionPlace(m_pSignatureInfo, p1, p2, p3, p4); + return S_OK; +} + +STDMETHODIMP CComSignatureInfo::getSignatureProductionPlace(BSTR* pszCity, BSTR* pszState, BSTR* pszZipCode, BSTR* pszCountry) +{ + USES_CONVERSION; + if(m_pSignatureInfo) { + SetBSTR(pszCity, (m_pSignatureInfo->sigProdPlace.szCity ? m_pSignatureInfo->sigProdPlace.szCity : "")); + SetBSTR(pszState, (m_pSignatureInfo->sigProdPlace.szStateOrProvince ? m_pSignatureInfo->sigProdPlace.szStateOrProvince : "")); + SetBSTR(pszZipCode, (m_pSignatureInfo->sigProdPlace.szPostalCode ? m_pSignatureInfo->sigProdPlace.szPostalCode : "")); + SetBSTR(pszCountry, (m_pSignatureInfo->sigProdPlace.szCountryName ? m_pSignatureInfo->sigProdPlace.szCountryName : "")); + } + return S_OK; +} + +//////////////////////////////////////////////////////////////////// +// helpers +//////////////////////////////////////////////////////////////////// + +CComSignatureInfo::CComSignatureInfo() { + m_pSignatureInfo = NULL; + m_pSigDoc = NULL; +} + +CComSignatureInfo::~CComSignatureInfo() { + // actually deleted probably by lib + //if(m_pSignatureInfo) ::SignatureInfo_free(m_pSignatureInfo); +} + +SignatureInfo* CComSignatureInfo::getSignatureInfo() { + return m_pSignatureInfo; +} + +void CComSignatureInfo::shiftStructPointer(SignatureInfo* pNew) { + // actually deleted probably by lib + //if(m_pSignatureInfo) ::SignatureInfo_free(m_pSignatureInfo); + m_pSignatureInfo = pNew; +} + +void CComSignatureInfo::setSignedDoc(SignedDoc* pSigDoc) { + m_pSigDoc = pSigDoc; +} + diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.h libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.h --- libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,100 @@ +/* + +Wrap of DigiCoc library SignatureInfo structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComSignatureInfo.h : Declaration of the CComSignatureInfo + +#ifndef __COMSIGNATUREINFO_H_ +#define __COMSIGNATUREINFO_H_ + +#include "resource.h" // main symbols + +///////////////////////////////////////////////////////////////////////////// +// CComSignatureInfo + +#include "libdigidoc/DigiDocDefs.h" +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocObj.h" +#include "libdigidoc/DigiDocGen.h" +#include "libdigidoc/DigiDocVerify.h" +//#include "ComSignerRole.h" +#include "ComDocInfo.h" +#include "ComSignedDoc.h" +//#include "ComSignatureProdPlace.h" + +class ATL_NO_VTABLE CComSignatureInfo : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComSignatureInfo(); + ~CComSignatureInfo(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMSIGNATUREINFO) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComSignatureInfo) + COM_INTERFACE_ENTRY(IComSignatureInfo) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComSignatureInfo +public: + STDMETHOD(getSignatureProductionPlace)(/*[out]*/ BSTR* pszCity, /*[out]*/ BSTR* pszState, /*[out]*/ BSTR* pszZipCode, /*[out]*/ BSTR* pszCountry); + STDMETHOD(setSignatureProductionPlace)(/*[in]*/ BSTR szCity, /*[in]*/ BSTR szState, /*[in]*/ BSTR szZipCode, /*[in]*/ BSTR szCountry); + //STDMETHOD(getSigProdPlace)(/*[in]*/ IComSignatureProdPlace *pStoreTo); + STDMETHOD(verifySigCert)(/*[out, retval]*/ long* nRetResult); + STDMETHOD(calculateSigInfoSignature)(/*[in]*/ IComSignedDoc* pSigDoc,/*[in]*/ long nSigType, /*[in]*/ BSTR szKeyFile, /*[in]*/ BSTR szPasswd, /*[in]*/ BSTR szCertfile, /*[out, retval]*/ long* nRetErr); + STDMETHOD(getDocInfoWithId)(/*[in]*/ BSTR szId, /*[in]*/ IComDocInfo* pStoreTo); + STDMETHOD(getDocInfo)(/*[in]*/ long nIndex, /*[in]*/ IComDocInfo* pStoreTo); + STDMETHOD(getSignCertData)(/*[out, retval]*/ long* hRetCertHandle); + STDMETHOD(calculateSignedPropertiesDigest)(/*[in]*/ IComSignedDoc* pSigDoc,/*[out, retval]*/ long* nRetResult); + STDMETHOD(setSignatureCertFile)(/*[in]*/ BSTR szCertFile, /*[out, retval]*/ long* nRetResult); + STDMETHOD(createXMLSignedProperties)(/*[in]*/ IComSignedDoc* pSigDoc,/*[out, retval]*/ BSTR* pRetProperties); + //STDMETHOD(getSignerRoleObject)(/*[in]*/ IComSignerRole* pStoreTo); + STDMETHOD(getSignerRole)(/*[in]*/ VARIANT tfCertified, /*[in]*/ long nIndex, /*[out, retval]*/ BSTR* pRetRole); + STDMETHOD(countSignerRoles)(/*[in]*/ VARIANT tfCertified, /*[out, retval]*/ long* nRetCnt); + STDMETHOD(addSignerRole)(/*[in]*/ VARIANT tfCertified, /*[in]*/ BSTR szRole, /*[in]*/ VARIANT tfEncode); + STDMETHOD(calculateSignatureWithCSPEstID)(/*[in]*/ IComSignedDoc* pSigDoc,/*in*/long fByKeyContainer, /*[in]*/ BSTR szPin,/*[out, retval]*/ long* pRetErr); + STDMETHOD(calculateSignatureWithEstID)(/*[in]*/ IComSignedDoc* pSigDoc,/*[in]*/ long nSlot, /*[in]*/ BSTR szPasswd, /*[out, retval]*/ long* nRetResult); + STDMETHOD(addDocInfo)(/*[in]*/ BSTR szDocId, /*[in]*/ BSTR szDigType, /*[in]*/ VARIANT baDigest, /*[in]*/ long nDigLen, /*[in]*/ VARIANT baMimeDig, /*[in]*/ long nMimeDigLen, /*[in]*/ IComDocInfo* pStoreTo); + STDMETHOD(verifySigPropDigest)(/*[in]*/ IComSignedDoc* pSigDoc,/*[in]*/ BSTR szDataFile, /*[out, retval]*/ long* nRetResult); + STDMETHOD(get_nCertDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_nIssuerSerial)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_nSigLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szSigType)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szSigType)(/*[in]*/ BSTR newVal); + STDMETHOD(get_nSigPropDigestLen)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szTimeStamp)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(put_szTimeStamp)(/*[in]*/ BSTR newVal); + STDMETHOD(get_nDocs)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szId)(/*[out, retval]*/ BSTR *pVal); + + SignatureInfo* getSignatureInfo(); + + void shiftStructPointer(SignatureInfo* pNew); + void setSignedDoc(SignedDoc* pSigDoc); + +protected: + SignedDoc* m_pSigDoc; + SignatureInfo* m_pSignatureInfo; +}; + +#endif //__COMSIGNATUREINFO_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.rgs libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.rgs --- libdigidoc-2.7.0/libdigidoccom/ComSignatureInfo.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignatureInfo.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComSignatureInfo.1 = s 'ComSignatureInfo Class' + { + CLSID = s '{2A54186A-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComSignatureInfo = s 'ComSignatureInfo Class' + { + CLSID = s '{2A54186A-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComSignatureInfo.1' + } + NoRemove CLSID + { + ForceRemove {2A54186A-9A3E-11D6-AEE5-420005574701} = s 'ComSignatureInfo Class' + { + ProgID = s 'DigiDocLibCOM.ComSignatureInfo.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComSignatureInfo' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.cpp libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.cpp --- libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,522 @@ +// ComSignedDoc.cpp : Implementation of CComSignedDoc +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "libdigidoc/DigiDocGlobals.h" +#include "libdigidoc/DigiDocDebug.h" +#include "libdigidoc/DigiDocConvert.h" +#include "ComSignedDoc.h" +#include "Converters.h" +#include "ComCertArray.h" +///////////////////////////////////////////////////////////////////////////// +// CComSignedDoc + + +////////////////////////////////////////////////////////////// +// properties +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComSignedDoc::get_szFormat(BSTR *pVal) +{ + if(m_pSignedDoc) + Convert::out_retval_sz2BSTR(m_pSignedDoc->szFormat, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComSignedDoc::get_szFormatVer(BSTR *pVal) +{ + if(m_pSignedDoc) + Convert::out_retval_sz2BSTR(m_pSignedDoc->szFormatVer, pVal); + else + Convert::out_retval_sz2BSTR("", pVal); + return S_OK; +} + +STDMETHODIMP CComSignedDoc::get_nDataFiles(long *pVal) +{ + *pVal = 0; + if(m_pSignedDoc) + *pVal = m_pSignedDoc->nDataFiles; + return S_OK; +} + + +STDMETHODIMP CComSignedDoc::get_nSignatures(long *pVal) +{ + *pVal = 0; + if(m_pSignedDoc) + *pVal = m_pSignedDoc->nSignatures; + return S_OK; +} + + +STDMETHODIMP CComSignedDoc::get_nNotaries(long *pVal) +{ + *pVal = 0; + if(m_pSignedDoc) + *pVal = getCountOfNotaryInfos(m_pSignedDoc); + + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// methods +////////////////////////////////////////////////////////////// + +STDMETHODIMP CComSignedDoc::initialize(BSTR szFormat, BSTR szVersion) +{ + USES_CONVERSION; + SignedDoc* pNew = NULL; + + //initConfigStore(NULL); + ::SignedDoc_new(&pNew,GetBSTR(szFormat), GetBSTR(szVersion)); + if (pNew != (SignedDoc*)0) { + shiftStructPointer(pNew); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::createDataFile(BSTR szFileName, BSTR szContentType, BSTR szMimeType, long nSize, VARIANT baDigest, long nDigLen, BSTR szDigType, BSTR szCharset, IComDataFile *pStoreTo) +{ + SAFEARRAY* pArr; + byte HUGEP* pData; + USES_CONVERSION; + + if(!m_pSignedDoc) + return S_OK; + // analyze digest array + if ((V_VT(&baDigest) != VT_EMPTY) + && (V_VT(&baDigest) == VT_ARRAY)) { + pArr = V_ARRAY(&baDigest); + if ((SafeArrayGetDim(pArr) <= 0) + || (SafeArrayAccessData(pArr, (void HUGEP**)&pData) != S_OK)) + pData = NULL; + } else { + pData = NULL; + } + + + DataFile* pDataFile = NULL; + + char *p1 = GetBSTR(szFileName); + char *p2 = GetBSTR(szContentType); + char *p3 = GetBSTR(szMimeType); + char *p4 = GetBSTR(szDigType); + char *p5 = GetBSTR(szCharset); + + ::DataFile_new(&pDataFile, m_pSignedDoc, NULL, + p1, p2, p3, nSize, pData, nDigLen, p4, p5); + + if (pData) + SafeArrayUnaccessData(pArr); + + if (pDataFile != (DataFile*)0) { + CComDataFile* pComDataFile = (CComDataFile*)pStoreTo; + pComDataFile->shiftStructPointer(pDataFile); + pComDataFile->setSignedDoc(m_pSignedDoc); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getDataFile(long nIndex, IComDataFile* pStoreTo) +{ + DataFile* pDataFile = 0; + if(m_pSignedDoc) + pDataFile = ::getDataFile(m_pSignedDoc, nIndex); + if (pDataFile != (DataFile*)0) { + CComDataFile* pComDataFile = (CComDataFile*)pStoreTo; + pComDataFile->shiftStructPointer(pDataFile); + pComDataFile->setSignedDoc(m_pSignedDoc); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getDataFileWithId(BSTR szId, IComDataFile *pStoreTo) +{ + USES_CONVERSION; + DataFile* pDataFile = 0; + if(m_pSignedDoc) + pDataFile = ::getDataFileWithId(m_pSignedDoc, GetBSTR(szId)); + if (pDataFile != (DataFile*)0) { + CComDataFile* pComDataFile = (CComDataFile*)pStoreTo; + pComDataFile->shiftStructPointer(pDataFile); + pComDataFile->setSignedDoc(getSignedDoc()); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::calculateDataFileSizeAndDigest(BSTR szId, BSTR szFileName, long digType, long* nRetResult) +{ + USES_CONVERSION; + if(m_pSignedDoc) + (*nRetResult) = ::calculateDataFileSizeAndDigest(m_pSignedDoc, GetBSTR(szId), GetBSTR(szFileName), digType); + return S_OK; +} + + +////////////////////////////////////////////////////////// +// SignatureInfo methods +STDMETHODIMP CComSignedDoc::createSignatureInfo(IComSignatureInfo* pStoreTo) +{ + SignatureInfo* pSigInfo = NULL; + + if(m_pSignedDoc) + ::SignatureInfo_new(&pSigInfo, m_pSignedDoc, NULL); + if (pSigInfo != (SignatureInfo*)0) { + ((CComSignatureInfo*)pStoreTo)->shiftStructPointer(pSigInfo); + ((CComSignatureInfo*)pStoreTo)->setSignedDoc(m_pSignedDoc); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getSignature(long nIndex, IComSignatureInfo *pStoreTo) +{ + SignatureInfo* pSigInfo = 0; + if(m_pSignedDoc) + pSigInfo = ::getSignature(m_pSignedDoc, nIndex); + if (pSigInfo != (SignatureInfo*)0) { + ((CComSignatureInfo*)pStoreTo)->shiftStructPointer(pSigInfo); + ((CComSignatureInfo*)pStoreTo)->setSignedDoc(m_pSignedDoc); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getSignatureWithId(BSTR szId, IComSignatureInfo *pStoreTo) +{ + USES_CONVERSION; + SignatureInfo* pSigInfo = 0; + if(m_pSignedDoc) + pSigInfo = ::getSignatureWithId(m_pSignedDoc, GetBSTR(szId)); + if (pSigInfo != (SignatureInfo*)0) { + ((CComSignatureInfo*)pStoreTo)->shiftStructPointer(pSigInfo); + ((CComSignatureInfo*)pStoreTo)->setSignedDoc(m_pSignedDoc); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::addAllDocInfos(IComSignatureInfo *pSigInfo) +{ + if(m_pSignedDoc) + ::addAllDocInfos(m_pSignedDoc, ((CComSignatureInfo*)pSigInfo)->getSignatureInfo()); + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getNotaryInfo(long nIndex, IComNotaryInfo *pStoreTo) +{ + NotaryInfo* pNotInfo = 0; + if(m_pSignedDoc) + pNotInfo = ::getNotaryInfo(m_pSignedDoc, nIndex); + if (pNotInfo != (NotaryInfo*)0){ + ((CComNotaryInfo*)pStoreTo)->shiftStructPointer(pNotInfo); + SignatureInfo *pSigInfo = ddocGetSignatureForNotary(m_pSignedDoc, pNotInfo); + if(pSigInfo) + ((CComNotaryInfo*)pStoreTo)->setSignatureInfo(pSigInfo); + } + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getNotaryWithId(BSTR szId, IComNotaryInfo *pStoreTo) +{ + USES_CONVERSION; + NotaryInfo* pNotInfo = 0; + if(m_pSignedDoc) + pNotInfo = ::getNotaryWithId(m_pSignedDoc, GetBSTR(szId)); + if (pNotInfo != (NotaryInfo*)0){ + ((CComNotaryInfo*)pStoreTo)->shiftStructPointer(pNotInfo); + SignatureInfo *pSigInfo = ddocGetSignatureForNotary(m_pSignedDoc, pNotInfo); + if(pSigInfo) + ((CComNotaryInfo*)pStoreTo)->setSignatureInfo(pSigInfo); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::getNotaryWithSigId(BSTR szSigId, IComNotaryInfo *pStoreTo) +{ + USES_CONVERSION; + NotaryInfo* pNotInfo = 0; + if(m_pSignedDoc) + pNotInfo = ::getNotaryWithSigId(m_pSignedDoc, GetBSTR(szSigId)); + if (pNotInfo != (NotaryInfo*)0){ + ((CComNotaryInfo*)pStoreTo)->shiftStructPointer(pNotInfo); + SignatureInfo *pSigInfo = ddocGetSignatureForNotary(m_pSignedDoc, pNotInfo); + if(pSigInfo) + ((CComNotaryInfo*)pStoreTo)->setSignatureInfo(pSigInfo); + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::createNotaryInfo(IComSignatureInfo *pSigInfo, IComNotaryInfo *pStoreTo) +{ + NotaryInfo* pNotInfo = NULL; + if(m_pSignedDoc) + ::NotaryInfo_new(&pNotInfo, m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo()); + if (pNotInfo != (NotaryInfo*)0) { + ((CComNotaryInfo*)pStoreTo)->shiftStructPointer(pNotInfo); + ((CComNotaryInfo*)pStoreTo)->setSignatureInfo(((CComSignatureInfo*)pSigInfo)->getSignatureInfo()); + } + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::createNotaryInfoFromFile(IComSignatureInfo *pSigInfo, + BSTR szOcspRespFile, BSTR szNotaryCertFile, long *pRetError, IComNotaryInfo *pStoreTo) +{ + int errcode; + USES_CONVERSION; + NotaryInfo* pNotInfo = NULL; + if(m_pSignedDoc) + errcode = ::NotaryInfo_new_file(&pNotInfo, m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo(), GetBSTR(szOcspRespFile), + GetBSTR(szNotaryCertFile)); + *pRetError = errcode; + if (pNotInfo != (NotaryInfo*)0) { + ((CComNotaryInfo*)pStoreTo)->shiftStructPointer(pNotInfo); + ((CComNotaryInfo*)pStoreTo)->setSignatureInfo(((CComSignatureInfo*)pSigInfo)->getSignatureInfo()); + } + + return S_OK; +} + +////////////////////////////////////////////////////////// +// DigiDoc file handling methods +//AA 2004/05/20 - ei saanud salvestada faili, kui kataloogis olid täppidega tähed +STDMETHODIMP CComSignedDoc::createSignedDoc(BSTR szOutputFile, BSTR szOldFileName, long *pRetError) +{ + USES_CONVERSION; + char *p1 = 0; + + if(m_pSignedDoc) { + p1 = GetBSTR(szOutputFile); + ddocDebug(3, "CComSignedDoc::createSignedDoc", "Writing to: %s", p1); + *pRetError = ::createSignedDoc(m_pSignedDoc, + (::SysStringLen(szOldFileName) > 0) ? GetBSTR(szOldFileName) : NULL, p1); + ddocDebug(3, "CComSignedDoc::createSignedDoc", "Wrote"); + if(m_szDigiDocFile) { + ddocDebug(3, "CComSignedDoc::createSignedDoc", "Free: %s", m_szDigiDocFile); + + free(m_szDigiDocFile); + m_szDigiDocFile = 0; + } + ddocDebug(3, "CComSignedDoc::createSignedDoc", "Assign: %s", p1); + + m_szDigiDocFile = strdup(p1); + } + return S_OK; +} + + +STDMETHODIMP CComSignedDoc::readSignedDoc(BSTR szFileName, long checkFileDigest, long nMaxDFLen, long *pRetErr) +{ + SignedDoc* pSigDoc = 0; + char *p1 = 0; + + USES_CONVERSION; + p1 = GetBSTR(szFileName); + // TODO: read bdoc + *pRetErr = ddocSaxReadSignedDocFromFile(&pSigDoc, p1, checkFileDigest, nMaxDFLen); + if (pSigDoc != (SignedDoc*)0) { + if(m_szDigiDocFile) { + free(m_szDigiDocFile); + m_szDigiDocFile = 0; + } + m_szDigiDocFile = strdup(p1); + if(m_pSignedDoc) { + ::SignedDoc_free(m_pSignedDoc); + m_pSignedDoc = 0; + } + shiftStructPointer(pSigDoc); + } + return S_OK; +} + + +////////////////////////////////////////////////////////// +// verification methods +STDMETHODIMP CComSignedDoc::verifyDigest(IComSignatureInfo *pSigInfo, + IComDocInfo *pDocInfo, BSTR szDataFile, BSTR szFileName, long *nRetResult) +{ + USES_CONVERSION; + + if(m_pSignedDoc) + *nRetResult = ::verifySigDocDigest(m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo(), + ((CComDocInfo*)pDocInfo)->getDocInfo(), GetBSTR(szDataFile)); + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::verifyMimeDigest(IComSignatureInfo *pSigInfo, + IComDocInfo *pDocInfo, BSTR szFileName, long *nRetResult) +{ + USES_CONVERSION; + + if(m_pSignedDoc) + *nRetResult = ::verifySigDocMimeDigest(m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo(), + ((CComDocInfo*)pDocInfo)->getDocInfo(), GetBSTR(szFileName)); + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::verifySignatureInfo(IComSignatureInfo *pSigInfo, + BSTR szDataFile, long *nRetResult) +{ + USES_CONVERSION; + + if(!m_pSignedDoc) + return S_OK; + *nRetResult = ::Digi_verifySignatureInfo(m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo(), + GetBSTR(szDataFile)); + // VS: ver 2.3.12 - consolidated verification in verifySignature method + if(!(*nRetResult)) + *nRetResult = ::Digi_verifyNotaryInfoWithCertSearch(m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo()->pNotary); + return S_OK; +} + +STDMETHODIMP CComSignedDoc::verifySigDoc(BSTR szDataFile, long *nRetResult) +{ + unsigned int dfLen = ::SysStringLen(szDataFile); + USES_CONVERSION; + + if(!m_pSignedDoc) + return S_OK; + *nRetResult = ::Digi_verifySigDocWithCertSearch(m_pSignedDoc, + ((dfLen > 0) ? GetBSTR(szDataFile) : NULL)); + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::verifyNotaryInfo(IComNotaryInfo *pNotInfo, long *nRetResult) +{ + USES_CONVERSION; + if(!m_pSignedDoc) + return S_OK; + // VS: ver 2.3.12 - consolidated verification in verifySignature method + //*nRetResult = ::Digi_verifyNotaryInfoWithCertSearch(m_pSignedDoc, + // ((CComNotaryInfo*)pNotInfo)->getNotaryInfo()); + *nRetResult = ERR_OK; // ? + return S_OK; +} + + + +////////////////////////////////////////////////////////// +// OCSP methods + +////////////////////////////////////////////////////////// +// delete methods +STDMETHODIMP CComSignedDoc::deleteDataFile(BSTR szDataFileId, long *nRetCode) +{ + USES_CONVERSION; + + if(m_pSignedDoc) + *nRetCode = ::DataFile_delete(m_pSignedDoc, GetBSTR(szDataFileId)); + + return S_OK; +} + +STDMETHODIMP CComSignedDoc::deleteNotaryInfo(BSTR szNotInfoId, long *nRetCode) +{ + USES_CONVERSION; + NotaryInfo* pNotInfo = 0; + + if(m_pSignedDoc) { + pNotInfo = ::getNotaryWithId(m_pSignedDoc, GetBSTR(szNotInfoId)); + if(pNotInfo) { + SignatureInfo *pSigInfo = ::ddocGetSignatureForNotary(getSignedDoc(), pNotInfo); + if(pSigInfo) + *nRetCode = ::NotaryInfo_delete(pSigInfo); + } + } + return S_OK; +} + +STDMETHODIMP CComSignedDoc::deleteSignatureInfo(BSTR szSigInfoId, long *nRetCode) +{ + USES_CONVERSION; + if(m_pSignedDoc) { + *nRetCode = ::SignatureInfo_delete(getSignedDoc(), GetBSTR(szSigInfoId)); + if(m_szDigiDocFile) { + *nRetCode = ::createSignedDoc(m_pSignedDoc, m_szDigiDocFile, m_szDigiDocFile); + } + } + return S_OK; +} + + +////////////////////////////////////////////////////////////// +// helpers +////////////////////////////////////////////////////////////// + +CComSignedDoc::CComSignedDoc() { + + _CrtSetDbgFlag( + _CRTDBG_ALLOC_MEM_DF + | _CRTDBG_CHECK_CRT_DF + | _CRTDBG_CHECK_ALWAYS_DF + | _CRTDBG_DELAY_FREE_MEM_DF + | _CRTDBG_LEAK_CHECK_DF ); + + + m_pSignedDoc = NULL; + //m_pDds = NULL; + m_szDigiDocFile = NULL; +} + +CComSignedDoc::~CComSignedDoc() { + if(m_pSignedDoc) + SignedDoc_free(m_pSignedDoc); + // TODO: remove file? + if(m_szDigiDocFile) + free(m_szDigiDocFile); +} + + +SignedDoc* CComSignedDoc::getSignedDoc() { + return m_pSignedDoc; +} + + +void CComSignedDoc::shiftStructPointer(SignedDoc* pNew) { + if(m_pSignedDoc) + SignedDoc_free(m_pSignedDoc); + m_pSignedDoc = pNew; +} + + + +STDMETHODIMP CComSignedDoc::getConfirmation(IComSignatureInfo* pSigInfo, BSTR pkcs12File, BSTR password, BSTR notaryURL, BSTR proxyHost, BSTR proxyPort, LONG* nRetCode) +{ + USES_CONVERSION; + + if(m_pSignedDoc) + *nRetCode = ::Digi_getConfirmationWithCertSearch(m_pSignedDoc, + ((CComSignatureInfo*)pSigInfo)->getSignatureInfo(), + GetBSTR(pkcs12File), GetBSTR(password), GetBSTR(notaryURL), + GetBSTR(proxyHost), GetBSTR(proxyPort)); + + return S_OK; +} + + +STDMETHODIMP CComSignedDoc::getDataFileNameWidthId(BSTR szId, BSTR* pFileName) +{ + int iErr; + char *psBuf = 0; + int iBufLen = 0; + + if(m_pSignedDoc) { + iErr = ddocGetDataFileFilename(m_pSignedDoc, GetBSTR(szId), (void **)&psBuf, &iBufLen); + if(psBuf) + Convert::out_retval_sz2BSTR(psBuf, pFileName); + } + if(psBuf) + freeLibMem(psBuf); + return S_OK; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.h libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.h --- libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,105 @@ +/* + +Wrap of DigiCoc library SignedDoc structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComSignedDoc.h : Declaration of the CComSignedDoc + +#ifndef __COMSIGNEDDOC_H_ +#define __COMSIGNEDDOC_H_ + +#include "resource.h" // main symbols + +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocSAXParser.h" +#include "ComDataFile.h" +#include "ComSignatureInfo.h" +#include "ComNotaryInfo.h" +#include "ComDocInfo.h" +#include "ComCertSearchStore.h" +#include "ComCertSearch.h" + +///////////////////////////////////////////////////////////////////////////// +// CComSignedDoc + +class ATL_NO_VTABLE CComSignedDoc : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComSignedDoc(); + ~CComSignedDoc(); + +DECLARE_REGISTRY_RESOURCEID(IDR_COMSIGNEDDOC) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComSignedDoc) + COM_INTERFACE_ENTRY(IComSignedDoc) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComSignedDoc +public: + STDMETHOD(deleteSignatureInfo)(/*[in]*/ BSTR szSigInfoId, /*[out, retval]*/ long* nRetCode); + STDMETHOD(deleteNotaryInfo)(/*[in]*/ BSTR szNotInfoId, /*[out, retval]*/ long* nRetCode); + STDMETHOD(deleteDataFile)(/*[in]*/ BSTR szDataFileId, /*[out, retval]*/ long* nRetCode); + STDMETHOD(verifyNotaryInfo)(/*[in]*/ IComNotaryInfo* pNotInfo, /*[out, retval]*/ long* nRetResult); + STDMETHOD(verifySigDoc)(/*[in]*/ BSTR szDataFile, /*[out, retval]*/ long* nRetResult); + STDMETHOD(verifySignatureInfo)(/*[in]*/ IComSignatureInfo* pSigInfo, /*[in]*/ BSTR szDataFile, /*[out, retval]*/ long* nRetResult); + STDMETHOD(verifyMimeDigest)(/*[in]*/ IComSignatureInfo* pSigInfo, /*[in]*/ IComDocInfo* pDocInfo, /*[in]*/ BSTR szFileName, /*[out, retval]*/ long* nRetResult); + STDMETHOD(verifyDigest)(/*[in]*/ IComSignatureInfo* pSigInfo, /*[in]*/ IComDocInfo* pDocInfo, /*[in]*/ BSTR szDataFile, /*[in]*/ BSTR szFileName, /*[out, retval]*/ long* nRetResult); + STDMETHOD(readSignedDoc)(/*[in]*/ BSTR szFileName, /*[in]*/ long checkFileDigest, /*in*/ long nMaxDFLen, /*[out, retval]*/ long* pRetErr); + STDMETHOD(createSignedDoc)(/*[in]*/ BSTR szOutputFile, /*[in]*/ BSTR szOldFileName, /*[out, retval]*/ long* pRetError); + STDMETHOD(createNotaryInfoFromFile)(/*[in]*/ IComSignatureInfo* pSigInfo, /*[in]*/ BSTR szOcspRespFile, /*[in]*/ BSTR szNotaryCertFile, /*[out]*/ long* pRetError, /*[in]*/ IComNotaryInfo* pStoreTo); + STDMETHOD(createNotaryInfo)(/*[in]*/ IComSignatureInfo* pSigInfo, /*[in]*/ IComNotaryInfo* pStoreTo); + STDMETHOD(getNotaryWithSigId)(/*[in]*/ BSTR szSigId, /*[in]*/ IComNotaryInfo* pStoreTo); + STDMETHOD(getNotaryWithId)(/*[in]*/ BSTR szId, /*[in]*/ IComNotaryInfo* pStoreTo); + STDMETHOD(getNotaryInfo)(/*[in]*/ long nIndex, /*[in]*/ IComNotaryInfo* pStoreTo); + STDMETHOD(addAllDocInfos)(/*[in]*/ IComSignatureInfo* pSigInfo); + STDMETHOD(getSignatureWithId)(/*[in]*/ BSTR szId, /*[in]*/ IComSignatureInfo* pStoreTo); + STDMETHOD(getSignature)(/*[in]*/ long nIndex, /*[in]*/ IComSignatureInfo* pStoreTo); + STDMETHOD(createSignatureInfo)(/*[in]*/ IComSignatureInfo* pStoreTo); + STDMETHOD(calculateDataFileSizeAndDigest)(/*[in]*/ BSTR szId, /*[in]*/ BSTR szFileName, /*[in]*/ long digType, /*[out, retval]*/ long* nRetResult); + STDMETHOD(initialize)(/*[in]*/ BSTR szFormat, /*[in]*/ BSTR szVersion); + STDMETHOD(getDataFileWithId)(/*[in]*/ BSTR szId, /*[in]*/ IComDataFile* pStoreTo); + STDMETHOD(getDataFile)(/*[in]*/ long nIndex, /*[in, out]*/ IComDataFile* pStoreTo); + STDMETHOD(createDataFile)(/*[in]*/ BSTR szFileName, /*[in]*/ BSTR szContentType, /*[in]*/ BSTR szMimeType, /*[in]*/ long nSize, /*[in]*/ VARIANT baDigest, /*[in]*/ long nDigLen, /*[in]*/ BSTR szDigType, /*[in]*/ BSTR szCharset, /*[in]*/ IComDataFile* pStoreTo); + STDMETHOD(get_nNotaries)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_nSignatures)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_nDataFiles)(/*[out, retval]*/ long *pVal); + STDMETHOD(get_szFormatVer)(/*[out, retval]*/ BSTR *pVal); + STDMETHOD(get_szFormat)(/*[out, retval]*/ BSTR *pVal); + + + SignedDoc* getSignedDoc(); + void shiftStructPointer(SignedDoc* pNew); + + +protected: + SignedDoc* m_pSignedDoc; + //DDS *m_pDds; + char *m_szDigiDocFile; + long lDdsSesscode; +public: + STDMETHOD(getConfirmation)(IComSignatureInfo* pSigInfo, BSTR pkcs12File, BSTR password, BSTR notaryURL, BSTR proxyHost, BSTR proxyPort, LONG* nRetCode); + STDMETHOD(getDataFileNameWidthId)(BSTR szId, BSTR* pFileName); + +}; + +#endif //__COMSIGNEDDOC_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.rgs libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.rgs --- libdigidoc-2.7.0/libdigidoccom/ComSignedDoc.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComSignedDoc.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComSignedDoc.1 = s 'ComSignedDoc Class' + { + CLSID = s '{2A541872-9A3E-11D6-AEE5-420005574701}' + } + DigiDocLibCOM.ComSignedDoc = s 'ComSignedDoc Class' + { + CLSID = s '{2A541872-9A3E-11D6-AEE5-420005574701}' + CurVer = s 'DigiDocLibCOM.ComSignedDoc.1' + } + NoRemove CLSID + { + ForceRemove {2A541872-9A3E-11D6-AEE5-420005574701} = s 'ComSignedDoc Class' + { + ProgID = s 'DigiDocLibCOM.ComSignedDoc.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComSignedDoc' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComTimestamp.cpp libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.cpp --- libdigidoc-2.7.0/libdigidoccom/ComTimestamp.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,129 @@ +// ComTimestamp.cpp : Implementation of CComTimestamp +#include "stdafx.h" +#include "DigiDocLibCOM_h.h" +#include "ComTimestamp.h" +#include "ComSignedDoc.h" + +///////////////////////////////////////////////////////////////////////////// +// CComTimestamp + + +STDMETHODIMP CComTimestamp::get_year(long *pVal) +{ + *pVal = m_timestamp.year; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_year(long newVal) +{ + m_timestamp.year = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_month(long *pVal) +{ + *pVal = m_timestamp.mon; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_month(long newVal) +{ + m_timestamp.mon = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_day(long *pVal) +{ + *pVal = m_timestamp.day; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_day(long newVal) +{ + m_timestamp.day = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_hour(long *pVal) +{ + *pVal = m_timestamp.hour; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_hour(long newVal) +{ + m_timestamp.hour = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_minute(long *pVal) +{ + *pVal = m_timestamp.min; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_minute(long newVal) +{ + m_timestamp.min = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_second(long *pVal) +{ + *pVal = m_timestamp.sec; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_second(long newVal) +{ + m_timestamp.sec = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::get_tz(long *pVal) +{ + *pVal = m_timestamp.tz; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::put_tz(long newVal) +{ + m_timestamp.tz = newVal; + + return S_OK; +} + +STDMETHODIMP CComTimestamp::readFromString(IComSignedDoc* pUseFormatOf, BSTR szReadFrom) +{ + USES_CONVERSION; + ::convertStringToTimestamp( + ((CComSignedDoc*)pUseFormatOf)->getSignedDoc(), + GetBSTR(szReadFrom), getTimestamp()); + + return S_OK; +} + +STDMETHODIMP CComTimestamp::getString(IComSignedDoc* pUseFormatOf, BSTR *szRetString) +{ + char buf[40]; + ::convertTimestampToString( + ((CComSignedDoc*)pUseFormatOf)->getSignedDoc(), + getTimestamp(), buf, sizeof(buf)); + USES_CONVERSION; + SetBSTR(szRetString, buf); //*szRetString = ::SysAllocString(A2OLE(buf)); + + return S_OK; +} diff -Nru libdigidoc-2.7.0/libdigidoccom/ComTimestamp.h libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.h --- libdigidoc-2.7.0/libdigidoccom/ComTimestamp.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,77 @@ +/* + +Wrap of DigiCoc library Timestamp structure to provide COM-interface +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ +// ComTimestamp.h : Declaration of the CComTimestamp + +#ifndef __COMTIMESTAMP_H_ +#define __COMTIMESTAMP_H_ + +#include "resource.h" // main symbols +#include "libdigidoc/DigiDocDefs.h" +#include "libdigidoc/DigiDocLib.h" +#include "libdigidoc/DigiDocObj.h" +#include "libdigidoc/DigiDocGen.h" + +///////////////////////////////////////////////////////////////////////////// +// CComTimestamp +class ATL_NO_VTABLE CComTimestamp : + public CComObjectRootEx, + public CComCoClass, + public IDispatchImpl +{ +public: + CComTimestamp() + { + } + +DECLARE_REGISTRY_RESOURCEID(IDR_COMTIMESTAMP) + +DECLARE_PROTECT_FINAL_CONSTRUCT() + +BEGIN_COM_MAP(CComTimestamp) + COM_INTERFACE_ENTRY(IComTimestamp) + COM_INTERFACE_ENTRY(IDispatch) +END_COM_MAP() + +// IComTimestamp +public: + STDMETHOD(getString)(/*[in]*/ IComSignedDoc* pUseFormatOf, /*[out, retval]*/ BSTR* szRetString); + STDMETHOD(readFromString)(/*[in]*/ IComSignedDoc* pUseFormatOf, /*[in]*/ BSTR szReadFrom); + STDMETHOD(get_tz)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_tz)(/*[in]*/ long newVal); + STDMETHOD(get_second)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_second)(/*[in]*/ long newVal); + STDMETHOD(get_minute)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_minute)(/*[in]*/ long newVal); + STDMETHOD(get_hour)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_hour)(/*[in]*/ long newVal); + STDMETHOD(get_day)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_day)(/*[in]*/ long newVal); + STDMETHOD(get_month)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_month)(/*[in]*/ long newVal); + STDMETHOD(get_year)(/*[out, retval]*/ long *pVal); + STDMETHOD(put_year)(/*[in]*/ long newVal); + + Timestamp* getTimestamp() { return &m_timestamp; } + +protected: + Timestamp m_timestamp; +}; + +#endif //__COMTIMESTAMP_H_ diff -Nru libdigidoc-2.7.0/libdigidoccom/ComTimestamp.rgs libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.rgs --- libdigidoc-2.7.0/libdigidoccom/ComTimestamp.rgs 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/ComTimestamp.rgs 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,25 @@ +HKCR +{ + DigiDocLibCOM.ComTimestamp.1 = s 'ComTimestamp Class' + { + CLSID = s '{FFA6FD8E-BB6F-11D6-AEF3-420005574701}' + } + DigiDocLibCOM.ComTimestamp = s 'ComTimestamp Class' + { + CLSID = s '{FFA6FD8E-BB6F-11D6-AEF3-420005574701}' + CurVer = s 'DigiDocLibCOM.ComTimestamp.1' + } + NoRemove CLSID + { + ForceRemove {FFA6FD8E-BB6F-11D6-AEF3-420005574701} = s 'ComTimestamp Class' + { + ProgID = s 'DigiDocLibCOM.ComTimestamp.1' + VersionIndependentProgID = s 'DigiDocLibCOM.ComTimestamp' + InprocServer32 = s '%MODULE%' + { + val ThreadingModel = s 'Apartment' + } + 'TypeLib' = s '{2A541855-9A3E-11D6-AEE5-420005574701}' + } + } +} diff -Nru libdigidoc-2.7.0/libdigidoccom/Converters.cpp libdigidoc-3.7.0.875/libdigidoccom/Converters.cpp --- libdigidoc-2.7.0/libdigidoccom/Converters.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/Converters.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,167 @@ + +#include "Converters.h" +#include "ComDef.h" + + +void SetBSTR(BSTR *lpBstr, char *psValue) +{ + USES_CONVERSION; + if (psValue && (int)psValue != 0xdddddddd && strlen(psValue)) + *lpBstr = SysAllocString(A2OLE(psValue)); + else + *lpBstr = SysAllocString(A2OLE("")); +} + +/* +static char *psTempGet[32]; +static int iGetNo = 0; + +char *GetBSTR(BSTR lpBstr) +{ +char *psRes = NULL; +USES_CONVERSION; +if (iGetNo < 30) + ++iGetNo; +else + iGetNo = 0; +if (::SysStringLen(lpBstr) > 0) + psTempGet[iGetNo] = OLE2A(lpBstr); +else + psTempGet[iGetNo] = NULL; +return(psTempGet[iGetNo]); +} +*/ + +static char sTempGet[32][1024]; +static int iGetNo = 0; +char *GetBSTR(BSTR lpBstr) +{ +char *psTemp = &sTempGet[iGetNo][0]; +char *psRes = NULL; +_bstr_t bsTemp(lpBstr); + +if (bsTemp.length() > 0) + { + USES_CONVERSION; + strcpy(psTemp,OLE2A(lpBstr)); + psRes = (char *)psTemp; + + } +if (iGetNo < 30) + ++iGetNo; +else + iGetNo = 0; +return(psRes); +} + + + +void Convert::copyBSTR2sz_noAlloc(BSTR copyFrom, char* copyTo) { + USES_CONVERSION; + strcpy(copyTo, GetBSTR(copyFrom)); +} + +void Convert::copysz2BSTR_withAlloc(char* copyFrom, BSTR* copyTo) { + USES_CONVERSION; + + SetBSTR(copyTo, copyFrom ? copyFrom : ""); //*copyTo = ::SysAllocString(A2OLE(copyFrom)); +} + + +void Convert::out_retval_sz2BSTR(char* copyFrom, BSTR* copyTo) { + USES_CONVERSION; + if (copyFrom == (char*)0) { + SetBSTR(copyTo, ""); //*copyTo = ::SysAllocString(A2OLE("")); + } else { + SetBSTR(copyTo, copyFrom); //*copyTo = ::SysAllocString(A2OLE(copyFrom)); + } +} + + +void Convert::in_BSTR2sz(BSTR copyFrom, char** copyTo) { + unsigned int newLen = SysStringLen(copyFrom); + + if (*copyTo != (char*)0) + delete *copyTo; + + if (newLen > 0) { + USES_CONVERSION; + *copyTo = new char[newLen + 1]; + strcpy(*copyTo, GetBSTR(copyFrom)); + } +} + + + +void Convert::out_retval_ac2VARIANT(const char* pCopyFrom, int copyLength, VARIANT* pStoreTo) { + if (pCopyFrom == (const char*)0) { + V_VT(pStoreTo)= VT_EMPTY; + } else { + SAFEARRAY* pArr = SafeArrayCreateVector(VT_UI1, 0, copyLength); + + V_ARRAY(pStoreTo) = pArr; + V_VT(pStoreTo) = (VT_ARRAY | VT_UI1); + + byte HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + memcpy(pData, pCopyFrom, copyLength); + SafeArrayUnaccessData(pArr); + } + +} + +void Convert::in_VARIANT2ac(VARIANT pCopyFrom, char** copyTo, int* setLength) { + if (*copyTo != (char*)0) + delete *copyTo; + + SAFEARRAY* pArr = V_ARRAY(&pCopyFrom); + byte HUGEP* pData; + + *setLength = pArr->rgsabound->cElements; + if (*setLength > 0) { + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + *copyTo = new char[*setLength]; + memcpy(*copyTo, pData, *setLength); + SafeArrayUnaccessData(pArr); + } +} + +void Convert::in_VARIANT2szarr(VARIANT pCopyFrom, char**& copyTo, int* setLength) { + if (copyTo != (char**)0) { + delete [] copyTo; + } + + SAFEARRAY* pArr = V_ARRAY(&pCopyFrom); + BSTR HUGEP* pData; + + *setLength = pArr->rgsabound->cElements; + if (*setLength > 0) { + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + copyTo = new char*[*setLength]; + for(int i = 0; i < *setLength; i++) { + copyTo[i] = new char[SysStringLen(pData[i]) + 1]; + copyBSTR2sz_noAlloc(pData[i], copyTo[i]); + } + SafeArrayUnaccessData(pArr); + } +} + + +void Convert::out_szarr2VARIANT(char** copyFrom, VARIANT* pCopyTo, int nLength) { + + SAFEARRAY* pArr = SafeArrayCreateVector(VT_BSTR, 0, nLength); + + V_ARRAY(pCopyTo) = pArr; + V_VT(pCopyTo) = (VT_ARRAY | VT_BSTR); + + BSTR HUGEP* pData; + SafeArrayAccessData(pArr, (void HUGEP**)&pData); + + USES_CONVERSION; + for(int i = 0; i < nLength; i++) { + copysz2BSTR_withAlloc(copyFrom[i], &(pData[i])); + } + + SafeArrayUnaccessData(pArr); +} diff -Nru libdigidoc-2.7.0/libdigidoccom/Converters.h libdigidoc-3.7.0.875/libdigidoccom/Converters.h --- libdigidoc-2.7.0/libdigidoccom/Converters.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/Converters.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,78 @@ +/* + +Provides some useful converters between C and COM data types. +Copyright (C) AS Sertifitseerimiskeskus + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +GNU Lesser General Public Licence is available at +http://www.gnu.org/copyleft/lesser.html + +*/ + +#ifndef __CONVERTERS_H__ +#define __CONVERTERS_H__ + +#include "stdafx.h" + +void SetBSTR(BSTR *lpBstr, char *psValue); +char *GetBSTR(BSTR lpBstr); + + +class Convert { +public: + static void copyBSTR2sz_noAlloc(BSTR copyFrom, char* copyTo); + static void copysz2BSTR_withAlloc(char* copyFrom, BSTR* copyTo); + + static void out_retval_sz2BSTR(char* copyFrom, BSTR* copyTo); + + static void in_BSTR2sz(BSTR copyFrom, char** copyTo); + + static void out_retval_ac2VARIANT(const char* pCopyFrom, int copyLength, VARIANT* pStoreTo); + // if copyTo is not NULL then performs delete. + static void in_VARIANT2ac(VARIANT pCopyFrom, char** copyTo, int* setLength); + + // if copyTo is not NULL then performs delete. + static void in_VARIANT2szarr(VARIANT pCopyFrom, char**& copyTo, int* setLength); + + static void out_szarr2VARIANT(char** copyFrom, VARIANT* pCopyTo, int nLength); + + __inline static void ToHex(DigiDocMemBuf* p) + { + int x = p->nLen; + + ddocMemSetLength(p, x * 2); + + char* w = "0123456789ABCDEF"; + char* n = (char*)p->pMem; + + while (x-- > 0) + { + char u = n[x]; + + + + n[ (x * 2) + 1 ] = (char) w[u & 0xF]; + n[ (x * 2) + 0 ] = (char) w[(u >> 4) & 0xF]; + + + } + } +}; + + +// Defines for much used code: +// as OLE2A, but in case string is NULL or has zero length, gives 'NULL' +//#define OLE2A_NULL4EMPTY_STR(str) ((str && (::SysStringLen(str) > 0)) ? OLE2A(str) : NULL) + + + +#endif // __CONVERTERS_H__ diff -Nru libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.cpp libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.cpp --- libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,108 @@ +// DigiDocLibCOM.cpp : Implementation of DLL Exports. + + +// Note: Proxy/Stub Information +// To build a separate proxy/stub DLL, +// run nmake -f DigiDocLibCOMps.mk in the project directory. + +#include "stdafx.h" +#include "resource.h" +#include +#include "DigiDocLibCOM_h.h" +//#include "DigiDocLibCOM_i.c" +#include +#include "ComDigiDocLib.h" +#include "ComDocInfo.h" +#include "ComSignatureInfo.h" +#include "ComDataFile.h" +#include "ComNotaryInfo.h" +#include "ComSignedDoc.h" +#include "ComErrorInfo.h" +#include "ComTimestamp.h" +#include "ComCertSearchStore.h" +#include "ComCertSearch.h" +#include "ComCertificate.h" +#include "ComCertArray.h" +#include "ComEncryptedData.h" +#include "ComEncryptedKey.h" +#include "ComEncryptionProperty.h" +#include "ComPolicyIdentifierArray.h" + +CComModule _Module; + +BEGIN_OBJECT_MAP(ObjectMap) +OBJECT_ENTRY(CLSID_ComDigiDocLib, CComDigiDocLib) +OBJECT_ENTRY(CLSID_ComDocInfo, CComDocInfo) +OBJECT_ENTRY(CLSID_ComSignatureInfo, CComSignatureInfo) +OBJECT_ENTRY(CLSID_ComDataFile, CComDataFile) +OBJECT_ENTRY(CLSID_ComNotaryInfo, CComNotaryInfo) +OBJECT_ENTRY(CLSID_ComSignedDoc, CComSignedDoc) +OBJECT_ENTRY(CLSID_ComErrorInfo, CComErrorInfo) +OBJECT_ENTRY(CLSID_ComTimestamp, CComTimestamp) +OBJECT_ENTRY(CLSID_ComCertSearchStore, CComCertSearchStore) +OBJECT_ENTRY(CLSID_ComCertSearch, CComCertSearch) +OBJECT_ENTRY(CLSID_ComCertificate, CComCertificate) +OBJECT_ENTRY(CLSID_ComCertArray, CComCertArray) +OBJECT_ENTRY(CLSID_ComEncryptedData, CComEncryptedData) +OBJECT_ENTRY(CLSID_ComEncryptionProperty, CComEncryptionProperty) +OBJECT_ENTRY(CLSID_ComEncryptedKey, CComEncryptedKey) +OBJECT_ENTRY(CLSID_ComPolicyIdentifierArray, CComPolicyIdentifierArray) +END_OBJECT_MAP() + +///////////////////////////////////////////////////////////////////////////// +// DLL Entry Point + +extern "C" +BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/) +{ + if (dwReason == DLL_PROCESS_ATTACH) + { + _Module.Init(ObjectMap, hInstance, &LIBID_DIGIDOCLIBCOMLib); + DisableThreadLibraryCalls(hInstance); + ::initDigiDocLib(); + // init also from config file + ::initConfigStore(NULL); + } + else if (dwReason == DLL_PROCESS_DETACH) { + ::finalizeDigiDocLib(); + _Module.Term(); + } + return TRUE; // ok +} + +///////////////////////////////////////////////////////////////////////////// +// Used to determine whether the DLL can be unloaded by OLE + +#ifdef VS_BUILD +STDAPI DllCanUnloadNow(void) +{ + return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// Returns a class factory to create an object of the requested type + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + return _Module.GetClassObject(rclsid, riid, ppv); +} +#endif + +///////////////////////////////////////////////////////////////////////////// +// DllRegisterServer - Adds entries to the system registry + +STDAPI DllRegisterServer(void) +{ + // registers object, typelib and all interfaces in typelib + return _Module.RegisterServer(TRUE); +} + +///////////////////////////////////////////////////////////////////////////// +// DllUnregisterServer - Removes entries from the system registry + +STDAPI DllUnregisterServer(void) +{ + return _Module.UnregisterServer(TRUE); +} + + diff -Nru libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.def libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.def --- libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.def 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.def 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,10 @@ +; DigiDocLibCOM.def : Declares the module parameters. + +LIBRARY "DigiDocLibCOM.DLL" + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + diff -Nru libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.idl libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.idl --- libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.idl 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.idl 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,902 @@ +import "oaidl.idl"; +//import "ocidl.idl"; + + interface IComTimestamp; + interface IComCertArray; + interface IComSignedDoc; + interface IComCertSearchStore; + interface IComCertSearch; + interface IComCertificate; + interface IComEncryptedData; + + + [ + object, + uuid(2A54186D-9A3E-11D6-AEE5-420005574701), + + helpstring("IComDataFile Interface"), + pointer_default(unique) + ] + interface IComDataFile : IDispatch + { + [propget, helpstring("property szId")] HRESULT szId([out, retval] BSTR *pVal); + [propget, helpstring("property szFileName")] HRESULT szFileName([out, retval] BSTR *pVal); + [propget, helpstring("property szMimeType")] HRESULT szMimeType([out, retval] BSTR *pVal); + [propget, helpstring("property szContentType")] HRESULT szContentType([out, retval] BSTR *pVal); + [propget, helpstring("property nSize")] HRESULT nSize([out, retval] long *pVal); + [propget, helpstring("property szDigestType")] HRESULT szDigestType([out, retval] BSTR *pVal); + [propget, helpstring("property baDigest")] HRESULT baDigest([out, retval] VARIANT *pVal); + [propget, helpstring("property nDigestLen")] HRESULT nDigestLen([out, retval] long *pVal); + [propget, helpstring("property nAttributes")] HRESULT nAttributes([out, retval] long *pVal); + [propget, helpstring("property szaAttNames")] HRESULT szaAttNames([out, retval] VARIANT *pVal); + [propget, helpstring("property szaAttValues")] HRESULT szaAttValues([out, retval] VARIANT *pVal); + [helpstring("method addAttribute")] HRESULT addAttribute([in] BSTR szAttrName, [in] BSTR szAttrValue); + [helpstring("method getAttributeName")] HRESULT getAttributeName([in] long nIndex, [out, retval] BSTR* szRetName); + [helpstring("method getAttributeValue")] HRESULT getAttributeValue([in] long nIndex, [out, retval] BSTR* szRetValue); + }; + [ + object, + uuid(2A541863-9A3E-11D6-AEE5-420005574701), + + helpstring("IComDocInfo Interface"), + pointer_default(unique) + ] + interface IComDocInfo : IDispatch + { + [propget, helpstring("property szDocId")] HRESULT szDocId([out, retval] BSTR *pVal); + [propput, helpstring("property szDocId")] HRESULT szDocId([in] BSTR newVal); + [propget, helpstring("property szDigestType")] HRESULT szDigestType([out, retval] BSTR *pVal); + [propput, helpstring("property szDigestType")] HRESULT szDigestType([in] BSTR newVal); + [propget, helpstring("property baDigest")] HRESULT baDigest([out, retval] VARIANT *pVal); + [propput, helpstring("property baDigest")] HRESULT baDigest([in] VARIANT newVal); + [propget, helpstring("property baMimeDigest")] HRESULT baMimeDigest([out, retval] VARIANT *pVal); + [propput, helpstring("property baMimeDigest")] HRESULT baMimeDigest([in] VARIANT newVal); + [propget, helpstring("property nDigestLen")] HRESULT nDigestLen([out, retval] long *pVal); + [propget, helpstring("property nMimeDigestLen")] HRESULT nMimeDigestLen([out, retval] long *pVal); + }; + + [ + object, + uuid(2A541869-9A3E-11D6-AEE5-420005574701), + + helpstring("IComSignatureInfo Interface"), + pointer_default(unique) + ] + interface IComSignatureInfo : IDispatch + { + + [propget, helpstring("property szId")] HRESULT szId([out, retval] BSTR *pVal); + [propget, helpstring("property nDocs")] HRESULT nDocs([out, retval] long *pVal); + [propget, helpstring("property szTimeStamp")] HRESULT szTimeStamp([out, retval] BSTR *pVal); + [propput, helpstring("property szTimeStamp")] HRESULT szTimeStamp([in] BSTR newVal); + [propget, helpstring("property nSigPropDigestLen")] HRESULT nSigPropDigestLen([out, retval] long *pVal); + [propget, helpstring("property szSigType")] HRESULT szSigType([out, retval] BSTR *pVal); + [propput, helpstring("property szSigType")] HRESULT szSigType([in] BSTR newVal); + [propget, helpstring("property nSigLen")] HRESULT nSigLen([out, retval] long *pVal); + [propget, helpstring("property nIssuerSerial")] HRESULT nIssuerSerial([out, retval] BSTR *pVal); + [propget, helpstring("property nCertDigestLen")] HRESULT nCertDigestLen([out, retval] long *pVal); + [helpstring("method verifySigPropDigest")] HRESULT verifySigPropDigest([in] IComSignedDoc* pSigDoc,[in] BSTR szDataFile, [out, retval] long* nRetResult); + [helpstring("method addDocInfo")] HRESULT addDocInfo([in] BSTR szDocId, [in] BSTR szDigType, [in] VARIANT baDigest, [in] long nDigLen, [in] VARIANT baMimeDig, [in] long nMimeDigLen, [in] IComDocInfo* pStoreTo); + [helpstring("method calculateSignatureWithEstID")] HRESULT calculateSignatureWithEstID([in] IComSignedDoc* pSigDoc,[in] long nSlot, [in] BSTR szPasswd, [out, retval] long* nRetResult); + [helpstring("method calculateSignatureWithCSPEstID")] HRESULT calculateSignatureWithCSPEstID([in] IComSignedDoc* pSigDoc,[in] long fByKeyContainer, [in] BSTR szPin, [out, retval] long* pRetErr); + [helpstring("method addSignerRole")] HRESULT addSignerRole([in] VARIANT tfCertified, [in] BSTR szRole, [in] VARIANT tfEncode); + [helpstring("method countSignerRoles")] HRESULT countSignerRoles([in] VARIANT tfCertified, [out, retval] long* nRetCnt); + //[helpstring("method getSignerRoleObject")] HRESULT getSignerRoleObject([in] IComSignerRole* pStoreTo); + [helpstring("method getSignerRole")] HRESULT getSignerRole([in] VARIANT tfCertified, [in] long nIndex, [out, retval] BSTR* pRetRole); + [helpstring("method createXMLSignedProperties")] HRESULT createXMLSignedProperties([in] IComSignedDoc* pSigDoc,[out, retval] BSTR* pRetProperties); + [helpstring("method setSignatureCertFile")] HRESULT setSignatureCertFile([in] BSTR szCertFile, [out, retval] long* nRetResult); + [helpstring("method calculateSignedPropertiesDigest")] HRESULT calculateSignedPropertiesDigest([in] IComSignedDoc* pSigDoc,[out, retval] long* nRetResult); + [helpstring("method getSignCertData")] HRESULT getSignCertData([out, retval] long* hRetCertHandle); + [helpstring("method getDocInfo")] HRESULT getDocInfo([in] long nIndex, [in] IComDocInfo* pStoreTo); + [helpstring("method getDocInfoWithId")] HRESULT getDocInfoWithId([in] BSTR szId, [in] IComDocInfo* pStoreTo); + [helpstring("method calculateSigInfoSignature")] HRESULT calculateSigInfoSignature([in] IComSignedDoc* pSigDoc,[in] long nSigType, [in] BSTR szKeyFile, [in] BSTR szPasswd, [in] BSTR szCertfile, [out, retval] long* nRetErr); + [helpstring("method verifySigCert")] HRESULT verifySigCert([out, retval] long* nRetResult); + [helpstring("Sets the production place attributes for this signature. Pass empty strings for unknown values")] HRESULT setSignatureProductionPlace([in] BSTR szCity, [in] BSTR szState, [in] BSTR szZipCode, [in] BSTR szCountry); + [helpstring("Returns signature production place attributes into provided strings. For undefined attributes, empty strings are returned.")] HRESULT getSignatureProductionPlace([out] BSTR* pszCity, [out] BSTR* pszState, [out] BSTR* pszZipCode, [out] BSTR* pszCountry); + + }; + [ + object, + uuid(2A54186F-9A3E-11D6-AEE5-420005574701), + + helpstring("IComNotaryInfo Interface"), + pointer_default(unique) + ] + interface IComNotaryInfo : IDispatch + { + [propget, helpstring("property szId")] HRESULT szId([out, retval] BSTR *pVal); + [propput, helpstring("property szId")] HRESULT szId([in] BSTR newVal); + [propget, helpstring("property szSigId")] HRESULT szSigId([out, retval] BSTR *pVal); + [propput, helpstring("property szSigId")] HRESULT szSigId([in] BSTR newVal); + [propget, helpstring("property szNotType")] HRESULT szNotType([out, retval] BSTR *pVal); + [propput, helpstring("property szNotType")] HRESULT szNotType([in] BSTR newVal); + [propget, helpstring("property timeProduced")] HRESULT timeProduced([out, retval] BSTR *pVal); + [propput, helpstring("property timeProduced")] HRESULT timeProduced([in] BSTR newVal); + [propget, helpstring("property szRespIdType")] HRESULT szRespIdType([out, retval] BSTR *pVal); + [propput, helpstring("property szRespIdType")] HRESULT szRespIdType([in] BSTR newVal); + [propget, helpstring("property baRespId")] HRESULT baRespId([out, retval] VARIANT *pVal); + [propget, helpstring("property nRespIdLen")] HRESULT nRespIdLen([out, retval] long *pVal); + [propget, helpstring("property thisUpdate")] HRESULT thisUpdate([out, retval] BSTR *pVal); + [propput, helpstring("property thisUpdate")] HRESULT thisUpdate([in] BSTR newVal); + [propget, helpstring("property nextUpdate")] HRESULT nextUpdate([out, retval] BSTR *pVal); + [propput, helpstring("property nextUpdate")] HRESULT nextUpdate([in] BSTR newVal); + [propget, helpstring("property nCertNr")] HRESULT nCertNr([out, retval] long *pVal); + [propput, helpstring("property nCertNr")] HRESULT nCertNr([in] long newVal); + [propget, helpstring("property szDigestType")] HRESULT szDigestType([out, retval] BSTR *pVal); + [propput, helpstring("property szDigestType")] HRESULT szDigestType([in] BSTR newVal); + [propget, helpstring("property szSigType")] HRESULT szSigType([out, retval] BSTR *pVal); + [propput, helpstring("property szSigType")] HRESULT szSigType([in] BSTR newVal); + [propget, helpstring("property baSigValue")] HRESULT baSigValue([out, retval] VARIANT *pVal); + [propget, helpstring("property nSigLen")] HRESULT nSigLen([out, retval] long *pVal); + [propget, helpstring("property nIssuerSerial")] HRESULT nIssuerSerial([out, retval] BSTR *pVal); + //[propput, helpstring("property nIssuerSerial")] HRESULT nIssuerSerial([in] long newVal); + [propget, helpstring("property baCertDigest")] HRESULT baCertDigest([out, retval] VARIANT *pVal); + [propget, helpstring("property nCertDigestLen")] HRESULT nCertDigestLen([out, retval] long *pVal); + [helpstring("method verifyNotCert")] HRESULT verifyNotCert([out, retval] long* nRetResult); + [helpstring("method getNotCertData")] HRESULT getNotCertData([out, retval] long* hRetCertHandle); + [propget, helpstring("property baOcspDigest")] HRESULT baOcspDigest([out, retval] VARIANT *pVal); + [propget, helpstring("property nOcspDigestLen")] HRESULT nOcspDigestLen([out, retval] long* pVal); + [helpstring("method verifyNotaryDigest")] HRESULT verifyNotaryDigest([in] IComSignedDoc* pUseFormatOf, [out, retval] long* nRetCode); + }; + [ + object, + uuid(2A541871-9A3E-11D6-AEE5-420005574701), + + helpstring("IComSignedDoc Interface"), + pointer_default(unique) + ] + interface IComSignedDoc : IDispatch + { + [propget, helpstring("property szFormat")] HRESULT szFormat([out, retval] BSTR *pVal); + [propget, helpstring("property szFormatVer")] HRESULT szFormatVer([out, retval] BSTR *pVal); + [propget, helpstring("property nDataFiles")] HRESULT nDataFiles([out, retval] long *pVal); + [propget, helpstring("property nSignatures")] HRESULT nSignatures([out, retval] long *pVal); + [propget, helpstring("property nNotaries")] HRESULT nNotaries([out, retval] long *pVal); + [helpstring("method createDataFile")] HRESULT createDataFile([in] BSTR szFileName, [in] BSTR szContentType, [in] BSTR szMimeType, [in] long nSize, [in] VARIANT baDigest, [in] long nDigLen, [in] BSTR szDigType, [in] BSTR szCharset, [in] IComDataFile* pStoreTo); + [helpstring("method getDataFile")] HRESULT getDataFile([in] long nIndex, [in] IComDataFile* pStoreTo); + [helpstring("method getDataFileWithId")] HRESULT getDataFileWithId([in] BSTR szId, [in] IComDataFile* pStoreTo); + [helpstring("method initialize")] HRESULT initialize([in] BSTR szFormat, [in] BSTR szVersion); + [helpstring("method calculateDataFileSizeAndDigest")] HRESULT calculateDataFileSizeAndDigest([in] BSTR szId, [in] BSTR szFileName, [in] long digType, [out, retval] long* nRetResult); + [helpstring("method createSignatureInfo")] HRESULT createSignatureInfo([in] IComSignatureInfo* pStoreTo); + [helpstring("method getSignature")] HRESULT getSignature([in] long nIndex, [in] IComSignatureInfo* pStoreTo); + [helpstring("method getSignatureWithId")] HRESULT getSignatureWithId([in] BSTR szId, [in] IComSignatureInfo* pStoreTo); + [helpstring("method addAllDocInfos")] HRESULT addAllDocInfos([in] IComSignatureInfo* pSigInfo); + [helpstring("method getNotaryInfo")] HRESULT getNotaryInfo([in] long nIndex, [in] IComNotaryInfo* pStoreTo); + [helpstring("method getNotaryWithId")] HRESULT getNotaryWithId([in] BSTR szId, [in] IComNotaryInfo* pStoreTo); + [helpstring("method getNotaryWithSigId")] HRESULT getNotaryWithSigId([in] BSTR szSigId, [in] IComNotaryInfo* pStoreTo); + [helpstring("method createNotaryInfo")] HRESULT createNotaryInfo([in] IComSignatureInfo* pSigInfo, [in] IComNotaryInfo* pStoreTo); + [helpstring("method createNotaryInfoFromFile")] HRESULT createNotaryInfoFromFile([in] IComSignatureInfo* pSigInfo, [in] BSTR szOcspRespFile, [in] BSTR szNotaryCertFile, [out] long* pRetError, [in] IComNotaryInfo* pStoreTo); + [helpstring("method createSignedDoc")] HRESULT createSignedDoc([in] BSTR szOutputFile, [in] BSTR szOldFileName, [out, retval] long* pRetError); + [helpstring("method readSignedDoc")] HRESULT readSignedDoc([in] BSTR szFileName, [in] long checkFileDigest, [in] long nMaxDFLen, [out, retval] long* pRetErr); + [helpstring("method verifyDigest")] HRESULT verifyDigest([in] IComSignatureInfo* pSigInfo, [in] IComDocInfo* pDocInfo, [in] BSTR szDataFile,[in] BSTR szFileName, [out, retval] long* nRetResult); + [helpstring("method verifyMimeDigest")] HRESULT verifyMimeDigest([in] IComSignatureInfo* pSigInfo, [in] IComDocInfo* pDocInfo, [in] BSTR szFileName, [out, retval] long* nRetResult); + [helpstring("method verifySignatureInfo")] HRESULT verifySignatureInfo([in] IComSignatureInfo* pSigInfo, BSTR szDataFile, [out, retval] long* nRetResult); + [helpstring("method verifySigDoc")] HRESULT verifySigDoc([in] BSTR szDataFile, [out, retval] long* nRetResult); + [helpstring("method verifyNotaryInfo")] HRESULT verifyNotaryInfo([in] IComNotaryInfo* pNotInfo, [out, retval] long* nRetResult); + [helpstring("method deleteDataFile")] HRESULT deleteDataFile([in] BSTR szDataFileId, [out, retval] long* nRetCode); + [helpstring("method deleteNotaryInfo")] HRESULT deleteNotaryInfo([in] BSTR szNotInfoId, [out, retval] long* nRetCode); + [helpstring("method deleteSignatureInfo")] HRESULT deleteSignatureInfo([in] BSTR szSigInfoId, [out, retval] long* nRetCode); + [helpstring("method getConfirmation")] HRESULT getConfirmation([in] IComSignatureInfo* pSigInfo, [in] BSTR pkcs12File, [in] BSTR password, [in] BSTR notaryURL, [in] BSTR proxyHost, [in] BSTR proxyPort, [out,retval] LONG* nRetCode); + [helpstring("method getDataFileNameWidthId")] HRESULT getDataFileNameWidthId([in] BSTR szId, [out,retval] BSTR* pFileName); + + }; + + [ + object, + uuid(2A541861-9A3E-11D6-AEE5-420005574701), + + helpstring("IComDigiDocLib Interface"), + pointer_default(unique) + ] + interface IComDigiDocLib : IDispatch + { + [id(1), helpstring("method getLibName")] HRESULT getLibName([out, retval] BSTR* ret); + [id(2), helpstring("method getLibVersion")] HRESULT getLibVersion([out, retval] BSTR* ret); + [id(3), helpstring("method getSupportedFormats")] HRESULT getSupportedFormats([out, retval] VARIANT* ret); + [id(4), helpstring("method extractDataFile")] HRESULT extractDataFile([in] IComSignedDoc* pSignedDoc, [in] BSTR szFileName, [in] BSTR szDataFileName, [in] BSTR szDocId, [in] BSTR szCharset, [out, retval] long* nRetResult); + [id(6), helpstring("method getCertSubjectName")] HRESULT getCertSubjectName([in] long hCertHandle, [out] BSTR* pCopyTo, [out, retval] long* nRetResult); + [id(7), helpstring("method getCertIssuerName")] HRESULT getCertIssuerName([in] long hCert, [out] BSTR* pszStoreTo, [out, retval] long* nRetResult); + [id(8), helpstring("method getCertSerialNumber")] HRESULT getCertSerialNumber([in] long hCert, [out] BSTR* pCopyTo, [out, retval] long* nRetResult); + [id(9), helpstring("method getCertNotBefore")] HRESULT getCertNotBefore([in] IComSignedDoc* pUseFormatOf,[in] long hCert, [out] BSTR* szTimeStamp, [out, retval] long* nRetResult); + [id(10), helpstring("method getCertNotAfter")] HRESULT getCertNotAfter([in] IComSignedDoc* pUseFormatOf, [in] long hCert, [out] BSTR* szTimeStamp, [out, retval] long* nRetResult); + [id(11), helpstring("method saveCert")] HRESULT saveCert([in] long hCert, [in] BSTR szSaveToFile, [in] long nFormat, [out, retval] long* nRetResult); + [id(12), helpstring("method isCertValid")] HRESULT isCertValid([in] long hCert, [in] IComTimestamp* TimeValue, [out, retval] long* nRetResult); + [id(13), helpstring("method isCertSignedBy")] HRESULT isCertSignedBy([in] long hCert, [in] BSTR szCAFile, [out, retval] long* nRetResult); + [id(14), helpstring("method isCertSignedByCERT")] HRESULT isCertSignedByCERT([in] IComCertSearch* searchCert, [in] IComCertSearch* searchCACert, [out, retval] long* nRetResult); + [id(15), helpstring("method findIssuerCertificatefromMsStore")] HRESULT findIssuerCertificatefromMsStore([in] IComCertificate* cert, [in] IComCertificate* storeTo); + [helpstring("method readCertificateByPKCS12OnlyCert")] HRESULT readCertificateByPKCS12OnlyCert([in] BSTR szPKCS12File, [in] BSTR szPassword, [out,retval] LONG* hX509Handle); + [helpstring("method RunDialogTest")] HRESULT RunDialogTest( [out, retval] long* nRetResult); + [helpstring("method dialogUnitSetTexts")] HRESULT dialogUnitSetTexts([in] BSTR szCaption, [in] BSTR szHeader, [in] BSTR szOkButton, [in] BSTR szCancelButton); + [helpstring("method dialogUnitSetHeaders")] HRESULT dialogUnitSetHeaders([in] BSTR szCol1, [in] BSTR szCol2, [in] BSTR szCol3, [in] BSTR szCol4, [in] BSTR szCol5); + [helpstring("method dialogUnitSetToolTips")] HRESULT dialogUnitSetToolTips([in] BSTR szCommon, [in] BSTR szListView, [in] BSTR szOkButton, [in] BSTR szCancelButton); + [helpstring("method oem2unicode")] HRESULT oem2unicode([in] BSTR szOem, [out,retval] BSTR* pVal); + [helpstring("method longnum2hex")] HRESULT longnum2hex([in] BSTR longNumber, [out,retval] BSTR* pVal); + [helpstring("method unicode2utf8")] HRESULT unicode2utf8([in] BSTR szUnicode, [out,retval] BSTR* pVal); + [helpstring("method utf82unicode")] HRESULT utf82unicode([in] BSTR szUtf8, [out,retval] BSTR* pVal); + [helpstring("method unicode2oem")] HRESULT unicode2oem([in] BSTR szUnicode, [out,retval] BSTR* pVal); + [helpstring("method DigiDocErrors")] HRESULT DigiDocErrors([out,retval] BSTR *retVal); + [helpstring("method ClearDigiDocErrors")] HRESULT ClearDigiDocErrors(); + [helpstring("method CollectErrors")] HRESULT CollectErrors(); + [helpstring("method getComVersion")] HRESULT getComVersion(BSTR *ret); + + + [helpstring("method SetClientNameVersion")] HRESULT SetClientNameVersion(BSTR content); + + + // WITH_TS update + + [propget, helpstring("property TsaUrl")] HRESULT TsaUrl([out, retval] BSTR *pVal); + [propput, helpstring("property TsaUrl")] HRESULT TsaUrl([in] BSTR newVal); + + [propget, helpstring("property AddTimeStamp")] HRESULT AddTimeStamp([out, retval] VARIANT_BOOL *pVal); + [propput, helpstring("property AddTimeStamp")] HRESULT AddTimeStamp([in] VARIANT_BOOL newVal); + + [propget, helpstring("property TimeStampMaxInterval")] HRESULT TimeStampMaxInterval([out, retval] LONG *pVal); + [propput, helpstring("property TimeStampMaxInterval")] HRESULT TimeStampMaxInterval([in] LONG newVal); + + [propget, helpstring("property DebugFilePath")] HRESULT DebugFilePath([out, retval] BSTR *pVal); + [propput, helpstring("property DebugFilePath")] HRESULT DebugFilePath([in] BSTR newVal); + + [propget, helpstring("property DebugLevel")] HRESULT DebugLevel([out, retval] LONG *pVal); + [propput, helpstring("property DebugLevel")] HRESULT DebugLevel([in] LONG newVal); + + // 07.07.2006 + [propget, helpstring("property AddSigAndRefsTimeStamp")] HRESULT AddSigAndRefsTimeStamp([out, retval] VARIANT_BOOL *pVal); + [propput, helpstring("property AddSigAndRefsTimeStamp")] HRESULT AddSigAndRefsTimeStamp([in] VARIANT_BOOL newVal); + + [id(405), helpstring("get configuration setting value")] HRESULT getSetting([in] BSTR szName, [out] BSTR* ret); + [id(406), helpstring("put configuration setting value")] HRESULT putSetting([in] BSTR szName, [in] BSTR szValue); + + }; + + [ + object, + uuid(E9C5A5D9-9E25-11D6-AEE6-420005574701), + + helpstring("IComErrorInfo Interface"), + pointer_default(unique) + ] + interface IComErrorInfo : IDispatch + { + [propget, helpstring("property nCode")] HRESULT nCode([out, retval] long *pVal); + [propget, helpstring("property szFileName")] HRESULT szFileName([out, retval] BSTR *pVal); + [propget, helpstring("property nFileLine")] HRESULT nFileLine([out, retval] long *pVal); + [propget, helpstring("property szAssertion")] HRESULT szAssertion([out, retval] BSTR *pVal); + [helpstring("Returns VARIANT containing bool value")] HRESULT hasContent([out, retval] VARIANT* pRetBool); + [helpstring("method getErrorString")] HRESULT getErrorString([out, retval] BSTR* pszRetText); + [helpstring("method getNextUnreadError")] HRESULT getNextUnreadError([out, retval] VARIANT* pbRetResult); + [helpstring("method clearErrorInfo")] HRESULT clearErrorInfo(); + [helpstring("method clearAllUnreadErrors")] HRESULT clearAllUnreadErrors(); + [helpstring("method getErrorStringByCode")] HRESULT getErrorStringByCode([in] long nCode, [out, retval] BSTR* pszRetString); + [helpstring("method getErrorClass")] HRESULT getErrorClass([in] LONG nCode, [out,retval] LONG* nClass); + }; + [ + object, + uuid(FFA6FD8D-BB6F-11D6-AEF3-420005574701), + + helpstring("IComTimestamp Interface"), + pointer_default(unique) + ] + interface IComTimestamp : IDispatch + { + [propget, helpstring("property year")] HRESULT year([out, retval] long *pVal); + [propput, helpstring("property year")] HRESULT year([in] long newVal); + [propget, helpstring("property month")] HRESULT month([out, retval] long *pVal); + [propput, helpstring("property month")] HRESULT month([in] long newVal); + [propget, helpstring("property day")] HRESULT day([out, retval] long *pVal); + [propput, helpstring("property day")] HRESULT day([in] long newVal); + [propget, helpstring("property hour")] HRESULT hour([out, retval] long *pVal); + [propput, helpstring("property hour")] HRESULT hour([in] long newVal); + [propget, helpstring("property minute")] HRESULT minute([out, retval] long *pVal); + [propput, helpstring("property minute")] HRESULT minute([in] long newVal); + [propget, helpstring("property second")] HRESULT second([out, retval] long *pVal); + [propput, helpstring("property second")] HRESULT second([in] long newVal); + [propget, helpstring("property tz")] HRESULT tz([out, retval] long *pVal); + [propput, helpstring("property tz")] HRESULT tz([in] long newVal); + [helpstring("method readFromString")] HRESULT readFromString([in] IComSignedDoc* pUseFormatOf, [in] BSTR szReadFrom); + [helpstring("method getString")] HRESULT getString([in] IComSignedDoc* pUseFormatOf, [out, retval] BSTR* szRetString); + }; + [ + object, + uuid(41B66A15-BE72-11D6-AEF5-420005574701), + + helpstring("IComCertSearchStore Interface"), + pointer_default(unique) + ] + interface IComCertSearchStore : IDispatch + { + [propget, helpstring("property szStoreName")] HRESULT szStoreName([out, retval] BSTR *pVal); + [propput, helpstring("property szStoreName")] HRESULT szStoreName([in] BSTR newVal); + [propget, helpstring("property nCertSerial")] HRESULT nCertSerial([out, retval] long *pVal); + [propput, helpstring("property nCertSerial")] HRESULT nCertSerial([in] long newVal); + [propget, helpstring("property saSubDNCriterias")] HRESULT saSubDNCriterias([out, retval] VARIANT *pVal); + [propput, helpstring("property saSubDNCriterias")] HRESULT saSubDNCriterias([in] VARIANT newVal); + [propget, helpstring("property saIssuerDNCriterias")] HRESULT saIssuerDNCriterias([out, retval] VARIANT *pVal); + [propput, helpstring("property saIssuerDNCriterias")] HRESULT saIssuerDNCriterias([in] VARIANT newVal); + [propget, helpstring("property nSubDNCriterias")] HRESULT nSubDNCriterias([out, retval] long *pVal); + [propget, helpstring("property nIssuerDNCriterias")] HRESULT nIssuerDNCriterias([out, retval] long *pVal); + [helpstring("nCertSearchStoreType is one of CERT_STORE_SEARCH_BY_x")] HRESULT addSearchType([in] long nCertSearchStoreType); + [helpstring("nCertSearchStoreType is one of CERT_STORE_SEARCH_BY_x")] HRESULT removeSearchType([in] long nCertSearchStoreType); + }; + [ + object, + uuid(41B66A17-BE72-11D6-AEF5-420005574701), + + helpstring("IComCertSearch Interface"), + pointer_default(unique) + ] + interface IComCertSearch : IDispatch + { + [propget, helpstring("One of CERT_SEARCH_BY_x constants")] HRESULT nCertSearchBy([out, retval] long *pVal); + [propput, helpstring("One of CERT_SEARCH_BY_x constants")] HRESULT nCertSearchBy([in] long newVal); + [propget, helpstring("property szX509FileName")] HRESULT szX509FileName([out, retval] BSTR *pVal); + [propput, helpstring("property szX509FileName")] HRESULT szX509FileName([in] BSTR newVal); + [propget, helpstring("property szKeyFileName")] HRESULT szKeyFileName([out, retval] BSTR *pVal); + [propput, helpstring("property szKeyFileName")] HRESULT szKeyFileName([in] BSTR newVal); + [propget, helpstring("property szPkcs12FileName")] HRESULT szPkcs12FileName([out, retval] BSTR *pVal); + [propput, helpstring("property szPkcs12FileName")] HRESULT szPkcs12FileName([in] BSTR newVal); + [propget, helpstring("property pswd")] HRESULT pswd([out, retval] BSTR *pVal); + [propput, helpstring("property pswd")] HRESULT pswd([in] BSTR newVal); + [helpstring("method getCertSearchStore")] HRESULT getCertSearchStore([in] IComCertSearchStore* pStoreTo); + [helpstring("method lookup")] HRESULT lookup([out, retval] VARIANT* pRetBool); + }; + [ + object, + uuid(8544D543-EB32-11D6-AF18-420005574701), + + helpstring("IComCertificate Interface"), + pointer_default(unique) + ] + interface IComCertificate : IDispatch + { + [propget, helpstring("Certificate handle as 32-bit integer value")] HRESULT hHandle([out, retval] long *pVal); + [propget, helpstring("True if this object holds a certificate or false otherwise")] HRESULT containsCert([out, retval] VARIANT *pVal); + [propget, helpstring("Same as ComDigiDocLib.getCertSubjectName but on error simply returns empty string")] HRESULT szPropSubjectName([out, retval] BSTR *pVal); + [propget, helpstring("Same as ComDigiDocLib.getCertIssuerName but on error simply returns empty string")] HRESULT szPropIssuerName([out, retval] BSTR *pVal); + [propget, helpstring("Same as ComDigiDocLib.getCertSerialNumber but on error simply returns zero")] HRESULT nPropSerialNumber([out, retval] BSTR *pVal); + }; + [ + object, + uuid(DFA0A5B9-EB46-11D6-AF18-420005574701), + + helpstring("IComCertArray Interface"), + pointer_default(unique) + ] + interface IComCertArray : IDispatch + { + [propget, helpstring("Number of certificates in array")] HRESULT nCerts([out, retval] long *pVal); + [helpstring("Stores required certificate into pStoreTo object. nIndex has valid range of [0..nCerts-1]")] HRESULT getCertByIndex([in] long nIndex, [in] IComCertificate* pStoreTo); + [helpstring("Clears array if it contains anything")] HRESULT clear(); + [helpstring("Performs lookup in MS CertStore according to pSearchStore criterias")] HRESULT searchBySearchStore([in] IComCertSearchStore* pSearchStore, [out, retval] long* nRetCode); + }; + + +[ + object, + uuid(9E1F83F0-9743-11D7-AF64-420005574701), + dual, + nonextensible, + helpstring("IComPolicyIdentifierArray Interface"), + pointer_default(unique) +] +interface IComPolicyIdentifierArray : IDispatch{ + [propget, id(1), helpstring("property m_nPolicyIdentifierCount")] HRESULT m_nPolicyIdentifierCount([out, retval] LONG *pVal); + [id(2), helpstring("method get_szUserNotice")] HRESULT get_szUserNotice([in] LONG iIndex, [out, retval] BSTR *lpResult); + [id(3), helpstring("method read_CertPolicies")] HRESULT read_CertPolicies([in] long lX509, [out, retval] LONG *lpCounter); + [id(4), helpstring("method get_szCPS")] HRESULT get_szCPS([in] LONG iIndex, [out,retval] BSTR *lpResult); + [id(5), helpstring("method get_szOID")] HRESULT get_szOID([in] LONG iIndex, [out,retval] BSTR *lpResult); + [id(6), helpstring("method isCompanyPolicy")] HRESULT isCompanyPolicy([in] LONG iIndex, [out,retval] LONG * lpResult); +}; +[ + object, + uuid(1CCD759D-2989-41AB-8287-E33C61BC143D), + dual, + nonextensible, + helpstring("IComEncryptionProperty Interface"), + pointer_default(unique) +] +interface IComEncryptionProperty : IDispatch{ + [id(1), helpstring("method SetId")] HRESULT SetId([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(2), helpstring("method SetTarget")] HRESULT SetTarget([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(3), helpstring("method SetName")] HRESULT SetName([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(4), helpstring("method SetContent")] HRESULT SetContent([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(5), helpstring("method GetId")] HRESULT GetId([out,retval] BSTR* lpEncProp); + [id(6), helpstring("method GetTarget")] HRESULT GetTarget([out,retval] BSTR* lpEncProp); + [id(7), helpstring("method GetName")] HRESULT GetName([out,retval] BSTR* lpEncProp); + [id(8), helpstring("method GetContent")] HRESULT GetContent([out,retval] BSTR* lpEncProp); + [id(9), helpstring("method Create")] HRESULT Create([in] IComEncryptedData * pEncData, [in] BSTR szId, [in] BSTR szTarget, [in] BSTR szName, [in] BSTR szContent, [out,retval] LONG* nRetResult); +}; + +[ + object, + uuid(8DFA3FC2-7B54-47E6-817D-8F10A86C60CA), + dual, + nonextensible, + helpstring("IComEncryptedKey Interface"), + pointer_default(unique) +] +interface IComEncryptedKey : IDispatch{ + [id(1), helpstring("method GetId")] HRESULT GetId([out,retval] BSTR* lpEncKey); + [id(2), helpstring("method GetRecipient")] HRESULT GetRecipient([out,retval] BSTR* lpEncKey); + [id(3), helpstring("method GetEncryptionMethod")] HRESULT GetEncryptionMethod([out,retval] BSTR* lpEncKey); + [id(4), helpstring("method GetKeyName")] HRESULT GetKeyName([out,retval] BSTR* lpEncKey); + [id(5), helpstring("method GetCarriedKeyName")] HRESULT GetCarriedKeyName([out,retval] BSTR* lpEncKey); + [id(6), helpstring("method SetId")] HRESULT SetId([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(7), helpstring("method SetRecipient")] HRESULT SetRecipient([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(8), helpstring("method SetEncryptionMethod")] HRESULT SetEncryptionMethod([in] BSTR szValue, [out,retval] LONG* nRetVal); + [id(9), helpstring("method SetKeyName")] HRESULT SetKeyName([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(10), helpstring("method SetCarriedKeyName")] HRESULT SetCarriedKeyName([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(11), helpstring("method GetCertificate")] HRESULT GetCertificate([out,retval] LONG* hx509Handle); + [id(12), helpstring("method SetCertificate")] HRESULT SetCertificate([in] LONG hx509Handle, [out,retval] LONG* hRetResult); + [id(13), helpstring("method Create")] HRESULT Create([in] IComEncryptedData * pEncData, [in] BSTR hX509_path, [in] BSTR szEncMethod, [in] BSTR szId, [in] BSTR szRecipient, [in] BSTR szKeyName, [in] BSTR szCarriedKeyname, [out,retval] LONG* nRetResult); + [id(14), helpstring("method GetIssuer")] HRESULT GetIssuer([out,retval] BSTR* issuer); + [id(15), helpstring("method GetNotAfter")] HRESULT GetNotAfter([out,retval] BSTR* notafter); +}; +[ + object, + uuid(0137DCAC-F9CB-467B-BC0D-A3659D106015), + dual, + nonextensible, + helpstring("IComEncryptedData Interface"), + pointer_default(unique) +] +interface IComEncryptedData : IDispatch{ + [id(1), helpstring("method GetId")] HRESULT GetId([out,retval] BSTR* lpEncData); + [id(2), helpstring("method GetType")] HRESULT GetType([out,retval] BSTR* lpEncData); + [id(3), helpstring("method GetMimeType")] HRESULT GetMimeType([out,retval] BSTR* lpEncData); + [id(4), helpstring("method GetXmlNs")] HRESULT GetXmlNs([out,retval] BSTR* lpEncData); + [id(5), helpstring("method GetEncryptionMethod")] HRESULT GetEncryptionMethod([out,retval] BSTR* lpEncData); + [id(6), helpstring("method GetEncryptionPropertiesId")] HRESULT GetEncryptionPropertiesId([out,retval] BSTR* lpEncData); + [id(7), helpstring("method GetEncryptionPropertiesCount")] HRESULT GetEncryptionPropertiesCount([out,retval] LONG* nRetResult); + [id(8), helpstring("method GetEncryptedKeyCount")] HRESULT GetEncryptedKeyCount([out,retval] LONG* nRetResult); + [id(9), helpstring("method GetEncryptedDataStatus")] HRESULT GetEncryptedDataStatus([out,retval] LONG* nRetResult); + [id(10), helpstring("method SetId")] HRESULT SetId([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(11), helpstring("method SetType")] HRESULT SetType([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(12), helpstring("method SetMimeType")] HRESULT SetMimeType([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(13), helpstring("method SetXmlNs")] HRESULT SetXmlNs([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(14), helpstring("method SetEncryptionMethod")] HRESULT SetEncryptionMethod([in] BSTR szValue, LONG* nRetResult); + [id(15), helpstring("method AppendData")] HRESULT AppendData([in] BSTR szData, [in] LONG nDataLen, [out,retval] LONG* nRetResult); + [id(16), helpstring("method SetEncryptionPropertiesId")] HRESULT SetEncryptionPropertiesId([in] BSTR szValue, [out,retval] LONG* nRetResult); + [id(17), helpstring("method DeleteEncryptionProperty")] HRESULT DeleteEncryptionProperty([in] LONG nIdx, [out,retval] LONG* nRetResult); + [id(18), helpstring("method DeleteEncryptedKey")] HRESULT DeleteEncryptedKey([in] LONG nIdx, [out,retval] LONG* nRetResult); + [id(19), helpstring("method EncryptData")] HRESULT EncryptData([in] LONG nCompressionOption, [out,retval] LONG* nRetResult); + [id(20), helpstring("method DecryptData")] HRESULT DecryptData([out,retval] LONG* nRetResult); + [id(21), helpstring("method CompressData")] HRESULT CompressData([in] LONG nCompressOption, [out,retval] LONG* nRetResult); + [id(22), helpstring("method DecompressData")] HRESULT DecompressData([out,retval] LONG* nRetResult); + [id(23), helpstring("method GetEncryptionProperty")] HRESULT GetEncryptionProperty([in] LONG nIdx, [in] IComEncryptionProperty * lpEncProperty); + [id(24), helpstring("method GetLastEncryptionProperty")] HRESULT GetLastEncryptionProperty([in] IComEncryptionProperty * lpEncProperty); + [id(25), helpstring("method GetEncryptedKey")] HRESULT GetEncryptedKey([in] LONG nIdx, [in] IComEncryptedKey * lpEncryptedKey); + [id(26), helpstring("method GetLastEncryptedKey")] HRESULT GetLastEncryptedKey(IComEncryptedKey * lpEncryptedKey); + [id(27), helpstring("method Decrypt")] HRESULT Decrypt([in] IComEncryptedKey * lpEncKey, [in] BSTR szPin, [in] BSTR clib_conffilepath, [in] BSTR out_file, [out,retval] LONG* nRetResult); + [id(28), helpstring("method Create")] HRESULT Create([in] BSTR szXmlNs, [in] BSTR szEncMode, [in] BSTR szId, [in] BSTR szType, [in] BSTR szMimeType, [out,retval] LONG* nRetResult); + [id(29), helpstring("method FindEncryptionPropertyByName")] HRESULT FindEncryptionPropertyByName([in] IComEncryptionProperty * lpEncProperty, [in] BSTR szName); + [id(30), helpstring("method Decrypt_WithKey")] HRESULT Decrypt_WithKey([in] IComEncryptedKey * lpEncKey, [in] BSTR out_file, [out,retval] LONG* nRetResult); + [id(31), helpstring("method SaveCDOC")] HRESULT SaveCDOC(BSTR save_path, [out,retval] long *pVal); + [id(32), helpstring("method OpenCDOC")] HRESULT OpenCDOC(BSTR file_path, [out,retval] long *pVal); + [id(33), helpstring("method AppendFile")] HRESULT AppendFile(BSTR file_path, [out,retval] long *pVal); +}; + + [ + object, + uuid(22BA9CDA-643B-4C85-80DA-3DA6DDFD1E38), + dual, + helpstring("IComTimeStampInfo Interface"), + pointer_default(unique) + ] + interface IComTimeStampInfo : IDispatch + { + [propget, helpstring("property Id")] HRESULT Id([out, retval] BSTR *pVal); + [propget, helpstring("property Type")] HRESULT Type([out, retval] BSTR *pVal); + + [propget, helpstring("property TSAProvider")] HRESULT TSAProvider([out, retval] BSTR *pVal); + [propget, helpstring("property TSATime")] HRESULT TSATime([out, retval] BSTR *pVal); + [propget, helpstring("property Serial")] HRESULT Serial([out, retval] BSTR *pVal); + + [propget, helpstring("property HashAlgorithm")] HRESULT HashAlgorithm([out, retval] BSTR *pVal); + [propget, helpstring("property HashValue")] HRESULT HashValue([out, retval] BSTR *pVal); + + [propget, helpstring("property CertificateHandler")] HRESULT CertificateHandler([out, retval] long *pVal); + + }; +[ + uuid(2A541855-9A3E-11D6-AEE5-420005574701), + version(1.0), + helpstring("DigiDocLibCOM 1.0 Type Library") +] +library DIGIDOCLIBCOMLib +{ + importlib("stdole32.tlb"); + importlib("stdole2.tlb"); + + + [ + uuid(88b32b16-9e20-11d6-aee6-420005574701) + ] + module ComConstants { + + const long COM_SIGNATURE_LEN = 128; + const long COM_DIGEST_LEN = 20; + const long COM_DIGEST_SHA1 = 0; + const long COM_CERT_DATA_LEN = 2048; + const long COM_X509_NAME_LEN = 256; + const long COM_SIGNATURE_RSA = 0; + + const BSTR COM_CONTENT_HASHCODE = L"HASHCODE"; + const BSTR COM_CONTENT_DETATCHED = L"DETATCHED"; + const BSTR COM_CONTENT_EMBEDDED = L"EMBEDDED"; + const BSTR COM_CONTENT_EMBEDDED_BASE64= L"EMBEDDED_BASE64"; + + const BSTR COM_CHARSET_ISO_8859_1 = L"ISO-8859-1"; + const BSTR COM_CHARSET_UTF_8 = L"UTF-8"; + + const BSTR COM_SK_PKCS7_1 = L"SK-PKCS#7-1.0"; + const BSTR COM_SK_XML_1_NAME = L"SK-XML"; + const BSTR COM_SK_XML_1_VER = L"1.0"; + const BSTR COM_DIGIDOC_XML_1_1_NAME = L"DIGIDOC-XML"; + const BSTR COM_DIGIDOC_XML_1_1_VER = L"1.1"; + const BSTR COM_DIGIDOC_XML_1_2_VER = L"1.2"; + const BSTR COM_DIGIDOC_XML_1_3_VER = L"1.3"; + + const BSTR COM_SK_NOT_VERSION = L"OCSP-1.0"; + + const BSTR COM_DIGEST_SHA1_NAME = L"sha1"; + const BSTR COM_SIGN_RSA_NAME = L"RSA"; + const BSTR COM_OCSP_NONCE_NAME = L"OCSP Nonce"; + const BSTR COM_RESPID_NAME_VALUE = L"NAME"; + const BSTR COM_RESPID_KEY_VALUE = L"KEY HASH"; + const BSTR COM_OCSP_SIG_TYPE = L"sha1WithRSAEncryption"; + + const BSTR COM_EST_EID_CSP = L"EstEID Card CSP"; + const BSTR COM_EST_AEID_CSP = L"Gemplus GemSAFE Card CSP"; + const BSTR COM_EST_AEID_CSP_WIN = L"Gemplus GemSAFE Card CSP v1.0"; + + const long COM_FILE_FORMAT_ASN1 = 0; + const long COM_FILE_FORMAT_PEM = 1; + + const long COM_DDOC_LANG_ENGLISH = 0; + const long COM_DDOC_LANG_ESTONIAN = 1; + + const long COM_OCSP_REQUEST_SIGN_NO = 1; + const long COM_OCSP_REQUEST_SIGN_CSP = 2; + const long COM_OCSP_REQUEST_SIGN_X509 = 3; + const long COM_OCSP_REQUEST_SIGN_PKCS11_WIN = 4; + const long COM_OCSP_REQUEST_SIGN_PKCS12 = 5; + + const long COM_CERT_SEARCH_BY_STORE = 1; + const long COM_CERT_SEARCH_BY_X509 = 2; + const long COM_CERT_SEARCH_BY_PKCS12 = 3; + + const long COM_CERT_STORE_SEARCH_BY_SERIAL = 0x01; + const long COM_CERT_STORE_SEARCH_BY_SUBJECT_DN = 0x02; + const long COM_CERT_STORE_SEARCH_BY_ISSUER_DN = 0x04; + const long COM_CERT_STORE_SEARCH_BY_KEY_INFO = 0x08; + + + const long COM_DENC_DATA_STATUS_UNINITIALIZED =0; + const long COM_DENC_DATA_STATUS_UNENCRYPTED_AND_NOT_COMPRESSED =1; + const long COM_DENC_DATA_STATUS_UNENCRYPTED_AND_COMPRESSED =2; + const long COM_DENC_DATA_STATUS_ENCRYPTED_AND_NOT_COMPRESSED =3; + const long COM_DENC_DATA_STATUS_ENCRYPTED_AND_COMPRESSED =4; + + const long COM_DENC_COMPRESS_ALLWAYS =0; + const long COM_DENC_COMPRESS_NEVER =1; + const long COM_DENC_COMPRESS_BEST_EFFORT =2; + + const BSTR COM_DENC_ENCDATA_TYPE_DDOC =L"http://www.sk.ee/DigiDoc/v1.3.0/digidoc.xsd"; + const BSTR COM_DENC_ENCDATA_MIME_XML =L"text/xml"; + const BSTR COM_DENC_ENCDATA_MIME_ZLIB =L"http://www.isi.edu/in-noes/iana/assignments/media-types/application/zip"; + const BSTR COM_DENC_ENC_METHOD_AES128 =L"http://www.w3.org/2001/04/xmlenc#aes128-cbc"; + const BSTR COM_DENC_ENC_METHOD_RSA1_5 =L"http://www.w3.org/2001/04/xmlenc#rsa-1_5"; + const BSTR COM_DENC_XMLNS_XMLENC =L"http://www.w3.org/2001/04/xmlenc#"; + const BSTR COM_DENC_XMLNS_XMLENC_ELEMENT =L"http://www.w3.org/2001/04/xmlenc#Element"; + const BSTR COM_DENC_XMLNS_XMLENC_CONTENT =L"http://www.w3.org/2001/04/xmlenc#Content"; + const BSTR COM_DENC_XMLNS_XMLENC_ENCPROP =L"http://www.w3.org/2001/04/xmlenc#EncryptionProperties"; + const BSTR COM_DENC_XMLNS_XMLDSIG =L"http://www.w3.org/2000/09/xmldsig#"; + }; + + //==========< Error codes >======================= + [ + uuid(43491bea-9d3e-11d6-aee6-420005574701) + ] + typedef enum ComErrConst + { + COM_ERR_OK = 0, + COM_ERR_UNSUPPORTED_DIGEST = 1, + COM_ERR_FILE_READ = 2, + COM_ERR_FILE_WRITE = 3, + COM_ERR_DIGEST_LEN = 4, + COM_ERR_BUF_LEN = 5, + COM_ERR_SIGNATURE_LEN = 6, + COM_ERR_PRIVKEY_READ = 7, + COM_ERR_PUBKEY_READ = 8, + COM_ERR_CERT_READ = 9, + COM_ERR_SIGNEDINFO_CREATE = 10, + COM_ERR_SIGNEDINFO_DATA = 11, + COM_ERR_SIGNEDINFO_FINAL = 12, + COM_ERR_UNSUPPORTED_FORMAT = 13, + COM_ERR_BAD_INDEX = 14, + COM_ERR_TIMESTAMP_DECODE = 15, + COM_ERR_DIGIDOC_PARSE = 16, + COM_ERR_UNSUPPORTED_SIGNATURE = 17, + COM_ERR_CERT_STORE_READ = 18, + COM_ERR_SIGPROP_DIGEST = 19, + COM_ERR_COMPARE = 20, + COM_ERR_DOC_DIGEST = 21, + COM_ERR_MIME_DIGEST = 22, + COM_ERR_SIGNATURE = 23, + COM_ERR_CERT_INVALID = 24, + COM_ERR_OCSP_UNSUCCESSFUL = 25, + COM_ERR_OCSP_UNKNOWN_TYPE = 26, + COM_ERR_OCSP_NO_BASIC_RESP = 27, + COM_ERR_OCSP_WRONG_VERSION = 28, + COM_ERR_OCSP_WRONG_RESPID = 29, + COM_ERR_OCSP_ONE_RESPONSE = 30, + COM_ERR_OCSP_RESP_STATUS = 31, + COM_ERR_OCSP_NO_SINGLE_EXT = 32, + COM_ERR_OCSP_NO_NONCE = 33, + COM_ERR_NOTARY_NO_SIGNATURE = 34, + COM_ERR_NOTARY_SIG_MATCH = 35, + COM_ERR_WRONG_CERT = 37, + COM_ERR_NULL_POINTER = 38, + COM_ERR_NULL_CERT_POINTER = 39, + COM_ERR_NULL_SER_NUM_POINTER = 40, + COM_ERR_NULL_KEY_POINTER = 41, + COM_ERR_EMPTY_STRING = 42, + COM_ERR_BAD_DATAFILE_INDEX = 43, + COM_ERR_BAD_DATAFILE_COUNT = 44, + COM_ERR_BAD_ATTR_COUNT = 45, + COM_ERR_BAD_ATTR_INDEX = 46, + COM_ERR_BAD_SIG_INDEX = 47, + COM_ERR_BAD_SIG_COUNT = 48, + COM_ERR_BAD_ROLE_INDEX = 49, + COM_ERR_BAD_DOCINFO_COUNT = 50, + COM_ERR_BAD_DOCINFO_INDEX = 51, + COM_ERR_BAD_NOTARY_INDEX = 52, + COM_ERR_BAD_NOTARY_ID = 53, + COM_ERR_BAD_NOTARY_COUNT = 54, + COM_ERR_X509_DIGEST = 55, + COM_ERR_CERT_LENGTH = 56, + COM_ERR_PKCS_LIB_LOAD = 57, + COM_ERR_PKCS_SLOT_LIST = 58, + COM_ERR_PKCS_WRONG_SLOT = 59, + COM_ERR_PKCS_LOGIN = 60, + COM_ERR_PKCS_PK = 61, + COM_ERR_PKCS_CERT_LOC = 62, + COM_ERR_PKCS_CERT_DECODE = 63, + COM_ERR_PKCS_SIGN_DATA = 64, + COM_ERR_PKCS_CARD_READ = 65, + COM_ERR_CSP_NO_CARD_DATA = 66, + COM_ERR_CSP_OPEN_STORE = 67, + COM_ERR_CSP_CERT_FOUND = 68, + COM_ERR_CSP_SIGN = 69, + COM_ERR_CSP_NO_HASH_START = 70, + COM_ERR_CSP_NO_HASH = 71, + COM_ERR_CSP_NO_HASH_RESULT = 72, + COM_ERR_CSP_OPEN_KEY = 73, + COM_ERR_CSP_READ_KEY = 74, + COM_ERR_OCSP_SIGN_NOT_SUPPORTED = 75, + COM_ERR_OCSP_SIGN_CSP_NAME = 76, + COM_ERR_CSP_CERT_DECODE = 77, + COM_ERR_OCSP_SIGN_PKCS_NAME = 78, + COM_ERR_OCSP_SIGN_OSLL_CERT = 79, + COM_ERR_OCSP_SIGN = 80, + COM_ERR_CERT_ISSUER = 81, + COM_ERR_OCSP_PKCS12_CONTAINER = 82, + COM_ERR_MODIFY_SIGNED_DOC = 83, + COM_ERR_NOTARY_EXISTS = 84, + COM_ERR_UNSUPPORTED_CERT_SEARCH = 85, + COM_ERR_INCORRECT_CERT_SEARCH = 86, + COM_ERR_BAD_OCSP_RESPONSE_DIGEST = 87, + COM_ERR_LAST_ESTID_CACHED = 88, + COM_ERR_BAD_DATAFILE_XML = 89, + COM_ERR_UNSUPPORTED_VERSION = 90, + COM_ERR_UNSUPPORTED_CHARSET = 91, + COM_ERR_PKCS12_EXPIRED = 92, + COM_ERR_CSP_USER_CANCEL = 93, + COM_ERR_CSP_NODEFKEY_CONTAINER = 94, + COM_ERR_CONNECTION_FAILURE = 95, + COM_ERR_WRONG_URL_OR_PROXY = 96, + COM_ERR_NULL_PARAM = 97, + COM_ERR_BAD_ALLOC = 98, + COM_ERR_CONF_FILE = 99, + COM_ERR_CONF_LINE = 100, + COM_ERR_OCSP_CERT_REVOKED = 101, + COM_ERR_OCSP_CERT_UNKNOWN = 102, + COM_ERR_OCSP_PKCS12_NO_FILE = 103, + COM_ERR_OCSP_PKCS12_NO_PASSWD = 104, + COM_ERR_BAD_DATAFILE_CONTENT_TYPE = 105, + COM_ERR_OCSP_WRONG_URL = 106, + COM_ERR_OCSP_MALFORMED = 107, + COM_ERR_OCSP_INTERNALERR = 108, + COM_ERR_OCSP_TRYLATER = 109, + COM_ERR_OCSP_SIGREQUIRED = 110, + COM_ERR_OCSP_UNAUTHORIZED = 111, + COM_ERR_UNKNOWN_CA = 112, + COM_ERR_DENC_ENC_METHOD = 113, + COM_ERR_DENC_ENC_XMLNS = 114, + COM_ERR_DENC_BAD_PROP_IDX = 115, + COM_ERR_DENC_BAD_KEY_IDX = 116, + COM_ERR_DENC_KEY_STATUS = 117, + COM_ERR_DENC_DATA_STATUS = 118, + COM_ERR_DENC_DECRYPT = 119, + COM_ERR_CHARSET_CONVERT = 120, + COM_ERR_COMPRESS = 121, + COM_ERR_DECOMPRESS = 122, + COM_ERR_OCSP_CERT_NOTFOUND = 123, + COM_ERR_INVALID_CONTENT = 124, + COM_ERR_DENC_NO_KEY_FOUND = 125, + COM_ERR_OCSP_RESP_NOT_TRUSTED = 126, + COM_ERR_PRIV_CERT_NOT_FOUND = 127, + COM_ERR_NO_OCSP = 128, + COM_ERR_OCSP_WRONG_SIGNATURE = 129, + COM_ERR_BAD_PARAM = 130, + COM_ERR_GENERIC_SOAP_ERR = 131, + COM_ERR_TS_TIMESTAMPINFO_TYPE = 132, + COM_ERR_TS_BAD_INCLUDEINFO_IDX = 133, + COM_ERR_TS_BAD_TIMESTAMPINFO_IDX = 134, + COM_ERR_TS_CREATE_TS_REQ = 135, + COM_ERR_CREATE_NONCE = 136, + COM_ERR_TXT2OID = 137, + COM_ERR_HTTP_ERR = 138, + COM_ERR_BAD_CERTID_IDX = 139, + COM_ERR_BAD_CERTVALUE_IDX = 140, + COM_ERR_TS_VERIFY = 141, + COM_ERR_TS_REQUEST = 142, + COM_ERR_TSA_NOT_TRUSTED = 143, + COM_ERR_MAX = 145 + } ComErrConst; + + // coclasses + [ + uuid(2A541862-9A3E-11D6-AEE5-420005574701), + helpstring("ComDigiDocLib Class") + ] + coclass ComDigiDocLib + { + [default] interface IComDigiDocLib; + }; + [ + uuid(2A541866-9A3E-11D6-AEE5-420005574701), + helpstring("ComDocInfo Class") + ] + coclass ComDocInfo + { + [default] interface IComDocInfo; + }; + /* + [ + uuid(2A541868-9A3E-11D6-AEE5-420005574701), + helpstring("ComSignatureProdPlace Class") + ] + coclass ComSignatureProdPlace + { + [default] interface IComSignatureProdPlace; + }; + */ + /* + [ + uuid(2A54186C-9A3E-11D6-AEE5-420005574701), + helpstring("ComSignerRole Class") + ] + coclass ComSignerRole + { + [default] interface IComSignerRole; + }; + */ + [ + uuid(2A54186A-9A3E-11D6-AEE5-420005574701), + helpstring("ComSignatureInfo Class") + ] + coclass ComSignatureInfo + { + [default] interface IComSignatureInfo; + }; + [ + uuid(2A54186E-9A3E-11D6-AEE5-420005574701), + helpstring("ComDataFile Class") + ] + coclass ComDataFile + { + [default] interface IComDataFile; + }; + [ + uuid(2A541870-9A3E-11D6-AEE5-420005574701), + helpstring("ComNotaryInfo Class") + ] + coclass ComNotaryInfo + { + [default] interface IComNotaryInfo; + }; + [ + uuid(2A541872-9A3E-11D6-AEE5-420005574701), + helpstring("ComSignedDoc Class") + ] + coclass ComSignedDoc + { + [default] interface IComSignedDoc; + }; + + [ + uuid(E9C5A5DA-9E25-11D6-AEE6-420005574701), + helpstring("ComErrorInfo Class") + ] + coclass ComErrorInfo + { + [default] interface IComErrorInfo; + }; + [ + uuid(FFA6FD8E-BB6F-11D6-AEF3-420005574701), + helpstring("ComTimestamp Class") + ] + coclass ComTimestamp + { + [default] interface IComTimestamp; + }; + [ + uuid(41B66A16-BE72-11D6-AEF5-420005574701), + helpstring("ComCertSearchStore Class") + ] + coclass ComCertSearchStore + { + [default] interface IComCertSearchStore; + }; + [ + uuid(41B66A18-BE72-11D6-AEF5-420005574701), + helpstring("ComCertSearch Class") + ] + coclass ComCertSearch + { + [default] interface IComCertSearch; + }; + [ + uuid(8544D544-EB32-11D6-AF18-420005574701), + helpstring("ComCertificate Class") + ] + coclass ComCertificate + { + [default] interface IComCertificate; + }; + + [ + uuid(DFA0A5BA-EB46-11D6-AF18-420005574701), + helpstring("ComCertArray Class") + ] + coclass ComCertArray + { + [default] interface IComCertArray; + }; + [ + uuid(9E1F83EF-9743-11D7-AF64-420005574701), + helpstring("ComPolicyIdentifierArray Class") + ] + coclass ComPolicyIdentifierArray + { + [default] interface IComPolicyIdentifierArray; + }; + [ + uuid(249E93E5-5723-4A7C-BA6A-940BDBC86200), + helpstring("ComEncryptionProperty Class") + ] + coclass ComEncryptionProperty + { + [default] interface IComEncryptionProperty; + }; + + [ + uuid(47D7B23D-BB86-46D2-BBEE-8D3AFB0566D9), + helpstring("ComEncryptedKey Class") + ] + coclass ComEncryptedKey + { + [default] interface IComEncryptedKey; + }; + [ + uuid(D1EDCE5D-8BF9-4B00-AD7B-0420C5C24F4F), + helpstring("ComEncryptedData Class") + ] + coclass ComEncryptedData + { + [default] interface IComEncryptedData; + }; + +}; diff -Nru libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.rc libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.rc --- libdigidoc-2.7.0/libdigidoccom/DigiDocLibCOM.rc 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/DigiDocLibCOM.rc 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,180 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE MOVEABLE PURE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE MOVEABLE PURE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE MOVEABLE PURE +BEGIN + "1 TYPELIB ""DigiDocLibCOM.tlb""\r\n" + "#include ""version.rc2""\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DLG_UNIT DIALOGEX 0, 0, 300, 155 +STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "DigiDoc" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&OK",IDOK,240,136,50,14 + GROUPBOX "Select certificate:",IDC_GROUPBOX,2,2,296,126 + PUSHBUTTON "&Cancel",IDCANCEL,180,136,50,14 + CONTROL "List1",IDC_LISTVIEW,"SysListView32",LVS_REPORT | + LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_AUTOARRANGE | + WS_BORDER | WS_TABSTOP,6,12,288,110,WS_EX_CLIENTEDGE +END + + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_COMDIGIDOCLIB REGISTRY MOVEABLE PURE "ComDigiDocLib.rgs" +IDR_COMDOCINFO REGISTRY MOVEABLE PURE "ComDocInfo.rgs" +IDR_COMSIGNATUREINFO REGISTRY MOVEABLE PURE "ComSignatureInfo.rgs" +IDR_COMDATAFILE REGISTRY MOVEABLE PURE "ComDataFile.rgs" +IDR_COMNOTARYINFO REGISTRY MOVEABLE PURE "ComNotaryInfo.rgs" +IDR_COMSIGNEDDOC REGISTRY MOVEABLE PURE "ComSignedDoc.rgs" +IDR_COMERRORINFO REGISTRY MOVEABLE PURE "ComErrorInfo.rgs" +IDR_COMTIMESTAMP REGISTRY MOVEABLE PURE "ComTimestamp.rgs" +IDR_COMCERTSEARCHSTORE REGISTRY MOVEABLE PURE "ComCertSearchStore.rgs" +IDR_COMCERTSEARCH REGISTRY MOVEABLE PURE "ComCertSearch.rgs" +IDR_COMCERTIFICATE REGISTRY MOVEABLE PURE "ComCertificate.rgs" +IDR_COMCERTARRAY REGISTRY MOVEABLE PURE "ComCertArray.rgs" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROJNAME "DigiDocLibCOM" +END + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Unknown language: 0x25, 0x1 resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ETI) +#ifdef _WIN32 +LANGUAGE 0x25, 0x1 +#pragma code_page(1257) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// REGISTRY +// + +IDR_COMPOLICYIDENTIFIERARRAY REGISTRY MOVEABLE PURE "ComPolicyIdentifierArray.rgs" +IDR_COMENCRYPTEDKEY REGISTRY MOVEABLE PURE "ComEncryptedKey.rgs" +IDR_COMENCRYPTEDDATA REGISTRY MOVEABLE PURE "ComEncryptedData.rgs" +IDR_COMENCRYPTIONPROPERTY REGISTRY MOVEABLE PURE "ComEncryptionProperty.rgs" + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 2,7,1,47 + PRODUCTVERSION 2,7,1,47 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "042504b0" + BEGIN + VALUE "Comments", "\0" + VALUE "CompanyName", "AS Sertifitseerimiskeskus\0" + VALUE "FileDescription", "DigiDocLibCOM\0" + VALUE "FileVersion", "VERSION_COMMA\0" + VALUE "InternalName", "DigiDocLibCOM\0" + VALUE "LegalCopyright", "Copyright © 2010\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "DigiDocLibCOM.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "AS Sertifitseerimiskeskus DigiDocLibCOM\0" + VALUE "ProductVersion", "VERSION_COMMA\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x425, 1200 + END +END + +#endif // !_MAC + +#endif // Unknown language: 0x25, 0x1 resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +//1 TYPELIB "DigiDocLibCOM.tlb" +#include "version.rc2" +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -Nru libdigidoc-2.7.0/libdigidoccom/Resource.h libdigidoc-3.7.0.875/libdigidoccom/Resource.h --- libdigidoc-2.7.0/libdigidoccom/Resource.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/Resource.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,41 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by DigiDocLibCOM.rc +// +#define IDS_PROJNAME 100 +#define IDR_COMDIGIDOCLIB 101 +#define IDR_COMDOCINFO 102 +#define IDR_COMSIGNATUREPRODPLACE 103 +#define IDR_COMSIGNATUREINFO 104 +#define IDR_COMSIGNERROLE 105 +#define IDR_COMDATAFILE 106 +#define IDR_COMNOTARYINFO 107 +#define IDR_COMSIGNEDDOC 108 +#define IDR_COMERRORINFO 109 +#define IDR_COMTIMESTAMP 110 +#define IDR_COMCERTSEARCHSTORE 111 +#define IDR_COMCERTSEARCH 112 +#define IDR_COMCERTIFICATE 113 +#define IDR_COMCERTARRAY 114 +#define IDR_COMPOLICYIDENTIFIERARRAY 115 +#define IDS_COMTIMESTAMPINFO_DESC 116 +#define IDR_COMFILEPATHARRAY 117 +#define IDR_COMENCRYPTEDKEY 118 +#define IDR_COMENCRYPTEDDATA 119 +#define IDR_ENCRYPTIONPROPERTY 120 +#define IDR_COMENCRYPTIONPROPERTY 121 +#define IDR_ComTimeStampInfo 122 +#define IDC_GROUPBOX 201 +#define IDC_LISTVIEW 202 +#define IDD_DLG_UNIT 220 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 202 +#define _APS_NEXT_COMMAND_VALUE 32768 +#define _APS_NEXT_CONTROL_VALUE 201 +#define _APS_NEXT_SYMED_VALUE 123 +#endif +#endif diff -Nru libdigidoc-2.7.0/libdigidoccom/StdAfx.cpp libdigidoc-3.7.0.875/libdigidoccom/StdAfx.cpp --- libdigidoc-2.7.0/libdigidoccom/StdAfx.cpp 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/StdAfx.cpp 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,12 @@ +// stdafx.cpp : source file that includes just the standard includes +// stdafx.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +#ifdef _ATL_STATIC_REGISTRY +//#include +//#include +#endif + +//#include diff -Nru libdigidoc-2.7.0/libdigidoccom/StdAfx.h libdigidoc-3.7.0.875/libdigidoccom/StdAfx.h --- libdigidoc-2.7.0/libdigidoccom/StdAfx.h 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/StdAfx.h 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,66 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#if !defined(AFX_STDAFX_H__4879C0B3_82D4_4B29_9C16_A7D17E0C8170__INCLUDED_) +#define AFX_STDAFX_H__4879C0B3_82D4_4B29_9C16_A7D17E0C8170__INCLUDED_ +// _WIN32_WINNT to be #defined at least to 0x0403. Value 0x0501 +#define _WIN32_WINNT 0x0501 +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#define STRICT +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0400 +#endif +#define _ATL_APARTMENT_THREADED + +#include +//You may derive a class from CComModule and use it if you want to override +//something, but do not change the name of _Module +extern CComModule _Module; +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +#ifdef _DEBUG + +#define TRACE(a, b) { \ + char buf[800]; \ + char buf2[800]; \ + FILE *errfile; \ + char Sdate[80]; \ + SYSTEMTIME stime; \ + GetSystemTime(&stime); \ + sprintf(buf2,a,b); \ + sprintf(buf,"%s,%s,%d",buf2,__FILE__,__LINE__); \ + errfile = fopen( "c:\\ddoc_com.log", "a" ); \ + sprintf(Sdate, "[ %d:%d:%d %d:%d:%d ] ", stime.wHour, stime.wMinute, stime.wSecond, stime.wDay, stime.wMonth, stime.wYear); \ + fprintf(errfile,"%s - %s \n", Sdate, buf); \ + OutputDebugString(buf); \ + OutputDebugString("\n"); \ + fclose(errfile); \ + } + +#else + +#define TRACE(a, b) { } + +#endif + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__4879C0B3_82D4_4B29_9C16_A7D17E0C8170__INCLUDED) diff -Nru libdigidoc-2.7.0/libdigidoccom/autobuilmakro.txt libdigidoc-3.7.0.875/libdigidoccom/autobuilmakro.txt --- libdigidoc-2.7.0/libdigidoccom/autobuilmakro.txt 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/autobuilmakro.txt 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,83 @@ +'------------------------------------------------------------------------------ +'FILE DESCRIPTION: Automatic build number increment +'------------------------------------------------------------------------------ + +Function GetProjectDir(FullName) + Dim proj_path + proj_path = Split(StrReverse(FullName),"\",-1,1) + + Dim count + count = UBound(proj_path) + + Dim full_path + full_path = "" + Dim i + + for i = 1 to count + full_path = full_path & "\" & proj_path(i) + next + + GetProjectDir = StrReverse(full_path) +End Function + +Sub ZeroText(selection, count) + selection.WordRight dsMove, count + selection.WordRight dsExtend, 1 + selection.Text = 0 +End Sub + +Sub ReplaceText(selection, count, incrementby) + selection.WordRight dsMove, count + selection.WordRight dsExtend, 1 + Dim localInt + localInt = cint(selection.Text) + localInt = localInt + incrementby + selection.Text = localInt +End Sub + +Function projectFile(inputStr) + projectFile = GetProjectDir(ActiveProject.FullName) & inputstr +End Function + +Sub Application_BuildFinish ( NumErrors, NumWarnings ) + if NumErrors <> 0 then exit sub + + 'Open the VersionNo.h file + on error resume next + Documents.Open projectfile("versionno.h") + errnum = err.number + on error goto 0 + if errnum<>0 then + exit sub + end if + + 'Obtain the TextSelection object + Dim selection + set selection = ActiveDocument.Selection + selection.StartOfDocument + + 'Increment the version information + ReplaceText selection, 7, 1 + selection.LineDown + selection.StartOfLine + ZeroText selection, 7 + selection.LineDown + + selection.StartOfLine + ReplaceText selection, 8, 1 + selection.LineDown + selection.StartOfLine + ZeroText selection, 8 + + ActiveDocument.Save + ActiveDocument.Close + +End Sub + + + +Sub s() +'DESCRIPTION: A description was not provided. + + 'TODO: Put macro code here +End Sub diff -Nru libdigidoc-2.7.0/libdigidoccom/version.rc2 libdigidoc-3.7.0.875/libdigidoccom/version.rc2 --- libdigidoc-2.7.0/libdigidoccom/version.rc2 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/libdigidoccom/version.rc2 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,66 @@ + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + +// +// Version +// +#include "..\config.h" +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_COMMA + PRODUCTVERSION VERSION_COMMA + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "COM DLL for DigiDoc library\0" + VALUE "CompanyName", "AS Sertifitseerimiskeskus\0" + VALUE "FileDescription", "DigiDocLibCOM Module\0" + VALUE "FileVersion", VERSION_COMMA"\0" + VALUE "InternalName", "DigiDocLibCOM\0" + VALUE "LegalCopyright", "Copyright (C) AS Sertifitseerimiskeskus\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "DigiDocLibCOM.DLL\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "DigiDocLibCOM Module\0" + VALUE "ProductVersion", DIGIDOC_VERSION + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// diff -Nru libdigidoc-2.7.0/readme libdigidoc-3.7.0.875/readme --- libdigidoc-2.7.0/readme 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/readme 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,13 @@ +DigiDoc is a generic library implementing the XAdES digital signature standard. +It allows to create, sign, verify, and modify digidoc XML containers. Support +for doing hardware cryptographic signing operations is porivded via PKCS#11 +on all platforms and CSP on win32. + +You can find more information about DigiDoc from www.openxades.org + +The project was initiated by AS Sertifitseerimiskeskus (www.sk.ee) +and implemented by Veiko Sinivee (veiko.sinive@seb.se) + +-- +Martin Paljak +10.03.2004 diff -Nru libdigidoc-2.7.0/vc2008/cdigidoc.vcproj libdigidoc-3.7.0.875/vc2008/cdigidoc.vcproj --- libdigidoc-2.7.0/vc2008/cdigidoc.vcproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/cdigidoc.vcproj 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,207 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libdigidoc-2.7.0/vc2008/digidoccom.vcproj libdigidoc-3.7.0.875/vc2008/digidoccom.vcproj --- libdigidoc-2.7.0/vc2008/digidoccom.vcproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/digidoccom.vcproj 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,222 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libdigidoc-2.7.0/vc2008/digidoclibcom.vcproj libdigidoc-3.7.0.875/vc2008/digidoclibcom.vcproj --- libdigidoc-2.7.0/vc2008/digidoclibcom.vcproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/digidoclibcom.vcproj 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libdigidoc-2.7.0/vc2008/digidoclibcom_vs.vcproj libdigidoc-3.7.0.875/vc2008/digidoclibcom_vs.vcproj --- libdigidoc-2.7.0/vc2008/digidoclibcom_vs.vcproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/digidoclibcom_vs.vcproj 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/vc2008/libdigidoc.ncb and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/vc2008/libdigidoc.ncb differ diff -Nru libdigidoc-2.7.0/vc2008/libdigidoc.sln libdigidoc-3.7.0.875/vc2008/libdigidoc.sln --- libdigidoc-2.7.0/vc2008/libdigidoc.sln 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/libdigidoc.sln 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdigidoc", "libdigidoc.vcproj", "{6DB238DD-6FC1-41AD-9317-1795EB40B32A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoccom", "digidoccom.vcproj", "{39E94F79-A838-468B-B53A-EED12E16828D}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30} = {7755CEE2-DDE2-417D-9AF9-8422C79F1C30} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoclibcom", "digidoclibcom.vcproj", "{7755CEE2-DDE2-417D-9AF9-8422C79F1C30}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdigidoc", "cdigidoc.vcproj", "{53105BC1-6319-4A63-B412-99F3CC31640F}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Debug|Win32.ActiveCfg = Debug|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Debug|Win32.Build.0 = Debug|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Release|Win32.ActiveCfg = Release|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Release|Win32.Build.0 = Release|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Debug|Win32.ActiveCfg = Debug|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Debug|Win32.Build.0 = Debug|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Release|Win32.ActiveCfg = Release|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Release|Win32.Build.0 = Release|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Debug|Win32.ActiveCfg = Debug|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Debug|Win32.Build.0 = Debug|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Release|Win32.ActiveCfg = Release|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Release|Win32.Build.0 = Release|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Debug|Win32.ActiveCfg = Debug|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Debug|Win32.Build.0 = Debug|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Release|Win32.ActiveCfg = Release|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Binary files /tmp/BOHXZs7vEn/libdigidoc-2.7.0/vc2008/libdigidoc.suo and /tmp/auft3J73Jc/libdigidoc-3.7.0.875/vc2008/libdigidoc.suo differ diff -Nru libdigidoc-2.7.0/vc2008/libdigidoc.vcproj libdigidoc-3.7.0.875/vc2008/libdigidoc.vcproj --- libdigidoc-2.7.0/vc2008/libdigidoc.vcproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/libdigidoc.vcproj 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,406 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru libdigidoc-2.7.0/vc2008/libdigidoc_vs.sln libdigidoc-3.7.0.875/vc2008/libdigidoc_vs.sln --- libdigidoc-2.7.0/vc2008/libdigidoc_vs.sln 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2008/libdigidoc_vs.sln 2012-12-13 22:05:46.000000000 +0000 @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdigidoc", "libdigidoc.vcproj", "{6DB238DD-6FC1-41AD-9317-1795EB40B32A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoccom", "digidoccom.vcproj", "{39E94F79-A838-468B-B53A-EED12E16828D}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30} = {7755CEE2-DDE2-417D-9AF9-8422C79F1C30} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoclibcom", "digidoclibcom_vs.vcproj", "{7755CEE2-DDE2-417D-9AF9-8422C79F1C30}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cdigidoc", "cdigidoc.vcproj", "{53105BC1-6319-4A63-B412-99F3CC31640F}" + ProjectSection(ProjectDependencies) = postProject + {6DB238DD-6FC1-41AD-9317-1795EB40B32A} = {6DB238DD-6FC1-41AD-9317-1795EB40B32A} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Debug|Win32.ActiveCfg = Debug|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Debug|Win32.Build.0 = Debug|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Release|Win32.ActiveCfg = Release|Win32 + {6DB238DD-6FC1-41AD-9317-1795EB40B32A}.Release|Win32.Build.0 = Release|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Debug|Win32.ActiveCfg = Debug|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Debug|Win32.Build.0 = Debug|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Release|Win32.ActiveCfg = Release|Win32 + {39E94F79-A838-468B-B53A-EED12E16828D}.Release|Win32.Build.0 = Release|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Debug|Win32.ActiveCfg = Debug|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Debug|Win32.Build.0 = Debug|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Release|Win32.ActiveCfg = Release|Win32 + {7755CEE2-DDE2-417D-9AF9-8422C79F1C30}.Release|Win32.Build.0 = Release|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Debug|Win32.ActiveCfg = Debug|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Debug|Win32.Build.0 = Debug|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Release|Win32.ActiveCfg = Release|Win32 + {53105BC1-6319-4A63-B412-99F3CC31640F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -Nru libdigidoc-2.7.0/vc2010/DigiDocLib.vcxproj libdigidoc-3.7.0.875/vc2010/DigiDocLib.vcxproj --- libdigidoc-2.7.0/vc2010/DigiDocLib.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/DigiDocLib.vcxproj 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,206 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DynamicLibrary + false + + + DynamicLibrary + false + + + + + + + + + + + + + + + .\Debug\ + .\Debug\ + true + digidoc + C:\install;C:\install\zlib\include;C:\install\openssl_shared\include;Z:\projects\libdigidoc\trunk;$(IncludePath) + C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;$(LibraryPath) + + + .\Release\ + .\Release\ + false + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;$(LibraryPath) + + + + MultiThreadedDebug + Default + false + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_WINDOWS;BUILDINGDLL;WITH_SOAPDEFS_H;digidoc_EXPORTS;%(PreprocessorDefinitions) + .\Debug\ + .\Debug\DigiDocLib.pch + .\Debug\ + .\Debug\ + + + true + _DEBUG;%(PreprocessorDefinitions) + .\Debug\DigiDocLib.tlb + true + NUL + Win32 + + + 0x041d + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\DigiDocLib.bsc + + + true + true + true + Windows + bin/digidoc.dll + bin\digidoc.lib + comctl32.lib;odbc32.lib;odbccp32.lib;libxml2.lib;crypt32.lib;Shlwapi.lib;libeay32.lib;ssleay32.lib;zlib.lib;wsock32.lib;%(AdditionalDependencies) + false + LIBCMTD.LIB + NotSet + + + + + MultiThreaded + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + %(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;BUILDINGDLL;WITH_SOAPDEFS_H;digidoc_EXPORTS;%(PreprocessorDefinitions) + .\Release\ + .\Release\DigiDocLib.pch + .\Release\ + .\Release\ + + + true + NDEBUG;%(PreprocessorDefinitions) + .\Release\DigiDocLib.tlb + true + NUL + Win32 + + + 0x041d + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\DigiDocLib.bsc + + + true + true + Windows + false + bin\DigiDocLib.dll + .\Release\DigiDocLib.lib + %(AdditionalLibraryDirectories) + comctl32.lib;odbc32.lib;odbccp32.lib;libxml2.lib;crypt32.lib;Shlwapi.lib;libeay32.lib;ssleay32.lib;zlib.lib;wsock32.lib;%(AdditionalDependencies) + LIBCMT.lib + + + + + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/DigiDocLibCOM.vcxproj libdigidoc-3.7.0.875/vc2010/DigiDocLibCOM.vcxproj --- libdigidoc-2.7.0/vc2010/DigiDocLibCOM.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/DigiDocLibCOM.vcxproj 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,300 @@ + + + + + Debug_2_rel + Win32 + + + Debug + Win32 + + + Release MinDependency + Win32 + + + + + + AtlProj + + + + DynamicLibrary + false + MultiByte + Static + + + DynamicLibrary + false + MultiByte + + + DynamicLibrary + false + MultiByte + Static + + + + + + + + + + + + + + + + + + + .\Release\ + .\Release\ + false + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + Z:\projects\libdigidoc\trunk\Release;C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;$(LibraryPath) + + + bin\ + .\Debug\ + false + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + Z:\projects\libdigidoc\trunk;C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;Z:\projects\libdigidoc\trunk\bin;$(LibraryPath) + + + .\DigiDocLibCOM___Win32_Debug_2_rel\ + .\DigiDocLibCOM___Win32_Debug_2_rel\ + false + + + + MultiThreaded + OnlyExplicitInline + true + true + MinSpace + true + Level3 + ..\DigiDocLib;..\add;..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDINGDLL;%(PreprocessorDefinitions) + .\Release\ + true + .\Release\DigiDocLibCOM.pch + .\Release\ + .\Release\ + + + .\Release\DigiDocLibCOM.tlb + libdigidoccom + + + 0x0425 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\DigiDocLibCOM.bsc + + + true + true + Windows + bin\DigiDocLibCOM.dll + bin\DigiDocLibCOM.lib + %(AdditionalLibraryDirectories) + odbc32.lib;odbccp32.lib;libxml2.lib;crypt32.lib;libeay32.lib;ssleay32.lib;Shlwapi.lib;DigiDocLib.lib;comctl32.lib;zlib.lib;%(AdditionalDependencies) + libdigidoccom\DigiDocLibCOM.def + + + regsvr32 /s /c "$(TargetPath)" +echo regsvr32 exec. time > "$(OutDir)regsvr32.trg" + Performing registration + $(OutDir)\regsvr32.trg;%(Outputs) + + + + + MultiThreadedDebug + Default + false + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_WINDOWS;_USRDLL;BUILDINGDLL;%(PreprocessorDefinitions) + .\Debug\ + true + .\Debug\DigiDocLibCOM.pch + .\Debug\ + .\Debug\ + + + EnableFastChecks + %(AdditionalIncludeDirectories) + false + + + ..\Debug\DigiDocLibCOM.tlb + libdigidoccom + %(Filename)_h.h + + + 0x0425 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\DigiDocLibCOM.bsc + + + true + true + true + Windows + bin\DigiDocLibCOM.dll + bin\DigiDocLibCOM.lib + %(AdditionalLibraryDirectories) + odbc32.lib;odbccp32.lib;libxml2.lib;crypt32.lib;libeay32.lib;ssleay32.lib;Shlwapi.lib;DigiDoc.lib;comctl32.lib;zlib.lib;%(AdditionalDependencies) + libdigidoccom\DigiDocLibCOM.def + NotSet + + + regsvr32 /s /c "$(TargetPath)" +echo regsvr32 exec. time > "$(OutDir)regsvr32.trg" + Performing registration + $(OutDir)\regsvr32.trg;%(Outputs) + + + + + MultiThreaded + OnlyExplicitInline + true + true + MaxSpeed + true + Level3 + true + ..\DigiDocLib;..\add;..;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;BUILDINGDLL;%(PreprocessorDefinitions) + .\DigiDocLibCOM___Win32_Debug_2_rel\ + .\DigiDocLibCOM___Win32_Debug_2_rel\DigiDocLibCOM.pch + .\DigiDocLibCOM___Win32_Debug_2_rel\ + .\DigiDocLibCOM___Win32_Debug_2_rel\ + /I + EnableFastChecks + + + .\DigiDocLibCOM___Win32_Debug_2_rel\DigiDocLibCOM.tlb + + + 0x0425 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\DigiDocLibCOM___Win32_Debug_2_rel\DigiDocLibCOM.bsc + + + true + true + false + Windows + .\DigiDocLibCOM___Win32_Debug_2_rel\DigiDocLibCOM.dll + .\DigiDocLibCOM___Win32_Debug_2_rel\DigiDocLibCOM.lib + ..\digiDocLib\digiDocLib___Win32_debug_2_Rel;..\add\lib;%(AdditionalLibraryDirectories) + odbc32.lib;odbccp32.lib;libxml2.lib;crypt32.lib;libeay32.lib;ssleay32.lib;Shlwapi.lib;DigiDocLib.lib;comctl32.lib;zlib.lib;DigiDocServiceClient.lib;%(AdditionalDependencies) + .\DigiDocLibCOM.def + + + regsvr32 /s /c "$(TargetPath)" +echo regsvr32 exec. time > "$(OutDir)regsvr32.trg" + Performing registration + $(OutDir)\regsvr32.trg;%(Outputs) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {0ab62309-a060-0bd6-a056-1f774efb4d04} + false + + + + + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/digidoc.vcxproj libdigidoc-3.7.0.875/vc2010/digidoc.vcxproj --- libdigidoc-2.7.0/vc2010/digidoc.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/digidoc.vcxproj 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,146 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Template + Win32 + + + + + + + + {0ab62309-a060-0bd6-a056-1f774efb4d04} + false + + + + + + + + + Application + + + Application + false + MultiByte + + + Application + false + MultiByte + + + + + + + + + + + + + + + + + + bin\ + .\Debug\ + true + $(ExecutablePath) + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;Z:\projects\libdigidoc\trunk;$(LibraryPath) + + + .\Release\ + .\Release\ + false + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + Z:\projects\libdigidoc\trunk\bin;Z:\projects\libdigidoc\trunk\Release;C:\install\libxml2;C:\install\openssl_static\lib;C:\install\zlib\lib;$(LibraryPath) + + + + MultiThreadedDebug + Default + false + Disabled + true + Level3 + true + EditAndContinue + WIN32;_DEBUG;_CONSOLE;WITH_SOAPDEFS_H;%(PreprocessorDefinitions) + .\Debug\ + .\Debug\digidoc.pch + .\Debug\ + .\Debug\ + EnableFastChecks + + + .\Debug\digidoc.tlb + + + 0x0409 + _DEBUG;%(PreprocessorDefinitions) + + + true + .\Debug\digidoc.bsc + + + true + true + Console + bin\digidoc.exe + odbc32.lib;odbccp32.lib;libxml2.lib;libeay32.lib;ssleay32.lib;bin\DigiDoc.lib;zlib.lib;wsock32.lib;%(AdditionalDependencies) + + + + + MultiThreaded + OnlyExplicitInline + true + true + MaxSpeed + true + Level4 + WIN32;NDEBUG;_CONSOLE;BUILDINGDLL;%(PreprocessorDefinitions) + .\Release\ + .\Release\digidoc.pch + .\Release\ + .\Release\ + + + .\Release\digidoc.tlb + + + 0x0409 + NDEBUG;%(PreprocessorDefinitions) + + + true + .\Release\digidoc.bsc + + + true + Console + bin/cdigidoc.exe + odbc32.lib;odbccp32.lib;libeay32.lib;ssleay32.lib;libxml2.lib;zlib.lib;Release\DigiDocLib.lib;wsock32.lib;Shlwapi.lib;crypt32.lib;comctl32.lib;%(AdditionalDependencies) + + + + + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/digidoccom.vcxproj libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj --- libdigidoc-2.7.0/vc2010/digidoccom.vcxproj 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,102 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {494A3DA8-A26C-41B2-A6EA-85BC57748152} + Win32Proj + digidoccom + + + + Application + true + Unicode + Static + + + Application + false + true + Unicode + Static + + + + + + + + + + + + + true + $(SolutionDir)bin\ + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + Z:\projects\libdigidoc\trunk\bin;C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;$(LibraryPath) + + + false + $(SolutionDir)bin\ + Z:\projects\libdigidoc\trunk;C:\install;C:\install\openssl_shared\include;C:\install\zlib\include;$(IncludePath) + Z:\projects\libdigidoc\trunk\bin;Z:\projects\libdigidoc\trunk\digidoccom\Release;C:\install\libxml2;C:\install\openssl_shared\lib;C:\install\zlib\lib;$(LibraryPath) + + + + Use + Level3 + Disabled + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + $(OutDir)$(TargetName)$(TargetExt) + comsuppw.lib;%(AdditionalDependencies) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + comsuppw.lib;%(AdditionalDependencies) + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/digidoccom.vcxproj.filters libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj.filters --- libdigidoc-2.7.0/vc2010/digidoccom.vcxproj.filters 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj.filters 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/digidoccom.vcxproj.user libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj.user --- libdigidoc-2.7.0/vc2010/digidoccom.vcxproj.user 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/digidoccom.vcxproj.user 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,7 @@ + + + + -in z:\projects\libdigidoc\trunk\bin\t2.ddoc -sign "Manifest" "Tallinn" "Eesti" -out z:\projects\libdigidoc\trunk\bin\t14.ddoc + WindowsLocalDebugger + + \ No newline at end of file diff -Nru libdigidoc-2.7.0/vc2010/libdigidoc.sln libdigidoc-3.7.0.875/vc2010/libdigidoc.sln --- libdigidoc-2.7.0/vc2010/libdigidoc.sln 1970-01-01 00:00:00.000000000 +0000 +++ libdigidoc-3.7.0.875/vc2010/libdigidoc.sln 2012-12-13 22:05:47.000000000 +0000 @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DigiDocLib", "DigiDocLib.vcxproj", "{0AB62309-A060-0BD6-A056-1F774EFB4D04}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoc", "digidoc.vcxproj", "{FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DigiDocLibCOM", "DigiDocLibCOM.vcxproj", "{62BC5BB8-94BD-B9D5-D004-70B7671171D6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "digidoccom", "digidoccom.vcxproj", "{494A3DA8-A26C-41B2-A6EA-85BC57748152}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug_2_rel|Win32 = Debug_2_rel|Win32 + Debug|Win32 = Debug|Win32 + Release MinDependency|Win32 = Release MinDependency|Win32 + Release|Win32 = Release|Win32 + Template|Win32 = Template|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Debug_2_rel|Win32.ActiveCfg = Debug|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Debug_2_rel|Win32.Build.0 = Debug|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Debug|Win32.ActiveCfg = Debug|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Debug|Win32.Build.0 = Debug|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Release MinDependency|Win32.ActiveCfg = Release|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Release MinDependency|Win32.Build.0 = Release|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Release|Win32.ActiveCfg = Release|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Release|Win32.Build.0 = Release|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Template|Win32.ActiveCfg = Release|Win32 + {0AB62309-A060-0BD6-A056-1F774EFB4D04}.Template|Win32.Build.0 = Release|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Debug_2_rel|Win32.ActiveCfg = Debug|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Debug_2_rel|Win32.Build.0 = Debug|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Debug|Win32.ActiveCfg = Debug|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Debug|Win32.Build.0 = Debug|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Release MinDependency|Win32.ActiveCfg = Release|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Release MinDependency|Win32.Build.0 = Release|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Release|Win32.ActiveCfg = Release|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Release|Win32.Build.0 = Release|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Template|Win32.ActiveCfg = Template|Win32 + {FEA32EF4-D9F2-F7AC-E6E9-153F371AEFDF}.Template|Win32.Build.0 = Template|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Debug_2_rel|Win32.ActiveCfg = Debug_2_rel|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Debug_2_rel|Win32.Build.0 = Debug_2_rel|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Debug|Win32.ActiveCfg = Debug|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Debug|Win32.Build.0 = Debug|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Release MinDependency|Win32.ActiveCfg = Release MinDependency|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Release MinDependency|Win32.Build.0 = Release MinDependency|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Release|Win32.ActiveCfg = Release MinDependency|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Release|Win32.Build.0 = Release MinDependency|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Template|Win32.ActiveCfg = Release MinDependency|Win32 + {62BC5BB8-94BD-B9D5-D004-70B7671171D6}.Template|Win32.Build.0 = Release MinDependency|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Debug_2_rel|Win32.ActiveCfg = Debug|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Debug_2_rel|Win32.Build.0 = Debug|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Debug|Win32.ActiveCfg = Debug|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Debug|Win32.Build.0 = Debug|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Release MinDependency|Win32.ActiveCfg = Release|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Release MinDependency|Win32.Build.0 = Release|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Release|Win32.ActiveCfg = Release|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Release|Win32.Build.0 = Release|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Template|Win32.ActiveCfg = Release|Win32 + {494A3DA8-A26C-41B2-A6EA-85BC57748152}.Template|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal