2 library(ssl): Secure Socket Layer (SSL) library
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog SSL Interface
        • library(ssl): Secure Socket Layer (SSL) library
          • ssl_context/3
          • ssl_add_certificate_key/4
          • ssl_set_options/3
          • ssl_negotiate/5
          • ssl_peer_certificate/2
          • ssl_peer_certificate_chain/2
          • ssl_session/2
          • load_certificate/2
          • load_crl/2
          • system_root_certificates/1
          • load_private_key/3
          • load_public_key/2
          • cert_accept_any/5
          • ssl_secure_ciphers/1
Availability::- use_module(library(ssl)).(can be autoloaded)
Source[det]load_certificate(+Stream, -Certificate)
Loads a certificate from a PEM- or DER-encoded stream, returning a term which will unify with the same certificate if presented in cert_verify_hook. A certificate is a list containing the following terms: issuer_name/1, hash/1, signature/1, signature_algorithm/1, version/1, notbefore/1, notafter/1, serial/1, subject/1 and key/1. subject/1 and issuer_name/1 are both lists of =/2 terms representing the name. With OpenSSL 1.0.2 and greater, to_be_signed/1 is also available, yielding the hexadecimal representation of the TBS (to-be-signed) portion of the certificate.

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), !
      ).