digital-signature

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

浪子不回头ぞ 提交于 2019-11-27 04:37:08
问题 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"? 回答1:

How to load a PKCS#12 Digital Certificate with Javascript WebCrypto API

我与影子孤独终老i 提交于 2019-11-27 04:25:36
I'm trying to sign data using the WebCrypto API, but instead of creating a private/public key and exporting it to pkcs#1 or 8, I would really like to use a user's PKCS#12 to sign data. I've read the W3C spec, but cannot make much of it and can't find any good material on how to do this. Right now I want to leave ActiveX and Java Applets aside. Is there a way to tweak the following: var buffer = encode(prompt("Please enter your password")); //TODO: //implement a prompt for a pfx or cert return crypto.subtle.importKey("raw", buffer, "PBKDF2", false, usages); //TODO: //instead of importing it,

Error occurred while decoding OAEP padding

耗尽温柔 提交于 2019-11-27 03:53:02
问题 While decrypting text using RSACryptoServiceProvider.Decrypt , I am getting the error: Error occurred while decoding OAEP padding. Here's my code: CspParameters cspParam = new CspParameters(); cspParam = new CspParameters(); cspParam.Flags = CspProviderFlags.UseMachineKeyStore; clsCertificates cc = new clsCertificates(); string a = ""; cc.OpenStoreIE(ref a); cc.SetProperties(); X509Certificate2 cert = new X509Certificate2(); cert = cc.x509_2Cert; RSACryptoServiceProvider rsa = new

how to digitally sign a file in PHP

谁说胖子不能爱 提交于 2019-11-27 03:44:46
问题 I made a user table in my DB with different columns for holding users' info. Also I have added two columns public_key and private_key . When a user registers, his info will be inserted to the table. plus I am using: // Create the keypair $res=openssl_pkey_new(); // Get private key openssl_pkey_export($res, $privatekey); // Get public key $publickey=openssl_pkey_get_details($res); $publickey=$publickey["key"]; to create a random key pair and give it to user so that every user has a key pair. I

Add signed/authenticated attributes to CMS signature using BouncyCastle

℡╲_俬逩灬. 提交于 2019-11-27 03:37:00
问题 I want to generate a simple CMS signature using bouncycastle. This code works! Security.addProvider(new BouncyCastleProvider()); String password = "123456"; KeyStore ks = KeyStore.getInstance("PKCS12"); ks.load(new FileInputStream("c:/cert_123456.p12"), password.toCharArray()); String alias = (String)ks.aliases().nextElement(); PrivateKey key = (PrivateKey)ks.getKey(alias, password.toCharArray()); Certificate[] chain = ks.getCertificateChain(alias); CMSSignedDataGenerator generator = new

iText - Generating PDF hash without certificate chain

痴心易碎 提交于 2019-11-27 02:59:07
问题 I'm trying to build an application where the following happens: A client requests a PDF-hash from the server. The server generates the hash of a PDF-file and sends this to the client. The client signs this hash with his private key and sends the signed hash along with the public part of his own certificate. The server generates a new, signed PDF file. The problem I'm having with this: It seems impossible for the server to generate a to-be-signed hash without having the client's certificate

Adding a digital signature to a pdf file [duplicate]

蓝咒 提交于 2019-11-27 02:50:42
问题 Possible Duplicate: Digitally sign PDF files In the application a user will upload a PDF file and then upload a personal signature created using a digital pen. How can I embed this signature in the pdf file? 回答1: Use a PDF editing library. I've used this one before: http://pdfsharp.com/PDFsharp/ 回答2: As far as I have been able to figure out, you can't programmatically sign the document and still have it be a valid signature. I am looking at this from the most strictest of positions though. I

How to Digitally Sign GST Return or eReturn using JavaScript form Browser and USB Token of user? Can I use WebCrypto API?

試著忘記壹切 提交于 2019-11-27 02:18:21
Looking for Javascript code to sign GST or Income Tax eReturns from Browser using USB Token. Recently much is being talked about WebCrypto API but as of now, WebCrypto API does not provide access to (Windows) or any other Key stores or local crypto USB/Smartcard device. Older methods being java applets, Active X, etc which are phased out or are being phased out from the Modern Browser offerings. Most of the web applications require Digital Signing pdf documents, files, eReturns (XML or JSON) etc, from user’s Browser using user’s local machine Key-store, USB Token or Smartcard. Also in most of

How to retrieve my public and private key from the keystore we created

无人久伴 提交于 2019-11-27 01:41:18
问题 My task is the following: Retrieve my public and private key from the keystore I created. Use these keys to encrypt a paragraph using my RSA 2048-bit public key. Digitally sign the result using the DSA-SHA-1 signature algorithm. Save the digital signature output on a file called output.dat . The program below is throwing error : "java.security.InvalidKeyException: No installed provider supports this key: sun.security.provider.DSAPublicKeyImpl". import java.security.*; import java.security

Provide secure Facebook authentication with my Server

a 夏天 提交于 2019-11-27 00:37:43
问题 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