Loading...
Searching...
No Matches
XrdTlsPeerCerts Class Reference

`#include <XrdTlsPeerCerts.hh>`

Collaboration diagram for XrdTlsPeerCerts:

## Public Member Functions

| XrdTlsPeerCerts (X509 *pCert=0, STACK_OF(X509) *pChain=0)
| ~XrdTlsPeerCerts ()
X509 * | getCert (bool upref=true)
bool | hasCert ()
bool | hasChain ()
| STACK_OF (X509) *getChain()

## Detailed Description

Definition at line 34 of file XrdTlsPeerCerts.hh.

## Constructor & Destructor Documentation

## XrdTlsPeerCerts()

XrdTlsPeerCerts::XrdTlsPeerCerts | ( | X509 * | pCert = 0,
|  | STACK_OF(X509) * | pChain = 0 )

inline

Constructor

Parameters

  pCert | - pointer to the cert.
  pChain | - pointer to the chain.

Definition at line 93 of file XrdTlsPeerCerts.hh.

: cert(pCert), chain(pChain) {}

## ~XrdTlsPeerCerts()

XrdTlsPeerCerts::~XrdTlsPeerCerts | ( |  | ) |

Definition at line 61 of file XrdTlsPeerCerts.cc.

{
// Free the peer cert
//
if (cert) X509_free(cert);
// Free the chain (we don't have to as only get1 call creates a copy.
//
// if (chain) sk_X509_pop_free(chain, X509_free);
}

## Member Function Documentation

## getCert()

X509 * XrdTlsPeerCerts::getCert | ( | bool | upref = true | ) |

Obtain pointer to the cert.

Parameters

  upref | When true the cert reference count is increased by one. Otherwise, the reference count stays the same (see note).

Returns
  Upon success, the pointer to the cert is returned. Upon failure, a nil pointer is returned.

Note
  If the cert is being passed to a method that will call X509_free() on the cert (many do) the reference count must be increased as the destructor decreases the reference count. Incorrrect handling of the reference count will invariable SEGV when the session is freed. Do not pass the cert to an opaque method without verifying how it handles the cert upon return.

Definition at line 76 of file XrdTlsPeerCerts.cc.

{
// If we have a cert and we need to up the reference, do so. Note that upref
// may fail; in which case we return a nil pointer to avoid a future segv.
//
if (cert && upref && !X509_up_ref(cert)) return 0;
return cert;
}

Referenced by XrdCryptosslX509ParseStack().

Here is the caller graph for this function:

## hasCert()

bool XrdTlsPeerCerts::hasCert | ( |  | ) |

inline

Check if this object has a cert.

Returns
  True if a cert is present and false otherwise.

Definition at line 76 of file XrdTlsPeerCerts.hh.

{return cert != 0;}

Referenced by XrdCryptosslX509ParseStack().

Here is the caller graph for this function:

## hasChain()

bool XrdTlsPeerCerts::hasChain | ( |  | ) |

inline

Check if this object has a chain.

Returns
  True if a chain is present and false otherwise.

Definition at line 84 of file XrdTlsPeerCerts.hh.

{return chain != 0;}

Referenced by XrdCryptosslX509ParseStack().

Here is the caller graph for this function:

## STACK_OF()

XrdTlsPeerCerts::STACK_OF | ( | X509 |  | ) |

inline

Obtain pointer to the chain.

Returns
  Upon success, the pointer to the cert is returned which may be nil if there is no chain.

Note
  The chain is the actual chain associated with the SSL session. When he SSL session is freed, the chain becomes invalid and all references to it must cease.

Definition at line 68 of file XrdTlsPeerCerts.hh.

{return chain;}

The documentation for this class was generated from the following files:

- XrdTlsPeerCerts.hh
- XrdTlsPeerCerts.cc