digital-signature

OpenSSL Digitally Sign Digest Only

╄→гoц情女王★ 提交于 2021-01-29 12:08:43
问题 I have a signing server where you can upload a file and it will respond with the digital signature. It is using openssl dgst -sha256 -sign which works fine. However, we've had to start signing large files (>1 GB) and the uploads take forever. I had the idea that we could compute the sha256 digest locally and pass just that to the signing server which would speed things up considerably. However, this seemingly simple task seems crazy hard with openssl. Is there a reason for this? I found one

Itext java digital signature text and border color and

为君一笑 提交于 2021-01-29 09:25:07
问题 Please let me know,how do we modify below text which appears above digital signature using java itext. Text is shown in black color in image. "Document certified by xyz" How do we change above text , color and font size ? Thanks 回答1: In comments you clarified that you use a deprecated option to make the PDF viewer display the validation result in the signature visualization. (Use of this option is strongly recommended against; in current PDF specifications - ISO 32000-2:2017 - it is forbidden

“malformed reference element” exception signing a XML file

做~自己de王妃 提交于 2021-01-29 04:09:41
问题 I'm trying to sign a XML document with a reference to the KeyInfo node but I'm getting "malformed reference element" exception after calling the method "ComputeSignature". This is my code: signedXml.SigningKey = certificate.PrivateKey; if (!signParameters.IncludeCertificateInSignature) return; var certificateKeyInfo = new KeyInfo(); certificateKeyInfo.AddClause(new KeyInfoX509Data(certificate)); signedXml.KeyInfo = certificateKeyInfo; signedXml.KeyInfo.Id = "xmldsig-keyinfo"; signedXml

Sign Xml with digital certificate in format of PKCS#7 in DER (ITU-T Rec. X.690)

假装没事ソ 提交于 2021-01-28 18:22:16
问题 I have a .xml file that has to be signed with digital certificate in format of PKCS#7 version 1.5 (RFC 2315) and DER (ITU-T Recommendation X.690 That .xml will be send to a govt. WebService that only accept the format I mentioned upwards. What I'm able to do - thanks to this website is digitaly sign .xml with the .pfx file that I generated with Certificate Export Wizard explained below. The class that I'm using to sign is down on mentioned website or here. From what I tried to understand so

Bouncy Castle convert ASN.1 to r and s byte arrays

徘徊边缘 提交于 2021-01-28 13:31:52
问题 I have the following code that generates a digital signature: byte[] GetSignature(byte[] message, byte[] privateKey) { var ecParams = NistNamedCurves.GetByName("P-256"); var domainParameters = new ECDomainParameters(ecParams.Curve, ecParams.G, ecParams.N, ecParams.H, ecParams.GetSeed()); var d = new BigInteger(1, privateKey); var privateKeyParameters = new ECPrivateKeyParameters(d, domainParameters); var signer = SignerUtilities.GetSigner("SHA-256withECDSA"); signer.Init(true,

Bouncy Castle convert ASN.1 to r and s byte arrays

岁酱吖の 提交于 2021-01-28 13:31:30
问题 I have the following code that generates a digital signature: byte[] GetSignature(byte[] message, byte[] privateKey) { var ecParams = NistNamedCurves.GetByName("P-256"); var domainParameters = new ECDomainParameters(ecParams.Curve, ecParams.G, ecParams.N, ecParams.H, ecParams.GetSeed()); var d = new BigInteger(1, privateKey); var privateKeyParameters = new ECPrivateKeyParameters(d, domainParameters); var signer = SignerUtilities.GetSigner("SHA-256withECDSA"); signer.Init(true,

Error validating CMS signature

不问归期 提交于 2021-01-28 09:21:03
问题 For the past 2 weeks I've been banging my head against a wall trying to create and validate CMS signatures in Swift 4 using OpenSSL. My code is ultimately destined to be run on Linux, so I can't use the macOS Security framework. I believe I have finally gotten CMS signature creation working properly. My code for that looks like this: let testBundle = Bundle(for: type(of: self)) guard let textUrl = testBundle.url(forResource: "test_message", withExtension: "txt"), let signingKeyUrl =

What's the detail in “SHA1withRSA”?

*爱你&永不变心* 提交于 2021-01-28 07:02:45
问题 Innocently, I thought "SHA1withRSA algorithm" was simply operating the plainText with "SHA1", and use RSA/pkcs1padding to encrypt the result of "SHA1"。However, I found I was wrong until I wrote some java code to test what I thought. I use RSA publickey to decrypt the signature which I use the corresponding privatekey to sign with "SHA1withRSA algorithm" . But I found the result is not equal to "SHA1(plainText)", below is my java code: String plaintext= "123456"; Signature signature=Signature

Digitally sign a hex string in command line using elliptic curve secp256k1

房东的猫 提交于 2021-01-28 06:51:40
问题 I'm trying to figure out the most simple way to digitally sign a string of hex values using a private key also represented by a string of hex values. I'm open to command line, or a script, but preferably using openssl cli. Example: string to sign: 1333183ddf384da83ed49296136c70d206ad2b19331bf25d390e69b222165e37 private key: a675c86089e0622c112379906f5cf19ee336575af1bfa1de558051312db9afdc Hoping there is a command like: $ openssl sign -msg

C# PKCS7 Smartcard Digital Signature - Document has been altered or corrupted since it was signed

我怕爱的太早我们不能终老 提交于 2021-01-27 21:17:49
问题 I try to sign a pdf file using my smartcard (USB token) but encounter "Document has been altered or corrupted since it was signed" error when I open the signed pdf file in Adobe. The error is not so descriptive and I'm not sure where to look at because the code seems good to me but apparently it's not.. The code that I use is: var signer = smartCardManager.getSigner("myTokenPassword"); var toBeSignedHash = GetHashOfPdf(File.ReadAllBytes(@"xxx\pdf.pdf"), cert.asX509Certificate2().RawData, "dsa