Initializing help system before first use

x509getinfo

x509getinfo


Purpose
Retrieve information stored in an X509 certificate.
Synopsis
function x509getinfo(x509:string, info:array(string) of text):integer
Arguments
x509 
Certificate file in PEM format
info 
Array where to store certificate information
Return value
Number of items stored in the array or -1 in case of error.
Example
The example below shows how to display the properties of a certificate:
declarations
 info:array(S:set of string) of text
end-declarations

if x509getinfo("srv.crt",info)<1 then
 writeln("Failed to load certificate")
else
 forall(s in S | exists(info(s)))
  writeln("   ", s, ":", info(s))
end-if
Further information
This function retrieves some of the information recorded in an X509 certificate. The data is recorded in the provided array indexed by the labels of the records in the certificate. The possible labels are:
Version 
Format version of the certificate
Serial 
Serial number
Issuer 
Issuer of the certificate
Subject 
Entity associated to the public key stored in the certificate
NotBefore 
Valid after this date
NotAfter 
Valid until this date
SgnAlg 
Algorithm used to sign the certificate
A self-signed certificate (such as those created with x509newcrt) will have identical values for Issuer and Subject.
Related topics
Module