mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed bug in tor v3 backward compatibility with v2
This commit is contained in:
parent
3912c6562e
commit
8d2a8f8ced
@ -132,12 +132,18 @@ bool CryptoKey::loadFromFile(const QString& path)
|
||||
QByteArray data = file.readAll();
|
||||
file.close();
|
||||
|
||||
if(data.startsWith("-----"))
|
||||
if(data.contains("-----BEGIN RSA PRIVATE KEY-----"))
|
||||
{
|
||||
std::cerr << "Note: Reading/converting Tor v2 key format." << std::endl;
|
||||
|
||||
// This to be compliant with old format. New format is oblivious to the type of key so we dont need a header
|
||||
data = data.replace("-----BEGIN RSA PRIVATE KEY-----",nullptr);
|
||||
data = data.replace("-----END RSA PRIVATE KEY-----",nullptr);
|
||||
// This to be compliant with old format. New format is oblivious to the type of key so we dont need a header
|
||||
data = data.replace("-----BEGIN RSA PRIVATE KEY-----",nullptr);
|
||||
data = data.replace("-----END RSA PRIVATE KEY-----",nullptr);
|
||||
data = data.replace("\n",nullptr);
|
||||
data = data.replace("\t",nullptr);
|
||||
|
||||
data = "RSA1024:"+data;
|
||||
}
|
||||
|
||||
std::cerr << "Have read the following key: " << std::endl;
|
||||
std::cerr << QString(data).toStdString() << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user