diff --git a/crypt-key.csv b/crypt-key.csv index d95b0a8..5c8e385 100644 --- a/crypt-key.csv +++ b/crypt-key.csv @@ -1,7 +1,7 @@ -KEY_NAME;KEY_DESCRIPTION -RSA;RSA/RSA -DSA ElGamal;DSA/ELG -DSA (sign only);DSA -RSA (sign only);RSA -GOST R 34.10-2012;GOST3410-2012 -GOST R 34.10-2001;GOST3410-2001 \ No newline at end of file +KEY_NAME;KEY_DESCRIPTION;KEY_ALGO_NAME +RSA;RSA/RSA;RSA +DSA ElGamal;DSA/ELG;ELG +DSA (sign only);DSA;DSA +RSA (sign only);RSA;RSA +GOST R 34.10-2012;GOST3410-2012;GOST3410-2012 +GOST R 34.10-2001;GOST3410-2001;GOST3410-2001 \ No newline at end of file diff --git a/source/ubl-settings-repomanager.c b/source/ubl-settings-repomanager.c index eb824d2..3df66ed 100644 --- a/source/ubl-settings-repomanager.c +++ b/source/ubl-settings-repomanager.c @@ -51,7 +51,7 @@ void on_repo_sign_changed(GtkWidget *self, storage_config_window *window){ if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->storages_copy),&itar,child_id)){ if (!yon_char_is_empty(sign)){ gtk_tree_store_set(window->storages_copy,&itar,6,1,5,sign,-1); - if (!system(yon_sign_repo(storage_path,target_repo,sign))){ + if (system(yon_sign_repo(storage_path,target_repo,sign))){ gtk_combo_box_set_active(GTK_COMBO_BOX((GtkWidget*)g_list_nth_data(list,2)),0); } }else @@ -61,7 +61,7 @@ void on_repo_sign_changed(GtkWidget *self, storage_config_window *window){ } } -void yon_storage_config_update(storage_config_window *window){ +void yon_storage_config_update(storage_config_window *window){ GList *children = gtk_container_get_children(GTK_CONTAINER(window->ReposBox)); for (int i=0;iInformationLabel),""); + GtkTreeIter iter,itar; + GtkTreeModel *model, *model2; + if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoFileTree)),&model,&iter)){ + gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->ReposTree)),&model2,&itar); + switch (gtk_tree_store_iter_depth(widgets->RepoList,&itar)){ + case 0: + break; + case 1: + break; + case 2: + char *path, *filename; + gtk_tree_model_get(model,&iter,3,&filename,-1); + gtk_tree_model_get(model2,&itar,3,&path,-1); + int size; + config_str parsed = yon_config_load(get_package_info_command(yon_char_unite(path,"/",filename,NULL)),&size); + char *full = yon_char_parsed_to_string(parsed,size,""); + gtk_label_set_text(GTK_LABEL(widgets->InformationLabel),full); + yon_char_parsed_free(parsed,size); + free(full); + break; + } + } +} + void yon_combo_box_text_set_signs(GtkComboBoxText *target){ g_return_if_fail(GTK_IS_COMBO_BOX_TEXT(target)); gtk_combo_box_text_remove_all(target); @@ -1130,6 +1156,30 @@ void on_calendar_open(GtkWidget *self,key_creation_window *window){ yon_calendar_popover_open(GTK_ENTRY(window->ExpireEntry),self); } +void on_key_generate_accept(GtkWidget *self, key_creation_window* window){ + const char *name = gtk_entry_get_text(GTK_ENTRY(window->NameEntry)); + const char *type = gtk_combo_box_get_active_id(GTK_COMBO_BOX(window->EncryptionCombo)); + const char *email = gtk_entry_get_text(GTK_ENTRY(window->EmailEntry)); + char *strength = yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(window->KeyStrengthSpin))); + const char *comment = gtk_entry_get_text(GTK_ENTRY(window->CommentsEntry)); + char *expire = NULL; + if (gtk_combo_box_get_active(GTK_COMBO_BOX(window->ExpireCombo))==1){ + expire = yon_char_from_int(yon_calendar_get_last_date()); + } + const char *password = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + const char *password_confirm = gtk_entry_get_text(GTK_ENTRY(window->PasswordEntry)); + if (yon_char_is_empty(password)&&yon_char_is_empty(password_confirm)){ + system(yon_generate_key_no_password_command(type,name,email,strength,comment,expire,password)); + } else if (!strcmp(password,password_confirm)){ + system(yon_generate_key_command(type,name,email,strength,comment,expire,password)); + } else { + yon_ubl_status_box_spawn(GTK_CONTAINER(window->StatusBox),PASSWORD_INCORRECT_LABEL,5,BACKGROUND_IMAGE_FAIL_TYPE); + return; + } + gtk_widget_destroy(window->Window); + yon_sign_list_update(); +} + key_creation_window *yon_key_creation_window_new(){ key_creation_window *window = malloc(sizeof(key_creation_window)); GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_key); @@ -1146,18 +1196,22 @@ key_creation_window *yon_key_creation_window_new(){ window->ExpireButton = yon_gtk_builder_get_widget(builder,"ExpireButton"); window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); window->AddButton = yon_gtk_builder_get_widget(builder,"AddButton"); + window->PasswordEntry = yon_gtk_builder_get_widget(builder,"PasswordEntry"); + window->PasswordConfirmationEntry = yon_gtk_builder_get_widget(builder,"PasswordConfirmationEntry"); g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->ExpireButton),"clicked",G_CALLBACK(on_calendar_open),window); + g_signal_connect(G_OBJECT(window->AddButton),"clicked",G_CALLBACK(on_key_generate_accept),window); int size; config_str encription_keys = yon_file_open(key_encription_path,&size); + window->expire_time=0; for (int i=1;iEncryptionCombo),parsed[0]); + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(window->EncryptionCombo),parsed[2],parsed[0]); yon_char_parsed_free(parsed,parsed_size); } return window; @@ -1214,6 +1268,7 @@ main_window *yon_main_window_complete(main_window *widgets){ g_signal_connect(G_OBJECT(widgets->RemoveButton),"clicked",G_CALLBACK(on_remove_clicked),widgets); g_signal_connect(G_OBJECT(widgets->ReposTree),"cursor-changed",G_CALLBACK(on_main_tree_selection_changed),widgets); g_signal_connect(G_OBJECT(widgets->CloudButton),"clicked",G_CALLBACK(on_ubl_settings_update_launch),widgets); + g_signal_connect(G_OBJECT(widgets->RepoFileTree),"cursor-changed",G_CALLBACK(on_package_selection_changed),widgets); yon_calendar_set_date_orientation(1); gtk_window_set_title(GTK_WINDOW(widgets->Window),TITLE_LABEL); diff --git a/source/ubl-settings-repomanager.h b/source/ubl-settings-repomanager.h index 5fd151b..b02abe4 100644 --- a/source/ubl-settings-repomanager.h +++ b/source/ubl-settings-repomanager.h @@ -67,9 +67,39 @@ typedef char* string; #define get_gpg_keys_command yon_char_unite(yon_ubl_check_root()==1 ? yon_char_unite("su - ",yon_ubl_root_user_get()," -c \"gpg --list-signatures\"",NULL):"gpg --list-signatures"," | grep '^sig 3' | cut -d' ' -f10,11,13- | sort -u |sed -e 's/[0-9]*-[0-9]*-[0-9]* //g'",NULL) #define yon_sign_package(storage,repo,arch,target,sign) yon_char_unite("repo-manager add -r '",repo,"' -a '",arch,"' -d '", storage,"' -S '",sign,"' ",target,NULL) -#define yon_sign_repo(storage,repo,sign) yon_char_unite("repo-manager add -r '",repo,"' -d '", storage,"' -S '",sign,"'",NULL) - -#define get_package_info_command(filename) yon_char_unite("pacman -Q --info --file ",filename," |sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g'",NULL) +#define yon_sign_repo(storage,repo,sign) yon_char_unite("repo-manager add -f -r '",repo,"' -d '", storage,"' --sign-repo='",sign,"'",NULL) + +#define get_package_info_command(filename) yon_char_unite("pacman -Q --info --file ",filename," |sed -e 's/ */ /g' -e 's/ : /:/g' -e 's/\\n/ /g' -e 's/^ /\\t/g'",NULL) + +#define yon_generate_key_command(type,name,email,strength,comment,expire,password) yon_char_unite("gpg --batch --gen-key < - + + True False diff --git a/ubl-settings-repomanager-key.glade b/ubl-settings-repomanager-key.glade index 01bc6bb..07621c5 100644 --- a/ubl-settings-repomanager-key.glade +++ b/ubl-settings-repomanager-key.glade @@ -4,9 +4,11 @@ - 99999999 - 1 - 10 + 1024 + 4096 + 2048 + 512 + 512 True @@ -235,6 +237,7 @@ True True adjustment1 + 2048 True @@ -272,8 +275,8 @@ False 0 - timeless - until + Timeless + Until @@ -318,6 +321,78 @@ 3 + + + True + False + 5 + + + True + False + Password: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 2 + + + + + False + True + 4 + + + + + True + False + 5 + + + True + False + Password confirmation: + 0 + + + False + True + 0 + + + + + True + True + + + True + True + 2 + + + + + False + True + 5 + + @@ -360,7 +435,7 @@ True False - Repository manager + Key creation @@ -400,4 +475,10 @@ + + + + + + diff --git a/ubl-settings-repomanager-repo-block.glade b/ubl-settings-repomanager-repo-block.glade index 9d02791..a1682ac 100644 --- a/ubl-settings-repomanager-repo-block.glade +++ b/ubl-settings-repomanager-repo-block.glade @@ -57,6 +57,7 @@ True True True + Sign repo image1