From 321eb6f0b374fcbfbfb50c1ba74d049a809e7ed2 Mon Sep 17 00:00:00 2001 From: Samir Vaidya Date: Sun, 17 Dec 2017 19:16:10 +0530 Subject: [PATCH] Removed DES support. Some more fixes for Java 9 --- README | 4 ++-- build.xml | 8 +++----- .../openstego/desktop/plugin/lsb/LSBEmbedOptionsUI.java | 4 ++-- src/com/openstego/desktop/plugin/lsb/LSBPlugin.java | 7 +++++-- .../openstego/desktop/plugin/randlsb/RandomLSBPlugin.java | 2 +- .../openstego/desktop/resource/OpenStegoLabels.properties | 6 +++--- src/com/openstego/desktop/ui/EmbedPanel.java | 3 +-- src/com/openstego/desktop/util/PluginManager.java | 2 +- src/com/openstego/desktop/util/dwt/DWT.java | 2 +- src/com/openstego/desktop/util/dwt/FilterXMLReader.java | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README b/README index b33b8c3..f7813f6 100644 --- a/README +++ b/README @@ -72,8 +72,8 @@ Following option is common for all commands other than 'algorithms': -A, --cryptalgo Algorithm to be used for encryption. Defaults to AES128. Possible - values are AES128, AES256 or DES. Please note that AES256 will only - be supported with JRE having unlimited strength jurisdiction policy + values are AES128 or AES256. Please note that AES256 will only be + supported with JRE having unlimited strength jurisdiction policy 'extract' options: diff --git a/build.xml b/build.xml index efe47ac..c9303ac 100644 --- a/build.xml +++ b/build.xml @@ -9,7 +9,7 @@ - + @@ -171,10 +171,8 @@ OpenStego (${package.ver}-1) ; urgency=low - * GUI changes to support window resizing - * File permissions fix for Linux - * Added support for changing JPEG compression level (via openstego.ini file) - * Maintain metadata while writing images (e.g. EXIF for JPEG) + * Added support for Java 9 + * Removed DES algorithm as it is not secure -- ${author.name} <${author.mail}> ${time.changelog} diff --git a/src/com/openstego/desktop/plugin/lsb/LSBEmbedOptionsUI.java b/src/com/openstego/desktop/plugin/lsb/LSBEmbedOptionsUI.java index 30701c3..27fb0c6 100644 --- a/src/com/openstego/desktop/plugin/lsb/LSBEmbedOptionsUI.java +++ b/src/com/openstego/desktop/plugin/lsb/LSBEmbedOptionsUI.java @@ -89,7 +89,7 @@ public LSBEmbedOptionsUI(OpenStegoUI stegoUI) { gridBagConstraints.gridy = 1; for (int i = 0; i < 8; i++) { - maxBitsList[i] = new Integer(i + 1); + maxBitsList[i] = Integer.valueOf(i + 1); } this.maxBitsComboBox = new JComboBox(maxBitsList); this.maxBitsComboBox.setPreferredSize(new Dimension(40, 20)); @@ -142,7 +142,7 @@ public boolean validateEmbedAction() throws OpenStegoException { */ @Override public void setGUIFromConfig(OpenStegoConfig config) throws OpenStegoException { - this.maxBitsComboBox.setSelectedItem(new Integer(((LSBConfig) config).getMaxBitsUsedPerChannel())); + this.maxBitsComboBox.setSelectedItem(Integer.valueOf(((LSBConfig) config).getMaxBitsUsedPerChannel())); } /** diff --git a/src/com/openstego/desktop/plugin/lsb/LSBPlugin.java b/src/com/openstego/desktop/plugin/lsb/LSBPlugin.java index 3263c66..e488c3e 100644 --- a/src/com/openstego/desktop/plugin/lsb/LSBPlugin.java +++ b/src/com/openstego/desktop/plugin/lsb/LSBPlugin.java @@ -201,7 +201,6 @@ public List getWritableFileExtensions() throws OpenStegoException { if (compTypes.length > 0) { writeParam.setCompressionType(compTypes[0]); } - writeFormats.remove(i); } catch (UnsupportedOperationException uoEx) { // Compression not supported break; @@ -211,12 +210,16 @@ public List getWritableFileExtensions() throws OpenStegoException { if (writeParam.isCompressionLossless()) { break; } + writeFormats.remove(i); } } // Expicilty removing GIF and WBMP formats, as they use unsupported color models writeFormats.remove("gif"); writeFormats.remove("wbmp"); + // Expicilty removing TIF(F) formats, as they are not working correctly - TODO check why + writeFormats.remove("tif"); + writeFormats.remove("tiff"); return writeFormats; } @@ -263,6 +266,6 @@ public Class getConfigClass() { @Override public String getUsage() throws OpenStegoException { LSBConfig defaultConfig = new LSBConfig(); - return labelUtil.getString("plugin.usage", new Integer(defaultConfig.getMaxBitsUsedPerChannel())); + return labelUtil.getString("plugin.usage", Integer.valueOf(defaultConfig.getMaxBitsUsedPerChannel())); } } diff --git a/src/com/openstego/desktop/plugin/randlsb/RandomLSBPlugin.java b/src/com/openstego/desktop/plugin/randlsb/RandomLSBPlugin.java index c598a21..421543b 100644 --- a/src/com/openstego/desktop/plugin/randlsb/RandomLSBPlugin.java +++ b/src/com/openstego/desktop/plugin/randlsb/RandomLSBPlugin.java @@ -172,6 +172,6 @@ public byte[] extractData(byte[] stegoData, String stegoFileName, byte[] origSig @Override public String getUsage() throws OpenStegoException { LSBConfig defaultConfig = new LSBConfig(); - return labelUtil.getString("plugin.usage", new Integer(defaultConfig.getMaxBitsUsedPerChannel())); + return labelUtil.getString("plugin.usage", Integer.valueOf(defaultConfig.getMaxBitsUsedPerChannel())); } } diff --git a/src/com/openstego/desktop/resource/OpenStegoLabels.properties b/src/com/openstego/desktop/resource/OpenStegoLabels.properties index 4f45042..6b00fa2 100644 --- a/src/com/openstego/desktop/resource/OpenStegoLabels.properties +++ b/src/com/openstego/desktop/resource/OpenStegoLabels.properties @@ -11,7 +11,7 @@ err.config.useCompression.invalid = Invalid value for configuration item ''useCo err.config.useEncryption.invalid = Invalid value for configuration item ''useEncryption''\: {0} err.config.password.invalid = Invalid password err.config.invalidKey = Invalid configuration item provided\: {0} -err.config.invalidCryptAlgo = Invalid encryption algorithm provided\: {0}. Possible values are DES, AES128 or AES256 +err.config.invalidCryptAlgo = Invalid encryption algorithm provided\: {0}. Possible values are AES128 or AES256 err.userpref.valueNotInteger = Invalid value in openstego.ini file for key\: {0}. Must be a valid integer err.userpref.valueNotFloat = Invalid value in openstego.ini file for key\: {0}. Must be a valid floating point number err.userpref.valueNotBoolean = Invalid value in openstego.ini file for key\: {0}. Must be one of\: true, false, t, f, yes, no, y, n, 1, 0 @@ -205,8 +205,8 @@ Following option is common for all commands other than ''algorithms'':\n\ \n\ \ -A, --cryptalgo \n\ \ Algorithm to be used for encryption. Defaults to AES128. Possible\n\ -\ values are AES128, AES256 or DES. Please note that AES256 will only\n\ -\ be supported with JRE having unlimited strength jurisdiction policy\n\ +\ values are AES128 or AES256. Please note that AES256 will only be\n\ +\ supported with JRE having unlimited strength jurisdiction policy\n\ \n\ ''extract'' options:\n\ \n\ diff --git a/src/com/openstego/desktop/ui/EmbedPanel.java b/src/com/openstego/desktop/ui/EmbedPanel.java index b1fc180..b3eb189 100644 --- a/src/com/openstego/desktop/ui/EmbedPanel.java +++ b/src/com/openstego/desktop/ui/EmbedPanel.java @@ -217,8 +217,7 @@ public JButton getStegoFileButton() { */ public JComboBox getEncryptionAlgoComboBox() { if (this.encryptionAlgoComboBox == null) { - this.encryptionAlgoComboBox = new JComboBox( - new String[] { OpenStegoCrypto.ALGO_AES128, OpenStegoCrypto.ALGO_AES256, OpenStegoCrypto.ALGO_DES }); + this.encryptionAlgoComboBox = new JComboBox(new String[] { OpenStegoCrypto.ALGO_AES128, OpenStegoCrypto.ALGO_AES256 }); } return this.encryptionAlgoComboBox; } diff --git a/src/com/openstego/desktop/util/PluginManager.java b/src/com/openstego/desktop/util/PluginManager.java index f1212a1..00c7fe6 100644 --- a/src/com/openstego/desktop/util/PluginManager.java +++ b/src/com/openstego/desktop/util/PluginManager.java @@ -57,7 +57,7 @@ public static void loadPlugins() throws OpenStegoException { } for (int i = 0; i < pluginList.size(); i++) { - plugin = (OpenStegoPlugin) Class.forName(pluginList.get(i)).newInstance(); + plugin = (OpenStegoPlugin) Class.forName(pluginList.get(i)).getDeclaredConstructor().newInstance(); plugins.add(plugin); pluginsMap.put(plugin.getName().toUpperCase(), plugin); } diff --git a/src/com/openstego/desktop/util/dwt/DWT.java b/src/com/openstego/desktop/util/dwt/DWT.java index 65f9ac2..4beab60 100644 --- a/src/com/openstego/desktop/util/dwt/DWT.java +++ b/src/com/openstego/desktop/util/dwt/DWT.java @@ -72,7 +72,7 @@ public DWT(int cols, int rows, int filterID, int level, int method) { this.filters = new FilterGH[level + 1]; for (int i = 0; i <= level; i++) { - this.filters[i] = filterGHMap.get(new Integer(filterID)); + this.filters[i] = filterGHMap.get(Integer.valueOf(filterID)); } this.level = level; diff --git a/src/com/openstego/desktop/util/dwt/FilterXMLReader.java b/src/com/openstego/desktop/util/dwt/FilterXMLReader.java index 73a6574..fba4482 100644 --- a/src/com/openstego/desktop/util/dwt/FilterXMLReader.java +++ b/src/com/openstego/desktop/util/dwt/FilterXMLReader.java @@ -89,7 +89,7 @@ private static FilterGH getFilterGH(Element el) { NodeList nl = null; Filter filter = null; - filterGH.setId(new Integer(el.getAttribute("id"))); + filterGH.setId(Integer.parseInt(el.getAttribute("id"))); filterGH.setName(el.getAttribute("name")); filterGH.setType(el.getAttribute("type"));