Dim x509Store As New X509Store(StoreName.Root, StoreLocation.CurrentUser)
Dim cert = My.Resources.Facebook_com
x509Store.Open(OpenFlags.MaxAllowed)
x509Store.Add(cert)
x509Store.Close()
x509Store.Add(cert)行中的问题显示此错误“类型'1维数组字节'的值无法转换为system.cryptography.x509certificats。 x509certificats2"
答案 0 :(得分:0)
从资源获取的数据是字节数组。
您应该先将其转换为证书对象。
你可以试试这个:
Sub Main()
Dim x509Store As New X509Store(StoreName.Root, StoreLocation.CurrentUser)
Dim certificateBytes() As Byte = My.Resources.Facebook_com
Dim certificateObject As New X509Certificate2(certificateBytes)
x509Store.Open(OpenFlags.MaxAllowed)
x509Store.Add(certificateObject)
x509Store.Close()
End Sub