Skip to content

Commit

Permalink
Merge pull request #78 from italia/bugfixing
Browse files Browse the repository at this point in the history
Fixes #112, #135, #140 and disables graphic signature checkbox when signing without a paired CIE.
  • Loading branch information
aantetomaso authored Jun 20, 2024
2 parents 62e38f5 + 4dc63fb commit 4d2337b
Show file tree
Hide file tree
Showing 358 changed files with 123,035 additions and 37 deletions.
61 changes: 32 additions & 29 deletions CIEID/src/it/ipzs/cieid/MainFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -1508,45 +1508,46 @@ public void run() {
}

System.out.printf("Verifica con CIE - Url: %s, Port: %s, credentials: %s", proxyAddress, proxyPort, proxyCredentials);
final long ret = Middleware.INSTANCE.verificaConCIE(filePath, proxyAddress, proxyPort, proxyCredentials);
final int ret = Middleware.INSTANCE.verificaConCIE(filePath, proxyAddress, proxyPort, proxyCredentials);

if (ret == 0) {
int nSign = Middleware.INSTANCE.getNumberOfSign();
if (ret > 0 && ret != (long)INVALID_FILE_TYPE) {

if (nSign == 0) {
logger.Info("Verifica completata");
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Il file selezionato non contiene firme", "Verifica completata", JOptionPane.INFORMATION_MESSAGE);
tabbedPane.setSelectedIndex(10);
} else {
VerifyTable vTable = new VerifyTable(verifyScrollPane);
verifyInfo vInfo = new verifyInfo();
verifyInfo[] vInfos = (verifyInfo[])vInfo.toArray(nSign);

for (int i = 0; i < nSign; i++) {
Middleware.INSTANCE.getVerifyInfo(i, vInfos[i]);
vInfos[i].printVerifyInfo();
vTable.addDataToModel(verifyScrollPane, vInfos[i]);
}
VerifyTable vTable = new VerifyTable(verifyScrollPane);
verifyInfo vInfo = new verifyInfo();
verifyInfo[] vInfos = (verifyInfo[])vInfo.toArray(ret);

verifyScrollPane.repaint();
for (int i = 0; i < ret; i++) {
Middleware.INSTANCE.getVerifyInfo(i, vInfos[i]);
vInfos[i].printVerifyInfo();
vTable.addDataToModel(verifyScrollPane, vInfos[i]);
}

if (FilenameUtils.getExtension(filePath).equals("p7m")) {
btnExtractP7M.setEnabled(true);
} else {
btnExtractP7M.setEnabled(false);
}
verifyScrollPane.repaint();

tabbedPane.setSelectedIndex(16);
if (FilenameUtils.getExtension(filePath).equals("p7m")) {
btnExtractP7M.setEnabled(true);
} else {
btnExtractP7M.setEnabled(false);
}
} else if (ret == (long)INVALID_FILE_TYPE) {

tabbedPane.setSelectedIndex(16);
}
else if (ret == (long)INVALID_FILE_TYPE) {
logger.Error("Il file selezionato non è un file valido");
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Il file selezionato non è un file valido. E' possibile verificare solo file con estensione .p7m o .pdf", "Errore nella pnVerify", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Il file selezionato non è un file valido. E' possibile verificare solo file con estensione .p7m o .pdf", "Errore nella verifica", JOptionPane.ERROR_MESSAGE);
tabbedPane.setSelectedIndex(10);
} else {
logger.Error("Errore generico durante la pnVerify");
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Si è verificato un errore durante la pnVerify", "Errore nella pnVerify", JOptionPane.ERROR_MESSAGE);
}
else if (ret == 0) {
logger.Info("Verifica completata");
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Il file selezionato non contiene firme.", "Verifica completata", JOptionPane.INFORMATION_MESSAGE);
tabbedPane.setSelectedIndex(10);
}
else {
logger.Error("Errore generico durante la verifica");
JOptionPane.showMessageDialog(MainFrame.this.getContentPane(), "Si è verificato un errore durante la verifica", "Errore nella verifica", JOptionPane.ERROR_MESSAGE);
tabbedPane.setSelectedIndex(10);
}

}
});
}
Expand Down Expand Up @@ -1579,8 +1580,10 @@ public void mouseClicked(MouseEvent e) {

if (getFileExtension(filePath).equals(".pdf") && !shouldSignWithoutPairing) {
cbGraphicSig.setEnabled(true);
cbGraphicSig.setVisible(true);
} else {
cbGraphicSig.setEnabled(false);
cbGraphicSig.setVisible(false);
}

tabbedPane.setSelectedIndex(12);
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.3-7
1.4.3-9
8 changes: 5 additions & 3 deletions cie-pkcs11/CSP/VerificaConCIE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ extern "C" {
CK_RV CK_ENTRY estraiP7m(const char* inFilePath, const char* outFilePath);
}

CK_RV CK_ENTRY verificaConCIE(const char* inFilePath, const char* proxyAddress, int proxyPort, const char* usrPass)

CK_RV CK_ENTRY verificaConCIE( const char* inFilePath, const char* proxyAddress, int proxyPort, const char* usrPass)
{
CIEVerify* verifier = new CIEVerify();
CIEVerify* verifier = new CIEVerify();

verifier->verify(inFilePath, (VERIFY_RESULT*)&verifyResult, proxyAddress, proxyPort, usrPass);
verifier->verify(inFilePath, (VERIFY_RESULT*)&verifyResult, proxyAddress, proxyPort, usrPass);

if (verifyResult.nErrorCode == 0)
{
Expand All @@ -37,6 +38,7 @@ CK_RV CK_ENTRY verificaConCIE(const char* inFilePath, const char* proxyAddress,
printf("Errore nella verifica: %lu\n", verifyResult.nErrorCode);
return verifyResult.nErrorCode;
}

}

CK_RV CK_ENTRY getNumberOfSign(void)
Expand Down
8 changes: 4 additions & 4 deletions cie-pkcs11/Util/defines.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "funccallinfo.h"

#include "funccallinfo.h"

#define StatusWord uint16_t

Expand Down Expand Up @@ -52,9 +52,9 @@

#define logParam(p)
#define logParamBuf(p,l)
#define logParamBufHide(p,l)
#define logParamBufHide(p,l)

CLog Log;
extern CLog Log;

#define init_func \
CFuncCallInfo info(__FUNCTION__ ,Log);
Expand Down
1 change: 1 addition & 0 deletions cie-pkcs11/Util/log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum logMode {
LM_Module_Thread // un file per modulo e per thread
} LogMode = LM_Module;

CLog Log;

void initLog(const char *moduleName, const char *iniFile,const char *version)
{
Expand Down
Loading

0 comments on commit 4d2337b

Please sign in to comment.