00001 /* 00002 * 00003 * Copyright (C) 1998-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: dcmsign 00019 * 00020 * Author: Marco Eichelberg 00021 * 00022 * Purpose: 00023 * classes: DcmSignature 00024 * 00025 * Last Update: $Author: meichel $ 00026 * Update Date: $Date: 2005/12/08 16:04:29 $ 00027 * CVS/RCS Revision: $Revision: 1.3 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef DCMSIGN_H 00035 #define DCMSIGN_H 00036 00037 #include "dcmtk/config/osconfig.h" 00038 #include "dcmtk/dcmsign/sitypes.h" 00039 00040 #ifdef WITH_OPENSSL 00041 00042 #include "dcmtk/dcmdata/dcxfer.h" /* for E_TransferSyntax */ 00043 00044 #define INCLUDE_CSTDIO 00045 #include "dcmtk/ofstd/ofstdinc.h" 00046 00047 class DcmItem; 00048 class DcmStack; 00049 class DcmSequenceOfItems; 00050 class DcmAttributeTag; 00051 class SiPrivateKey; 00052 class SiCertificate; 00053 class SiSecurityProfile; 00054 class SiMAC; 00055 class SiTimeStamp; 00056 00064 class DcmSignature 00065 { 00066 public: 00071 static void initializeLibrary(); 00072 00074 DcmSignature(); 00075 00077 virtual ~DcmSignature(); 00078 00085 void attach(DcmItem *dataset); 00086 00089 void detach(); 00090 00108 OFCondition createSignature( 00109 SiPrivateKey& key, 00110 SiCertificate& cert, 00111 SiMAC& mac, 00112 SiSecurityProfile& profile, 00113 E_TransferSyntax xfer=EXS_LittleEndianExplicit, 00114 const DcmAttributeTag *tagList=NULL, 00115 SiTimeStamp *timeStamp=NULL); 00116 00120 unsigned long numberOfSignatures(); 00121 00126 OFCondition removeSignature(unsigned long i); 00127 00132 OFCondition selectSignature(unsigned long i); 00133 00139 OFCondition verifyCurrent(); 00140 00146 OFCondition getCurrentMacID(Uint16& macID); 00147 00155 OFCondition getCurrentMacXferSyntaxName(OFString& str); 00156 00162 OFCondition getCurrentMacName(OFString& str); 00163 00169 OFCondition getCurrentSignatureUID(OFString& str); 00170 00176 OFCondition getCurrentSignatureDateTime(OFString& str); 00177 00186 OFCondition getCurrentDataElementsSigned(DcmAttributeTag& desig); 00187 00193 SiCertificate *getCurrentCertificate(); 00194 00199 void setDumpFile(FILE *f); 00200 00208 static DcmItem *findFirstSignatureItem(DcmItem& item, DcmStack& stack); 00209 00217 static DcmItem *findNextSignatureItem(DcmItem& item, DcmStack& stack); 00218 00219 private: 00220 00222 DcmSignature(DcmSignature& arg); 00223 00225 DcmSignature& operator=(DcmSignature& arg); 00226 00228 void deselect(); 00229 00236 OFCondition allocateMACID(Uint16& newID); 00237 00243 static Uint16 getMACIDnumber(DcmItem &item); 00244 00248 static void currentDateTime(OFString &str); 00249 00251 DcmItem *currentItem; 00252 00254 DcmSequenceOfItems *macParametersSq; 00255 00257 DcmSequenceOfItems *signatureSq; 00258 00260 FILE *dumpFile; 00261 00263 DcmItem *selectedSignatureItem; 00264 00266 DcmItem *selectedMacParametersItem; 00267 00269 SiCertificate *selectedCertificate; 00270 00271 }; 00272 00273 #endif 00274 #endif 00275 00276 /* 00277 * $Log: dcsignat.h,v $ 00278 * Revision 1.3 2005/12/08 16:04:29 meichel 00279 * Changed include path schema for all DCMTK header files 00280 * 00281 * Revision 1.2 2003/06/04 14:21:03 meichel 00282 * Simplified include structure to avoid preprocessor limitation 00283 * (max 32 #if levels) on MSVC5 with STL. 00284 * 00285 * Revision 1.1 2002/12/20 14:53:08 wilkens 00286 * Modified name clash resulting in a compiler error on Solaris 2.5.1 using 00287 * compiler SC 2.0.1. 00288 * 00289 * Revision 1.5 2002/11/27 14:53:40 meichel 00290 * Adapted module dcmsign to use of new header file ofstdinc.h 00291 * 00292 * Revision 1.4 2001/11/16 15:50:49 meichel 00293 * Adapted digital signature code to final text of supplement 41. 00294 * 00295 * Revision 1.3 2001/09/26 14:30:18 meichel 00296 * Adapted dcmsign to class OFCondition 00297 * 00298 * Revision 1.2 2001/06/01 15:50:46 meichel 00299 * Updated copyright header 00300 * 00301 * Revision 1.1 2000/11/07 16:48:51 meichel 00302 * Initial release of dcmsign module for DICOM Digital Signatures 00303 * 00304 * 00305 */ 00306