Re: World's smallest well-formed certificate

Rob Stradling <[email protected]>
Newsgroups gmane.ietf.x509
Message-ID <[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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.