Loads a certificate from a PEM- or DER-encoded stream, returning a
certificate. The fields of the certificate can be inspected using
certificate_field(+Certificate, ?Field).
Note that the OpenSSL CA.pl
utility creates certificates
that have a human readable textual representation in front of the PEM
representation. You can use the following to skip to the certificate if
you know it is a PEM certificate:
skip_to_pem_cert(In) :-
repeat,
( peek_char(In, '-')
-> !
; skip(In, 0'\n),
at_end_of_stream(In), !
).