question

osvbnet avatar image
0 Votes"
osvbnet asked JiachenLiMFST-9349 commented

Import Certificate


Hi,
I found this code to import a certificate from disk:
https://stackoverflow.com/questions/33899509/x509-certificate-installation-using-vb-net

Anyway, can't figure out how to set store location: "MY", "AddressBook", "CA" or "Root"

2nd: StoreLocation.CurrentUser vs LocalMachine, when we import via IE or Firefox, it'll be imported to which one, CurrentUser or LocalMachine?

dotnet-visual-basic
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered JiachenLiMFST-9349 commented

Hi @osvbnet ,
According to Local Machine and Current User Certificate Stores.

  • Local machine certificate store
    This type of certificate store is local to the computer and is global to all users on the computer. This certificate store is located in the registry under the HKEY_LOCAL_MACHINE root.

  • Current user certificate store
    This type of certificate store is local to a user account on the computer. This certificate store is located in the registry under the HKEY_CURRENT_USER root.

Refer to the documentation below to set the storage location.
StoreLocation Enum

Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello, thanks but not reflecting my question:

  1. When I import via IE or Firefox, it'll be imported to which one, CurrentUser or LocalMachine?

  2. How to set to import to which store location: "MY", "AddressBook", "CA" or "Root"?

0 Votes 0 ·

Hi @osvbnet ,

  1. The certificate imported by the browser is saved in CurrentUser by default.

  2. Check X509Store Constructors and X509Certificate2Collection.Add(X509Certificate2) Method, Select the storage area when constructing the X509Store, and then store the certificate in the corresponding storage area.



0 Votes 0 ·