Changeset View
Changeset View
Standalone View
Standalone View
src/newcertificatewizard/newcertificatewizard.cpp
Show First 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | |||||
103 | static const char PGP_KEY_TYPE_ENTRY[] = "PGPKeyType"; | 103 | static const char PGP_KEY_TYPE_ENTRY[] = "PGPKeyType"; | ||
104 | static const char CMS_KEY_TYPE_ENTRY[] = "CMSKeyType"; | 104 | static const char CMS_KEY_TYPE_ENTRY[] = "CMSKeyType"; | ||
105 | 105 | | |||
106 | // This should come from gpgme in the future | 106 | // This should come from gpgme in the future | ||
107 | // For now we only support the basic 2.1 curves and check | 107 | // For now we only support the basic 2.1 curves and check | ||
108 | // for GnuPG 2.1. The whole subkey / usage generation needs | 108 | // for GnuPG 2.1. The whole subkey / usage generation needs | ||
109 | // new api and a reworked dialog. (ah 10.3.16) | 109 | // new api and a reworked dialog. (ah 10.3.16) | ||
110 | // EDDSA should be supported, too. | 110 | // EDDSA should be supported, too. | ||
111 | static const QStringList curveNames { | 111 | static const QStringList brainpoolCurveNames { | ||
112 | { QStringLiteral("brainpoolP256r1") }, | 112 | { QStringLiteral("brainpoolP256r1") }, | ||
113 | { QStringLiteral("brainpoolP384r1") }, | 113 | { QStringLiteral("brainpoolP384r1") }, | ||
114 | { QStringLiteral("brainpoolP512r1") }, | 114 | { QStringLiteral("brainpoolP512r1") }, | ||
115 | }; | ||||
116 | static const QStringList nistCurveNames { | ||||
115 | { QStringLiteral("NIST P-256") }, | 117 | { QStringLiteral("NIST P-256") }, | ||
116 | { QStringLiteral("NIST P-384") }, | 118 | { QStringLiteral("NIST P-384") }, | ||
117 | { QStringLiteral("NIST P-521") }, | 119 | { QStringLiteral("NIST P-521") }, | ||
118 | }; | 120 | }; | ||
119 | 121 | | |||
120 | static void set_tab_order(const QList<QWidget *> &wl) | 122 | static void set_tab_order(const QList<QWidget *> &wl) | ||
121 | { | 123 | { | ||
122 | kdtools::for_each_adjacent_pair(wl.begin(), wl.end(), &QWidget::setTabOrder); | 124 | kdtools::for_each_adjacent_pair(wl.begin(), wl.end(), &QWidget::setTabOrder); | ||
▲ Show 20 Lines • Show All 1638 Lines • ▼ Show 20 Line(s) | 1762 | if (sizes[i] < 0) { | |||
1761 | cb.setCurrentIndex(cb.count() - 1); | 1763 | cb.setCurrentIndex(cb.count() - 1); | ||
1762 | } | 1764 | } | ||
1763 | } | 1765 | } | ||
1764 | } | 1766 | } | ||
1765 | 1767 | | |||
1766 | void AdvancedSettingsDialog::fillKeySizeComboBoxen() | 1768 | void AdvancedSettingsDialog::fillKeySizeComboBoxen() | ||
1767 | { | 1769 | { | ||
1768 | 1770 | | |||
1771 | bool de_vs = Kleo::gpgComplianceP("de-vs"); | ||||
1769 | const KConfigGroup config(KSharedConfig::openConfig(), "CertificateCreationWizard"); | 1772 | const KConfigGroup config(KSharedConfig::openConfig(), "CertificateCreationWizard"); | ||
1770 | 1773 | | |||
1771 | const QList<int> rsaKeySizes = config.readEntry(RSA_KEYSIZES_ENTRY, QList<int>() << 1536 << -2048 << 3072 << 4096); | 1774 | const QList<int> rsaKeySizes = config.readEntry(RSA_KEYSIZES_ENTRY, | ||
1775 | de_vs | ||||
1776 | ? QList<int>() << -2048 << 3072 << 4096 | ||||
1777 | : QList<int>() << 1536 << -2048 << 3072 << 4096); | ||||
1772 | const QList<int> dsaKeySizes = config.readEntry(DSA_KEYSIZES_ENTRY, QList<int>() << -2048); | 1778 | const QList<int> dsaKeySizes = config.readEntry(DSA_KEYSIZES_ENTRY, QList<int>() << -2048); | ||
1773 | const QList<int> elgKeySizes = config.readEntry(ELG_KEYSIZES_ENTRY, QList<int>() << 1536 << -2048 << 3072 << 4096); | 1779 | const QList<int> elgKeySizes = config.readEntry(ELG_KEYSIZES_ENTRY, QList<int>() << 1536 << -2048 << 3072 << 4096); | ||
1774 | 1780 | | |||
1775 | const QStringList rsaKeySizeLabels = config.readEntry(RSA_KEYSIZE_LABELS_ENTRY, QStringList()); | 1781 | const QStringList rsaKeySizeLabels = config.readEntry(RSA_KEYSIZE_LABELS_ENTRY, QStringList()); | ||
1776 | const QStringList dsaKeySizeLabels = config.readEntry(DSA_KEYSIZE_LABELS_ENTRY, QStringList()); | 1782 | const QStringList dsaKeySizeLabels = config.readEntry(DSA_KEYSIZE_LABELS_ENTRY, QStringList()); | ||
1777 | const QStringList elgKeySizeLabels = config.readEntry(ELG_KEYSIZE_LABELS_ENTRY, QStringList()); | 1783 | const QStringList elgKeySizeLabels = config.readEntry(ELG_KEYSIZE_LABELS_ENTRY, QStringList()); | ||
1784 | const QStringList curveNames = (de_vs | ||||
1785 | ? brainpoolCurveNames | ||||
1786 | : brainpoolCurveNames + nistCurveNames); | ||||
1778 | 1787 | | |||
1779 | fill_combobox(*ui.rsaKeyStrengthCB, rsaKeySizes, rsaKeySizeLabels); | 1788 | fill_combobox(*ui.rsaKeyStrengthCB, rsaKeySizes, rsaKeySizeLabels); | ||
1780 | fill_combobox(*ui.rsaKeyStrengthSubCB, rsaKeySizes, rsaKeySizeLabels); | 1789 | fill_combobox(*ui.rsaKeyStrengthSubCB, rsaKeySizes, rsaKeySizeLabels); | ||
1781 | fill_combobox(*ui.dsaKeyStrengthCB, dsaKeySizes, dsaKeySizeLabels); | 1790 | fill_combobox(*ui.dsaKeyStrengthCB, dsaKeySizes, dsaKeySizeLabels); | ||
1782 | fill_combobox(*ui.elgKeyStrengthCB, elgKeySizes, elgKeySizeLabels); | 1791 | fill_combobox(*ui.elgKeyStrengthCB, elgKeySizes, elgKeySizeLabels); | ||
1783 | ui.ecdhKeyCurvesCB->addItems(curveNames); | 1792 | ui.ecdhKeyCurvesCB->addItems(curveNames); | ||
1784 | ui.ecdsaKeyCurvesCB->addItems(curveNames); | 1793 | ui.ecdsaKeyCurvesCB->addItems(curveNames); | ||
1785 | } | 1794 | } | ||
Show All 26 Lines | 1797 | { | |||
1812 | } | 1821 | } | ||
1813 | 1822 | | |||
1814 | keyTypeImmutable = config.isEntryImmutable(entry); | 1823 | keyTypeImmutable = config.isEntryImmutable(entry); | ||
1815 | updateWidgetVisibility(); | 1824 | updateWidgetVisibility(); | ||
1816 | } | 1825 | } | ||
1817 | 1826 | | |||
1818 | void AdvancedSettingsDialog::updateWidgetVisibility() | 1827 | void AdvancedSettingsDialog::updateWidgetVisibility() | ||
1819 | { | 1828 | { | ||
1829 | bool de_vs = Kleo::gpgComplianceP("de-vs"); | ||||
1830 | | ||||
1820 | // Personal Details Page | 1831 | // Personal Details Page | ||
1821 | if (protocol == OpenPGP) { // ### hide until multi-uid is implemented | 1832 | if (protocol == OpenPGP) { // ### hide until multi-uid is implemented | ||
1822 | if (ui.tabWidget->indexOf(ui.personalTab) != -1) { | 1833 | if (ui.tabWidget->indexOf(ui.personalTab) != -1) { | ||
1823 | ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.personalTab)); | 1834 | ui.tabWidget->removeTab(ui.tabWidget->indexOf(ui.personalTab)); | ||
1824 | } | 1835 | } | ||
1825 | } else { | 1836 | } else { | ||
1826 | if (ui.tabWidget->indexOf(ui.personalTab) == -1) { | 1837 | if (ui.tabWidget->indexOf(ui.personalTab) == -1) { | ||
1827 | ui.tabWidget->addTab(ui.personalTab, tr2i18n("Personal Details", nullptr)); | 1838 | ui.tabWidget->addTab(ui.personalTab, tr2i18n("Personal Details", nullptr)); | ||
Show All 16 Lines | 1853 | if (keyTypeImmutable) { | |||
1844 | ui.rsaSubCB->setEnabled(false); | 1855 | ui.rsaSubCB->setEnabled(false); | ||
1845 | ui.dsaRB->setEnabled(false); | 1856 | ui.dsaRB->setEnabled(false); | ||
1846 | ui.elgCB->setEnabled(false); | 1857 | ui.elgCB->setEnabled(false); | ||
1847 | ui.ecdsaRB->setEnabled(false); | 1858 | ui.ecdsaRB->setEnabled(false); | ||
1848 | ui.ecdhCB->setEnabled(false); | 1859 | ui.ecdhCB->setEnabled(false); | ||
1849 | } else { | 1860 | } else { | ||
1850 | ui.rsaRB->setEnabled(true); | 1861 | ui.rsaRB->setEnabled(true); | ||
1851 | ui.rsaSubCB->setEnabled(protocol == OpenPGP); | 1862 | ui.rsaSubCB->setEnabled(protocol == OpenPGP); | ||
1852 | ui.dsaRB->setEnabled(protocol == OpenPGP); | 1863 | ui.dsaRB->setEnabled(protocol == OpenPGP && ! de_vs); | ||
1853 | ui.elgCB->setEnabled(protocol == OpenPGP); | 1864 | ui.elgCB->setEnabled(protocol == OpenPGP && ! de_vs); | ||
1854 | ui.ecdsaRB->setEnabled(protocol == OpenPGP); | 1865 | ui.ecdsaRB->setEnabled(protocol == OpenPGP); | ||
1855 | ui.ecdhCB->setEnabled(protocol == OpenPGP); | 1866 | ui.ecdhCB->setEnabled(protocol == OpenPGP); | ||
1856 | } | 1867 | } | ||
1857 | ui.certificationCB->setVisible(protocol == OpenPGP); // gpgsm limitation? | 1868 | ui.certificationCB->setVisible(protocol == OpenPGP); // gpgsm limitation? | ||
1858 | ui.authenticationCB->setVisible(protocol == OpenPGP); | 1869 | ui.authenticationCB->setVisible(protocol == OpenPGP); | ||
1859 | if (protocol == OpenPGP) { // pgp keys must have certify capability | 1870 | if (protocol == OpenPGP) { // pgp keys must have certify capability | ||
1860 | ui.certificationCB->setChecked(true); | 1871 | ui.certificationCB->setChecked(true); | ||
1861 | ui.certificationCB->setEnabled(false); | 1872 | ui.certificationCB->setEnabled(false); | ||
Show All 12 Lines |