I am struggling to convert the following code to c#:
private SecretKey generateSecretKey(char[] key, byte[] salt) {
this.FACTORY = SecretKeyFactory.getInstance("PBEWithHmacSHA256AndAES_256");
KeySpec spec = new PBEKeySpec(key, salt, 65536, 256);
SecretKey tmp = this.FACTORY.generateSecret(spec);
return new SecretKeySpec(tmp.getEncoded(), "AES");
}
what is the corresponding algorithm behind PBEWithHmacSHA256AndAES_256/PBEKeySpec in c#?
the java code is then used for something like this:
this.secretKey = generateSecretKey(this.key, newSalt);
Cipher c = Cipher.getInstance("AES/CBC/PKCS5PADDING");
c.init(2, this.secretKey, new IvParameterSpec(IV));
Also I have noticed that PKCS5PADDING does not exist in C# can it be replaced with PKCS7? Any help would be appreciated!