byte[] key = null;
if (config != null && config.source() == Source.PASSWORD_LOCKER) {
if ("".equals( config.sourceName() )) throw new IllegalArgumentException("Password locker source name must be provider for: " + clazz);
if (PasswordContext.get() == null) throw new IllegalStateException("No password locker available for the current context");
IPassword pw = PasswordContext.get().getPassword(config.sourceName());
if (pw == null) throw new IllegalArgumentException("No such password in current context locker: " + config.sourceName());
key = pw.getPassword();
} else {
ClassProperty property = clazz.getProperty(EncryptionKey.class);
if (property == null) throw new IllegalStateException("No encryption key property available for: " + clazz);
key = ReflectionUtil.coerce(byte[].class, property.getValue(instance));