working whit dcmsign
Moderator: Moderator Team
working whit dcmsign
hello
i wanted to write a simple program which sign a DICOM file.i use the dcmsign example.i included the for example "dcmtk/dcmsign/sicreapr.h" and link dcmsign lib at my project.but my program has error.it says that 'SiCreatorProfile' : undeclared identifier . what should i also include to my program?
regards
________
vapor genie
i wanted to write a simple program which sign a DICOM file.i use the dcmsign example.i included the for example "dcmtk/dcmsign/sicreapr.h" and link dcmsign lib at my project.but my program has error.it says that 'SiCreatorProfile' : undeclared identifier . what should i also include to my program?
regards
________
vapor genie
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
hi
i write a simple c++ program to use dcmsign example:
//--------- dcmtk Lib
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dctk.h"
//--------- for SIGNE
#include "dcmtk/dcmsign/sicreapr.h"
#include "dcmtk/dcmsign/siripemd.h"
#include "dcmtk/dcmsign/dcsignat.h"
#include "dcmtk/dcmsign/sicert.h"
#include "dcmtk/dcmsign/siprivat.h"
bool CSignApp::SigneDicomFile(string filename,string certif,string pKey)
{
bool resualt=true;
DcmFileFormat fileformat;
E_TransferSyntax xfer;
OFCondition status;
xfer = (fileformat.getDataset())->getOriginalXfer();
status= fileformat.loadFile(filename.data()
,xfer /*EXS_Unknown*/
,EGL_withoutGL
,DCM_MaxReadLength);
if (status.good())
{
DcmDataset *dataset = fileformat.getDataset();
SiCreatorProfile profile; // select the "RSA Creator Profile"
SiRIPEMD160 mac; // use RIPEMD160 as MAC algorithm
DcmSignature signer; // signature handler
SiCertificate cert; // our certificate
if (cert.loadCertificate(certif.data(), X509_FILETYPE_PEM).bad())
{
cerr << "unable to load certificate" << endl;
return false;
}
SiPrivateKey key; // private key, must be unencrypted here
if (key.loadPrivateKey("privkey.pem", X509_FILETYPE_PEM).bad())
{
cerr << "unable to load private key" << endl;
return false;
}
signer.attach(dataset); // connect handler to data set
if (signer.createSignature(key, cert, mac, profile).good())
{
fileformat.saveFile("test_signed.dcm"); // write back
}
}
return resualt;
}
i put the include path of the dcmtk include files and libs to my project.and link the :Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib zlib_o.lib
to my project.but when i compile my prog there is this error:
error C2065: 'SiCreatorProfile' : undeclared identifier
i don't know what's the matter.
thanks in advanced
________
iolite vaporizer
i write a simple c++ program to use dcmsign example:
//--------- dcmtk Lib
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */
#include "dcmtk/dcmdata/dctk.h"
//--------- for SIGNE
#include "dcmtk/dcmsign/sicreapr.h"
#include "dcmtk/dcmsign/siripemd.h"
#include "dcmtk/dcmsign/dcsignat.h"
#include "dcmtk/dcmsign/sicert.h"
#include "dcmtk/dcmsign/siprivat.h"
bool CSignApp::SigneDicomFile(string filename,string certif,string pKey)
{
bool resualt=true;
DcmFileFormat fileformat;
E_TransferSyntax xfer;
OFCondition status;
xfer = (fileformat.getDataset())->getOriginalXfer();
status= fileformat.loadFile(filename.data()
,xfer /*EXS_Unknown*/
,EGL_withoutGL
,DCM_MaxReadLength);
if (status.good())
{
DcmDataset *dataset = fileformat.getDataset();
SiCreatorProfile profile; // select the "RSA Creator Profile"
SiRIPEMD160 mac; // use RIPEMD160 as MAC algorithm
DcmSignature signer; // signature handler
SiCertificate cert; // our certificate
if (cert.loadCertificate(certif.data(), X509_FILETYPE_PEM).bad())
{
cerr << "unable to load certificate" << endl;
return false;
}
SiPrivateKey key; // private key, must be unencrypted here
if (key.loadPrivateKey("privkey.pem", X509_FILETYPE_PEM).bad())
{
cerr << "unable to load private key" << endl;
return false;
}
signer.attach(dataset); // connect handler to data set
if (signer.createSignature(key, cert, mac, profile).good())
{
fileformat.saveFile("test_signed.dcm"); // write back
}
}
return resualt;
}
i put the include path of the dcmtk include files and libs to my project.and link the :Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib zlib_o.lib
to my project.but when i compile my prog there is this error:
error C2065: 'SiCreatorProfile' : undeclared identifier
i don't know what's the matter.
thanks in advanced
________
iolite vaporizer
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
This is what is used for the dcmsign app (CMake format with OpenSSL but without ZLib):
Code: Select all
# make sure executables are linked to the corresponding libraries
TARGET_LINK_LIBRARIES(dcmsign netapi32 wsock32 ofstd dcmdata dcmdsig dcmtkssl_o.lib dcmtkeay_o.lib)
in cmake i set the parameter "whit_openssl" to on then reconfig the cmake.then in my project i link this libs:
Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib openssl.lib dcmtkssl_o.lib dcmtkeay_o.lib
but there is no diferencde yet
________
Chrysler Airflite
Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib openssl.lib dcmtkssl_o.lib dcmtkeay_o.lib
but there is no diferencde yet
________
Chrysler Airflite
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
i download dcmtk-3.5.4-win32-i386-support.zip and use openssl-0.9.8a directory and from here openssl-0.9.8a\lib get the dcmtkeay_o.lib and dcmtkssl_o.lib.then in my project link this libs:
Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib dcmtkssl_o.lib dcmtkeay_o.lib
but yet my program could not be compiled.
________
host and design
Ws2_32.lib Netapi32.lib ofstd.lib dcmdata.lib dcmdsig.lib dcmtkssl_o.lib dcmtkeay_o.lib
but yet my program could not be compiled.
________
host and design
Last edited by yeganeh on Thu, 2011-02-03, 10:34, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
i set the parameter "whit_openssl" in cmake and reconfig it.then i open dcmtk.sln and rebuild it.and yet my project can't complie
________
vapir oxygen
________
vapir oxygen
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Could you please check in your program whether WITH_OPENSSL is really defined e.g. by using the following:
Code: Select all
#ifndef WITH_OPENSSL
#error You did not compile with compiler definition WITH_OPENSSL defined
#endif
hi
thanks for your help.finally i can run my program.but in this simple code i open a .dcm file then i insert one signature to this.see my question is this: if we wanted to insert more than one signature what should we do?for example if the file has several sequence item and we wanted to insert one signature to each item of this.
thanks in advanced
________
drug tests
thanks for your help.finally i can run my program.but in this simple code i open a .dcm file then i insert one signature to this.see my question is this: if we wanted to insert more than one signature what should we do?for example if the file has several sequence item and we wanted to insert one signature to each item of this.
thanks in advanced
________
drug tests
Last edited by yeganeh on Thu, 2011-02-03, 10:35, edited 1 time in total.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests