digital-signature

Reading RSA Private Key in PEM format And Reading public Key from certificate

爱⌒轻易说出口 提交于 2019-12-11 23:17:23
问题 I'm trying to use a PEM(X.509) certificate (stored in a privateKey.pem file on disk) to sign messages.After that i need to verify signature by using certificate (sent to the receiver). Help with this, especially example code in c# and RSA algorithm 回答1: You may find the Bouncycastle C# library to be of value in your problem. There is a PEMReader class that should be able to read in your PEM file and convert the contents to Bouncycastle cryptography objects. And there is a DotNetUtilities

Is there a way to programmatically predefine the purpose when signing an office document?

冷暖自知 提交于 2019-12-11 21:25:25
问题 I'm creating an Excel file *.xlsx in a C# environment with Microsoft Excel Interop. I call the signing dialog programmatically with the following commands: using Excel = Microsoft.Office.Interop.Excel; Excel.Application xlapp = null; xlapp = new Microsoft.Office.Interop.Excel.Application(); Excel.Workbook xlwb = xlapp.Workbooks.Add(); object sigID = "{00000000-0000-0000-0000-000000000000}"; xlwb.Signatures.AddNonVisibleSignature(sigID); The "Sign" dialog appears and the user's credentials are

Sign MimeBodyPart which has attachments in it (with Bouncycastle)

妖精的绣舞 提交于 2019-12-11 19:41:25
问题 I am working with OpenAS2Server-1.3.3 library. There sending a single document is working fine.. Now I wanted to modify it to send document with attachments, like we do with emails. In this scenario, all the decription work well, but signature verification failed (MIC is not matched) This is how I am tring to send attachments with main doc: Create a MimeMultipart and add two MimeBodyPart into it. (main document and the attachment) Finally wrap the MimeMultipart within a MimeBodyPart (I am not

Xml signing with remote applet devices

偶尔善良 提交于 2019-12-11 19:03:13
问题 All files are stored in the cloud system. The average size of file 200MB.Very large size of the files.Also Usb token on the client side. I don't want to transfer entire file from the server to client. I just want to sign the hash of the file on the client side. How can I do this with the xades4j library? 回答1: I'm not sure I fully understood, but here are some ideas: Make the file accessible via HTTP. Xade4j (actually, the underlying Apache Santuario) already supports HTTP data object

jsrsasign - how to extract an x.509 certificate's fingerprint?

烂漫一生 提交于 2019-12-11 17:43:44
问题 Is it possible to use jsrsasign to extract the fingerprint of an x.509 certficate, similar to what can be achieved using this openssl command: openssl x509 -sha1 -in cert.pem -noout -fingerprint - Ref: openssl x.509 doc I'm reading my X509 like so: var c = new X509(); c.readCertPEM(cert); \\ how to get the fingerprint? Ref: jsrsasign x.509 apidoc 回答1: You just need to extract the string from between the "-----BEGIN CERTIFICATE-----" header and "-----END CERTIFICATE----- " footer, base64

Verify digital signature with ItextSharp

穿精又带淫゛_ 提交于 2019-12-11 17:31:31
问题 I'm trying to verify digital signatures in c# using iTextSharp. I've followed the example in the iText web (http://gitlab.itextsupport.com/itextsharp/tutorial/blob/master/signatures/chapter5/C5_03_CertificateValidation/C5_03_CertificateValidation.cs) but the results aren't what I expected. Specifically, when trying to verify a signature through OCSP or CRL, the result usually is that the signature couldn't be verified. I think that shouldn't happen, since Adobe Reader verificates the

itext pdf verify if signature is visible or invisible

点点圈 提交于 2019-12-11 16:55:57
问题 I am currently using Itext 5.4.4 and I would like to know if it is possible to check if a signature in my current PDF is visible or invisible. Is this possible? Or do I have to upgrade to a newer versión of Itext? 回答1: You can do it like the code below. Other flags are easily added.. PdfReader reader; //instantiate AcroFields acroFields = reader.getAcroFields(); Map<String, Item> fieldNames = acroFields.getFields(); Set<Entry<String, Item>> entries = fieldNames.entrySet(); Iterator<Entry

PDF signature itext pkcs7 multi sign

做~自己de王妃 提交于 2019-12-11 16:46:34
问题 I would like to do multiple signature on pdf document, like in a workflow. I am using following code to sign pdf which I wrote, which works fine. To get hash public String getHash() { LOGGER.debug("PDFSigner.getHash : method invoked"); String pdfHashValue = null; try { int contentEstimated = PDFSigner.CONTENT_ESTIMATED;//8192 HashMap<PdfName, Integer> exc = new HashMap<>(); exc.put(PdfName.CONTENTS, contentEstimated * 2 + 2); PdfSignature pdfSignature = new PdfSignature(PdfName.ADOBE_PPKLITE,

iText7 multiple signature

ぃ、小莉子 提交于 2019-12-11 15:21:56
问题 I want to do multiple signatures in a pdf document with iText7 , but the problem is when I have once sign , it works . If I sign twice , the first signature is invalid . It looks like this : unsigned PDF signed PDF and here is my code: @Test public void testMutiSign() { iTextSignerUtil1.SignMultPDF(getBytes(unsignedPath), destPath1); iTextSignerUtil2.SignMultPDF(getBytes(destPath1), destPath2); } IExternalSignatureContainer externalP7DetachSignatureContainer = new IExternalSignatureContainer(

Sign Pdf Using ITextSharp and XML Signature

守給你的承諾、 提交于 2019-12-11 15:21:53
问题 I am trying to sing a pdf using a remote web service which returns a XML signature that consists of PKCS#1 signature with end users certificate. I need to use this signature to sign pdf via IText deferred signing because the web service works asynchronously . All the IText examples uses PKCS#7 message format but I am not sure what should I do for XML signature. Code That Adds Empty Signature Field and Gets Signable Bytes of Pdf public static string GetBytesToSign(string unsignedPdf, string