Install Dummy Certificate for WCF Programmatically

 

Let’s assume, you have already certificates and everything works if you install them manually.

But if you try install from your c# code you may get a “Certificate keyset does not exists” from wcf host.

Using FindPrivateKey utility I’ve realized that destination folders for private key are different – my code “puts” private key to the current user store instead of “All Users”.

So, everything I need – to specify X509KeyStorageFlags.MachineKeySet flag.

The whole code is:

//install server sertificate
store = new
X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
certStream = assembly.GetManifestResourceStream(
assembly.GetName().Name + “.Resources.server.pfx”);
certByte = new
byte[certStream.Length];
certStream.Read(certByte, 0, (int)certStream.Length);
cert = new
X509Certificate2(certByte, “1234”,
    X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet
    | X509KeyStorageFlags.Exportable);
store.Add(cert);
store.Close();

Advertisements

VmWare server virtual network configuration

Simple answer: run vmentsfg.exe in vmware installation folder.

My Problem: I’ve installed Hamachi and after that my vmware’s bridget connection stopped to work. That’s because vmware chose hamachi’s virtual adapter instead of real one.

The solution is simple – just put hamachi to ignored adapters at virtual network editor:

But!! Oops – the new Vmware server’s console doesn’t have that menu option, and on the home page you won’t find such option. I tried to google, but al solutions were related to an old console… L

But after looking at vmware’s home directory I noticed vmentsfg.exe. Yep, after running it, you will see above mentioned window.

Or another option – much simpler, find it in start menu.