Is that possible in general? There's no maximum key size or signature size, and certificates can have extensions.
I typically read the file size first, then allocate memory, then read the file. In general, hard coding a maximum length is used to enable a buffer overflow attack. :-) owner-openssl-us...@openssl.org wrote on 07/26/2011 07:38:12 AM: > From: Katif <yiz...@gmail.com> > To: openssl-users@openssl.org > Date: 07/26/2011 09:17 AM > > I need to know in advance the maximum length of the following three PEM > formatted files (excluding the -----BEGIN/END lines): > > Private key file, Certificate file, CA certificate file. > > For example - the following file has 68 characters length: > > -----BEGIN CERTIFICATE----- > MIIDCDCCAfACCQDhtkeHC+WN+DANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJQ > TD > -----END CERTIFICATE-----