(fix) fixed S/MIME code with chained certificates
parent
f4cc8450a3
commit
00be330915
1
NEWS
1
NEWS
|
@ -13,6 +13,7 @@ Bug fixes
|
||||||
- [core] properly update the last-modified attribute (#4313)
|
- [core] properly update the last-modified attribute (#4313)
|
||||||
- [core] fixed default data value for c_hascertificate (#4442)
|
- [core] fixed default data value for c_hascertificate (#4442)
|
||||||
- [core] fixed ACLs restoration with sogo-tool in single store mode (#4385)
|
- [core] fixed ACLs restoration with sogo-tool in single store mode (#4385)
|
||||||
|
- [core] fixed S/MIME code with chained certificates
|
||||||
- [web] prevent deletion of special folders using del key
|
- [web] prevent deletion of special folders using del key
|
||||||
- [web] fixed SAML2 session timeout handling during XHR requests
|
- [web] fixed SAML2 session timeout handling during XHR requests
|
||||||
- [web] fixed renaming a folder under iOS
|
- [web] fixed renaming a folder under iOS
|
||||||
|
|
|
@ -59,7 +59,6 @@
|
||||||
const char* bytes;
|
const char* bytes;
|
||||||
const char* sbytes;
|
const char* sbytes;
|
||||||
|
|
||||||
//int flags = PKCS7_DETACHED | PKCS7_STREAM;
|
|
||||||
int flags = PKCS7_STREAM | PKCS7_DETACHED | PKCS7_CRLFEOL;
|
int flags = PKCS7_STREAM | PKCS7_DETACHED | PKCS7_CRLFEOL;
|
||||||
|
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
|
@ -70,7 +69,9 @@
|
||||||
len = [theData length];
|
len = [theData length];
|
||||||
tbio = BIO_new_mem_buf((void *)bytes, len);
|
tbio = BIO_new_mem_buf((void *)bytes, len);
|
||||||
|
|
||||||
scert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
|
// Grab the last certificate in case it's chained
|
||||||
|
scert = NULL;
|
||||||
|
while (PEM_read_bio_X509(tbio, &scert, 0, NULL) != NULL);
|
||||||
|
|
||||||
if (!scert)
|
if (!scert)
|
||||||
{
|
{
|
||||||
|
@ -147,8 +148,10 @@
|
||||||
NSLog(@"FATAL: unable to allocate BIO memory");
|
NSLog(@"FATAL: unable to allocate BIO memory");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rcert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
|
// Grab the last certificate in case it's chained
|
||||||
|
rcert = NULL;
|
||||||
|
while (PEM_read_bio_X509(tbio, &rcert, 0, NULL) != NULL);
|
||||||
|
|
||||||
if (!rcert)
|
if (!rcert)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +229,9 @@
|
||||||
len = [theData length];
|
len = [theData length];
|
||||||
tbio = BIO_new_mem_buf((void *)bytes, len);
|
tbio = BIO_new_mem_buf((void *)bytes, len);
|
||||||
|
|
||||||
scert = PEM_read_bio_X509(tbio, NULL, 0, NULL);
|
// Grab the last certificate in case it's chained
|
||||||
|
scert = NULL;
|
||||||
|
while (PEM_read_bio_X509(tbio, &scert, 0, NULL) != NULL);
|
||||||
|
|
||||||
if (!scert)
|
if (!scert)
|
||||||
{
|
{
|
||||||
|
@ -464,20 +469,23 @@
|
||||||
*/
|
*/
|
||||||
- (NSDictionary *) certificateDescription
|
- (NSDictionary *) certificateDescription
|
||||||
{
|
{
|
||||||
BIO *pemBio;
|
|
||||||
NSDictionary *data;
|
NSDictionary *data;
|
||||||
|
BIO *bio;
|
||||||
X509 *x;
|
X509 *x;
|
||||||
|
|
||||||
data = nil;
|
data = nil;
|
||||||
OpenSSL_add_all_algorithms();
|
OpenSSL_add_all_algorithms();
|
||||||
pemBio = BIO_new_mem_buf((void *) [self bytes], [self length]);
|
bio = BIO_new_mem_buf((void *) [self bytes], [self length]);
|
||||||
x = PEM_read_bio_X509(pemBio, NULL, 0, NULL);
|
|
||||||
|
// Grab the last certificate in case it's chained
|
||||||
|
x = NULL;
|
||||||
|
while (PEM_read_bio_X509(bio, &x, 0, NULL) != NULL);
|
||||||
|
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
BIO *buf;
|
|
||||||
char p[1024];
|
|
||||||
NSString *subject, *issuer;
|
NSString *subject, *issuer;
|
||||||
|
char p[1024];
|
||||||
|
BIO *buf;
|
||||||
|
|
||||||
memset(p, 0, 1024);
|
memset(p, 0, 1024);
|
||||||
buf = BIO_new(BIO_s_mem());
|
buf = BIO_new(BIO_s_mem());
|
||||||
|
@ -502,10 +510,11 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int err = ERR_get_error();
|
|
||||||
const char* sslError;
|
|
||||||
NSString *error;
|
NSString *error;
|
||||||
|
const char* sslError;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = ERR_get_error();
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
sslError = ERR_reason_error_string(err);
|
sslError = ERR_reason_error_string(err);
|
||||||
error = [NSString stringWithUTF8String: sslError];
|
error = [NSString stringWithUTF8String: sslError];
|
||||||
|
|
Loading…
Reference in New Issue