Hi there,
I have a string with my key (key = wilbard 2020@uipath forum!) and my integer iterations (iterations = 10). I would like to create encryption key out of these.
In Java Code is as below, But I want to convert it to C# or VB. is this possible.
public static void setKey(final String myKey, final int iterations) {
AESEncryptor.key1 = myKey.toString();
MessageDigest sha = null;
try {
AESEncryptor.key = myKey.getBytes("UTF-8");
sha = MessageDigest.getInstance("SHA-256");
for (int i = 1; i <= iterations; ++i) {
AESEncryptor.key = sha.digest(AESEncryptor.key);
}
AESEncryptor.key = Arrays.copyOf(AESEncryptor.key, 16);
AESEncryptor.secretKey = new SecretKeySpec(AESEncryptor.key, "AES");
}
catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
catch (UnsupportedEncodingException e2) {
e2.printStackTrace();
}
}
Please Help.