The function is used to export certificate in PEM format, optionally it can export also private key (if present)
This function can generate the following errors:
The example bellow imports a client public key, then it creates a certificate and sign it with CA's private key and finally it exports the generated certificate in PEM format.
kname := xenc_SPKI_read (null, replace (get_keyword ('key', params), '\r\n', ''));
xenc_x509_generate ('id_rsa', kname, sequence_next ('ca_id_rsa'), 365,
vector (
'CN', get_keyword ('name', params, name),
'C', get_keyword ('c', params, name),
'O', get_keyword ('o', params, name),
'OU', get_keyword ('ou', params, name),
'emailAddress', get_keyword ('email', params)
),
vector ('subjectAltName', 'URI:'||webid, 'nsComment', 'Virtuoso Generated Certificate',
'authorityKeyIdentifier', 'keyid,issuer:always'));
cvalue := xenc_pem_export (kname);