Şifrelenmiş Dosyaların Şifresini Doğrulama

Şifrelenmiş dosyanın parolasını doğrulama

Şifrelenmiş dosyanın parolasını doğrulamak için, Aspose.Cells for .NET VerifyPassword yöntemini sağlar. Bu yöntemler, dosya akışını ve doğrulanması gereken parolayı kabul eder. Aşağıdaki kod parçası, sağlanan parolanın geçerli olup olmadığını doğrulamak için VerifyPassword yönteminin nasıl kullanıldığını göstermektedir.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
// Create a Stream object
FileStream fstream = new FileStream(dataDir + "EncryptedBook1.xlsx", FileMode.Open);
bool isPasswordValid = FileFormatUtil.VerifyPassword(fstream, "1234");
Console.WriteLine("Password is Valid: " + isPasswordValid);