1 /* 2 * 3 * Copyright (C) 1998-2019, 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: Norbert Loxen, Marco Eichelberg 17 * 18 * Purpose: 19 * classes: SiBaseRSAProfile 20 * 21 */ 22 23 #ifndef SIBRSAPR_H 24 #define SIBRSAPR_H 25 26 #include "dcmtk/config/osconfig.h" 27 28 #ifdef WITH_OPENSSL 29 30 #include "dcmtk/dcmsign/sisprof.h" /* for SiSecurityProfile */ 31 32 /** Base RSA Digital Signature Profile 33 * @remark This class is only available if DCMTK is compiled with 34 * OpenSSL support enabled. 35 */ 36 class DCMTK_DCMSIGN_EXPORT SiBaseRSAProfile: public SiSecurityProfile 37 { 38 public: 39 40 /// default constructor SiBaseRSAProfile()41 SiBaseRSAProfile() { } 42 43 /// destructor ~SiBaseRSAProfile()44 virtual ~SiBaseRSAProfile() { } 45 46 /** checks whether the given MAC type can be used with this security profile. 47 * @param macType MAC type to be checked 48 * @return true if MAC type is allowable for this profile, false otherwise. 49 */ 50 virtual OFBool isAllowableMACType(E_MACType macType) const; 51 52 /** checks whether the given public/private key algorithm can be used with this security profile. 53 * @param keyType public key algorithm type to be checked 54 * @return true if public key algorithm is allowable for this profile, false otherwise. 55 */ 56 virtual OFBool isAllowableAlgorithmType(E_KeyType keyType) const; 57 58 /** checks whether the given transfer syntax can be used with this security profile 59 * @param xfer transfer syntax to be checked 60 * @return true if transfer syntax is allowable for this profile, false otherwise. 61 */ 62 virtual OFBool isAllowableTransferSyntax(E_TransferSyntax xfer) const; 63 64 /** checks whether an attribute with the given tag is required to be signed 65 * for the current security profile if the attribute is present in the dataset 66 * @param key tag key to be checked 67 * @return true if required, false otherwise. 68 */ 69 virtual OFBool attributeRequiredIfPresent(const DcmTagKey& key) const; 70 71 /** checks whether all attributes that are required unconditionally 72 * to be signed in this profile are included in the given tagList. 73 * @param taglist attribute tag list 74 * @return true if requirements for profile are fulfilled, false otherwise. 75 */ 76 virtual OFBool checkRequiredAttributeList(DcmAttributeTag& tagList) const; 77 78 /** checks whether an attribute with the given tag must not be signed 79 * for the current security profile. 80 * @param key tag key to be checked 81 * @return true if attribute must not be signed, false otherwise. 82 */ 83 virtual OFBool attributeForbidden(const DcmTagKey& key) const; 84 85 /** some digital signature profiles specify conditions under which certain 86 * attributes must be included into the signature. 87 * This method allows the signature profile to inspect the dataset in order 88 * to determine whether or not the conditions are met. 89 * This method should be called before DcmSignature::createSignature() is executed. 90 * @param item the dataset or item to which the signature will be added 91 * @return status code 92 */ 93 virtual OFCondition inspectSignatureDataset(DcmItem &item); 94 95 /** returns true if this signature profile only applies to main dataset level 96 * @return OFTrue if this signature profile only applies to main dataset level, OFFalse otherwise 97 */ 98 virtual OFBool mainDatasetRequired() const; 99 100 }; 101 102 #endif 103 #endif 104