digital-signature

XML Canonicalization algorithm gives two difference results when called directly than when called as part of an xml digital signature?

落花浮王杯 提交于 2019-11-30 19:39:57
I'm getting two different hashes of the same xml document when I directly canonicalize some xml than when I perform a digital signature on it which also performs the same canonicalization algoririth on the xml before hashing it? I worked out that the digital signature canonicalization includes the new line characters '\n' and spacing characters when canonicalizing and the direct algorithm does not. Including the new line characters + spaces is not in the canonicalization specification though? I'm specifically looking at this version http://www.w3.org/TR/2001/REC-xml-c14n-20010315 Does anyone

In java using PDFBox, how to create visible digital signature with text

旧城冷巷雨未停 提交于 2019-11-30 19:25:45
问题 Digital text with text and background imageI am trying to digitally sign pdf file using PDFBox in Java with visible text to appear on page similar to one that gets created when manually created in Acrobat. As shown in the image (one with only snap shot I am looking for and another with details of digital signature too), this example shows signing using image file. How to do that? 回答1: This code will be included among the samples in the upcoming 2.0.9 release of PDFBox. See also the discussion

js signature on chrome with OS keystore

不想你离开。 提交于 2019-11-30 18:11:31
问题 W3C is working on a http://www.w3.org/TR/WebCryptoAPI/ to define a way to generate digital signatures, encrypton and so on from javascript. Basically defines a new object crypto inside a window object in DOM which must provide javascript with signature and encrypton features. Chrome starts to implement this object which is currently available in its javascript engine (I think in beta stage), I make some tries to generate some signatures with it an seems to work correctly, however I think the

Digitally Sign Parts of a XML document

徘徊边缘 提交于 2019-11-30 16:25:56
问题 I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (using .net c#) ? 回答1: You should be able to add an XPath-Transform to the Signature. It should look something like this: <Transform Algorithm="http://www.w3.org/TR/1999/REC

Digitally Sign Parts of a XML document

倾然丶 夕夏残阳落幕 提交于 2019-11-30 16:08:53
I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (using .net c#) ? You should be able to add an XPath-Transform to the Signature. It should look something like this: <Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"> <XPath xmlns:dsig="&dsig;"> ... </XPath> </Transform> I am not fluent in XPath, but it should

How to digitally sign PDF documents using Python with an etoken (pen drive)?

假装没事ソ 提交于 2019-11-30 16:04:47
How to digitally sign PDF documents using Python? I have an etoken (in pen drive). Additionally, I have created an excel file using openpyxl and converted it into PDF. Now there is a requirement that I need to add digital signature to that PDF document. Is there any way I can achieve this in python? Use python module designed for this task, it signs digitally PDF-s. Everything what You should have is p12/pfx file with certificate. Simple example in: github repository example #!/usr/bin/env python3 # *-* coding: utf-8 *-* from oscrypto import asymmetric from endesive import pdf def main(): dct

Java Digital Signature different to C#

ぐ巨炮叔叔 提交于 2019-11-30 15:57:57
问题 I have the following c# code to generate a digital signature from a private key: static string Sign(string text, string certificate) { X509Certificate2 cert = new X509Certificate2(certificate, "TestPassword", X509KeyStorageFlags.Exportable); RSACryptoServiceProvider rsa = (RSACryptoServiceProvider)cert.PrivateKey; // Hash the data SHA1Managed sha1 = new SHA1Managed(); ASCIIEncoding encoding = new ASCIIEncoding(); byte[] data = encoding.GetBytes(text); byte[] hash = sha1.ComputeHash(data); //

Securing a license key with RSA key

て烟熏妆下的殇ゞ 提交于 2019-11-30 14:47:42
it's late, I'm tired, and probably being quite dense.... I have written an application that I need to secure so it will only run on machines that I generate a key for. What I am doing for now is getting the BIOS serial number and generating a hash from that, I then am encrypting it using a XML RSA private key. I then sign the XML to ensure that it is not tampered with. I am trying to package the public key to decrypt and verify the signature with, but every time I try to execute the code as a different user than the one that generated the signature I get a failure on the signature. Most of my

Managed Windows Service starts up slowly after digital signing

南楼画角 提交于 2019-11-30 14:13:45
We recently tried out digitally signing our .NET binaries. We have a Windows Service which typically starts up within 10 seconds. However after we started digitally signing it, the time increased to around 20-30 seconds. Googling led to me this: http://support.microsoft.com/kb/936707 which basically says that I have to set generatePublisherEvidence to false. But the description of generatePublisherEvidence on MSDN points to the fact that this is not applicable for .NET 4. Still I tried out this setting and it did work. I double checked that my binaries do target .NET 4. Can someone please

Validating Azure AD Token signature fails JAVA

这一生的挚爱 提交于 2019-11-30 13:49:40
I am struggling to validate an Azure AD token signature. When I look up the correct key description in the "jwks_uri" field under https://login.microsoftonline.com/common/.well-known/openid-configuration I check the belonging key data . I try to use the "n" - modulus and "e" fields to generate the public key for the signature validation I end up with an error: BASE64Decoder decoder = new BASE64Decoder(); byte[] modulusBytes = decoder.decodeBuffer(n); byte[] exponentBytes = decoder.decodeBuffer(e); BigInteger modulusInt = new BigInteger(1, modulusBytes); BigInteger exponentInt = new BigInteger