mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-10 19:36:57 +00:00
Complete rewrite from gpgme to rnp
This commit is contained in:
@@ -19,6 +19,11 @@ ImportKeyJob::ImportKeyJob(QDir rnp_homedir, QString key_file_path):
|
||||
void ImportKeyJob::run()
|
||||
{
|
||||
qDebug() << "[ImportKeyJob] Starting";
|
||||
|
||||
// Loading keyring
|
||||
this->loadFullKeyring(NULL);
|
||||
|
||||
// Import new key
|
||||
rnp_input_t input = NULL;
|
||||
auto ret = rnp_input_from_path(&input, this->m_key_file_path.toLocal8Bit().constData());
|
||||
if (ret == RNP_SUCCESS) {
|
||||
@@ -35,29 +40,33 @@ void ImportKeyJob::run()
|
||||
rnp_input_destroy(input);
|
||||
terminateOnError(ret);
|
||||
|
||||
rnp_output_t output = NULL;
|
||||
qDebug() << "[ImportKeyJob] Writing pubring to " << this->pubringPath();
|
||||
ret = rnp_output_to_file(&output, this->pubringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||
if (ret == RNP_SUCCESS) {
|
||||
qDebug() << "[ImportKeyJob] Saving key pubring ";
|
||||
ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_PUBLIC_KEYS);
|
||||
// Save resulting keyring
|
||||
this->saveFullKeyring();
|
||||
// rnp_output_t output = NULL;
|
||||
// qDebug() << "[ImportKeyJob] Writing pubring to " << this->pubringPath();
|
||||
// ret = rnp_output_to_file(&output, this->pubringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||
// if (ret == RNP_SUCCESS) {
|
||||
// qDebug() << "[ImportKeyJob] Saving key pubring ";
|
||||
// ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_PUBLIC_KEYS);
|
||||
|
||||
}
|
||||
if (ret == RNP_SUCCESS) {
|
||||
ret = rnp_output_finish(output);
|
||||
}
|
||||
rnp_output_destroy(output);
|
||||
terminateOnError(ret);
|
||||
// }
|
||||
// if (ret == RNP_SUCCESS) {
|
||||
// ret = rnp_output_finish(output);
|
||||
// }
|
||||
// rnp_output_destroy(output);
|
||||
// terminateOnError(ret);
|
||||
|
||||
qDebug() << "[ImportKeyJob] Writing secring to " << this->secringPath();
|
||||
ret = rnp_output_to_file(&output, this->secringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||
if (ret == RNP_SUCCESS) {
|
||||
qDebug() << "[ImportKeyJob] Saving key secring ";
|
||||
ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_SECRET_KEYS);
|
||||
}
|
||||
// qDebug() << "[ImportKeyJob] Writing secring to " << this->secringPath();
|
||||
// ret = rnp_output_to_file(&output, this->secringPath().toLocal8Bit().constData(), RNP_OUTPUT_FILE_OVERWRITE);
|
||||
// if (ret == RNP_SUCCESS) {
|
||||
// qDebug() << "[ImportKeyJob] Saving key secring ";
|
||||
// ret = rnp_save_keys(this->m_ffi, RNP_KEYSTORE_GPG, output, RNP_LOAD_SAVE_SECRET_KEYS);
|
||||
// }
|
||||
|
||||
rnp_output_destroy(output);
|
||||
terminateOnError(ret);
|
||||
// rnp_output_destroy(output);
|
||||
// terminateOnError(ret);
|
||||
|
||||
// Emit result
|
||||
emit resultSuccess();
|
||||
qDebug() << "[ImportKeyJob] Finished Successfully ";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user