This code is almost right, but you need to use a mutable stringref...
/* UNCHECKED */ MCStringCreateMutable(0, sslerror);
/* UNCHECKED */ MCStringAppendFormat(sslerror, "-Error with certificate at depth: %i\n", depth);
X509_NAME_oneline(X509_get_issuer_name(cert), data, 256);
/* UNCHECKED */ MCStringAppendFormat(sslerror, "  issuer   = %s\n", data);
X509_NAME_oneline(X509_get_subject_name(cert), data, 256);
/* UNCHECKED */ MCStringAppendFormat(sslerror, "  subject  = %s\n", data);
/* UNCHECKED */ MCStringAppendFormat(&sslerror[certlen-1], "  err %i:%s\n", err, X509_verify_cert_error_string(err));
/* UNCHECKED */ MCStringCopyAndRelease(sslerror, sslerror);