Tuesday, February 21, 2017

How to find the public key token of any dll.

Run following command in PowerShell. 

([system.reflection.assembly]::loadfile("G:\Devlopment\Samples\Azure\WebAPIServiceAuth\TodoListService\bin\System.IdentityModel.Tokens.Jwt.dll")).FullName

Trust IIS Certificate

To configure your computer to trust the IIS Express SSL certificate, begin by opening a Windows Powershell command window as Administrator.
Query your personal certificate store to find the thumbprint of the certificate for CN=localhost:
PS C:\windows\system32> dir Cert:\LocalMachine\My


    Directory: Microsoft.PowerShell.Security\Certificate::LocalMachine\My


Thumbprint                                Subject
----------                                -------
C24798908DA71693C1053F42A462327543B38042  CN=localhost
Next, add the certificate to the Trusted Root store:
PS C:\windows\system32> $cert = (get-item cert:\LocalMachine\My\C24798908DA71693C1053F42A462327543B38042)
PS C:\windows\system32> $store = (get-item cert:\Localmachine\Root)
PS C:\windows\system32> $store.Open("ReadWrite")
PS C:\windows\system32> $store.Add($cert)
PS C:\windows\system32> $store.Close()
You can verify the certificate is in the Trusted Root store by running this command:
PS C:\windows\system32> dir Cert:\LocalMachine\Root

Ref: 
https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-native-headless/