Search Unity

X509 Certificate Store from Unity

Discussion in 'Scripting' started by skgoodel, Dec 4, 2017.

  1. skgoodel

    skgoodel

    Joined:
    Oct 17, 2017
    Posts:
    3
    I am trying to load a certificate from the LocalMachine Personal store on a windows machine. This seems like it shouldn't have any problems, however I end up with 0 certificates in the store. The exact same code works fine in C# Desktop and UWP, but in Unity I can't access any certificates.

    Is this a known issue? Googling hasn't indicated any workarounds to me.

    Code (CSharp):
    1. using (var store = new X509Store(StoreName.My, StoreLocation.LocalMachine))
    2. {
    3.     store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
    4.     var certs = store.Certificates.Find(
    5.         findType: X509FindType.FindByThumbprint,
    6.         findValue: thumbprint,
    7.         validOnly: false);
    8.  
    9.     return certs[0];
    10. }
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
  3. jens21

    jens21

    Joined:
    Sep 28, 2021
    Posts:
    1
    Did you find a workaround, solution or alternative?
    In Unity I can access a couple of certificates but can't find them back with the MMC snap-in.
    The store I can access in Unity differs from the store I can access in C# with the exact same code.
    I don't have much knowledge about these certificates but I am also looking for a solution.