Class Poco::Net::X509Certificate
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco::Net

# class X509Certificate

Library: NetSSL_OpenSSL
Package: SSLCore
Header: Poco/Net/X509Certificate.h

## Description

This class extends Poco::Crypto::X509Certificate with the feature to validate a certificate.

## Inheritance

Direct Base Classes: Poco::Crypto::X509Certificate

All Base Classes: Poco::Crypto::X509Certificate

## Member Summary

Member Functions: containsWildcards, matchByAlias, operator =, verify

Inherited Functions: certificate, commonName, expiresOn, extractNames, init, issuedBy, issuerName, load, operator =, save, subjectName, swap, validFrom

## Constructors

### X509Certificate

explicit X509Certificate(
std::istream & istr
);

Creates the X509Certificate object by reading a certificate in PEM format from a stream.

### X509Certificate

explicit X509Certificate(
const std::string & path
);

Creates the X509Certificate object by reading a certificate in PEM format from a file.

### X509Certificate

explicit X509Certificate(
X509 * pCert
);

Creates the X509Certificate from an existing OpenSSL certificate. Ownership is taken of the certificate.

### X509Certificate

X509Certificate(
const Poco::Crypto::X509Certificate & cert
);

Creates the certificate by copying another one.

## Destructor

### ~X509Certificate

~X509Certificate();

Destroys the X509Certificate.

## Member Functions

### operator =

X509Certificate & operator = (
const Poco::Crypto::X509Certificate & cert
);

Assigns a certificate.

### verify

long verify(
const std::string & hostName
) const;

Verifies the validity of the certificate against the host name.

Returns X509_V_OK if verification succeeded, or an error code (X509_V_ERR_APPLICATION_VERIFICATION) otherwise.

### verify

static long verify(
const Poco::Crypto::X509Certificate & cert,
const std::string & hostName
);

Verifies the validity of the certificate against the host name.

Returns X509_V_OK if verification succeeded, or an error code (X509_V_ERR_APPLICATION_VERIFICATION) otherwise.

### containsWildcards

static bool containsWildcards(
const std::string & commonName
);

### matchByAlias

static bool matchByAlias(
const std::string & alias,
const HostEntry & heData
);