@@ -121,10 +121,9 @@ public static SecurityConfiguration getInstance() {
121121 public static final String CIPHER_TRANSFORMATION_IMPLEMENTATION = "Encryptor.CipherTransformation" ;
122122 public static final String CIPHERTEXT_USE_MAC = "Encryptor.CipherText.useMAC" ;
123123 public static final String PLAINTEXT_OVERWRITE = "Encryptor.PlainText.overwrite" ;
124- public static final String IV_TYPE = "Encryptor.ChooseIVMethod" ;
125124
126125 @ Deprecated
127- public static final String FIXED_IV = "Encryptor.fixedIV" ;
126+ public static final String IV_TYPE = "Encryptor.ChooseIVMethod" ; // Will be removed in future release.
128127
129128 public static final String COMBINED_CIPHER_MODES = "Encryptor.cipher_modes.combined_modes" ;
130129 public static final String ADDITIONAL_ALLOWED_CIPHER_MODES = "Encryptor.cipher_modes.additional_allowed" ;
@@ -251,6 +250,13 @@ public static SecurityConfiguration getInstance() {
251250 */
252251 public DefaultSecurityConfiguration (Properties properties ) {
253252 resourceFile = DEFAULT_RESOURCE_FILE ;
253+ try {
254+ this .esapiPropertyManager = new EsapiPropertyManager ();
255+ // Do NOT call loadConfiguration() here!
256+ } catch ( IOException e ) {
257+ logSpecial ("Failed to load security configuration" , e );
258+ throw new ConfigurationException ("Failed to load security configuration" , e );
259+ }
254260 this .properties = properties ;
255261 this .setCipherXProperties ();
256262 }
@@ -265,7 +271,7 @@ private void setCipherXProperties() {
265271 // TODO: FUTURE: Replace by future CryptoControls class???
266272 // See SecurityConfiguration.setCipherTransformation() for
267273 // explanation of this.
268- // (Propose this in 2.1 via future email to ESAPI-DEV list.)
274+ // (Propose this in a future 2.x release via future email to ESAPI-DEV list.)
269275 cipherXformFromESAPIProp =
270276 getESAPIProperty (CIPHER_TRANSFORMATION_IMPLEMENTATION ,
271277 "AES/CBC/PKCS5Padding" );
@@ -832,49 +838,26 @@ public boolean overwritePlainText() {
832838 /**
833839 * {@inheritDoc}
834840 */
841+ @ Deprecated
835842 public String getIVType () {
836843 String value = getESAPIProperty (IV_TYPE , "random" );
837844 if ( value .equalsIgnoreCase ("random" ) ) {
838845 return value ;
839846 } else if ( value .equalsIgnoreCase ("fixed" ) ) {
840- logSpecial ("WARNING: Property '" + IV_TYPE + "=fixed' is DEPRECATED. It was intended to support legacy applications, but is inherently insecure, especially with any streaming mode. Support for this will be completed dropped next ESAPI minor release (probably 2.3 " );
841- return value ;
847+ logSpecial ("WARNING: Property '" + IV_TYPE + "=fixed' is no longer supported AT ALL!!! It had been deprecated since 2.2.0.0 and back then, was announced it would be removed in release 2.3.0.0. It was originally intended to support legacy applications, but is inherently insecure, especially with any streaming mode." );
848+ throw new ConfigurationException ( "'" + IV_TYPE + "=fixed' is no longer supported AT ALL. It has been deprecated since release 2.2 and has been removed since 2.3." ) ;
842849 } else if ( value .equalsIgnoreCase ("specified" ) ) {
843- // This is planned for future implementation where setting
844- // Encryptor.ChooseIVMethod=specified will require setting some
845- // other TBD property that will specify an implementation class that
846- // will generate appropriate IVs. The intent of this would be to use
847- // such a class with various feedback modes where it is imperative
848- // that for a given key, any particular IV is *NEVER* reused. For
849- // now, we will assume that generating a random IV is usually going
850- // to be sufficient to prevent this.
851- throw new ConfigurationException ("'" + IV_TYPE + "=specified' is not yet implemented. Use 'random' for now." );
852- } else {
853- // TODO: Once 'specified' is legal, adjust exception msg, below.
854- // DISCUSS: Could just log this and then silently return "random" instead.
855- throw new ConfigurationException (value + " is illegal value for " + IV_TYPE +
856- ". Use 'random'." );
857- }
858- }
859-
860- /**
861- * {@inheritDoc}
862- */
863- @ Deprecated
864- public String getFixedIV () {
865- if ( getIVType ().equalsIgnoreCase ("fixed" ) ) {
866- String ivAsHex = getESAPIProperty (FIXED_IV , "" ); // No default
867- if ( ivAsHex == null || ivAsHex .trim ().equals ("" ) ) {
868- throw new ConfigurationException ("Fixed IV requires property " +
869- FIXED_IV + " to be set, but it is not." );
870- }
871- return ivAsHex ; // We do no further checks here as we have no context.
850+ // Originally, this was planned for future implementation where setting
851+ // Encryptor.ChooseIVMethod=specified
852+ // would have allowed a dev to write their own static method to be
853+ // invoked in a future TBD property, but that is a recipe for
854+ // disaster. So, it's not going to happen. Ever.
855+ throw new ConfigurationException ("Contrary to previous internal comments, '" + IV_TYPE + "=specified' is not going to be supported -- ever." );
872856 } else {
873- // DISCUSS: Should we just log a warning here and return null instead?
874- // If so, may cause NullPointException somewhere later.
875- throw new ConfigurationException ("IV type not 'fixed' [which is DEPRECATED!] (set to '" +
876- getIVType () + "'), so no fixed IV applicable." );
857+ logSpecial ("WARNING: '" + value + "' is illegal value for " + IV_TYPE +
858+ ". Using 'random' for the IV type." );
877859 }
860+ return "random" ;
878861 }
879862
880863 /**
0 commit comments