Skip to content

How to generate a x.509 certificate with a Serial Number using openssl? #106

Discussion options

You must be logged in to vote

You can supply your own interpolation values for text stamps / qr stamps using the appearance_text_params argument to sign_pdf and friends. You could use those to create %(st)s and %(serial)s parameters, if you'd want to.

As for how to extract the information to populate those variables from the certificate: have a look at the properties on this class in asn1crypto (that's also the one pyHanko uses internally). Getting the serial number is straightforward, but extracting a RDN segment like ST will require a bit more digging. You'll want to parse that out of the x509.Name structure that represents the certificate's subject. asn1crypto can help you with that as well.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Vishwamithra37
Comment options

@MatthiasValvekens
Comment options

Answer selected by Vishwamithra37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants