From 6f0d768e6932fe0c13bc52b193f41235ee6b306b Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Sun, 19 Aug 2018 16:11:43 -0400 Subject: [PATCH] Saving custom passwords and logins. --- .../lyndir/masterpassword/MPMasterKey.java | 10 +++ .../lyndir/masterpassword/MPResultType.java | 26 ++++---- .../lyndir/masterpassword/gui/util/Res.java | 4 ++ .../gui/view/UserContentPanel.java | 63 +++++++++++++++++- .../src/main/resources/media/icon_edit.png | Bin 0 -> 1946 bytes .../src/main/resources/media/icon_edit@2x.png | Bin 0 -> 2815 bytes .../lyndir/masterpassword/model/MPSite.java | 11 ++- .../model/impl/MPBasicSite.java | 4 +- .../masterpassword/model/impl/MPFileSite.java | 2 +- 9 files changed, 96 insertions(+), 24 deletions(-) create mode 100644 platform-independent/java/gui/src/main/resources/media/icon_edit.png create mode 100644 platform-independent/java/gui/src/main/resources/media/icon_edit@2x.png diff --git a/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPMasterKey.java b/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPMasterKey.java index bd55e387..32147cf6 100644 --- a/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPMasterKey.java +++ b/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPMasterKey.java @@ -66,6 +66,7 @@ public class MPMasterKey { * * @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object. */ + @Nonnull public byte[] getKeyID(final MPAlgorithm algorithm) throws MPKeyUnavailableException, MPAlgorithmException { @@ -87,6 +88,7 @@ public class MPMasterKey { return !invalidated; } + @Nonnull private byte[] masterKey(final MPAlgorithm algorithm) throws MPKeyUnavailableException, MPAlgorithmException { Preconditions.checkArgument( masterPassword.length > 0 ); @@ -109,6 +111,7 @@ public class MPMasterKey { return masterKey; } + @Nonnull private byte[] siteKey(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter, final MPKeyPurpose keyPurpose, @Nullable final String keyContext) throws MPKeyUnavailableException, MPAlgorithmException { @@ -141,13 +144,19 @@ public class MPMasterKey { * In the case of {@link MPResultTypeClass#Stateful} types, the result of * {@link #siteState(String, MPAlgorithm, UnsignedInteger, MPKeyPurpose, String, MPResultType, String)}. * + * @return {@code null} if the result type is missing a required parameter. + * * @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object. */ + @Nullable public String siteResult(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter, final MPKeyPurpose keyPurpose, @Nullable final String keyContext, final MPResultType resultType, @Nullable final String resultParam) throws MPKeyUnavailableException, MPAlgorithmException { + if ((resultType.getTypeClass() == MPResultTypeClass.Stateful) && (resultParam == null)) + return null; + byte[] masterKey = masterKey( algorithm ); byte[] siteKey = siteKey( siteName, algorithm, siteCounter, keyPurpose, keyContext ); @@ -176,6 +185,7 @@ public class MPMasterKey { * * @throws MPKeyUnavailableException {@link #invalidate()} has been called on this object. */ + @Nonnull public String siteState(final String siteName, final MPAlgorithm algorithm, final UnsignedInteger siteCounter, final MPKeyPurpose keyPurpose, @Nullable final String keyContext, final MPResultType resultType, final String resultParam) diff --git a/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPResultType.java b/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPResultType.java index e13e358c..36af3936 100644 --- a/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPResultType.java +++ b/platform-independent/java/algorithm/src/main/java/com/lyndir/masterpassword/MPResultType.java @@ -41,7 +41,7 @@ public enum MPResultType { /** * 16: pg^VMAUBk5x3p%HP%i4= */ - GeneratedMaximum( "maximum", "Maximum Security", "pg^VMAUBk5x3p%HP%i4=", "20 characters, contains symbols.", // + GeneratedMaximum( "maximum", "Maximum Security", "pg^VMAUBk5x3p%HP%i4=", "20 characters, contains symbols", // ImmutableList.of( new MPTemplate( "anoxxxxxxxxxxxxxxxxx" ), new MPTemplate( "axxxxxxxxxxxxxxxxxno" ) ), // MPResultTypeClass.Template, 0x0 ), @@ -49,7 +49,7 @@ public enum MPResultType { /** * 17: BiroYena8:Kixa */ - GeneratedLong( "long", "Long Password", "BiroYena8:Kixa", "Copy-friendly, 14 characters, contains symbols.", // + GeneratedLong( "long", "Long Password", "BiroYena8:Kixa", "Copy-friendly, 14 characters, contains symbols", // ImmutableList.of( new MPTemplate( "CvcvnoCvcvCvcv" ), new MPTemplate( "CvcvCvcvnoCvcv" ), new MPTemplate( "CvcvCvcvCvcvno" ), new MPTemplate( "CvccnoCvcvCvcv" ), new MPTemplate( "CvccCvcvnoCvcv" ), new MPTemplate( "CvccCvcvCvcvno" ), @@ -66,7 +66,7 @@ public enum MPResultType { /** * 18: BirSuj0- */ - GeneratedMedium( "medium", "Medium Password", "BirSuj0-", "Copy-friendly, 8 characters, contains symbols.", // + GeneratedMedium( "medium", "Medium Password", "BirSuj0-", "Copy-friendly, 8 characters, contains symbols", // ImmutableList.of( new MPTemplate( "CvcnoCvc" ), new MPTemplate( "CvcCvcno" ) ), // MPResultTypeClass.Template, 0x2 ), @@ -74,14 +74,14 @@ public enum MPResultType { /** * 19: Bir8 */ - GeneratedShort( "short", "Short Password", "Bir8", "Copy-friendly, 4 characters, no symbols.", // + GeneratedShort( "short", "Short Password", "Bir8", "Copy-friendly, 4 characters, no symbols", // ImmutableList.of( new MPTemplate( "Cvcn" ) ), // MPResultTypeClass.Template, 0x3 ), /** * 20: pO98MoD0 */ - GeneratedBasic( "basic", "Basic Password", "pO98MoD0", "8 characters, no symbols.", // + GeneratedBasic( "basic", "Basic Password", "pO98MoD0", "8 characters, no symbols", // ImmutableList.of( new MPTemplate( "aaanaaan" ), new MPTemplate( "aannaaan" ), new MPTemplate( "aaannaaa" ) ), // @@ -90,44 +90,44 @@ public enum MPResultType { /** * 21: 2798 */ - GeneratedPIN( "pin", "PIN Code", "2798", "4 numbers.", // + GeneratedPIN( "pin", "PIN Code", "2798", "4 numbers", // ImmutableList.of( new MPTemplate( "nnnn" ) ), // MPResultTypeClass.Template, 0x5 ), /** * 30: birsujano */ - GeneratedName( "name", "Name", "birsujano", "9 letter name.", // + GeneratedName( "name", "Name", "birsujano", "9 letter name", // ImmutableList.of( new MPTemplate( "cvccvcvcv" ) ), // MPResultTypeClass.Template, 0xE ), /** * 31: bir yennoquce fefi */ - GeneratedPhrase( "phrase", "Phrase", "bir yennoquce fefi", "20 character sentence.", // + GeneratedPhrase( "phrase", "Phrase", "bir yennoquce fefi", "20 character sentence", // ImmutableList.of( new MPTemplate( "cvcc cvc cvccvcv cvc" ), new MPTemplate( "cvc cvccvcvcv cvcv" ), new MPTemplate( "cv cvccv cvc cvcvccv" ) ), // MPResultTypeClass.Template, 0xF ), /** - * 1056: Custom saved password. + * 1056: Custom saved value. */ - StoredPersonal( "personal", "Saved Password", null, "AES-encrypted, exportable.", // + StoredPersonal( "personal", "Saved", null, "AES-encrypted, exportable", // ImmutableList.of(), // MPResultTypeClass.Stateful, 0x0, MPSiteFeature.ExportContent ), /** - * 2081: Custom saved password that should not be exported from the device. + * 2081: Custom saved value that should not be exported from the device. */ - StoredDevicePrivate( "device", "Private Password", null, "AES-encrypted, not exported.", // + StoredDevicePrivate( "device", "Private", null, "AES-encrypted, not exported", // ImmutableList.of(), // MPResultTypeClass.Stateful, 0x1, MPSiteFeature.DevicePrivate ), /** * 4160: Derive a unique binary key. */ - DeriveKey( "key", "Binary Key", null, "Encryption key.", // + DeriveKey( "key", "Binary Key", null, "Encryption key", // ImmutableList.of(), // MPResultTypeClass.Derive, 0x0, MPSiteFeature.Alternative ); diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java index 837b7ab2..2a0241b7 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java @@ -160,6 +160,10 @@ public abstract class Res { return icon( "media/icon_settings.png" ); } + public Icon edit() { + return icon( "media/icon_edit.png" ); + } + public Icon avatar(final int index) { return icon( strf( "media/avatar-%d.png", index % avatars() ) ); } diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java index af9b83a6..1bc494a0 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java @@ -470,6 +470,8 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, "Show site settings." ); private final JButton questionsButton = Components.button( Res.icons().question(), event -> showSiteQuestions(), "Show site recovery questions." ); + private final JButton editButton = Components.button( Res.icons().edit(), event -> showEditSite(), + "Set/save personal password/login." ); private final JButton deleteButton = Components.button( Res.icons().delete(), event -> deleteSite(), "Delete the site from the user." ); @@ -499,6 +501,7 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, siteToolbar.add( settingsButton ); siteToolbar.add( questionsButton ); + siteToolbar.add( editButton ); siteToolbar.add( deleteButton ); settingsButton.setEnabled( false ); questionsButton.setEnabled( false ); @@ -587,12 +590,14 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, Components.strut() ); components.add( Components.label( "Password Type:" ), - Components.comboBox( MPResultType.values(), MPResultType::getLongName, + Components.comboBox( MPResultType.values(), type -> getTypeDescription( + type, user.getDefaultType(), user.getAlgorithm().mpw_default_result_type() ), site.getResultType(), site::setResultType ), Components.strut() ); components.add( Components.label( "Login Type:" ), - Components.comboBox( MPResultType.values(), MPResultType::getLongName, + Components.comboBox( MPResultType.values(), type -> getTypeDescription( + type, user.getAlgorithm().mpw_default_login_type() ), site.getLoginType(), site::setLoginType ), Components.strut() ); @@ -606,6 +611,15 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, BoxLayout.PAGE_AXIS, components.build().toArray( new Component[0] ) ) ) ); } + private String getTypeDescription(final MPResultType type, final MPResultType... defaults) { + boolean isDefault = false; + for (final MPResultType d : defaults) + if (isDefault = type == d) + break; + + return strf( "%s%s%s, %s", isDefault? "": "", type.getLongName(), isDefault? "": "", type.getDescription() ); + } + public void showSiteQuestions() { MPSite site = sitesModel.getSelectedItem(); if (site == null) @@ -651,6 +665,51 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, } ); } + public void showEditSite() { + MPSite site = sitesModel.getSelectedItem(); + if (site == null) + return; + + try { + JTextField passwordField = Components.textField( site.getResult(), null ); + JTextField loginField = Components.textField( site.getLogin(), null ); + passwordField.setEditable( site.getResultType().getTypeClass() == MPResultTypeClass.Stateful ); + loginField.setEditable( site.getLoginType().getTypeClass() == MPResultTypeClass.Stateful ); + + if (JOptionPane.OK_OPTION == Components.showDialog( this, site.getSiteName(), new JOptionPane( + Components.panel( + BoxLayout.PAGE_AXIS, + Components.label( strf( "Site Login (currently set to: %s):", + getTypeDescription( site.getLoginType() ) ) ), + loginField, + Components.strut(), + Components.label( strf( "Site Password (currently set to: %s):", + getTypeDescription( site.getResultType() ) ) ), + passwordField, + Components.strut(), + Components.label( "To save a personal value in these fields,\n" + + "change the type to Saved in the site's settings." ) ), + JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION ) { + @Override + public void selectInitialValue() { + passwordField.requestFocusInWindow(); + } + } )) { + if (site instanceof MPFileSite) { + MPFileSite fileSite = (MPFileSite) site; + + if (site.getResultType().getTypeClass() == MPResultTypeClass.Stateful) + fileSite.setSitePassword( site.getResultType(), passwordField.getText() ); + if (site.getLoginType().getTypeClass() == MPResultTypeClass.Stateful) + fileSite.setLoginName( site.getLoginType(), loginField.getText() ); + } + } + } + catch (final MPKeyUnavailableException | MPAlgorithmException e) { + logger.err( e, "While computing site edit results." ); + } + } + public void deleteSite() { MPSite site = sitesModel.getSelectedItem(); if (site == null) diff --git a/platform-independent/java/gui/src/main/resources/media/icon_edit.png b/platform-independent/java/gui/src/main/resources/media/icon_edit.png new file mode 100644 index 0000000000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s=T#%+AYp- zl??*#%1uqoJP&!^YL?OSYU!4A$z$n|dEwxV&t+_n|E_A9y|a zB-*~-MPcps_3O{EnXg~Da%XsK?A-ptb5&Z`@GWoAoLqVJ;c2c1y{y~L=42GV`PqHV ze8UwbM~+rmJ)y`PK2Em9o!WYlwLc~?{fNE#`s+`F_xC@4`c(8$>C>8}PjwTwF3eC{ z)*}!n6#k=#>7}!My_tolki0^ji;CW=SJJo6ifIc;n)?)ncRl8h_e*%Kzjt4G)v=~G zdYvwTbG@!MzCNzTD-fr{*4sWh#F< z|K2XP|M}fHTA3Fgb_z|{o0q-2djBuS=)8B1HAOp_V_5YVc6{FyS~KH_>IA+wY<5y0_1og$<-){Y{3>X7#G-Zo-#<2yt78^P&YtSi?iv89QaxS$T-G@yGywqJ CKla}M literal 0 HcmV?d00001 diff --git a/platform-independent/java/gui/src/main/resources/media/icon_edit@2x.png b/platform-independent/java/gui/src/main/resources/media/icon_edit@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..56dc750d649b851ba2aabd560a3df01df7cc950d GIT binary patch literal 2815 zcmbVLc~nzZ8h;RxR1FZsDY!rgDiIQr5FiVi2?>%yAS?n=#DpY3APa_v5T=xfNRdr! zB%n;)L0b_~5m3>9id5N0r=XNYD_R7s2NjGP^PMZ++b{sY;w2H$U^FL)CRE5=1R_P8*d;@j0^I|Emv2Uj zK$t8BQE}n~iQF6g`(+&(B@ua}que3cczk+#x=T9A zMWIZ<6RA|H!G^0V4np8kRdP^}fs>~?%v)fJQ-w-N3Mf&?Q3i{GI7J%hjfNuql!7dU z!}-IoJoR&-ppxM;1Sxo;3jr^a8S?swP6fln{|Vzy(Ww!t6fr(boT^Au3dIoIVO|-k z-CsL00HJ7TAxa7KC;}-{Axx8rFj8G_~^BurVRDg=qL`4e9FWeo)5eOx6!`|>bpR#3&m6GjZ zk-t(QLw&3-P4XxH{i*+(H-+xOWV!kiDXt7RcYh)k{aIJ^|I`c*1%o#<$A2};{1McF zhUFiv4{iP+k5~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)7}XTo3d{0*@d3iXqt47@MX~ z)n2kG%nn{E*1y5gGl(@SLJH4L$D8mqVioMZNzIc}jA+D6)W-f_M%%b~ktxAT#;a|n zckSABqIe(KS>5;D>Wg>A-BvwqcFJAHM^Ngn^Ykq}b-cSKN55UGC|n0wDs{|%7)TSj zGbq1-Q_^?VqVr4embe36zGLa?IKnVS6>f}icCNH7ZWCKI+pz*2a{YqK7uyqf_Zxi= zc*TZ~alSZwatG#J%w03Y%SH7X^aYrSx3L*HBmiufy0fL;pC*0j^V^lP2YCH@q-aEqI#m#njP;S9pnz_8PMniT` zU#nZ)_71z@%}zS2f000QeOqG-LvK*H1O6aK%k+dq$CUc zkS&VlB-(A{R8(E!9qoV3i@ddBmHNu5QxnS{6Z;;%8ce@6IQ#7FM9=rStcI)KB&byS z)lR2!`BAoqv3toh_17g|4ri;6A8-sglywmtOG@9^b#SIFQ2Pr*S2()lq{##wS=RW~ zKs~V1tXlZ8MsBZpQ;44`yvPI%hWOd1h;TOz!b0 QAw+S2%?f7LGWa?F2CGGeO8@`> literal 0 HcmV?d00001 diff --git a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/MPSite.java b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/MPSite.java index 645e160c..f35a150a 100644 --- a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/MPSite.java +++ b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/MPSite.java @@ -58,30 +58,29 @@ public interface MPSite extends Comparable> { void setLoginType(@Nullable MPResultType loginType); - @Nonnull + @Nullable default String getResult() throws MPKeyUnavailableException, MPAlgorithmException { - return getResult( MPKeyPurpose.Authentication ); } - @Nonnull + @Nullable default String getResult(final MPKeyPurpose keyPurpose) throws MPKeyUnavailableException, MPAlgorithmException { return getResult( keyPurpose, null ); } - @Nonnull + @Nullable default String getResult(final MPKeyPurpose keyPurpose, @Nullable final String keyContext) throws MPKeyUnavailableException, MPAlgorithmException { return getResult( keyPurpose, keyContext, null ); } - @Nonnull + @Nullable String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext, @Nullable String state) throws MPKeyUnavailableException, MPAlgorithmException; - @Nonnull + @Nullable String getResult(MPKeyPurpose keyPurpose, @Nullable String keyContext, @Nullable UnsignedInteger counter, MPResultType type, @Nullable String state) throws MPKeyUnavailableException, MPAlgorithmException; diff --git a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPBasicSite.java b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPBasicSite.java index e7dce0c3..2d3b3a1c 100644 --- a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPBasicSite.java +++ b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPBasicSite.java @@ -129,7 +129,7 @@ public abstract class MPBasicSite, Q extends MPQuestion> ext setChanged(); } - @Nonnull + @Nullable @Override public String getResult(final MPKeyPurpose keyPurpose, @Nullable final String keyContext, @Nullable final String state) throws MPKeyUnavailableException, MPAlgorithmException { @@ -137,7 +137,7 @@ public abstract class MPBasicSite, Q extends MPQuestion> ext return getResult( keyPurpose, keyContext, getCounter(), getResultType(), state ); } - @Nonnull + @Nullable @Override public String getResult(final MPKeyPurpose keyPurpose, @Nullable final String keyContext, @Nullable final UnsignedInteger counter, final MPResultType type, @Nullable final String state) diff --git a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPFileSite.java b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPFileSite.java index 1de501f0..595216d1 100644 --- a/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPFileSite.java +++ b/platform-independent/java/model/src/main/java/com/lyndir/masterpassword/model/impl/MPFileSite.java @@ -93,7 +93,7 @@ public class MPFileSite extends MPBasicSite { setChanged(); } - @Nonnull + @Nullable @Override public String getResult(final MPKeyPurpose keyPurpose, @Nullable final String keyContext) throws MPKeyUnavailableException, MPAlgorithmException {