类型: 安全缺陷
在安全性要求较高的系统中,使用不安全的加密算法(如DES、RC4、RC5等),将无法保证敏感数据的保密性。
BufferedReader bufread2 = null;
InputStreamReader inread2 = null;
try {
inread2 = new InputStreamReader(System.in);
bufread2 = new BufferedReader(inread2);
String str = bufread2.readLine();
/* FLAW: Insecure cryptographic algorithm (DES) */
Cipher des = Cipher.getInstance("DES");
SecretKey key = KeyGenerator.getInstance("DES").generateKey();
des.init(Cipher.ENCRYPT_MODE, key);
byte[] enc_str = des.doFinal(str.getBytes());
IO.writeLine(IO.toHex(enc_str));
} catch(IOException e) {
log_bsnk.warning("Error reading from console");
} finally{
...
}