00001 /* 00002 * 00003 * Copyright (C) 2001-2010, OFFIS e.V. 00004 * All rights reserved. See COPYRIGHT file for details. 00005 * 00006 * This software and supporting documentation were developed by 00007 * 00008 * OFFIS e.V. 00009 * R&D Division Health 00010 * Escherweg 2 00011 * D-26121 Oldenburg, Germany 00012 * 00013 * 00014 * Module: dcmpstat 00015 * 00016 * Author: Marco Eichelberg 00017 * 00018 * Purpose: 00019 * classes: DVSignatureHandler 00020 * 00021 * Last Update: $Author: joergr $ 00022 * Update Date: $Date: 2010-10-14 13:16:37 $ 00023 * CVS/RCS Revision: $Revision: 1.11 $ 00024 * Status: $State: Exp $ 00025 * 00026 * CVS/RCS Log at end of file 00027 * 00028 */ 00029 00030 #ifndef DVSIGHDL_H 00031 #define DVSIGHDL_H 00032 00033 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00034 #include "dcmtk/ofstd/ofstream.h" 00035 #include "dcmtk/dcmpstat/dvpstyp.h" 00036 #include "dcmtk/ofstd/ofstring.h" 00037 #include "dcmtk/dcmsign/sicertvf.h" 00038 #include "dcmtk/dcmdata/dcerror.h" 00039 00040 00041 00042 class DcmAttributeTag; 00043 class DcmItem; 00044 class DcmStack; 00045 class DVConfiguration; 00046 class DcmAttributeTag; 00047 class DcmTagKey; 00048 00051 class DVSignatureHandler 00052 { 00053 public: 00057 DVSignatureHandler(DVConfiguration& cfg); 00058 00060 virtual ~DVSignatureHandler(); 00061 00068 const char *getCurrentSignatureValidationHTML(DVPSObjectType objtype) const; 00069 00074 const char *getCurrentSignatureValidationOverview() const; 00075 00083 void updateDigitalSignatureInformation(DcmItem& dataset, DVPSObjectType objtype, OFBool onRead); 00084 00088 void disableDigitalSignatureInformation(DVPSObjectType objtype); 00089 00094 DVPSSignatureStatus getCurrentSignatureStatus(DVPSObjectType objtype) const; 00095 00100 unsigned long getNumberOfCorrectSignatures(DVPSObjectType objtype) const; 00101 00106 unsigned long getNumberOfUntrustworthySignatures(DVPSObjectType objtype) const; 00107 00112 unsigned long getNumberOfCorruptSignatures(DVPSObjectType objtype) const; 00113 00117 DVPSSignatureStatus getCombinedImagePStateSignatureStatus() const; 00118 00123 void disableImageAndPState(); 00124 00136 OFBool attributesSigned(DcmItem& item, DcmAttributeTag& tagList) const; 00137 00149 OFCondition createSignature( 00150 DcmItem& mainDataset, 00151 const DcmStack& itemStack, 00152 DcmAttributeTag& attributesNotToSignInMainDataset, 00153 const char *userID, 00154 const char *passwd); 00155 00156 private: 00157 00159 DVSignatureHandler(const DVSignatureHandler& copy); 00160 00162 DVSignatureHandler& operator=(const DVSignatureHandler&); 00163 00164 /* print the location stack into the given stream. 00165 * It is assumed that the stack top is a DigitalSignatureSequence which is not printed 00166 * and that the stack bottom is the main dataset, which is also not printed. 00167 * @param stack search stack, as returned by DcmSignature::findFirstSignatureItem() etc. 00168 * @param os output stream 00169 */ 00170 static void printSignatureItemPosition(DcmStack& stack, STD_NAMESPACE ostream& os); 00171 00176 void replaceString(DVPSObjectType objtype, const char *str); 00177 00180 void updateSignatureValidationOverview(); 00181 00183 OFString htmlSR; 00184 00186 OFString htmlImage; 00187 00189 OFString htmlPState; 00190 00192 OFString htmlOverview; 00193 00195 unsigned long correctSignaturesSR; 00196 00198 unsigned long corruptSignaturesSR; 00199 00201 unsigned long untrustSignaturesSR; 00202 00204 unsigned long correctSignaturesImage; 00205 00207 unsigned long corruptSignaturesImage; 00208 00210 unsigned long untrustSignaturesImage; 00211 00213 unsigned long correctSignaturesPState; 00214 00216 unsigned long corruptSignaturesPState; 00217 00219 unsigned long untrustSignaturesPState; 00220 00221 #ifdef WITH_OPENSSL 00223 SiCertificateVerifier certVerifier; 00224 #endif 00225 00227 DVConfiguration& config; 00228 00229 }; 00230 00231 #endif 00232 00233 /* 00234 * $Log: dvsighdl.h,v $ 00235 * Revision 1.11 2010-10-14 13:16:37 joergr 00236 * Updated copyright header. Added reference to COPYRIGHT file. 00237 * 00238 * Revision 1.10 2006/08/15 16:57:01 meichel 00239 * Updated the code in module dcmpstat to correctly compile when 00240 * all standard C++ classes remain in namespace std. 00241 * 00242 * Revision 1.9 2005/12/08 16:04:15 meichel 00243 * Changed include path schema for all DCMTK header files 00244 * 00245 * Revision 1.8 2004/02/04 15:49:09 joergr 00246 * Removed acknowledgements with e-mail addresses from CVS log. Removed leading 00247 * underscore characters from preprocessor symbols (reserved symbols). 00248 * 00249 * Revision 1.7 2002/04/16 14:02:04 joergr 00250 * Added configurable support for C++ ANSI standard includes (e.g. streams). 00251 * 00252 * Revision 1.6 2001/09/26 15:36:19 meichel 00253 * Adapted dcmpstat to class OFCondition 00254 * 00255 * Revision 1.5 2001/06/01 15:50:26 meichel 00256 * Updated copyright header 00257 * 00258 * Revision 1.4 2001/05/25 10:07:34 meichel 00259 * Modified dcmpstat signature handler to also compile without OpenSSL 00260 * 00261 * Revision 1.3 2001/01/29 14:55:43 meichel 00262 * Added new methods for creating signatures and checking the signature 00263 * status in module dcmpstat. 00264 * 00265 * Revision 1.2 2001/01/25 17:37:43 meichel 00266 * Fixed problem with undefined copy constructor 00267 * 00268 * Revision 1.1 2001/01/25 15:18:05 meichel 00269 * Added initial support for verification of digital signatures 00270 * in presentation states, images and structured reports to module dcmpstat. 00271 * 00272 * 00273 */