OFFIS DCMTK  Version 3.6.0
dcsignat.h
1 /*
2  *
3  * Copyright (C) 1998-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmsign
15  *
16  * Author: Marco Eichelberg
17  *
18  * Purpose:
19  * classes: DcmSignature
20  *
21  * Last Update: $Author: joergr $
22  * Update Date: $Date: 2010-10-14 13:17:24 $
23  * CVS/RCS Revision: $Revision: 1.4 $
24  * Status: $State: Exp $
25  *
26  * CVS/RCS Log at end of file
27  *
28  */
29 
30 #ifndef DCMSIGN_H
31 #define DCMSIGN_H
32 
33 #include "dcmtk/config/osconfig.h"
34 #include "dcmtk/dcmsign/sitypes.h"
35 
36 #ifdef WITH_OPENSSL
37 
38 #include "dcmtk/dcmdata/dcxfer.h" /* for E_TransferSyntax */
39 
40 #define INCLUDE_CSTDIO
41 #include "dcmtk/ofstd/ofstdinc.h"
42 
43 class DcmItem;
44 class DcmStack;
45 class DcmSequenceOfItems;
46 class DcmAttributeTag;
47 class SiPrivateKey;
48 class SiCertificate;
49 class SiSecurityProfile;
50 class SiMAC;
51 class SiTimeStamp;
52 
61 {
62 public:
67  static void initializeLibrary();
68 
70  DcmSignature();
71 
73  virtual ~DcmSignature();
74 
81  void attach(DcmItem *dataset);
82 
85  void detach();
86 
105  SiPrivateKey& key,
106  SiCertificate& cert,
107  SiMAC& mac,
108  SiSecurityProfile& profile,
109  E_TransferSyntax xfer=EXS_LittleEndianExplicit,
110  const DcmAttributeTag *tagList=NULL,
111  SiTimeStamp *timeStamp=NULL);
112 
116  unsigned long numberOfSignatures();
117 
122  OFCondition removeSignature(unsigned long i);
123 
128  OFCondition selectSignature(unsigned long i);
129 
136 
142  OFCondition getCurrentMacID(Uint16& macID);
143 
152 
159 
166 
173 
183 
190 
195  void setDumpFile(FILE *f);
196 
204  static DcmItem *findFirstSignatureItem(DcmItem& item, DcmStack& stack);
205 
213  static DcmItem *findNextSignatureItem(DcmItem& item, DcmStack& stack);
214 
215 private:
216 
219 
222 
224  void deselect();
225 
232  OFCondition allocateMACID(Uint16& newID);
233 
239  static Uint16 getMACIDnumber(DcmItem &item);
240 
244  static void currentDateTime(OFString &str);
245 
248 
251 
254 
256  FILE *dumpFile;
257 
260 
263 
266 
267 };
268 
269 #endif
270 #endif
271 
272 /*
273  * $Log: dcsignat.h,v $
274  * Revision 1.4 2010-10-14 13:17:24 joergr
275  * Updated copyright header. Added reference to COPYRIGHT file.
276  *
277  * Revision 1.3 2005-12-08 16:04:29 meichel
278  * Changed include path schema for all DCMTK header files
279  *
280  * Revision 1.2 2003/06/04 14:21:03 meichel
281  * Simplified include structure to avoid preprocessor limitation
282  * (max 32 #if levels) on MSVC5 with STL.
283  *
284  * Revision 1.1 2002/12/20 14:53:08 wilkens
285  * Modified name clash resulting in a compiler error on Solaris 2.5.1 using
286  * compiler SC 2.0.1.
287  *
288  * Revision 1.5 2002/11/27 14:53:40 meichel
289  * Adapted module dcmsign to use of new header file ofstdinc.h
290  *
291  * Revision 1.4 2001/11/16 15:50:49 meichel
292  * Adapted digital signature code to final text of supplement 41.
293  *
294  * Revision 1.3 2001/09/26 14:30:18 meichel
295  * Adapted dcmsign to class OFCondition
296  *
297  * Revision 1.2 2001/06/01 15:50:46 meichel
298  * Updated copyright header
299  *
300  * Revision 1.1 2000/11/07 16:48:51 meichel
301  * Initial release of dcmsign module for DICOM Digital Signatures
302  *
303  *
304  */
305 
a class representing a list of DICOM elements in which each element has a different tag and elements ...
Definition: dcitem.h:51
SiCertificate * getCurrentCertificate()
returns the certificate of the current signature if present.
void attach(DcmItem *dataset)
attaches a DICOM dataset or item to the signature object.
class representing a DICOM Sequence of Items (SQ).
Definition: dcsequen.h:47
this class provides the main interface to the dcmsign module - it allows to create, examine and verify digital signatures in DICOM datasets or items.
Definition: dcsignat.h:60
DcmSequenceOfItems * macParametersSq
pointer to mac parameters sequence of attached item, may be NULL if not attached or not yet present ...
Definition: dcsignat.h:250
unsigned long numberOfSignatures()
returns the number of signatures in the dataset.
void detach()
detaches an attached DICOM dataset from the signature object.
OFCondition selectSignature(unsigned long i)
selects one of the digital signatures from the attached dataset for reading.
DcmItem * selectedMacParametersItem
pointer to currently selected mac parameters item
Definition: dcsignat.h:262
a class representing X.509 public key certificates.
Definition: sicert.h:47
OFCondition getCurrentSignatureUID(OFString &str)
returns the Digital Signature UID of the current signature.
DcmSequenceOfItems * signatureSq
pointer to digital signatures sequence of attached item, may be NULL if not attached or not yet prese...
Definition: dcsignat.h:253
static void currentDateTime(OFString &str)
returns the current date and time as a DICOM DT string.
DcmItem * selectedSignatureItem
pointer to currently selected signature item
Definition: dcsignat.h:259
OFCondition getCurrentMacXferSyntaxName(OFString &str)
returns the MAC Calculation Transfer Syntax of the current signature.
FILE * dumpFile
if nonzero, the data fed to the MAC algorithm is also stored in this file.
Definition: dcsignat.h:256
abstract base class for all security profiles.
Definition: sisprof.h:48
DcmItem * currentItem
pointer to current item if attached, NULL otherwise
Definition: dcsignat.h:247
this class manages a stack of pointers to DcmObject instances.
Definition: dcstack.h:77
virtual ~DcmSignature()
destructor
OFCondition getCurrentMacID(Uint16 &macID)
returns the MAC ID of the current signature.
static void initializeLibrary()
initializes the dcmsign library including the underlying OpenSSL library.
static Uint16 getMACIDnumber(DcmItem &item)
searches a given item for the DCM_MACIDnumber element and returns its value if present, otherwise returns 0.
OFCondition allocateMACID(Uint16 &newID)
allocates a new mac ID number for a new signature.
a class representing a private key.
Definition: siprivat.h:48
OFCondition getCurrentDataElementsSigned(DcmAttributeTag &desig)
returns the Data Elements Signed attribute of the current signature if present.
a base class for all classes that implement hash functions.
Definition: simac.h:41
void setDumpFile(FILE *f)
dump all data that is fed into the MAC algorithm into the given file, which must be opened and closed...
OFCondition getCurrentSignatureDateTime(OFString &str)
returns the Signature Date/Time of the current signature.
OFCondition verifyCurrent()
verifies the current signature.
static DcmItem * findFirstSignatureItem(DcmItem &item, DcmStack &stack)
recursively browses through the given dataset and searches the first occurence of the DigitalSignatur...
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
SiCertificate * selectedCertificate
pointer to certificate for currently selected signature item
Definition: dcsignat.h:265
OFCondition getCurrentMacName(OFString &str)
returns the MAC Algorithm Name of the current signature.
pure virtual base class for a timestamp client.
Definition: sitstamp.h:44
DcmSignature()
default constructor
OFCondition removeSignature(unsigned long i)
removes a signature from the dataset.
static DcmItem * findNextSignatureItem(DcmItem &item, DcmStack &stack)
recursively browses through the given dataset and searches the next occurence of the DigitalSignature...
OFCondition createSignature(SiPrivateKey &key, SiCertificate &cert, SiMAC &mac, SiSecurityProfile &profile, E_TransferSyntax xfer=EXS_LittleEndianExplicit, const DcmAttributeTag *tagList=NULL, SiTimeStamp *timeStamp=NULL)
creates a new digital signature in the current dataset.
DcmSignature & operator=(DcmSignature &arg)
private undefined copy assignment operator
General purpose class for condition codes.
Definition: ofcond.h:305
void deselect()
removes the selection of a current signature if present
a class representing the DICOM value representation 'Attribute Tag' (AT)
Definition: dcvrat.h:40


Generated on Wed Dec 14 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.11