Code with Misuse: |
class BFProperties {
/**
* Get Property
*
* @param key
* String
* @return String
*/
public static String getProperty(BFProps key) {
String value = sProperties.getProperty(key.name().toLowerCase(), UNKNOWN);
if (BFProps.PROXY_PASSWORD.equals(key)) {
try {
byte[] secretKey = new byte[16];
secretKey[0]=78;
secretKey[1]=-44;
secretKey[2]=-10;
secretKey[3]=-42;
secretKey[4]=-44;
secretKey[5]=106;
secretKey[6]=-30;
secretKey[7]=-1;
secretKey[8]=-104;
secretKey[9]=105;
secretKey[10]=24;
secretKey[11]=-103;
secretKey[12]=-9;
secretKey[13]=-81;
secretKey[14]=-32;
secretKey[15]=95;
Cipher c = Cipher.getInstance("AES");
Key k = new SecretKeySpec(secretKey, "AES");
c.init(Cipher.DECRYPT_MODE, k);
value = new String(c.doFinal(value.getBytes()));
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
} catch (NoSuchPaddingException e1) {
e1.printStackTrace();
} catch (InvalidKeyException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalBlockSizeException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (BadPaddingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
return value;
} /* getProperty */
}
|
Code with Pattern(s): |
class DecodeAfterLoad {
String pattern(Key key, String value) throws BadPaddingException, InvalidKeyException, IllegalBlockSizeException, NoSuchAlgorithmException, NoSuchPaddingException, UnsupportedEncodingException {
Cipher c = Cipher.getInstance("AES");
c.init(Cipher.DECRYPT_MODE, key);
return new String(c.doFinal(Base64.decode(value)), "UTF8");
}
}
|