@@ -29,24 +29,24 @@ SMimePart::~SMimePart()
29
29
30
30
void SMimePart::setKeyFile (const QString &filename, const QString &password)
31
31
{
32
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
33
- d->_keyfile = filename;
34
- d->_password = password;
32
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
33
+ d->_keyfile = filename;
34
+ d->_password = password;
35
35
loadPKCS12PrivateKey ();
36
36
}
37
37
38
38
void SMimePart::setPublicKey (const QString &filename)
39
39
{
40
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
41
- d->_publicKeyfile = filename;
40
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
41
+ d->_publicKeyfile = filename;
42
42
loadPKCS12PublicKey ();
43
43
}
44
44
45
45
bool SMimePart::sign ()
46
46
{
47
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
48
- bool ret = false ;
49
- PKCS7 *p7 = nullptr ;
47
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
48
+ bool ret = false ;
49
+ PKCS7 *p7 = nullptr ;
50
50
51
51
if (!d->_certificate || !d->_privateKey ) {
52
52
qCDebug (SIMPLEMAIL_SMIMEPART) << " no certificate or private key" ;
@@ -94,9 +94,9 @@ bool SMimePart::sign()
94
94
95
95
bool SMimePart::encrypt ()
96
96
{
97
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
98
- bool ret = false ;
99
- PKCS7 *p7 = nullptr ;
97
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
98
+ bool ret = false ;
99
+ PKCS7 *p7 = nullptr ;
100
100
101
101
if (!d->_recipsReceiver ) {
102
102
qCDebug (SIMPLEMAIL_SMIMEPART) << " no public key" ;
@@ -130,10 +130,10 @@ bool SMimePart::encrypt()
130
130
131
131
bool SMimePart::signAndEncrypt ()
132
132
{
133
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
134
- bool ret = false ;
135
- PKCS7 *p7 = nullptr ;
136
- BIO *signedContent = nullptr ;
133
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
134
+ bool ret = false ;
135
+ PKCS7 *p7 = nullptr ;
136
+ BIO *signedContent = nullptr ;
137
137
if (!d->_certificate || !d->_privateKey ) {
138
138
qCDebug (SIMPLEMAIL_SMIMEPART) << " no certificate or private key" ;
139
139
return ret;
@@ -204,7 +204,7 @@ void SMimePart::setEncryptionHeader()
204
204
205
205
void SMimePart::loadPKCS12PrivateKey ()
206
206
{
207
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
207
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
208
208
QFile file (d->_keyfile );
209
209
if (!file.exists ())
210
210
return ;
@@ -226,8 +226,8 @@ void SMimePart::loadPKCS12PrivateKey()
226
226
qCDebug (SIMPLEMAIL_SMIMEPART) << " Error reading PKCS#12 file" ;
227
227
}
228
228
229
- EVP_PKEY *privateKey = nullptr ;
230
- X509 *certificate = nullptr ;
229
+ EVP_PKEY *privateKey = nullptr ;
230
+ X509 *certificate = nullptr ;
231
231
STACK_OF (X509) *certificateCA = nullptr ;
232
232
if (!PKCS12_parse (
233
233
p12, d->_password .toStdString ().c_str (), &privateKey, &certificate, &certificateCA)) {
@@ -250,7 +250,7 @@ void SMimePart::loadPKCS12PrivateKey()
250
250
251
251
void SMimePart::loadPKCS12PublicKey ()
252
252
{
253
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
253
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
254
254
QFile file (d->_publicKeyfile );
255
255
if (!file.exists ())
256
256
return ;
@@ -268,7 +268,6 @@ void SMimePart::loadPKCS12PublicKey()
268
268
X509 *publicrcert = PEM_read_bio_X509 (keyBuffer, NULL , 0 , NULL );
269
269
BIO_free (keyBuffer);
270
270
271
-
272
271
STACK_OF (X509) *recipsReceiver = sk_X509_new_null ();
273
272
274
273
if (!recipsReceiver || !sk_X509_push (recipsReceiver, publicrcert)) {
@@ -286,9 +285,9 @@ void SMimePart::initOpenSSL()
286
285
287
286
bool SMimePart::writeInputBuffer ()
288
287
{
289
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
290
- BIO *input = BIO_new (BIO_s_mem ());
291
- d->_input = std::unique_ptr<BIO>(input);
288
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
289
+ BIO *input = BIO_new (BIO_s_mem ());
290
+ d->_input = std::unique_ptr<BIO>(input);
292
291
if (!d->_input )
293
292
return false ;
294
293
if (!BIO_write (d->_input .get (), (void *) d->_message .data (), d->_message .length ()))
@@ -298,7 +297,7 @@ bool SMimePart::writeInputBuffer()
298
297
299
298
bool SMimePart::writeMimeMessageBuffer (const std::shared_ptr<SimpleMail::MimePart> &mimeParts)
300
299
{
301
- SMimePartPrivate *d = static_cast <SMimePartPrivate*>(d_ptr.data ());
300
+ SMimePartPrivate *d = static_cast <SMimePartPrivate *>(d_ptr.data ());
302
301
QBuffer buffer;
303
302
buffer.open (QBuffer::ReadWrite);
304
303
0 commit comments