Not able to load the certificate from a buffer(byte sequence)
See original GitHub issueHi I’m trying to load the certificate from the following buffer. b’0\x82\x02\x9a0\x82\x02\x01\xa0\x03\x02\x01\x02\x02\x08(\x81%\xf0s\x1b\xa5\x030\n\x06\x08*\x86H\xce=\x04\x03\x020!1\x1f0\x1d\x06\x03U\x04\x03\x13\x16ct-woodpecker CA51b4a40\x1e\x17\r220101000000Z\x17\r221231000000Z081604\x06\x03U\x04\x03\x13-288125f073.woodpecker.testing.letsencrypt.org0Y0\x13\x06\x07*\x86H\xce=\x02\x01\x06\x08*\x86H\xce=\x03\x01\x07\x03B\x00\x04\x1d\xce\xd7\xc8\x88\xb1Y1\xa6\x18\x81\xcd\xf6_\x97\x01\xc9\xf9\xe5\x7fh\x1f4\xb9\xa7l \xe6\x8d^T.\x97\x05\xe5 \x15\xdc\xfe\xa3\xb0\x087\xa2\x92\x80I\x98)X\x1d\xb3\xeb\x06\xda\xf9a\x8e\x02%\xff\x9b\x13\xab\xa3\x82\x01\n0\x82\x01\x060\x0e\x06\x03U\x1d\x0f\x01\x01\xff\x04\x04\x03\x02\x07\x800\x1d\x06\x03U\x1d%\x04\x160\x14\x06\x08+\x06\x01\x05\x05\x07\x03\x01\x06\x08+\x06\x01\x05\x05\x07\x03\x020\x0c\x06\x03U\x1d\x13\x01\x01\xff\x04\x020\x000L\x06\x08+\x06\x01\x05\x05\x07\x01\x01\x04@0>0<\x06\x08+\x06\x01\x05\x05\x070\x02\x860http://issuer.woodpecker.testing.letsencrypt.org08\x06\x03U\x1d\x11\x0410/\x82-288125f073.woodpecker.testing.letsencrypt.org0?\x06\x03U\x1d\x1f\x0480604\xa02\xa00\x86.http://crls.woodpecker.testing.letsencrypt.org0I\x06\x08*\x86H\xce=\x04\x03\x02\x13.This is not the certificate you're looking for\x13\r1588385814322\x03H\x000E\x02!\x00\xd6\xb8H\x0c\xa4Jw?\xd6 \xa6\x92\xd8\xbb\x88fu\xa7\x0fK\xef\xd9\xff\x16M\xa9\xb5\x97\x97\xcah\xa5\x02 m\xfc\xd9K\xb6\xfekZ\xb5\xfdA\xaf\x85\xa4\xafy\xbe\x0c\x0e^[\xe55\xa1B\xcc`*"r\xc9\xa4’
I’m using the following line to load the certificate crypto.load_certificate(crypto.FILETYPE_ASN1,buffer).
Exception: OpenSSL.crypto.Error: [(‘asn1 encoding routines’, ‘asn1_item_embed_d2i’, ‘sequence length mismatch’), (‘asn1 encoding routines’, ‘asn1_template_noexp_d2i’, ‘nested asn1 error’)]
However I’m able to parse the same byte sequence using C# x509 library. Any suggestions?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
I’m guessing the C# library just ignores extra data in that sequence.
On Mon, Apr 5, 2021 at 5:30 PM jayanitw @.***> wrote:
– All that is necessary for evil to succeed is for good people to do nothing.
This is because this isn’t a valid certificate as far as I can tell. the signatureAlgorithm is supposed to contain a sequence with two elements, an OID and a value defined by that oid. But this blob of bytes has a sequence with three elements
vs.