openssl & dcmsign

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

openssl & dcmsign

#1 Post by yeganeh »

hi
would please some one tell me about "verifyCurrent()" in DcmSignature.i wanted to know which parameters this function check to verify a signature?is it check the cetrificate that attache the file?and which parameter of that certificate whoould check?
and one more about openssl libs.can we used them whit MD projects?
thanks
________
Toyota Corolla E80
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1449
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

DcmSignature::verifyCurrent() verifies the digital signature, not the certificate. This method extracts the public key from the certificate and decodes the digital signature. It also serializes the signed elements from the DICOM dataset and feeds this byte stream into a hash algorithm, creating a digital fingerprint (MAC). It then compares MAC and decoded signature to determine whether or not the signature is valid.

There is a different method SiCertificateVerifier::verifyCertificate() in the library that can be used to check the validity and trustworthyness of the certificate itself.

Concerning "MD projects", if you are talking about projects compiled under MS Visual Studio using the "/MD" code generation option, then the answer is: you will most probably have to re-compile OpenSSL from source, since the two libraries available in binary form from the DCMTK website are compiled for /MT and /MTd, respectively.

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#3 Post by yeganeh »

hi
thanks for your kind reply.
see sir i wanted to use DcmSignature to retrive signature from a signed structure report file.then in this signed dicom file i wanted to be sure that the certificate which used to signe is trusted and belonge to me(consider i am a self signed CA and want to produce certificate for my company).
with SiCertificate i just can extract raw certificate data not verify of the trusted one.and this is my problem.
________
medical marijuana grow
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#4 Post by yeganeh »

sorry
one more
when i use DcmSignature::verifyCurrent() ,my program has memory leak.when i comment this line there is no mem leak.what i should do for this?
thanks in advanced
________
Honda CBR125R
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#5 Post by Jörg Riesmeier »

when i use DcmSignature::verifyCurrent() ,my program has memory leak.when i comment this line there is no mem leak.what i should do for this?
Did you already try to add "delete signature;" at the end of DcmSignature::verifyCurrent()?

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#6 Post by yeganeh »

hi
it dosen't need to delete because i use "DcmSignature signer; " it is not pointer.

DcmSignature signer; // signature handler
DcmItem *sigItem = DcmSignature::findFirstSignatureItem(*dataset, stack);
while (sigItem)
{
signer.attach(sigItem);
for (unsigned long l=0; l < signer.numberOfSignatures(); ++l)
{
if (signer.selectSignature(l).good())
{
++counter;
if (signer.verifyCurrent().bad()) // verify signature
{
//========== this causes leak memory
corrupt_counter++;
return ERR_VERIFY_SIGE;
}
}
}
signer.detach();
sigItem = DcmSignature::findNextSignatureItem(*dataset, stack);
}


and if i comment signer.verifyCurrent() this program has no mem leak.
________
Wilmington Assembly
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#7 Post by Jörg Riesmeier »

Please read my last posting again (I wrote "at the end of" and not "after").

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#8 Post by yeganeh »

would you please tell me how to delete a non pointer object?i use a handler for DcmSignature which is not pointer.i guss maybe DcmSignature ::detach() whould do the same job. i search DcmSignature class but cannot another appropriate one to do this job
________
medical marijuana strains
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#9 Post by Jörg Riesmeier »

I was talking about the implementation of verifyCurrent() and not of your code. Here's a patch that might fix the memory leak:

Code: Select all

@@ -699,6 +699,7 @@
     } else result = SI_EC_VerificationFailed_NoCertificate;
   }

+  delete signature;
   delete tagList;
   delete mac;
   return result;
So as I wrote before, just add "delete signature;" at the end of the implementation of DcmSignature::verifyCurrent(). That all :-)

And, please tell us whether this solves your problem ...

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#10 Post by yeganeh »

i open my dsmsign.sln and modify dcsignat.cxx file in this way:

Code: Select all

@@ -699,6 +699,7 @@
     } else result = SI_EC_VerificationFailed_NoCertificate;
   }

+  delete signature;
   delete tagList;
   delete mac;
   return result;
but when i do the BUILd SOLOTIOn there are a lot of errors:
1>Linking...
1>LIBCMTD.lib(_file.obj) : error LNK2005: ___iob_func already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(tidtable.obj) : error LNK2005: __decode_pointer already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: _exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __cexit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __amsg_exit already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0dat.obj) : error LNK2005: __initterm_e already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(fflush.obj) : error LNK2005: _fflush already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __lock already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(mlock.obj) : error LNK2005: __unlock already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(dbghook.obj) : error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(sprintf.obj) : error LNK2005: _sprintf already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(isctype.obj) : error LNK2005: __isctype already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in MSVCRTD.lib(cinitexe.obj)
1>LIBCMTD.lib(hooks.obj) : error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(winsig.obj) : error LNK2005: _signal already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(dosmap.obj) : error LNK2005: __errno already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(crt0.obj) : error LNK2005: _mainCRTStartup already defined in MSVCRTD.lib(crtexe.obj)
1>LIBCMTD.lib(errmode.obj) : error LNK2005: ___set_app_type already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(getenv.obj) : error LNK2005: _getenv already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(tolower.obj) : error LNK2005: _tolower already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(strtol.obj) : error LNK2005: _strtol already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(strtol.obj) : error LNK2005: _strtoul already defined in MSVCRTD.lib(MSVCR90D.dll)
1>LIBCMTD.lib(dbgrptw.obj) : error LNK2005: __CrtDbgReportW already defined in MSVCRTD.lib(MSVCR90D.dll)
1>MSVCRTD.lib(MSVCR90D.dll) : error LNK2005: __fileno already defined in LIBCMTD.lib(fileno.obj)
1> Creating library Debug\dcmsign.lib and object Debug\dcmsign.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Debug\dcmsign.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Build log was saved at "file://f:\dcmtk\dcmtk-3.5.4\dcmsign\apps\dcmsign.dir\Debug\BuildLog.htm"
1>dcmsign - 34 error(s), 2 warning(s)
2>------ Skipped Build: Project: INSTALL, Configuration: Debug Win32 ------
2>Project not selected to build for this solution configuration
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 1 skipped ==========
________
Mazda RX-4 specifications
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#11 Post by Jörg Riesmeier »

These are linker error messages and are not related to the modification you've made to dcsignat.cxx. See FAQ #26.

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#12 Post by yeganeh »

i do the same but the problem not solved.
________
make a vaporizer
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#13 Post by yeganeh »

really thanks for your support dear J?rg Riesmeier

by that solution mem leak solved.but what ishould do for:


i wanted to use DcmSignature to retrive signature from a signed structure report file.then in this signed dicom file i wanted to be sure that the certificate which used to signe is trusted and belonge to me(consider i am a self signed CA and want to produce certificate for my company).
with SiCertificate i just can extract raw certificate data not verify of the trusted one.and this is my problem.
________
vapor genie review
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#14 Post by Jörg Riesmeier »

I guess class SiCertificateVerifier provides what you are looking for. DICOMscope also uses this class (through the dcmpstat module) in order to check the trustworthyness of a signature.

yeganeh
Posts: 43
Joined: Mon, 2008-10-27, 07:38

#15 Post by yeganeh »

hi
i used SiCertificateVerifier .i mean i do SiCertificateVerifier::addTrustedCertificateFile.see i use a self signed CA and issued certificates for my group. it's a trusted one for my local network.when i used SiCertificateVerifier::verifyCertificate(a) were a is a SiCertificate object which retrives from the signature of a dicom file the return value if error :"signature verification failed.certificate issued by unknown CA"
what i should do?

one more :where i could find the openssl source file witch i can compile them in MD mode?
thanks in advanced.
________
hotels in mexico city
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Majestic-12 [Bot] and 1 guest