xenc_key_create_cert
Import a key from a certificate
xenc_key_create_cert
(in name varchar,
in cert varchar,
in type varchar,
in fmt int,
in pkey varchar,
in pass varchar);
Description
The function is used to import a key (usually an asymmetric key like RSA or DSA)
into user's space from a certificate.
Parameters
name –
The name of the key to be registered
cert –
String containing the certificate
type –
'X.509' is only supported value
fmt –
The input format of the certificate: 3 - "DER", 1 - "PEM" or 2 - "PKCS#12".
pkey –
When an X.509 certificate is imported, this can be supplied to load
the corresponding private key also. This is optional. Note that when
the PKCS#12 format is used to import an X.509 certificate, the private
key is in the 'cert', hence this parameter in such case must be
omitted.
pass –
The password to unlock the private key. If not required this can be NULL
to indicate no password is needed.
Errors
This function can generate the following errors:
.
Examples
Importing a key from X.509 certificate
...
xenc_key_create_cert ('myRSA', file_to_string ('keys/mycert.pfx'), 'X.509', 2, NULL, 'secret');
xenc_set_primary_key ('myRSA');
...