Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 61c33585 authored by Andre Heinecke's avatar Andre Heinecke

Change OpenPGP key defaults to match GnuPG's

This causes kleopatra to generate OpenPGP keys
with a Sign / Certify primary key and an Encryption
only subkey.

The advanced options still give you the option to
generate a SCE Primary key without subkeys.

This change has been requested by the GnuPG maintainer
and was discussed on the Gpg4win-devel mailing list:
http://lists.wald.intevation.org/pipermail/gpg4win-devel/2015-April/001474.html

REVIEW: 124180
parent be886ddf
......@@ -27,17 +27,20 @@
<string>Key Material</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="3">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="rsaRB">
<property name="text">
<string>RSA</string>
</property>
<property name="checked">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="5">
<item row="0" column="2">
<widget class="QComboBox" name="rsaKeyStrengthCB"/>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -50,41 +53,34 @@
</property>
</spacer>
</item>
<item row="1" column="0" colspan="3">
<widget class="QRadioButton" name="dsaRB">
<property name="text">
<string>DSA</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="elgCB">
<item row="1" column="1">
<widget class="QCheckBox" name="rsaSubCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>+ Elgamal</string>
<string>+ RSA</string>
</property>
</widget>
</item>
<item row="2" column="3" colspan="2">
<widget class="QComboBox" name="elgKeyStrengthCB">
<property name="enabled">
<bool>false</bool>
<item row="1" column="2">
<widget class="QComboBox" name="rsaKeyStrengthSubCB"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QRadioButton" name="dsaRB">
<property name="text">
<string>DSA</string>
</property>
</widget>
</item>
<item row="0" column="3" colspan="2">
<widget class="QComboBox" name="rsaKeyStrengthCB"/>
</item>
<item row="1" column="3" colspan="2">
<item row="2" column="2">
<widget class="QComboBox" name="dsaKeyStrengthCB">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -94,12 +90,29 @@
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>1</height>
<width>13</width>
<height>13</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="elgCB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>+ Elgamal</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="elgKeyStrengthCB">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -255,11 +268,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KDateComboBox</class>
<extends>KComboBox</extends>
<header>kdatecombobox.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
......@@ -274,6 +282,11 @@
<signal>itemsChanged()</signal>
</slots>
</customwidget>
<customwidget>
<class>KDateComboBox</class>
<extends>KComboBox</extends>
<header>kdatecombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
......@@ -341,6 +354,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>rsaSubCB</sender>
<signal>toggled(bool)</signal>
<receiver>rsaKeyStrengthSubCB</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>147</x>
<y>185</y>
</hint>
<hint type="destinationlabel">
<x>291</x>
<y>185</y>
</hint>
</hints>
</connection>
<connection>
<sender>expiryCB</sender>
<signal>toggled(bool)</signal>
......@@ -389,6 +418,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>rsaSubCB</sender>
<signal>toggled(bool)</signal>
<receiver>Kleo::NewCertificateUi::AdvancedSettingsDialog</receiver>
<slot>slotKeyMaterialSelectionChanged()</slot>
<hints>
<hint type="sourcelabel">
<x>39</x>
<y>95</y>
</hint>
<hint type="destinationlabel">
<x>5</x>
<y>93</y>
</hint>
</hints>
</connection>
<connection>
<sender>dsaRB</sender>
<signal>toggled(bool)</signal>
......
......@@ -310,13 +310,30 @@ namespace {
0 ;
}
void setSubkeyType( unsigned int algo ) { ui.elgCB->setChecked( is_elg( algo ) ); }
unsigned int subkeyType() const { return ui.elgCB->isChecked() ? GPGME_PK_ELG_E : 0 ; }
void setSubkeyType( unsigned int algo ) {
ui.elgCB->setChecked( is_elg( algo ) );
ui.rsaSubCB->setChecked( is_rsa( algo ) );
}
unsigned int subkeyType() const {
if ( ui.elgCB->isChecked() ) {
return GPGME_PK_ELG_E;
} else if ( ui.rsaSubCB->isChecked() ) {
return GPGME_PK_RSA;
}
return 0;
}
void setSubkeyStrength( unsigned int strength ) {
set_keysize( ui.elgKeyStrengthCB, strength );
if ( subkeyType() == GPGME_PK_RSA ) {
set_keysize( ui.rsaKeyStrengthSubCB, strength );
} else {
set_keysize( ui.elgKeyStrengthCB, strength );
}
}
unsigned int subkeyStrength() const {
if ( subkeyType() == GPGME_PK_RSA ) {
return get_keysize( ui.rsaKeyStrengthSubCB );
}
return get_keysize( ui.elgKeyStrengthCB );
}
......@@ -354,6 +371,12 @@ namespace {
ui.signingCB->setEnabled( true );
ui.signingCB->setChecked( true );
ui.authenticationCB->setEnabled( true );
if ( is_rsa( sk_algo ) ) {
ui.encryptionCB->setEnabled( false );
ui.encryptionCB->setChecked( true );
} else {
ui.encryptionCB->setEnabled( true );
}
} else if ( is_dsa( algo ) ) {
ui.encryptionCB->setEnabled( false );
if ( is_elg( sk_algo ) )
......@@ -1227,7 +1250,7 @@ QStringList KeyCreationPage::keyUsages() const {
QStringList usages;
if ( signingAllowed() )
usages << QLatin1String("sign");
if ( encryptionAllowed() && !is_dsa( keyType() ) )
if ( encryptionAllowed() && !is_dsa( keyType() ) && !is_rsa( subkeyType() ) )
usages << QLatin1String("encrypt");
if ( 0 ) // not needed in pgp (implied) and not supported in cms
if ( certificationAllowed() )
......@@ -1241,7 +1264,7 @@ QStringList OverviewPage::i18nKeyUsages() const {
QStringList usages;
if ( signingAllowed() )
usages << i18n("Sign");
if ( encryptionAllowed() && !is_dsa( keyType() ) )
if ( encryptionAllowed() && !is_dsa( keyType() ) && !is_rsa( subkeyType() ) )
usages << i18n("Encrypt");
if ( 0 ) // not needed in pgp (implied) and not supported in cms
if ( certificationAllowed() )
......@@ -1253,9 +1276,8 @@ QStringList OverviewPage::i18nKeyUsages() const {
QStringList KeyCreationPage::subkeyUsages() const {
QStringList usages;
if ( encryptionAllowed() && is_dsa( keyType() ) ) {
if ( encryptionAllowed() && ( is_dsa( keyType() ) || is_rsa ( subkeyType() ) ) ) {
assert( subkeyType() );
assert( is_elg( subkeyType() ) );
usages << QLatin1String("encrypt");
}
return usages;
......@@ -1263,9 +1285,8 @@ QStringList KeyCreationPage::subkeyUsages() const {
QStringList OverviewPage::i18nSubkeyUsages() const {
QStringList usages;
if ( encryptionAllowed() && is_dsa( keyType() ) ) {
if ( encryptionAllowed() && ( is_dsa( keyType() ) || is_rsa ( subkeyType() ) ) ) {
assert( subkeyType() );
assert( is_elg( subkeyType() ) );
usages << i18n("Encrypt");
}
return usages;
......@@ -1411,6 +1432,7 @@ void AdvancedSettingsDialog::fillKeySizeComboBoxen() {
const QStringList elgKeySizeLabels = config.readEntry( ELG_KEYSIZE_LABELS_ENTRY, QStringList() );
fill_combobox( *ui.rsaKeyStrengthCB, rsaKeySizes, rsaKeySizeLabels );
fill_combobox( *ui.rsaKeyStrengthSubCB, rsaKeySizes, rsaKeySizeLabels );
fill_combobox( *ui.dsaKeyStrengthCB, dsaKeySizes, dsaKeySizeLabels );
fill_combobox( *ui.elgKeyStrengthCB, elgKeySizes, elgKeySizeLabels );
......@@ -1438,7 +1460,7 @@ void AdvancedSettingsDialog::loadDefaultKeyType() {
<< "\" for entry \"[CertificateCreationWizard]"
<< qPrintable( entry ) << "\"";
setKeyType( GPGME_PK_RSA );
setSubkeyType( 0 );
setSubkeyType( GPGME_PK_RSA );
}
keyTypeImmutable = config.isEntryImmutable( entry );
......@@ -1463,10 +1485,12 @@ void AdvancedSettingsDialog::updateWidgetVisibility() {
// Technical Details Page
if ( keyTypeImmutable ) {
ui.rsaRB->setEnabled( false );
ui.rsaSubCB->setEnabled( false );
ui.dsaRB->setEnabled( false );
ui.elgCB->setEnabled( false );
} else {
ui.rsaRB->setEnabled( true );
ui.rsaSubCB->setEnabled( protocol == OpenPGP );
ui.dsaRB->setEnabled( protocol == OpenPGP );
ui.elgCB->setEnabled( protocol == OpenPGP );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment