Questions tagged [asn1crypto]

Fast ASN.1 parser and serializer with definitions for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7, PKCS#8, PKCS#12, PKCS#5, X.509 and TSP

15 questions
3
votes
1 answer

Searching for certain values in asn1 cert

The asn1crypto package with x509 is being used. I'd like to find particular values in the .der file. The file is opened and read(), then: mycert = x509.Certificate.load(data) This returns an object of type asn1crypto.x509.Certificate like so…
pymat
  • 1,090
  • 1
  • 23
  • 45
3
votes
1 answer

Creating and saving CMS / PKCS#7 objects in Python

I need to be able to generate, save and read CMS / PKCS#7 data in Python. It seems that it can be done using asn1crypto library, but I am having a hard time finding functions that would allow me to save the data to the disk (in PEM/DER format).…
3
votes
1 answer

Export Time stamp 'signing_time' from signed data in asn1 format

Question is: Exporting timestamp (signing time) from signeddata? I verify my signature before. I have an asn1 signed data to verification. import cryptography import OpenSSL from OpenSSL.crypto import * from asn1crypto import cms, util, x509, pem,…
Iraj
  • 137
  • 1
  • 1
  • 8
2
votes
1 answer

Openssl Asn1parse does not extract data correctly

Issue in decoding openssl data using asn1parse. After using asn1parse command , out.pem contains does not match with expected output. Both the actual and expected output are shown below. Please help me in this issue. openssl asn1parse -inform PEM…
1
vote
1 answer

Verifying a pdf signature with Endesive raises an error when accessing SignerInfo native

I am trying to compare a signature with a certificate for a pdf file in python. I found this very nice package called endesive. I followed the example for verifying a pdf signature and I have something like this: pdf_file_path =…
OldDew
  • 57
  • 10
0
votes
0 answers

Is it possible to ASN1 decode a string with a custom ASN1 specification in flutter/dart?

I have a custom ASN1 specification as a .asn file that defines a complex data structure. What I essentially want to do is, to decode strings that have been encoded with this specification to a data structure that i can then use within my flutter…
Krypton
  • 9
  • 2
0
votes
1 answer

Retrieving email in PDF signature with asn1crypto

I have a PDF file with the following signature: I try to explore the PDF file using the following code: from pdfrw import PdfReader, PdfWriter from PyPDF2 import PdfFileReader import subprocess from endesive import pdf from pdfreader import…
CaTx
  • 1,421
  • 4
  • 21
  • 42
0
votes
0 answers

asn1crypto not evaluating cms.ContentInfo correctly until the fourth time

I have the following PDF file. I try to explore it using the following code: from pdfrw import PdfReader, PdfWriter from PyPDF2 import PdfFileReader import subprocess from endesive import pdf from pdfreader import PDFDocument from asn1crypto import…
CaTx
  • 1,421
  • 4
  • 21
  • 42
0
votes
1 answer

How to extract the signature from a p7s file?

I need the Python code to extract from the p7s file the signature resulting from digitally signing a document, in both situations where the payload is inside of, and external to, the p7s file. I have tried several crypto packages (PyOpenSSL,…
lcofresi
  • 33
  • 6
0
votes
0 answers

How to extract the pub part from a X509 Subject Public Key Info?

So I have a certificate in pem format (mycert.pem), from which I only need to extract the public key. openssl x509 -in mycert.pem -pubkey -noout gives me a public key. However, it seems to be the base64 encoded string of the entire subject public…
Leo
  • 1,508
  • 13
  • 27
0
votes
0 answers

OpenSSL C API to implement openssl asn1parse logic

Decoded data using openssl asn1parse with the command "openssl asn1parse -in a.pem -out b.pem". How to implement the same using Openssl C language API.
0
votes
1 answer

Adding LTV (Long Term Validation) makes byterange invalid

I am writing a small library intended to be a high level (as in simple to use) library for digitally signing pdf's generated with the WeasyPrint library (https://github.com/Kozea/WeasyPrint). I have already got it working for self-signed…
hejsan
  • 371
  • 2
  • 7
0
votes
0 answers

How to Decode SCT List from SSL cert in C#

I am currently doing this : var extensions = (certificate.Extensions ?? new X509ExtensionCollection()).Cast(); var sctExtension = extensions.Where(x => x.Oid.Value.Equals("1.3.6.1.4.1.11129.2.4.2")).FirstOrDefault(); …
Deepak
  • 5
  • 4
0
votes
0 answers

Error while extracting public key from PKCS11 and Asn1crypto signed certificate

In addition to this thread: Where is the trust chain? [python] asn1crypto and pkcs11 Aladdin USB eToken I tried: openssl x509 -pubkey -noout -in cert.pem Error getting public key 140003854860736:error:0D0680A8:asn1 encoding…
0
votes
1 answer

Does asn1crypto or ocspbuilder support multiple certs OCSP status requests?

Making in Python a OCSP service that supports for instance such requests: openssl ocsp -issuer ca-cert.pem -cert 1.pem -cert 2.pem -cert 3.pem -no_nonce -url http://localhost/ocsp -noverify I can see that the OCSP Request list is populated with 3…
andrea-f
  • 1,045
  • 9
  • 23