Re: World's smallest well-formed certificate
Erwann Abalea <[email protected]>
| Newsgroups | gmane.ietf.x509 |
|---|---|
| Message-ID | <CA+i=0E78phJHizoOniU3+wrJBWKbLhCKwZKVF5oLC0xwqV74GQ@mail.gmail.com> |
Bonjour, Your examples have serial numbers encoded with a zero length, this is not DER compliant. The Name type used for issuer and subject is an unconstrained SEQUENCE OF, so in theory it can be empty and be well-formed (from a DER point of view). My proposal, 66 octets: -----BEGIN CERTIFICATE----- MEAwNgIBADADBgEAMAAwHhcNMTYwNTE4MDAwMDAwWhcNMTcwNTE4MDAwMDAwWjAA MAgwAwYBAAMBADADBgEAAwEA -----END CERTIFICATE----- 2016-05-18 11:25 GMT+02:00 Rob Stradling <[email protected]>: > Hi Sean. I can get OpenSSL to not barf in 99 bytes... > > $ echo "-----BEGIN CERTIFICATE----- > MGEwVwIAMAMGAQAwCTEHMAUGAQATADAeFw0xNjA1MTgwMDAwMDBaFw0xNzA1MTgw > MDAwMDBaMAkxBzAFBgEAEwAwGDANBgkqhkiG9w0BAQEFAAMHADAEAgACADADBgEA > AwEA > -----END CERTIFICATE-----" | openssl x509 -text -noout > Certificate: > Data: > Version: 1 (0x0) > Serial Number: 0 (0x0) > Signature Algorithm: 0.0 > Issuer: 0.0= > Validity > Not Before: May 18 00:00:00 2016 GMT > Not After : May 18 00:00:00 2017 GMT > Subject: 0.0= > Subject Public Key Info: > Public Key Algorithm: rsaEncryption > Public-Key: (0 bit) > Modulus: 0 > Exponent: 0 > Signature Algorithm: 0.0 > > > I see what you mean about barfing on a "malformed" public key. This was > my first attempt... > > $ echo "-----BEGIN CERTIFICATE----- > MFEwRwIAMAMGAQAwCTEHMAUGAQATADAeFw0xNjA1MTgwMDAwMDBaFw0xNzA1MTgw > MDAwMDBaMAkxBzAFBgEAEwAwCDADBgEAAwEAMAMGAQADAQA= > -----END CERTIFICATE-----" | openssl x509 -text -noout > Certificate: > Data: > Version: 1 (0x0) > Serial Number: 0 (0x0) > Signature Algorithm: 0.0 > Issuer: 0.0= > Validity > Not Before: May 18 00:00:00 2016 GMT > Not After : May 18 00:00:00 2017 GMT > Subject: 0.0= > Subject Public Key Info: > Public Key Algorithm: 0.0 > Unable to load Public Key > 3073144508:error:0609E09C:digital envelope > routines:PKEY_SET_TYPE:unsupported algorithm:p_lib.c:231: > 3073144508:error:0B07706F:x509 certificate > routines:X509_PUBKEY_get:unsupported algorithm:x_pubkey.c:148: > Signature Algorithm: 0.0 > > P.S. OpenSSL barfs on an RDN Attribute of type NULL, so I used a > zero-length PrintableString instead. > > On 18/05/16 08:29, Sean Leonard wrote: > >> I'm working on a problem that involves the DER encoding of the smallest >> well-formed (yet pathological) certificate. How many octets can the >> world's smallest well-formed certificate be? >> >> A Certificate is a SEQUENCE of TBSCertificate, AlgorithmIdentifier, and >> BIT STRING (the signature). The world's smallest certificate would be >> version = 1 (therefore omitted), a serial number of 0, a hypothetical >> signature (AlgorithmIdentifier) that has the world's smallest object >> identifier (0.0) and no parameters, an issuer Name (distinguished name) >> that has one RDN that has one Attribute whose type is the world's >> smallest object identifier (0.0) and whose value is the ASN.1's smallest >> value (NULL), with proper validity times, the same or similar smallest >> subject Name, a well-formed SubjectPublicKeyInfo, and none of the >> optional fields: issuerUniqueID, subjectUniqueID, and extensions. >> >> By "well-formed", I mean that an ASN.1 '88 parser (i.e., one that does >> not enforce information object classes) will parse it (including the BIT >> STRING contents) and not barf. Such a certificate could not possibly be >> "valid", since the signature block would not be a real digital signature. >> >> Sean >> >> (PS For those who want to know "why", it's because I am trying to test >> some assumptions about how small a certificate can be.) >> > > -- > Rob Stradling > Senior Research & Development Scientist > COMODO - Creating Trust Online > > > _______________________________________________ > pkix mailing list > [email protected] > https://www.ietf.org/mailman/listinfo/pkix > -- Erwann. _______________________________________________ pkix mailing list [email protected] https://www.ietf.org/mailman/listinfo/pkix