See the question and my original answer on StackOverflow

Here is a piece of C# code that creates a StrongNameKeyPair object from a password-protected .PFX file:

    public static StrongNameKeyPair GetStrongNameKeyPairFromPfx(string pfxFile, string password)
    {
        X509Certificate2Collection certs = new X509Certificate2Collection();
        certs.Import(pfxFile, password, X509KeyStorageFlags.Exportable);
        if (certs.Count == 0)
            throw new ArgumentException(null, "pfxFile");

        RSACryptoServiceProvider provider = certs[0].PrivateKey as RSACryptoServiceProvider;
        if (provider == null) // not a good pfx file
            throw new ArgumentException(null, "pfxFile");

        return new StrongNameKeyPair(provider.ExportCspBlob(false));
    }

NOTE: I assume the PFX here has been created by the .NET Framework tools (for example the Visual Studio Strong Name UI form) to support an assembly strong name creation. It may not be ok with any PFX.