پیداش کردم.
برای این کار نیاز به مرجع System.Security داریم:
Imports System.Security.Cryptography.X509Certificates
زمانی که فایل قفل یا رمزگذاری می شه طبق نام حساب کاربری فعلی Certificate در Store ایجاد و ذخیره سازی می شه:
cert.png
که با این دستور می شه اونرو بصورت Binary استخراج کرد و در نهایت یا بصورت فایل و یا در دیتابیس برای استفاده مجدد ذخیره سازی کرد:
تابع ایجاد شده: که کدش رو از MSDN گیر آوردم:
Private Shared Function GetCertificateFromStore(ByVal certName As String) As X509Certificate2
' Get the certificate store for the current user.
Dim store As New X509Store(StoreLocation.CurrentUser)
Try
store.Open(OpenFlags.ReadOnly)
' Place all certificates in an X509Certificate2Collection object.
Dim certCollection As X509Certificate2Collection = store.Certificates
' If using a certificate with a trusted root you do not need to FindByTimeValid, instead use:
' currentCerts.Find(X509FindType.FindBySubjectDistin guishedName, certName, true);
Dim currentCerts As X509Certificate2Collection = certCollection.Find(X509FindType.FindByTimeValid, DateTime.Now, False)
Dim signingCert As X509Certificate2Collection = currentCerts.Find(X509FindType.FindBySubjectDistin guishedName, certName, False)
If signingCert.Count = 0 Then
Return Nothing
End If ' Return the first certificate in the collection, has the right name and is current.
Return signingCert(0)
Finally
store.Close()
End Try
End Function 'GetCertificateFromStore
و دستوری که برای استخراج اطلاعات Certificate ایجاد کردم....
Dim CertName As String = String.Format("CN={0}", My.User.Name)
Dim cert As X509Certificate2 = GetCertificateFromStore(CertName)
Dim Bytes As Byte() = cert.Export(X509ContentType.Pfx, "2")
Dim FileName As String = String.Format(".\{0}.pfx", My.User.Name.Replace("", "-"))
IO.File.WriteAllBytes(FileName, Bytes)
در مورد کاراییش توی یک حساب کاربری دیگه هنور تست نکردم. اگه مشکلی داشت تصحیح خواهم کرد اِن شاء الله....