API Documentation
Documentation for developing SailfishOS applicationsCertificates Class
(Sailfish::Mdm::Certificates)The Certificates class manages system CA certificates. More...
Header: | #include <mdm-certificate.h> |
Public Types
enum | Result { Success, Error } |
Public Functions
Certificates(QObject *parent = nullptr) | |
~Certificates() | |
void | blacklist(const QString &fileName, const QByteArray &data) |
void | blacklist(const QString &fileName, const QList<QSslCertificate> &certificates) |
QList<CertificateFile> | blacklistedFiles() const |
QList<QSslCertificate> | certificates() const |
void | install(const QString &fileName, const QByteArray &data) |
void | install(const QString &fileName, const QList<QSslCertificate> &certificates) |
QList<CertificateFile> | installedFiles() const |
void | unblacklist(const QString &fileName) |
void | uninstall(const QString &fileName) |
Signals
void | blacklistFinished(const CertificateFile &file, Result result) |
void | blacklistedFilesChanged() |
void | certificatesChanged() |
void | installFinished(const CertificateFile &file, Result result) |
void | installedFilesChanged() |
void | unblacklistFinished(const CertificateFile &file, Result result) |
void | uninstallFinished(const CertificateFile &file, Result result) |
Detailed Description
The Certificates class manages system CA certificates.
New certificates can be added to the set of system certificates using the install() functions. The files containing these installed certificates can be queried using the installedFiles() function.
Undesirable certificates can be blacklisted using the blacklist() functions. The full list of installed certificate blacklist files is available from the blacklistedFiles() function.
A full list of system certificates is available from the certificates function.
Member Type Documentation
enum Certificates::Result
The possible types of results for operations such as install() and uninstall().
Constant | Value | Description |
---|---|---|
Sailfish::Mdm::Certificates::Success | 0 | The operation succeeded. |
Sailfish::Mdm::Certificates::Error | 1 | The operation failed. |
Member Function Documentation
Certificates::Certificates(QObject *parent = nullptr)
Constructs a new certificates instance with the given parent.
Certificates::~Certificates()
Destroys a certificates instance.
void Certificates::blacklist(const QString &fileName, const QByteArray &data)
Installs a certificate blacklist file named fileName.
The PEM formatted certificates in data will be written to the new file. If a file with the same file name exists already it will be overwritten.
Note file names are relative and may not contain any path separators or the installation will fail.
Installation may take some time and is executed asynchronously. The blacklistFinished() signal will be emitted on completion.
See also blacklistedFiles() and unblacklist().
void Certificates::blacklist(const QString &fileName, const QList<QSslCertificate> &certificates)
Installs a certificate blacklist file named fileName.
The certificates be written to the new file. If a file with the same file name exists already it will be overwritten.
This is an overloaded function.
[signal]
void Certificates::blacklistFinished(const CertificateFile &file, Result result)
Emitted when a blacklist() operation finishes for the specified certificate file. result indicates the result of the operation.
QList<CertificateFile> Certificates::blacklistedFiles() const
Returns a list of all installed certificate blacklist files.
The certificates in these files rejected even if they would have been validated by the system certificates provided by the operating system or one of the installed certificate files.
New files can be added to this list using the blacklist() function and files may be removed using the unblacklist() function.
The blacklistedFilesChanged() signal will be emitted if this list changes.
[signal]
void Certificates::blacklistedFilesChanged()
Emitted when the list of blacklistedFiles() changes.
QList<QSslCertificate> Certificates::certificates() const
Returns a list of all system CA certificates.
This is combination of the certificates provided by the operating system and those from the installedFiles().
The certificatesChanged() signal will be emitted if this list changes.
[signal]
void Certificates::certificatesChanged()
Emitted when the list of certificates() changes.
void Certificates::install(const QString &fileName, const QByteArray &data)
Installs a certificate file named fileName.
The PEM formatted certificates in data will be written to the new file. If a file with the same file name exists already it will be overwritten.
Note file names are relative and may not contain any path separators or the installation will fail.
Installation may take some time and is executed asynchronously. The installFinished() signal will be emitted on completion.
See also installedFiles() and uninstall().
void Certificates::install(const QString &fileName, const QList<QSslCertificate> &certificates)
Installs a certificate file named fileName.
The certificates be written to the new file. If a file with the same file name exists already it will be overwritten.
This is an overloaded function.
[signal]
void Certificates::installFinished(const CertificateFile &file, Result result)
Emitted when an install() action finishes for the specified certificate file. result indicates the result of the operation.
QList<CertificateFile> Certificates::installedFiles() const
Returns a list of all installed certificate files.
The certificates in these files extend the system certificates beyond the core set provided by the operating system.
New files can be added to this list using the install() function and files may be removed using the uninstall() function.
The installedFilesChanged() signal will be emitted if this list changes.
[signal]
void Certificates::installedFilesChanged()
Emitted when the list of installedFiles() changes.
void Certificates::unblacklist(const QString &fileName)
Removes an installed certificate blacklist file named fileName.
Uninstallation may take some time and is executed asynchronously. The unblacklistFinished() signal will be emitted on completion.
See also blacklistedFiles() and blacklist().
[signal]
void Certificates::unblacklistFinished(const CertificateFile &file, Result result)
Emitted when an unblacklist() operation finishes for the specified certificate file. result indicates the result of the operation.
void Certificates::uninstall(const QString &fileName)
Removes an installed certificate file named fileName.
Uninstallation may take some time and is executed asynchronously. The uninstallFinished() signal will be emitted on completion.
See also installedFiles() and install().
[signal]
void Certificates::uninstallFinished(const CertificateFile &file, Result result)
Emitted when an uninstall() operation finishes for the specified certificate file. result indicates the result of the operation.