Chry007 :
I am working on an application that reads data from a database. There are already encrypted entries in the DB. I have the key as a byte array and want to load it from a yaml file.
Is there a way i can populate an array like this
private static final byte[] iv = { 13, -11, -88, 20, -110, 113, -2, -8, -15, -99, -23, -10, -10, -74, 1, 11 }
Directly from a yaml file?
yaml file:
iv: 13,-11,-88
Since I cannot autowire the class where I need to use the key, i cannot use @value annotation (from my understanding). So I was looking to use a util class like so:
public static byte[] getKeyFor(Class type) {
return context.getEnvironment().getProperty("iv");
}
Aditya Narayan Dixit :
Below should work:
application.yml:
iv: 12,32,12,32
In the class where you want the values, bind it like below:
@Value("${iv}") byte[] iv;