Tag: 签名

c#中的位图(签名)比较

我们有一个有趣的项目,要求我们比较两个签名的两个黑白位图,并说明它们是否是同一个人签名。 由于这只是两个加载的位图而不是从平板电脑捕获的数据,因此该方法将与正常的签名识别略有不同。 我认为这需要以下步骤 将位图裁剪为仅签名 尝试计算某种旋转来对齐它们 resize以使裁剪/旋转位图相同 分析内部的签名(可能通过分解为网格) 有没有人对这个项目有任何想法? 如何最好地进行轮换,比较等? 看到类似的东西?

在PDF上添加签名图像,而无需使用iTextSharp对其进行数字签名

我正在使用iTextSharp来处理PDF。 我想在签名字段中添加签名图像,而不对文档进行数字签名(不需要任何证书参与)。 可能吗? 我可以使用数字签名但我也想在签名字段上添加签名图像而不使用任何证书。 更新: 现在写我有以下代码。 // Set PDF Reader and PDF Stamper PdfReader reader = new PdfReader(sourceDocument); // File stream where PDF will write FileStream fout = new FileStream(destinationPath, FileMode.Create, FileAccess.ReadWrite); PdfStamper stamper = PdfStamper.CreateSignature(reader, fout, ‘\0’, null, true); // Set PDF Appearance PdfSignatureAppearance appearance = stamper.SignatureAppearance; iTextSharp.text.Image signatureFieldImage = iTextSharp.text.Image.GetInstance(image, System.Drawing.Imaging.ImageFormat.Png); appearance.SignatureGraphic = […]

ITextSharp SetVisibleSignature无法按预期工作

所以我一直在使用IText的Java实现,但现在我正在为C#编写一个签名过程的端口,我遇到了麻烦。 因此,当我使用SetVisibleSignature(rect,page,name)重载签署我的文档时,它会按预期签署文档(只要签名字段不存在),但是当我使用重载SetVisibleSignature(name)签名现有文档时字段,它实际上不签署文件。 我可能做了一些愚蠢的事情并且遗漏了什么吗? 感谢您的任何帮助。 更新的代码 using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.pdf.security; using Org.BouncyCastle.Security; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using BouncyCastle = Org.BouncyCastle; public class DocumentSigner : IDocumentSigner { private const string _datetimeFormat = “dd/MM/yyyy hh:mm:ss”; private readonly IDateTimeProvider _dateTimeProvider; private readonly ISettingManager _settingManager; public DocumentSigner(IDateTimeProvider dateTimeProvider, ISettingManager settingManager) […]

在C#中使用SetFilePointer已经取消了堆栈

好的,我在C#和.NET 4.0中使用SetFilePointer函数。 以下是我用来调用此函数的dllimports: [DllImport(“Kernel32.dll”, SetLastError = true, CharSet = CharSet.Auto, CallingConvention = CallingConvention.Cdecl)] static extern uint SetFilePointer([In] SafeFileHandle hFile, [In] long lDistanceToMove, [Out] out int lpDistanceToMoveHigh, [In] EMoveMethod dwMoveMethod); 每当我运行在调试器中使用SetFilePointer函数的代码时,我都会遇到以下exception: PInvokeStackImbalance was detected Message: A call to PInvoke function ‘MyDiskStuff!MyDiskStuff.HardDisk::SetFilePointer’ has unbalanced the stack. This is likely because the managed PInvoke signature does not match […]

C#支持对单个XML元素进行RSA SHA 256签名

我遇到过使用.NET Framework 4.5版的阻止程序来处理带有数字签名的XML。 我的问题是基于使用RSA SHA-256算法使用X.509证书签署单个XML元素的需要。 我已经阅读了很多关于这个主题的.NETpost,看来最初在CLR安全项目RSAPKCS1SHA256SignatureDescription.cs类中开发了一个解决方案。 RSAPKCS1SHA256SignatureDescription当然已经被整合到.net运行时中,从.NET 4.5开始,现在可以在分布式二进制System.Deployment.dll下使用。 我尝试在.NET中使用RSA SHA-256对特定的XML元素进行签名,但是还没有取得任何成功。 我正在尝试使用WSSE令牌签署符合Oasis ebms标准的SOAP消息。 请注意,该课程是为了满足Soap With Attachments(SwA)和签署个人附件而编写的。 我的代码如下 我的代码如下: using System; using System.Collections.Generic; using System.IO; using System.IdentityModel.Tokens; using System.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.Xml; using System.ServiceModel.Channels; using System.ServiceModel.Security; using System.Text; using System.Xml; using System.Xml.Linq; using System.Xml.Serialization; using System.Deployment.Internal.CodeSigning; namespace TestCSharpX509CertificateRSSHA256 { public class SignatureSupportUtility { private […]

c#中的数字签名,不使用BouncyCastle

如果不使用第三方BouncyCastle库,有没有办法读取自定义私钥并签署消息? (sha256 hash +使用私钥加密)

如何将hex字符串转换为有符号整数?

我得到一个hex字符串,需要转换为带符号的8位整数。 目前我正在使用Int16 / Int32进行转换,这显然不会给出8位整数的负值。 如果我在hex中得到值255,我如何将其转换为-1十进制? 我假设我想使用sbyte,但我不确定如何正确地获得该值。

如何使用Windows Cert Store中的证书签署PDF文档?

我需要使用Windows证书库中存在的证书来签署PDF文档。 我整天都在努力想弄明白,我离 这么远很近 。 所有缺少的是: 如何获取IExternalSignature对象来签署PDF文件? Rahul Singla写了一个很好的例子,说明如何使用新的iText 5.3.0 API签署PDF文档 – 只要你可以在某个地方访问PC上的.pfx文件。 有一个关于使用Windows证书存储区中的证书进行签名的问题 ,除了它使用的是仍然存在SetCrypto的API版本,并且签名显然是可选的。 在iText 5.3.0中,API已经改变,而SetCrypto不再是一件事。 以下是我到目前为止所做的评论(为后代添加了评论,因为这可能是如何在’网络上执行此操作的最完整和最新版本): using iTextSharp.text.pdf; using iTextSharp.text.pdf.security; using BcX509 = Org.BouncyCastle.X509; using Org.BouncyCastle.Pkcs; using Org.BouncyCastle.Crypto; using DotNetUtils = Org.BouncyCastle.Security.DotNetUtilities; … // Set up the PDF IO PdfReader reader = new PdfReader(@”some\dir\SomeTemplate.pdf”); PdfStamper stamper = PdfStamper.CreateSignature(reader, new FileStream(@”some\dir\SignedPdf.pdf”, FileMode.Create), ‘\0’); PdfSignatureAppearance sap […]

有人有任何代码从C#调用SignerSignEx吗?

非常感谢在这里做了与SignerSignEx示例等效的.Net的东西: http://blogs.msdn.com/b/alejacma/archive/2008/12/11/how-to-sign-exe-files-with-an-authenticode-certificate-part-2.aspx?CommentPosted=true 谢谢!!!!!!!

从.NET中的Authenticode签名文件中获取时间戳

我们需要validation二进制文件是否使用数字签名(Authenticode)正确签名。 这可以通过signtool.exe轻松实现。 但是,我们需要一种自动方式来validation签名者名称和时间戳。 这在使用CryptQueryObject() API的本机C ++中是可行的,如以下精彩示例所示: 如何从Authenticode签名的可执行文件获取信息 然而,我们生活在一个托管的世界:)因此寻找相同问题的C#解决方案。 直接的方法是pInvoke Crypt32.dll,一切都完成了。 但是System.Security.Cryptography.X509Certificates命名空间中有类似的托管API。 X509Certificate2类似乎提供了一些信息但没有时间戳。 现在我们来看原始问题,我们如何才能在C Sharp中获得数字签名的时间戳?