public EsitoCheckFileSigned CheckSignTimeStampFileInfo2(string FileToVerifiy, string FileToVerifiyWithoutSign) { EsitoCheckFileSigned oEsitoCheckFileSigned = new EsitoCheckFileSigned(); try { // const string FileToVerifiy = @"C:\Users\GTorelli\Desktop\Firmati Marcati\Notifica_6789_20040312110300.pdf.p7m"; SC.FileIni = @"arcsql35.ini"; _Logger.WriteOnLog(_sLogId, "Verifico la firma", 3); using (var signSC = new SC(true)) { _Logger.WriteOnLog(_sLogId, "Eseguo la verifica", 3); var checkResult = signSC.Verify(FileToVerifiy, VerifyDegree.StandardVerify, SaveOption.SaveSignContent, @FileToVerifiyWithoutSign); _Logger.WriteOnLog(_sLogId, _Logger.ToJson(checkResult), 3); var sPathFileDecrypted = @checkResult.ContentFileName; if (File.Exists(sPathFileDecrypted)) { oEsitoCheckFileSigned.FileNameDecrypt = checkResult.ContentFileName; oEsitoCheckFileSigned.byteContentDecrypt = FileUtil.ReadFully(sPathFileDecrypted); } if (checkResult.SignaturesValid == true) { oEsitoCheckFileSigned.Check = true; oEsitoCheckFileSigned.Descrizione = "Il file di tipo P7M è stato correttamente validato."; } // true else if (checkResult.SignaturesValid == false) { oEsitoCheckFileSigned.Check = false; oEsitoCheckFileSigned.Descrizione = "Il file di tipo PDF NON è valido."; } // false else { oEsitoCheckFileSigned.Check = false; oEsitoCheckFileSigned.Descrizione = "Il file non è firmato."; } // null } } catch (Exception ex) { _Logger.WriteOnLog(_sLogId, ex.StackTrace + " - " + ex.Message + " - " + ex.Source, 1); throw new ArgumentException(ex.Message + " - " + ex.StackTrace); } return(oEsitoCheckFileSigned); }
public List <dynamic> GetAttachmentExt(string stGuidConnect, SVAOLLib.Card gCard, List <string> idAttachments, Boolean addBinary = true) { //Controllo se non è stato aperto già un File di Log bool newcon = false; //controllo se sono già connesso, in caso contrario mi connetto e ritorno la stringa di connessione SVAOLLib.Session oSession = new SVAOLLib.Session(); oSession.GUIDconnect = stGuidConnect; SVAOLLib.Attachment oAttachmentFrom = new SVAOLLib.Attachment(); oAttachmentFrom.GUIDconnect = stGuidConnect; oAttachmentFrom.GuidCard = gCard.GuidCard; dynamic objAttachment; Object aBinaryData = new Object(); List <dynamic> objAttachments = new List <dynamic>(); try { int iCount; object[,] attachments = (object[, ])gCard.AttachmentsAsArray; for (iCount = 1; iCount < attachments.GetLength(0); iCount++) { if (Convert.ToInt32(attachments[iCount, 3]) == 0) { objAttachment = new DynamicDictionary(); objAttachment.id = attachments[iCount, 1].ToString(); objAttachment.nomefile = attachments[iCount, 4].ToString(); objAttachment.note = attachments[iCount, 2].ToString(); objAttachment.binarycontent = Convert.ToBase64String((byte[])(aBinaryData)); objAttachments.Add(objAttachment); } } return(objAttachments); } catch (Exception e) { _Logger.WriteOnLog(_sLogId, "ERRORE NELL'ESECUZIONE DI : GetAttachmentExt", 1); _Logger.WriteOnLog(_sLogId, e.Source + " " + e.Message, 1); return(null); throw new Exception(String.Format("{0}>>{1}>>{2}", "GetAttachmentExt", e.Source, e.Message), e); } finally { if (newcon) { oSession.Logout(); } } }
public WsAction(string sUser) { ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(customXertificateValidation); resourceFileManager = ResourceFileManager.Instance; resourceFileManager.SetResources(); Logger = new LOLIB(); oRijndael = new Rijndael(); if (LogId == null || LogId == "") { LogId = LOLIB.CodeGen(sUser); } string sPathWork = resourceFileManager.getConfigData("WorkFolder"); sWorkingFolder = sPathWork + @"\" + LogId; System.IO.Directory.CreateDirectory(sWorkingFolder); Logger.WriteOnLog(LogId, "Creazione della directory di lavoro: " + sWorkingFolder, 3); }
public Outcome base64ToPdfA(MainDocument mainDoc, out MainDocument mainDocOut) { string strMessage = ""; mainDocOut = new MainDocument(); Outcome esito = new Outcome(); esito.iCode = 1; esito.sTransactionId = LogId; try { if (mainDoc.Validate(out strMessage)) { Logger.WriteOnLog(LogId, "Oggetto da convertire: " + mainDoc.ToXml(), 3); Convert2PdfManager oConvert2PdfManager = new Convert2PdfManager(); oConvert2PdfManager.ConvertMainDoc(mainDoc, Logger, sWorkingFolder, LogId, out mainDocOut); } else { Logger.WriteOnLog(LogId, "Oggetto NON Convertito: " + mainDoc.ToXml(), 3); esito.iCode = 0; } } catch (Exception e) { esito.iCode = 0; strMessage = e.Message; Logger.WriteOnLog(LogId, e.Source + " -> " + e.StackTrace + " -> " + e.Message, 3); } finally { Logger.WriteOnLog(LogId, "Fine elaborazione", 3); esito.sDescription = strMessage; if (esito.iCode == 1) { Logger.WriteOnLog(LogId, esito.iCode + " - " + strMessage, 3); Logger.RenameFileLog(LogId, "OK_" + LogId); } else { Logger.WriteOnLog(LogId, esito.iCode + " - " + strMessage, 3); Logger.RenameFileLog(LogId, "KO_" + LogId); } } return(esito); }