Initializing help system before first use

x509newcrt

Purpose
Create a new self-signed X509 certificate.
Synopsis
function x509newcrt(x509:string, kfile:string, info:array(string) of text):integer
Arguments
x509 
Certificate file to create (PEM format)
kfile 
File containing the private key
info 
Array describing the certificate properties
Return value
0 if success or -1 in the case of an error.
Example
The following example creates a certificate that is valid for 3 years, using a new RSA key:
info("Version"):="1"
info("Serial"):="123456789"
info("Duration"):=text(365*3)
info("C"):="FR"
info("O"):="My Company"
info("CN"):="www.mycomp.com"
if RSAgenkey(1024,"srv.key")<=0 then
 writeln("Failed to create RSA key")
elif x509newcrt("srv.crt","srv.key",info)<>0 then
 writeln("Failed to create certificate")
end-if
Further information
1. This function creates a self-signed X509 certificate. Such a certificate can be used to run an HTTPS server but clients of such a server have to disable server certificate verification (see https_trustsrv) or include this certificate in their trusted certificate file (see https_cacerts).
2. The routine expects an array with indices defining the following entries (a default value applies if the entry is missing):
Version 
Format version of the certificate (default: 1)
Serial 
Serial number (default: 1)
Duration 
Validity (in days) from the current date (default: 365)
Country code (default: system country or 'EU')
Organisation name (default: anonymous)
CN 
Common Name (typically the host name to authenticate, default: localhost)
The entries C, O and CN are used to generate the Issuer and Subject records of the certificate. The provided key is used both as the certificate key (using the public part of the key) and as the signing key.
Related topics
Module

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.