Commit 8943f7de authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Use std::string for the strings in EntityInfo

parent 0d3c6b40
......@@ -36,50 +36,13 @@ X509CertificateInfo::PublicKeyInfo &X509CertificateInfo::PublicKeyInfo::operator
return *this;
}
X509CertificateInfo::EntityInfo::EntityInfo() :
commonName(nullptr),
distinguishedName(nullptr),
email(nullptr),
organization(nullptr)
{
}
X509CertificateInfo::EntityInfo::EntityInfo() = default;
X509CertificateInfo::EntityInfo::~EntityInfo()
{
free(commonName);
free(distinguishedName);
free(email);
free(organization);
}
X509CertificateInfo::EntityInfo::~EntityInfo() = default;
X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other)
{
commonName = other.commonName;
distinguishedName = other.distinguishedName;
email = other.email;
organization = other.organization;
other.commonName = nullptr;
other.distinguishedName = nullptr;
other.email = nullptr;
other.organization = nullptr;
}
X509CertificateInfo::EntityInfo::EntityInfo(X509CertificateInfo::EntityInfo &&other) = default;
X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other)
{
free(commonName);
free(distinguishedName);
free(email);
free(organization);
commonName = other.commonName;
distinguishedName = other.distinguishedName;
email = other.email;
organization = other.organization;
other.commonName = nullptr;
other.distinguishedName = nullptr;
other.email = nullptr;
other.organization = nullptr;
return *this;
}
X509CertificateInfo::EntityInfo &X509CertificateInfo::EntityInfo::operator=(X509CertificateInfo::EntityInfo &&other) = default;
X509CertificateInfo::X509CertificateInfo() :
ku_extensions(KU_NONE),
......
......@@ -67,10 +67,10 @@ public:
EntityInfo(const EntityInfo &) = delete;
EntityInfo &operator=(const EntityInfo &) = delete;
char *commonName;
char *distinguishedName;
char *email;
char *organization;
std::string commonName;
std::string distinguishedName;
std::string email;
std::string organization;
};
struct Validity {
......
......@@ -953,16 +953,16 @@ SignatureValidationInfo FormFieldSignature::validate(int opt, const QDateTime& v
certPriv->serial_number = QByteArray(certSerial.c_str(), certSerial.getLength());
const X509CertificateInfo::EntityInfo &issuerInfo = ci->getIssuerInfo();
certPriv->issuer_info.common_name = issuerInfo.commonName;
certPriv->issuer_info.distinguished_name = issuerInfo.distinguishedName;
certPriv->issuer_info.email_address = issuerInfo.email;
certPriv->issuer_info.org_name = issuerInfo.organization;
certPriv->issuer_info.common_name = issuerInfo.commonName.c_str();
certPriv->issuer_info.distinguished_name = issuerInfo.distinguishedName.c_str();
certPriv->issuer_info.email_address = issuerInfo.email.c_str();
certPriv->issuer_info.org_name = issuerInfo.organization.c_str();
const X509CertificateInfo::EntityInfo &subjectInfo = ci->getSubjectInfo();
certPriv->subject_info.common_name = subjectInfo.commonName;
certPriv->subject_info.distinguished_name = subjectInfo.distinguishedName;
certPriv->subject_info.email_address = subjectInfo.email;
certPriv->subject_info.org_name = subjectInfo.organization;
certPriv->subject_info.common_name = subjectInfo.commonName.c_str();
certPriv->subject_info.distinguished_name = subjectInfo.distinguishedName.c_str();
certPriv->subject_info.email_address = subjectInfo.email.c_str();
certPriv->subject_info.org_name = subjectInfo.organization.c_str();
X509CertificateInfo::Validity certValidity = ci->getValidity();
certPriv->validity_start = QDateTime::fromTime_t(certValidity.notBefore, Qt::UTC);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment