# 22. Virtuoso Functions Guide - xenc_key_serialize

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

## xenc_key_serialize

Extracts a key from user's repository
varchar xenc_key_serialize (in name varchar, in public int);
Description

The function returns a string containing base64 encoded binary key data. It is used to extract symmetric or asymmetric keys. So if key is asymmetric (RSA or DSA) the second parameter designate which part to extract private or public.

Parameters
name – The key name.
public – 1 - export public part, 0 - export private key if exists.
Return Types

The function returns serialized key material.

Examples
Exporting a RSA public key.

The 'ServerPrivate.pfx' is a own RSA key so we exporting public part to supply to some party to encript data for us.

    SQL> select xenc_key_serialize ('ServerPrivate.pfx', 1);
    callret
    VARCHAR
    _______________________________________________________________________________

    MIGJAoGBAMuSqCUCsie6RGUPBdtyM3fPF+yN5ot34i9/IPmjfmlSOlOQ/A9eYClJyvxRVDEHkkNFJWUzPWVRDoIEsUsYgBA6ls8qfai6XdWYoB/2dFB/08tT5uJajNleSF5sjJrjcPvmvn7k1SrVFtCIILioihtGpR2Dpp26MFjfffAnLhiDAgMBAAE=

    1 Rows. -- 1 msec.

See Also