digital-signature

PDFBox - opening and saving a signed pdf invalidates my signature

隐身守侯 提交于 2019-11-28 05:56:46
问题 I am trying to learn to use Apache's pdfBox to deal with digitaly signed documents for work. During testing, I created a completely empty pdf document. I then signed the document through Adobe reader using the sign with certificate function. I tried to open, save and close the signed file with pdfBox without any modifications. However once I open the file in Adobe the files are no longer valid. Adobe tells me: "There are errors in the formatting or information contained in this signature

Provide secure Facebook authentication with my Server

穿精又带淫゛_ 提交于 2019-11-28 04:44:50
I would like to build a little mobile App (Android and iOS) and a little backend server with a REST Api. My app users (android or iOS) needs to login on facebook. I do that by using facebooks mobile sdk. When the login has been successful, facebook sdk will return a authentificationToken, that is now on the users smartphone. The idea is as follows: Whenever my app needs some data, the app will conntact to my server backend (REST) over HTTPS. For example: The app makes a simple HTTP GET and passes the retrieved Facebook authenticationToken. My Server gets this facebook authenticationToken and

Verifying app's signature by code [duplicate]

旧街凉风 提交于 2019-11-28 04:34:12
问题 This question already has answers here : How to obtain codesigned application certificate info (3 answers) Closed 5 years ago . I have app signed. I created an identity and used codesign to sign my app as per Apple's Code Signing Guide. Now, how do I check the signature from within my application? I need to verify this on Cocoa apps (Objective-C) and apps written in C. 回答1: Note: Currently MacOS X does not verify signed code prior to execution. This may be different for sandboxed code, and it

Java implementation of C# SignedCms

若如初见. 提交于 2019-11-28 03:11:40
问题 I am working on an implementation of C# SignedCms functionality in Java. I am using bouncycastle libs. The problem is I get java signature that is different from the one generated with SignedCms. C# code X509Certificate2 certificate = new X509Certificate2("myCertPath", "myPass"); String text = "text"; ContentInfo contentInfo = new ContentInfo(System.Text.Encoding.UTF8.GetBytes(text)); SignedCms cms = new SignedCms(contentInfo, false); CmsSigner signer = new CmsSigner(certificate); signer

iText7 LtvVerification.addVerification not enabling LTV

左心房为你撑大大i 提交于 2019-11-28 00:37:26
We are trying to make the signed signature LTV enabled. I am using the below code to add verification. When signature.isTsp() is false, the PDF says Signature is not LTV enabled , though in the other case (signature.isTsp() is true) it shows as valid. When we open the PDF and try to manually add verification info by right clicking on the signature it enables LTV without any issue. Not sure what we are missing here. Any input will be highly helpful. // Adds LTV-enabled information to the PDF document. private ByteArrayOutputStream addLtv(final IOcspClient ocspClient, final ByteArrayOutputStream

Generate Digital Signature but with a Specific Namespace Prefix (“ds:”)

白昼怎懂夜的黑 提交于 2019-11-27 23:38:18
I digitally sign XML files, but need the signature tags contain the namespace prefix "ds". I researched quite the google and found many of the same questions, but no satisfactory answer. I tried to put the "ds" manually in the file, but the signature becomes invalid. The tag "SignatureValue" signs the tag "SignedInfo" so the signature becomes invalid. Could somebody show me how I generate the value of the tag "SignatureValue" so I can replace the signature after adding the prefix "ds"? Apparently a lot of people ran into the same problem. After investigating source code of the class Signature

verifying detached signature with BC

蹲街弑〆低调 提交于 2019-11-27 22:24:56
问题 How can I verify a detached signature (CMS/pkcs #7 signature) using the BouncyCastle provider in Java? Currently, my code below throws an exception with the message message-digest attribute value does not match calculated value Security.addProvider(new BouncyCastleProvider()); File f = new File(filename); byte[] buffer = new byte[(int)f.length()]; DataInputStream in = new DataInputStream(new FileInputStream(f)); in.readFully(buffer); in.close(); CMSSignedData signature = new CMSSignedData

How to make a digital signature in a web application (JavaScript) using a smartcard?

半腔热情 提交于 2019-11-27 19:33:07
We have written a document management system and would like to digitally sign documents using the web client. Our Java client application is already able to apply and check digital signature, but we would like to make signature even with our web client. This is written in GWT and so, when run on the client side, it is a JavaScript application. We not want to create a Java applet and download it on the client and execute it. We would like to use the browser security device or the browser API in order to sign a document. We would also like to keep the complete document server side, and move to

How to sign string with private key

本秂侑毒 提交于 2019-11-27 18:24:36
How can I get the signature of a string using SHA1withRSA if I already have the Private Key as byte[] or String ? Prabath Siriwardena I guess what you say is you know the key pair before hand and want to sign/verify with that. Please see the following code. import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException; import java.security.Signature; import sun.misc.BASE64Encoder; public class MainClass { public static void main(String[] args) throws Exception { KeyPair keyPair = getKeyPair(); byte[] data = "test".getBytes("UTF8"); Signature

In C#, sign an xml with a x.509 certificate and check the signature

拟墨画扇 提交于 2019-11-27 18:02:36
I'm trying to sign an XML file using a x.509 certificate, I can use the private key to sign the document and then use the CheckSignature method (it has an overload that receives a certificate as parameter) to verify the signature. The problem is that the user who validates the signature must have the certificate, my concern is, if the user has the certificate then he has access to the private key, and as I understand, this is private and should be available only to the user who signs. What am I missing? Thanks for your help. In .NET, If you get your X509 cert from a .pfx file, like this: