/// <summary> /// Encapsulates logic to decrypt keys so that it is not repeated. /// </summary> /// <param name="encKey">Encrypted key that needs decrypting with programs master key</param> /// <param name="IV">Initialisation vector that key was encrypted with</param> /// <returns>byte array representing key</returns> private byte[] decryptKey(byte[] encKey, byte[] IV) { byte[] masterKey = Globals.getMasterKey(); //gets master key to decrypt these keys with byte[] decryptedKey = CryptoUtility.AESDecryptBytes(encKey, masterKey, IV); //decrypts key return(decryptedKey); }