Fixed utf8 issue when using strings with openssl

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7726 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-12-03 23:03:03 +00:00
parent 512a938cfb
commit 40bfa50b29
2 changed files with 11 additions and 17 deletions

View File

@ -681,7 +681,7 @@ X509 *AuthSSLimpl::SignX509ReqWithGPG(X509_REQ *req, long days)
}
//long version = 0x00;
unsigned long chtype = MBSTRING_ASC;
unsigned long chtype = MBSTRING_UTF8;
X509_NAME *issuer_name = X509_NAME_new();
X509_NAME_add_entry_by_txt(issuer_name, "CN", chtype,
(unsigned char *) AuthGPG::getAuthGPG()->getGPGOwnId().toStdString().c_str(), -1, -1, 0);

View File

@ -176,7 +176,7 @@ X509_REQ *GenerateX509Req(
****************************/
long version = 0x00;
unsigned long chtype = MBSTRING_ASC;
unsigned long chtype = MBSTRING_UTF8;
X509_NAME *x509_name = X509_NAME_new();
// fill in the request.
@ -750,9 +750,6 @@ int LoadCheckX509(const char *cert_file, RsPgpId& issuerName, std::string &locat
}
}
std::string getX509NameString(X509_NAME *name)
{
std::string namestr;
@ -786,12 +783,10 @@ std::string getX509NameString(X509_NAME *name)
{
namestr += "\n";
}
}
return namestr;
}
std::string getX509CNString(X509_NAME *name)
{
std::string namestr;
@ -805,19 +800,19 @@ std::string getX509CNString(X509_NAME *name)
{
if (entry_data -> data != NULL)
{
namestr += (char *) entry_data -> data;
// do we need to convert ASN1_STRING to utf8 (ASN1_STRING_to_UTF8)?
namestr = (char *) entry_data->data;
}
else
{
namestr += "Unknown";
namestr = "Unknown";
}
return namestr;
break;
}
}
return namestr;
}
std::string getX509TypeString(X509_NAME *name, const char *type, int len)
{
std::string namestr;
@ -831,19 +826,19 @@ std::string getX509TypeString(X509_NAME *name, const char *type, int len)
{
if (entry_data -> data != NULL)
{
namestr += (char *) entry_data -> data;
// do we need to convert ASN1_STRING to utf8 (ASN1_STRING_to_UTF8)?
namestr = (char *) entry_data -> data;
}
else
{
namestr += "Unknown";
namestr = "Unknown";
}
return namestr;
break;
}
}
return namestr;
}
std::string getX509LocString(X509_NAME *name)
{
return getX509TypeString(name, "L", 2);
@ -853,8 +848,7 @@ std::string getX509OrgString(X509_NAME *name)
{
return getX509TypeString(name, "O", 2);
}
std::string getX509CountryString(X509_NAME *name)
{
return getX509TypeString(name, "C", 2);