private static org.apache.log4j.Logger LOGGER = LoggingManager.getLogger(DecoderFactory.class.getName());
public static Decoder getDecoder(String dir, String keyFile) {
String cryptoAlgo = System.getProperty("crypto.algo", CryptoFactory.DES);
byte[] keyBytes = readKey(dir, keyFile);
Crypto cr = CryptoFactory.get(cryptoAlgo);
Object key = cr.getKeyGenerator().getDecodingKey(keyBytes);
if (key==null) {
LOGGER.warn("creation of a " + cryptoAlgo + " decoder has failed");
return null;
}
LOGGER.info("Decoder built from key in file: " + keyFile);
return cr.newDecoder(key);
}