Top

Name

xenc_x509_csr_generate — Generate Certificate Signing Request (CSR)

Synopsis

varchar xenc_x509_csr_generate ( in cli_pk_name varchar ,
  in subject array ,
  in extensions array );
 

Description

This function generates Certificate Signing Request (CSR)

Parameters

cli_pk_name

The user's private key name.

subject

An array of name/value pairs representing the subject aka name enties, for ex:

('CN', 'Demo User', 'C', 'US')

extensions

An array of name/value pairs to add as X.509v3 extensions to certificate.

Return Types

String

Errors

Table 24.118. Errors signalled by xenc_x509_csr_generate

SQLState Error Code Error Text Description
22023 XECXX Missing key  
22023 XECXX Key is not DSA nor RSA  
22023 XECXX Missing private key  
22023 XECXX Subject array must be name/value pairs  
22023 XECXX Extension array must be name/value pairs  
42000 XECXX Can not create pkey  
42000 XECXX Can not assign primary key  
42000 XECXX Can not create pkey  
42000 XECXX Can not create x.509 structure  
42000 XECXX Can not sign certificate : [the sign error text]  

Examples

Example 24.485. Create a new xenc_x509 CSR

SQL> create procedure csr_gen_demo()
{
declare kname, cvalue varchar;
       xenc_key_RSA_create ('myRSAkey', 1024);
       xenc_x509_csr_generate ('myRSAkey',
		vector (
			'CN', 'Demo user',
			'C',  'US',
			'O',  'OpenLink',
			'OU', 'Accounts',
			'emailAddress', 'demo@openlinksw.com'),
		vector ('subjectAltName', 'URI: http://www.openlinksw.com/dataspace/person/demo#this', 'nsComment', 'Virtuoso Generated Certificate',
			'authorityKeyIdentifier', 'keyid,issuer:always'));
};

Done. -- 0 msec.
SQL> select csr_gen_demo();
temp
VARCHAR
_______________________________________________________________________________

-----BEGIN CERTIFICATE REQUEST-----
MIICLDCCAZUCADBrMRIwEAYDVQQDEwlEZW1vIHVzZXIxCzAJBgNVBAYTAlVTMREw
DwYDVQQKEwhPcGVuTGluazERMA8GA1UECxMIQWNjb3VudHMxIjAgBgkqhkiG9w0B
CQEWE2RlbW9Ab3Blbmxpbmtzdy5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ
AoGBAM+e21xeQIJX5ySd6Juc3GtCnyT+JvDKgoxkmovFdqkCm1Ks7Pys0x59ksSZ
DZoEATEt/sQsEB7AnRAkH76lWyG0zMtvxdkFH8Cepaaq4bcdqSgmE12DRwViR95a
ZNA8vhonr5UdTbtKkIGD67IrkGH81C8trwF+8LnYKdtf1bMdAgMBAAGggYEwfwYJ
KoZIhvcNAQkOMXIwcDA/BgNVHREEODA2hjRodHRwOi8vd3d3Lm9wZW5saW5rc3cu
Y29tL2RhdGFzcGFjZS9wZXJzb24vZGVtbyN0aGlzMC0GCWCGSAGG+EIBDQQgFh5W
aXJ0dW9zbyBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwDQYJKoZIhvcNAQEEBQADgYEA
CQ+UeQGWLnHn5X9tKumvgP2p4LgxHsNq0uFZffVBRUAV6w8WRwor5ZKOeNhHrldp
ZvxHc9ESFBTA772W01VmQNfpjkFcpH5yd81dFkSsF3lKemQIHnlz4bORU4av2TMM
T9OIp5FNOec13jXqVesymd+Kl+Vb9sRBaC1Xb1OSryU=
-----END CERTIFICATE REQUEST-----

1 Rows. -- 390 msec.