# 22. Virtuoso Functions Guide - x509_certificate_verify

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
dsig_template_ext
md5
md5_final
md5_init
md5_update
x509_certificate_ver...
xenc_x509_certificat...
xenc_decrypt_soap
xenc_delete_temp_key...
xenc_encrypt
xenc_get_key_algo
xenc_get_key_identif...
xenc_key_3des_create
xenc_key_3des_rand_c...
xenc_key_3des_read
xenc_key_aes_create
xenc_key_aes_rand_cr...
xenc_key_dsa_create
xenc_key_dsa_read
xenc_key_rsa_read
xenc_key_create_cert
xenc_key_exists
xenc_key_inst_create
xenc_key_remove
xenc_key_serialize
xenc_set_primary_key
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
XML
XPATH & XQUERY
Functions Index

## x509_certificate_verify

Verifies X.509 certificate
varchar x509_certificate_verify (in cert varchar, in cacerts any, [in flags varchar]);
Description

This function takes a X.509 certificate and verifies it against list of CA certificates. It checks for various certificate attributes such as self signed, expiration date etc. If an error is detected it will be signalled.

The certificates are passed as a strings containing X.509 certificate binary data in DER (raw) format.

Parameters
cert – The X.509 certificate to be verified
cacerts – array of strings containing CA certificates
flags – A string containing comma separated list of verification options. See table below for valid values.

Table: 22.1. Values for flags
Option | Description
--- | ---
expired | Do not check for expiration
self-signed | Do not treat self signed certificate as error
invalid-ca | Ignore invalid CA
invalid-purpose | Ignore invaid certificate purpose
unhandled-extension | Ignore unhadled critical extension

Return Types

None

Errors

SQLState | Error Code | Error Text | Description
--- | --- | --- | ---
22023 | CR014 | Invalid certificate | The input can't be decoded as a X.509 certificate
22023 | CR016 | Can not allocate a X509 store |
22023 | CR019 | Invalid CA certificate | Some of CA certificates can not be loaded due to bad format
22023 | CR017 | Can not allocate X509 verification context |
22023 | CR018 | Can not initialize X509 verification context |
22023 | CR015 | X509 error: [the verification error text] |

Examples
Verification of a X.509 certificate

        SQL> x509_certificate_verify (file_to_string ('keys/srv/cert.cer'), vector (file_to_string ('keys/srv/ca.cer')), 'self-signed');

        Done. -- 29 msec.

See Also

get_certificate_info()