00001 /* 00002 * 00003 * Copyright (C) 2001-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmpstat 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: 00023 * classes: DVSignatureHandler 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:04:15 $ 00027 * CVS/RCS Revision: $Revision: 1.9 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef DVSIGHDL_H 00035 #define DVSIGHDL_H 00036 00037 #include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ 00038 #include "dcmtk/ofstd/ofstream.h" 00039 #include "dcmtk/dcmpstat/dvpstyp.h" 00040 #include "dcmtk/ofstd/ofstring.h" 00041 #include "dcmtk/dcmsign/sicertvf.h" 00042 #include "dcmtk/dcmdata/dcerror.h" 00043 00044 00045 00046 class DcmAttributeTag; 00047 class DcmItem; 00048 class DcmStack; 00049 class DVConfiguration; 00050 class DcmAttributeTag; 00051 class DcmTagKey; 00052 00055 class DVSignatureHandler 00056 { 00057 public: 00061 DVSignatureHandler(DVConfiguration& cfg); 00062 00064 virtual ~DVSignatureHandler(); 00065 00072 const char *getCurrentSignatureValidationHTML(DVPSObjectType objtype) const; 00073 00078 const char *getCurrentSignatureValidationOverview() const; 00079 00087 void updateDigitalSignatureInformation(DcmItem& dataset, DVPSObjectType objtype, OFBool onRead); 00088 00092 void disableDigitalSignatureInformation(DVPSObjectType objtype); 00093 00098 DVPSSignatureStatus getCurrentSignatureStatus(DVPSObjectType objtype) const; 00099 00104 unsigned long getNumberOfCorrectSignatures(DVPSObjectType objtype) const; 00105 00110 unsigned long getNumberOfUntrustworthySignatures(DVPSObjectType objtype) const; 00111 00116 unsigned long getNumberOfCorruptSignatures(DVPSObjectType objtype) const; 00117 00121 DVPSSignatureStatus getCombinedImagePStateSignatureStatus() const; 00122 00127 void disableImageAndPState(); 00128 00140 OFBool attributesSigned(DcmItem& item, DcmAttributeTag& tagList) const; 00141 00153 OFCondition createSignature( 00154 DcmItem& mainDataset, 00155 const DcmStack& itemStack, 00156 DcmAttributeTag& attributesNotToSignInMainDataset, 00157 const char *userID, 00158 const char *passwd); 00159 00160 private: 00161 00163 DVSignatureHandler(const DVSignatureHandler& copy); 00164 00166 DVSignatureHandler& operator=(const DVSignatureHandler&); 00167 00168 /* print the location stack into the given stream. 00169 * It is assumed that the stack top is a DigitalSignatureSequence which is not printed 00170 * and that the stack bottom is the main dataset, which is also not printed. 00171 * @param stack search stack, as returned by DcmSignature::findFirstSignatureItem() etc. 00172 * @param os output stream 00173 */ 00174 static void printSignatureItemPosition(DcmStack& stack, ostream& os); 00175 00180 void replaceString(DVPSObjectType objtype, const char *str); 00181 00184 void updateSignatureValidationOverview(); 00185 00187 OFString htmlSR; 00188 00190 OFString htmlImage; 00191 00193 OFString htmlPState; 00194 00196 OFString htmlOverview; 00197 00199 unsigned long correctSignaturesSR; 00200 00202 unsigned long corruptSignaturesSR; 00203 00205 unsigned long untrustSignaturesSR; 00206 00208 unsigned long correctSignaturesImage; 00209 00211 unsigned long corruptSignaturesImage; 00212 00214 unsigned long untrustSignaturesImage; 00215 00217 unsigned long correctSignaturesPState; 00218 00220 unsigned long corruptSignaturesPState; 00221 00223 unsigned long untrustSignaturesPState; 00224 00225 #ifdef WITH_OPENSSL 00226 00227 SiCertificateVerifier certVerifier; 00228 #endif 00229 00231 DVConfiguration& config; 00232 00233 }; 00234 00235 #endif 00236 00237 /* 00238 * $Log: dvsighdl.h,v $ 00239 * Revision 1.9 2005/12/08 16:04:15 meichel 00240 * Changed include path schema for all DCMTK header files 00241 * 00242 * Revision 1.8 2004/02/04 15:49:09 joergr 00243 * Removed acknowledgements with e-mail addresses from CVS log. Removed leading 00244 * underscore characters from preprocessor symbols (reserved symbols). 00245 * 00246 * Revision 1.7 2002/04/16 14:02:04 joergr 00247 * Added configurable support for C++ ANSI standard includes (e.g. streams). 00248 * 00249 * Revision 1.6 2001/09/26 15:36:19 meichel 00250 * Adapted dcmpstat to class OFCondition 00251 * 00252 * Revision 1.5 2001/06/01 15:50:26 meichel 00253 * Updated copyright header 00254 * 00255 * Revision 1.4 2001/05/25 10:07:34 meichel 00256 * Modified dcmpstat signature handler to also compile without OpenSSL 00257 * 00258 * Revision 1.3 2001/01/29 14:55:43 meichel 00259 * Added new methods for creating signatures and checking the signature 00260 * status in module dcmpstat. 00261 * 00262 * Revision 1.2 2001/01/25 17:37:43 meichel 00263 * Fixed problem with undefined copy constructor 00264 * 00265 * Revision 1.1 2001/01/25 15:18:05 meichel 00266 * Added initial support for verification of digital signatures 00267 * in presentation states, images and structured reports to module dcmpstat. 00268 * 00269 * 00270 */