Şifrelenmiş Dosyaların Şifresini Doğrulama
Contents
[
Hide
]
Eğer Excel (xlsx, xlsb, xls, xlsm) ve Open office (ODS) dosyaları şifrelenmişse, Aspose belirli dosya verilerini ayrıştırmadan basit bir şifre doğrulamasını destekler.
Ş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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |