1
- /** \ingroup core
2
- * \brief Utilities for working with certificates and keys
3
- */
1
+ /************************************************************************
2
+ * This file has been generated automatically from *
3
+ * *
4
+ * src/core/auth/qgsauthcertutils.h *
5
+ * *
6
+ * Do not edit manually ! Edit header and run scripts/sipify.pl again *
7
+ ************************************************************************/
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
4
16
class QgsAuthCertUtils
5
17
{
18
+ %Docstring
19
+ Utilities for working with certificates and keys
20
+ %End
21
+
6
22
%TypeHeaderCode
7
- #include < qgsauthcertutils.h>
23
+ #include " qgsauthcertutils.h"
8
24
%End
9
25
public:
10
- /** Type of CA certificate source */
11
26
enum CaCertSource
12
27
{
13
- SystemRoot = 0 ,
14
- FromFile = 1 ,
15
- InDatabase = 2 ,
16
- Connection = 3
28
+ SystemRoot,
29
+ FromFile,
30
+ InDatabase,
31
+ Connection
17
32
};
18
33
19
- /** Type of certificate trust policy */
20
34
enum CertTrustPolicy
21
35
{
22
- DefaultTrust = 0 ,
23
- Trusted = 1 ,
24
- Untrusted = 2 ,
25
- NoPolicy = 3
36
+ DefaultTrust,
37
+ Trusted,
38
+ Untrusted,
39
+ NoPolicy
26
40
};
27
41
28
- /** Type of certificate usage */
29
42
enum CertUsageType
30
43
{
31
- UndeterminedUsage = 0 ,
44
+ UndeterminedUsage,
32
45
AnyOrUnspecifiedUsage,
33
46
CertAuthorityUsage,
34
47
CertIssuerUsage,
@@ -41,170 +54,188 @@ class QgsAuthCertUtils
41
54
CRLSigningUsage
42
55
};
43
56
44
- /** Type of certificate key group */
45
57
enum ConstraintGroup
46
58
{
47
- KeyUsage = 0 ,
48
- ExtendedKeyUsage = 1
59
+ KeyUsage,
60
+ ExtendedKeyUsage
49
61
};
50
62
51
63
52
- /** SSL Protocol name strings per enum */
53
64
static QString getSslProtocolName( QSsl::SslProtocol protocol );
65
+ %Docstring
66
+ SSL Protocol name strings per enum
67
+ :rtype: str
68
+ %End
54
69
55
- /** Map certificate sha1 to certificate as simple cache */
56
70
static QMap<QString, QSslCertificate> mapDigestToCerts( const QList<QSslCertificate> &certs );
71
+ %Docstring
72
+ Map certificate sha1 to certificate as simple cache
73
+ :rtype: QMap<str, QSslCertificate>
74
+ %End
57
75
58
- /** Map certificates to their oraganization.
59
- * @note not available in Python bindings
60
- */
61
- // static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
62
76
63
- /** Map SSL custom configs' certificate sha1 to custom config as simple cache
64
- */
65
77
static QMap<QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( const QList<QgsAuthConfigSslServer> &configs );
78
+ %Docstring
79
+ Map SSL custom configs' certificate sha1 to custom config as simple cache
80
+ :rtype: QMap<str, QgsAuthConfigSslServer>
81
+ %End
66
82
67
- /** Map SSL custom configs' certificates to their oraganization.
68
- * @note not available in Python bindings
69
- */
70
- // static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( const QList<QgsAuthConfigSslServer> &configs );
71
83
72
- /** Return list of concatenated certs from a PEM or DER formatted file */
73
84
static QList<QSslCertificate> certsFromFile( const QString &certspath );
85
+ %Docstring
86
+ Return list of concatenated certs from a PEM or DER formatted file
87
+ :rtype: list of QSslCertificate
88
+ %End
74
89
75
- /** Return first cert from a PEM or DER formatted file */
76
90
static QSslCertificate certFromFile( const QString &certpath );
91
+ %Docstring
92
+ Return first cert from a PEM or DER formatted file
93
+ :rtype: QSslCertificate
94
+ %End
77
95
78
- /** Return non-encrypted key from a PEM or DER formatted file
79
- * @param keypath File path to private key
80
- * @param keypass Passphrase for private key
81
- * @param algtype QString to set with resolved algorithm type
82
- */
83
96
static QSslKey keyFromFile( const QString &keypath,
84
97
const QString &keypass = QString(),
85
98
QString *algtype = 0 );
99
+ %Docstring
100
+ Return non-encrypted key from a PEM or DER formatted file
101
+ \param keypath File path to private key
102
+ \param keypass Passphrase for private key
103
+ \param algtype QString to set with resolved algorithm type
104
+ :rtype: QSslKey
105
+ %End
86
106
87
- /** Return list of concatenated certs from a PEM Base64 text block */
88
107
static QList<QSslCertificate> certsFromString( const QString &pemtext );
108
+ %Docstring
109
+ Return list of concatenated certs from a PEM Base64 text block
110
+ :rtype: list of QSslCertificate
111
+ %End
89
112
90
- /** Return list of certificate, private key and algorithm (as PEM text) from file path components
91
- * @param certpath File path to certificate
92
- * @param keypath File path to private key
93
- * @param keypass Passphrase for private key
94
- * @param reencrypt Whether to re-encrypt the private key with the passphrase
95
- * @return certificate, private key, key's algorithm type
96
- */
97
113
static QStringList certKeyBundleToPem( const QString &certpath,
98
114
const QString &keypath,
99
115
const QString &keypass = QString(),
100
116
bool reencrypt = true );
117
+ %Docstring
118
+ Return list of certificate, private key and algorithm (as PEM text) from file path components
119
+ \param certpath File path to certificate
120
+ \param keypath File path to private key
121
+ \param keypass Passphrase for private key
122
+ \param reencrypt Whether to re-encrypt the private key with the passphrase
123
+ :return: certificate, private key, key's algorithm type
124
+ :rtype: list of str
125
+ %End
101
126
102
- /** Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
103
- * @param bundlepath File path to the PKCS bundle
104
- * @param bundlepass Passphrase for bundle
105
- * @param reencrypt Whether to re-encrypt the private key with the passphrase
106
- * @return certificate, private key, key's algorithm type
107
- */
108
127
static QStringList pkcs12BundleToPem( const QString &bundlepath,
109
128
const QString &bundlepass = QString(),
110
129
bool reencrypt = true );
130
+ %Docstring
131
+ Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
132
+ \param bundlepath File path to the PKCS bundle
133
+ \param bundlepass Passphrase for bundle
134
+ \param reencrypt Whether to re-encrypt the private key with the passphrase
135
+ :return: certificate, private key, key's algorithm type
136
+ :rtype: list of str
137
+ %End
111
138
112
- /** Write a temporary file for a PEM text of cert/key/CAs bundle component
113
- * @param pemtext Component content as PEM text
114
- * @param name Name of file
115
- * @return File path to temporary file
116
- */
117
139
static QString pemTextToTempFile( const QString &name, const QByteArray &pemtext );
140
+ %Docstring
141
+ Write a temporary file for a PEM text of cert/key/CAs bundle component
142
+ \param pemtext Component content as PEM text
143
+ \param name Name of file
144
+ :return: File path to temporary file
145
+ :rtype: str
146
+ %End
118
147
119
- /** Get the general name for CA source enum type
120
- * @param source The enum source type for the CA
121
- * @param single Whether to return singular or plural description
122
- */
123
- static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
148
+ static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single = false );
149
+ %Docstring
150
+ Get the general name for CA source enum type
151
+ \param source The enum source type for the CA
152
+ \param single Whether to return singular or plural description
153
+ :rtype: str
154
+ %End
124
155
125
- /** Get the general name via RFC 5280 resolution */
126
156
static QString resolvedCertName( const QSslCertificate &cert, bool issuer = false );
157
+ %Docstring
158
+ Get the general name via RFC 5280 resolution
159
+ :rtype: str
160
+ %End
161
+
127
162
128
- /** Get combined distinguished name for certificate
129
- * @param qcert Qt SSL cert object
130
- * @param acert QCA SSL cert object to add more info to the output
131
- * @param issuer Whether to return cert's subject or issuer combined name
132
- * @note not available in Python bindings
133
- */
134
- // static QString getCertDistinguishedName( const QSslCertificate& qcert,
135
- // const QCA::Certificate& acert = QCA::Certificate(),
136
- // bool issuer = false );
137
-
138
- /** Get the general name for certificate trust */
139
163
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
164
+ %Docstring
165
+ Get the general name for certificate trust
166
+ :rtype: str
167
+ %End
140
168
141
- /** Get string with colon delimiters every 2 characters */
142
169
static QString getColonDelimited( const QString &txt );
170
+ %Docstring
171
+ Get string with colon delimiters every 2 characters
172
+ :rtype: str
173
+ %End
174
+
175
+ static QString shaHexForCert( const QSslCertificate &cert, bool formatted = false );
176
+ %Docstring
177
+ Get the sha1 hash for certificate
178
+ \param cert Qt SSL certificate to generate hash from
179
+ \param formatted Whether to colon-delimit the hash
180
+ :rtype: str
181
+ %End
182
+
183
+
184
+
185
+
186
+
187
+
188
+
143
189
144
- /** Get the sha1 hash for certificate
145
- * @param cert Qt SSL certificate to generate hash from
146
- * @param formatted Whether to colon-delimit the hash
147
- */
148
- static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
149
-
150
- /** Convert a QSslCertificate to a QCA::Certificate.
151
- * @note not available in Python bindings
152
- */
153
- // static QCA::Certificate qtCertToQcaCert( const QSslCertificate &cert );
154
-
155
- /** Convert a QList of QSslCertificate to a QCA::CertificateCollection.
156
- * @note not available in Python bindings
157
- */
158
- // static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate> &certs );
159
-
160
- /** PKI key/cert bundle from file path, e.g. from .p12 or pfx files.
161
- * @note not available in Python bindings
162
- */
163
- // static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
164
-
165
- /** Certificate validity check messages per enum.
166
- * @note not available in Python bindings
167
- */
168
- // static QString qcaValidityMessage( QCA::Validity validity );
169
-
170
- /** Certificate signature algorithm strings per enum.
171
- * @note not available in Python bindings
172
- */
173
- // static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
174
-
175
- /** Certificate well-known constraint strings per enum.
176
- * @note not available in Python bindings
177
- */
178
- // static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
179
-
180
- /** Certificate usage type strings per enum
181
- * @note not available in Python bindings
182
- */
183
- static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
184
-
185
- /** Try to determine the certificates usage types */
186
190
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate &cert );
191
+ %Docstring
192
+ Try to determine the certificates usage types
193
+ :rtype: list of QgsAuthCertUtils.CertUsageType
194
+ %End
187
195
188
- /** Get whether a certificate is an Authority */
189
196
static bool certificateIsAuthority( const QSslCertificate &cert );
197
+ %Docstring
198
+ Get whether a certificate is an Authority
199
+ :rtype: bool
200
+ %End
190
201
191
- /** Get whether a certificate can sign other certificates */
192
202
static bool certificateIsIssuer( const QSslCertificate &cert );
203
+ %Docstring
204
+ Get whether a certificate can sign other certificates
205
+ :rtype: bool
206
+ %End
193
207
194
- /** Get whether a certificate is an Authority or can at least sign other certificates */
195
208
static bool certificateIsAuthorityOrIssuer( const QSslCertificate &cert );
209
+ %Docstring
210
+ Get whether a certificate is an Authority or can at least sign other certificates
211
+ :rtype: bool
212
+ %End
196
213
197
- /** Get whether a certificate is probably used for a SSL server */
198
214
static bool certificateIsSslServer( const QSslCertificate &cert );
215
+ %Docstring
216
+ Get whether a certificate is probably used for a SSL server
217
+ :rtype: bool
218
+ %End
199
219
200
- /** Get whether a certificate is probably used for a client identity */
201
220
static bool certificateIsSslClient( const QSslCertificate &cert );
221
+ %Docstring
222
+ Get whether a certificate is probably used for a client identity
223
+ :rtype: bool
224
+ %End
202
225
203
- /** Get short strings describing an SSL error */
204
226
static QString sslErrorEnumString( QSslError::SslError errenum );
227
+ %Docstring
228
+ Get short strings describing an SSL error
229
+ :rtype: str
230
+ %End
231
+
205
232
206
- /** Get short strings describing SSL errors.
207
- * @note not available in Python bindings
208
- */
209
- // static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
210
233
};
234
+
235
+ /************************************************************************
236
+ * This file has been generated automatically from *
237
+ * *
238
+ * src/core/auth/qgsauthcertutils.h *
239
+ * *
240
+ * Do not edit manually ! Edit header and run scripts/sipify.pl again *
241
+ ************************************************************************/
0 commit comments