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, matchWildcard, operator =, verify

Inherited Functions: certificate, commonName, dup, equals, expiresOn, extractNames, fingerprint, init, issuedBy, issuerName, load, operator =, print, readPEM, save, serialNumber, signatureAlgorithm, subjectName, swap, validFrom, version, writePEM

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.

X509Certificate

X509Certificate(
    const X509Certificate & cert
);

Creates the certificate by copying another one.

X509Certificate

X509Certificate(
    X509Certificate && cert
) noexcept;

Creates the certificate by moving another one.

X509Certificate

X509Certificate(
    X509 * pCert,
    bool shared
);

Creates the X509Certificate from an existing OpenSSL certificate. Ownership is taken of the certificate. If shared is true, the certificate's reference count is incremented.

Destructor

~X509Certificate

~X509Certificate();

Destroys the X509Certificate.

Member Functions

operator =

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

Assigns a certificate.

operator =

X509Certificate & operator = (
    const X509Certificate & cert
);

Assigns a certificate.

operator =

X509Certificate & operator = (
    X509Certificate && cert
) noexcept;

Moves a certificate.

verify

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

Verifies the validity of the certificate against the host name.

For this check to be successful, the certificate must contain a domain name that matches the domain name of the host.

Returns true if verification succeeded, or false otherwise.

verify static

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

Verifies the validity of the certificate against the host name.

For this check to be successful, the certificate must contain a domain name that matches the domain name of the host.

Returns true if verification succeeded, or false otherwise.

containsWildcards protected static

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

matchWildcard protected static

static bool matchWildcard(
    const std::string & alias,
    const std::string & hostName
);