Home Contents | # rawio:getPeerCertInfo | Rawio | Core4 Lua Event System

## SYNOPSIS

info = handle:getPeerCertInfo()

## DESCRIPTION

After a SSL connection has been established, it is possible to obtain information about the peer's certificate, if the peer has provided a certificate.

Note that it is possible to configure SSL to not require a peer certificate, in that case this function returns nil. It also returns nil when called before the SSL handshake was done.

The info function returns a table with the following key/value pairs:

valid_from | The earliest date that the certificate is valid
valid_to | The latest date that the certificate is valid
serial | The serial number of the certificate
issuer | Information about the certificate issuer, see below
subject | Information about the certificate subject, see below

The fields issuer and subject are nested tables with more info. Following are the fields that may be present in the certificate. The table will only contain entries if there is actually data of that kind present. The table may contain additional items if the certificate has further data. The extra items are listed with their hexadecimal tag code.

CN | Common Name
O | Organization
OU | Organizational Unit
L | Location
S | State/Province
C | Country
R | Email address

## RETURN VALUE

Returns information about the peer's certificate.

If there is no certificate, returns nil.

## SEE ALSO

cipher.ssl(), rawio:setSSL(), rawio:getSSL(), rawio:handshake(), rawio:getCipherSuite()