Compare serial number of certificates

The serial number of the certificates is checked together with the
issuer, since some certificates have the same subject and issuer but a
different serial number.

Also, the certificate subject, issuer and serial number are also written
to the certificates file just before the certificate itself, in order to
make it easier to distinguish each certificate in the file.