digital-signature

Adding a digital signature to a PDF using Java

烈酒焚心 提交于 2019-12-03 13:53:19
问题 I want to digitally sign a PDF file using a certificate stored on a USB-token, HSM, etc. How do I use the private key stored on the USB token using JAVA? 回答1: To the iText self-reference, I'll add Gnostice DigiSigner Apache PDFBox (open source) Java4Less (open source, based on PDFBox) Adobe LiveCycle jPDFSecure Oracle Fusion 回答2: Steps involved in Adding Digital Signature to a PDF File: (I) Create Template PDFDocument : Create PDFDocument with template signature: PDSignature pdSignature;

PGP-signing multipart e-mails with Python

喜你入骨 提交于 2019-12-03 12:37:18
I'm currently trying to add PGP signing support to my small e-mail sending script (which uses Python 3.x and python-gnupg module). The code that signs message is: gpg = gnupg.GPG() basetext = basemsg.as_string().replace('\n', '\r\n') signature = str(gpg.sign(basetext, detach=True)) if signature: signmsg = messageFromSignature(signature) msg = MIMEMultipart(_subtype="signed", micalg="pgp-sha1", protocol="application/pgp-signature") msg.attach(basemsg) msg.attach(signmsg) else: print('Warning: failed to sign the message!') (Here basemsg is of email.message.Message type.) And messageFromSignature

CMS signing in .NET with certificate chain not in local trusted certificate store

爷,独闯天下 提交于 2019-12-03 12:22:13
I have X509 certificates that are stored on the network. I can read the chain from remote windows certificate store. I need to sign some data and include chain to the signature to make it possible to validate it later. The problem is that I can't find a way to put certificate chain to the CsmSigner. I have read that it takes certificate from constructor parameter and tries to build a chain with X509Chain.Build. It ignores Certificates list values and fails (obviously) because no certificate can be found in the local Windows cert store. Please find below my test code (that works only if

Java and .NET interop on (RSA) signatures

安稳与你 提交于 2019-12-03 09:20:12
I'm signing some data on a .net-based smartcard and trying to verify that signature in a java environment - but without success. Smartcard (c#): RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); // In a different method, rsaParams.Exponent and rsaParams.Modulus are set rsaProvider.ImportParameters(rsaParams); // Here I'm importing the key SHA1 sha1 = SHA1.Create(); byte[] signature = rsaProvider.SignData(data, sha1); Client (Java): Signature sig = Signature.getInstance("SHA1withRSA"); sig.initVerify(rsaPublicKey); // initiate the signature with public key sig.update

How to implement digital signature

拜拜、爱过 提交于 2019-12-03 09:14:40
We are building a web application(Java). Could anybody help brief me what we need to realize the following business scenario ? An user access our web site He inputs some data He generate a PDF file from the data he input and export it He digitally sign this PDF file He then upload this PDF file to our web site The system can parse the PDF file to know who signed this file and be sure it is of integrity and Non-repudiation and to some post-processes. My questions are: What products/libraries(commercial or free opensource) should I need to implement the above ? Do those products provide API for

How to RSA verify a signature in java that was generated in php

天大地大妈咪最大 提交于 2019-12-03 09:14:23
We are using phpseclib for Public key signing of data and android java is used for Public key verification. But it repeatedtly failed. PHP Code For generating keys and signing by private key include_once("phpseclib/autoload.php"); function getKeys($keysize=2048){ $rsa = new Crypt_RSA(); //$rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_OPENSSH); //$rsa->setPublicKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1); $rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS8); $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1); $d = $rsa->createKey($keysize); return array("publickey"=>$d['publickey'],

Separate digest & signing using java security provider

爷,独闯天下 提交于 2019-12-03 09:12:11
Due to some implementation detail, I need to split hashing and signature generation. I tried to achieve this using the 'NONEwithRSA' signature algorithm. This is a basic working example: public void rsaSignatureIntegrityTest() { KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); gen.initialize(2048, new SecureRandom()); KeyPair pair = gen.generateKeyPair(); byte[] digest = MessageDigest.getInstance("SHA-256").digest(MESSAGE); Signature signer = Signature.getInstance("NONEwithRSA"); signer.initSign(pair.getPrivate()); signer.update(digest); byte[] signed = signer.sign(); Signature

Timestamping using TSA URL and Java APIs

烈酒焚心 提交于 2019-12-03 09:03:03
Can anyone please help me in understanding the process and Java APIs used while timestamping a signature. I need to sign a file and timestamp it using TSA url " http://timestamp.globalsign.com/scripts/timstamp.dll " using Java APIs. I am able to sign the file using java.security APIs but unable to timestamp it. Your question is a bit broad... I will give you some info which I hope it will point you on the right direction. The thing is that you want to use a timestamp service to perform a timestamp signature using the service there: http://timestamp.globalsign.com/scripts/timstamp.dll . First

iPhone signature capture

橙三吉。 提交于 2019-12-03 08:33:15
Is it possible to transfer a signature from an iPhone into an .xls file via a cable (USB) connection? So, this may not be exactly what you are looking for, but this is how I capture a signature drawn by a user (with their finger/stylus). Your UIImageView will have the drawn signature. I have not thought about how to transfer the signature image to the .xls but you could save the image to the device's photo library then export it like you would any other image, then drop it into the .xls (I know, that's a manual process). I hope this helps. SignatureViewController.h IBOutlet UIImageView

Adding a OpenPGP signature to an already signed document? [closed]

我怕爱的太早我们不能终老 提交于 2019-12-03 08:30:30
We'd like to implement a workflow that requires multiple people to digitallly sign a document. If I have multiple secret keys in my own keychain, I can do something as simple as: gpg --sign -u userid1 -u userid2 filename But what do I do if I've got an already signed document and I want to add a signature? One solution would be to have everyone generate detached signatures for the document, and then package them all together in a zip file or something, but the overhead there is substantially higher. Is there a better way? No need to ZIP them: you can simply concatenate detached signatures in a