Checking Valid Password for Pst file

I am trying to check if the password provided is a valid password for processing pst file. And I am not able to validate the password. The file I am using has Password “a” , so i was just manually checking it’s Hash value is equal to that of provided string value, bt this doesn’t happen so. I went through the documentation, instead of using computecrc32, i have used crc32algorithm.Compute .How can I use computecrc32 class ??? Is it because of this difference??
using (PersonalStorage personalStorage = PersonalStorage.FromFile(filePath))
{
if (personalStorage.Store.Properties[MapiPropertyTag.PR_PST_PASSWORD].GetLong() != 0)
{
passwordHash = personalStorage.Store.Properties[MapiPropertyTag.PR_PST_PASSWORD].GetLong();
if (passwordHash == Crc32Algorithm.Compute(Encoding.ASCII.GetBytes(“a”)))
{
//code to do
}

@alishasharma,

I like to share the there is no such a method in the API that takes into account the password while loading PST. Such a method can not be implemented by the API as it doesn’t take into account the password while loading the PST file. For available options in API, I suggest you to please visit this documentation section.

I knew that loading pst file whether it’s pwd protected or not doesn’t requires a password. But as mentioned in the documentation link, i just want to check if the specified string is valid password or not. How can I use ComputeCrc32 as mentioned in the document ??
Screenshot (45)_LI.jpg (170.7 KB)

@alishasharma,

I like to share that the same documentation link has method, IsPasswordValid(string password, PersonalStorage pst) that can be used to verify the passwords. Please refer to that on your end.

Hi,
I am also not able to validate the PST password. I am retrieving the the pst password hash like below.
passwordHash = personalStorage.Store.Properties[MapiPropertyTag.PR_PST_PASSWORD].GetLong();
(it returns value of 2268788557, when pst password is outlook123

Now when I calculate the hash of the same pst password(outlook123), provided in Outlook 2013, the value I am getting is 1689296699, which is different from what I retrieved from PST property PR_PST_PASSWORD above.
I have validated the CRC value on online CRC calculator as well.

Hence, the function isPasswordValid, posted in documentation below is not working as expected