/// <summary> /// Verifica un file firmato e/o marcato /// </summary> /// <param name="fileName"></param> /// <param name="verifyDegree"></param> /// <param name="saveOptions"></param> /// <param name="saveTo"></param> /// <param name="signFormat"></param> /// <param name="timestampFormat"></param> /// <returns></returns> public VerifyResult Verify(string fileName, VerifyDegree verifyDegree = VerifyDegree.StandardVerify, SaveOption saveOptions = SaveOption.DontSave, string saveTo = null, SignatureType signFormat = SignatureType.EnvelopedDataSignature, TimeStampFileFormat timestampFormat = TimeStampFileFormat.UndefinedTimeStampFormat) { StringBuilder workPath = null; if (saveOptions != 0 || !string.IsNullOrEmpty(saveTo)) { workPath = new StringBuilder(260); } if (!string.IsNullOrEmpty(saveTo)) { workPath.Append(saveTo); } Violation tsViolation, signViolation; var success = NativeMethods.SvScVerifyCryptographicEnvelope(signSCHandle, timestampFormat, fileName, workPath, verifyDegree, signFormat, saveOptions, out tsViolation, out signViolation); CheckScResult(success || tsViolation != 0 || signViolation != 0); return(new VerifyResult { SignatureViolation = (signFormat == SignatureType.None && signViolation == Violation.Syntactic) ? (Violation?)null : signViolation, TimestampViolation = (timestampFormat == TimeStampFileFormat.UndefinedTimeStampFormat && tsViolation == Violation.Syntactic) ? (Violation?)null : tsViolation, ContentFileName = workPath?.ToString(), }); }
bool SvScVerifyCryptographicEnvelope( uint hSignSC, TimeStampFileFormat eTSFormat, string sTSFilePath, StringBuilder sFilePath, VerifyDegree eVerifyDegree, SignatureType eSignedContentFormat, SaveOption eSaveOptions, out Violation pTSVerifyResult, out Violation pContentVerifyResult);
public VerifyResult VerifyDetached(string envelopeFileName, string contentFileName, VerifyDegree verifyDegree = VerifyDegree.StandardVerify, SignatureType signFormat = SignatureType.EnvelopedDataSignature, TimeStampFileFormat timestampFormat = TimeStampFileFormat.UndefinedTimeStampFormat) { var workPath = new StringBuilder(contentFileName); Violation tsViolation, signViolation; var success = NativeMethods.SvScVerifyCryptographicEnvelope(signSCHandle, timestampFormat, envelopeFileName, workPath, verifyDegree, signFormat, SaveOption.DontSave, out tsViolation, out signViolation); CheckScResult(success || tsViolation != 0 || signViolation != 0); return(new VerifyResult { SignatureViolation = (signFormat == SignatureType.None && signViolation == Violation.Syntactic) ? (Violation?)null : signViolation, TimestampViolation = (timestampFormat == TimeStampFileFormat.UndefinedTimeStampFormat && tsViolation == Violation.Syntactic) ? (Violation?)null : tsViolation, }); }