Performed project-wide code formatting
* Updated format CMake command to properly ignore new directories and files * Added output when command is run * Resolves #2623
This commit is contained in:
@@ -27,6 +27,6 @@ namespace ASN1Key
|
||||
bool parseDSA(QByteArray& ba, OpenSSHKey& key);
|
||||
bool parsePrivateRSA(QByteArray& ba, OpenSSHKey& key);
|
||||
bool parsePublicRSA(QByteArray& ba, OpenSSHKey& key);
|
||||
}
|
||||
} // namespace ASN1Key
|
||||
|
||||
#endif // KEEPASSXC_ASN1KEY_H
|
||||
|
||||
@@ -36,39 +36,39 @@ const QString OpenSSHKey::TYPE_OPENSSH_PRIVATE = "OPENSSH PRIVATE KEY";
|
||||
|
||||
namespace
|
||||
{
|
||||
QPair<QString, QList<QByteArray>> binaryDeserialize(const QByteArray& serialized)
|
||||
{
|
||||
if (serialized.isEmpty()) {
|
||||
return {};
|
||||
QPair<QString, QList<QByteArray>> binaryDeserialize(const QByteArray& serialized)
|
||||
{
|
||||
if (serialized.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
QBuffer buffer;
|
||||
buffer.setData(serialized);
|
||||
buffer.open(QBuffer::ReadOnly);
|
||||
BinaryStream stream(&buffer);
|
||||
QString type;
|
||||
stream.readString(type);
|
||||
QByteArray temp;
|
||||
QList<QByteArray> data;
|
||||
while (stream.readString(temp)) {
|
||||
data << temp;
|
||||
}
|
||||
return ::qMakePair(type, data);
|
||||
}
|
||||
QBuffer buffer;
|
||||
buffer.setData(serialized);
|
||||
buffer.open(QBuffer::ReadOnly);
|
||||
BinaryStream stream(&buffer);
|
||||
QString type;
|
||||
stream.readString(type);
|
||||
QByteArray temp;
|
||||
QList<QByteArray> data;
|
||||
while (stream.readString(temp)) {
|
||||
data << temp;
|
||||
}
|
||||
return ::qMakePair(type, data);
|
||||
}
|
||||
|
||||
QByteArray binarySerialize(const QString& type, const QList<QByteArray>& data)
|
||||
{
|
||||
if (type.isEmpty() && data.isEmpty()) {
|
||||
return {};
|
||||
QByteArray binarySerialize(const QString& type, const QList<QByteArray>& data)
|
||||
{
|
||||
if (type.isEmpty() && data.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
QByteArray buffer;
|
||||
BinaryStream stream(&buffer);
|
||||
stream.writeString(type);
|
||||
for (const QByteArray& part : data) {
|
||||
stream.writeString(part);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
QByteArray buffer;
|
||||
BinaryStream stream(&buffer);
|
||||
stream.writeString(type);
|
||||
for (const QByteArray& part : data) {
|
||||
stream.writeString(part);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// bcrypt_pbkdf.cpp
|
||||
int bcrypt_pbkdf(const QByteArray& pass, const QByteArray& salt, QByteArray& key, quint32 rounds);
|
||||
@@ -95,7 +95,9 @@ OpenSSHKey OpenSSHKey::generate(bool secure)
|
||||
Tools::Map<Index, gcry_mpi_t, &gcry_mpi_release> mpi;
|
||||
Tools::Map<Index, gcry_sexp_t, &gcry_sexp_release> sexp;
|
||||
gcry_error_t rc = GPG_ERR_NO_ERROR;
|
||||
rc = gcry_sexp_build(&sexp[Params], NULL, secure ? "(genkey (rsa (nbits 4:2048)))" : "(genkey (rsa (transient-key) (nbits 4:2048)))");
|
||||
rc = gcry_sexp_build(&sexp[Params],
|
||||
NULL,
|
||||
secure ? "(genkey (rsa (nbits 4:2048)))" : "(genkey (rsa (transient-key) (nbits 4:2048)))");
|
||||
if (rc != GPG_ERR_NO_ERROR) {
|
||||
qWarning() << "Could not create ssh key" << gcry_err_code(rc);
|
||||
return OpenSSHKey();
|
||||
@@ -204,32 +206,32 @@ OpenSSHKey OpenSSHKey::generate(bool secure)
|
||||
}
|
||||
|
||||
OpenSSHKey::OpenSSHKey(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_type(QString())
|
||||
, m_cipherName(QString("none"))
|
||||
, m_kdfName(QString("none"))
|
||||
, m_kdfOptions(QByteArray())
|
||||
, m_rawType(QString())
|
||||
, m_rawData(QByteArray())
|
||||
, m_rawPublicData(QList<QByteArray>())
|
||||
, m_rawPrivateData(QList<QByteArray>())
|
||||
, m_comment(QString())
|
||||
, m_error(QString())
|
||||
: QObject(parent)
|
||||
, m_type(QString())
|
||||
, m_cipherName(QString("none"))
|
||||
, m_kdfName(QString("none"))
|
||||
, m_kdfOptions(QByteArray())
|
||||
, m_rawType(QString())
|
||||
, m_rawData(QByteArray())
|
||||
, m_rawPublicData(QList<QByteArray>())
|
||||
, m_rawPrivateData(QList<QByteArray>())
|
||||
, m_comment(QString())
|
||||
, m_error(QString())
|
||||
{
|
||||
}
|
||||
|
||||
OpenSSHKey::OpenSSHKey(const OpenSSHKey& other)
|
||||
: QObject(nullptr)
|
||||
, m_type(other.m_type)
|
||||
, m_cipherName(other.m_cipherName)
|
||||
, m_kdfName(other.m_kdfName)
|
||||
, m_kdfOptions(other.m_kdfOptions)
|
||||
, m_rawType(other.m_rawType)
|
||||
, m_rawData(other.m_rawData)
|
||||
, m_rawPublicData(other.m_rawPublicData)
|
||||
, m_rawPrivateData(other.m_rawPrivateData)
|
||||
, m_comment(other.m_comment)
|
||||
, m_error(other.m_error)
|
||||
: QObject(nullptr)
|
||||
, m_type(other.m_type)
|
||||
, m_cipherName(other.m_cipherName)
|
||||
, m_kdfName(other.m_kdfName)
|
||||
, m_kdfOptions(other.m_kdfOptions)
|
||||
, m_rawType(other.m_rawType)
|
||||
, m_rawData(other.m_rawData)
|
||||
, m_rawPublicData(other.m_rawPublicData)
|
||||
, m_rawPrivateData(other.m_rawPrivateData)
|
||||
, m_comment(other.m_comment)
|
||||
, m_error(other.m_error)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user