public BlowfishTupleSerializer(Kryo kryo, Map<String, Object> topoConf) {
String encryptionkey;
try {
encryptionkey = (String) topoConf.get(SECRET_KEY);
LOG.debug("Blowfish serializer being constructed ...");
byte[] bytes;
if (encryptionkey != null) {
bytes = Hex.decodeHex(encryptionkey.toCharArray());
} else {
String payload = (String) topoConf.get(Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
if (payload != null) {
LOG.debug("{} is not present. Use {} as Blowfish encryption key", SECRET_KEY,
Config.STORM_ZOOKEEPER_TOPOLOGY_AUTH_PAYLOAD);
bytes = payload.getBytes();
} else {
throw new RuntimeException("Blowfish encryption key not specified");
}
}
serializer = new BlowfishSerializer(new ListDelegateSerializer(), bytes);
} catch (DecoderException ex) {
throw new RuntimeException("Blowfish encryption key invalid", ex);
}
}