Skip to content

Instantly share code, notes, and snippets.

@R41D3NN
Created June 13, 2018 21:49
Show Gist options
  • Save R41D3NN/f2b9206311208fd7a5a0217dbbb0749e to your computer and use it in GitHub Desktop.
Save R41D3NN/f2b9206311208fd7a5a0217dbbb0749e to your computer and use it in GitHub Desktop.
Get Public Key From SNK
# Kudos Ivan G.: https://stackoverflow.com/a/43897217
function Get-SnkPublicKey([string]$FilePath)
{
$bytes = [System.IO.File]::ReadAllBytes($FilePath)
$pair = New-Object System.Reflection.StrongNameKeyPair -ArgumentList @(,$bytes)
$publicKey = $pair.PublicKey
#[System.Convert]::ToBase64String($publicKey)
$hexes = [System.BitConverter]::ToString($publicKey);
$hexes.Replace("-", "")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment