-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't rely on StrongNameKeyPair #548
Conversation
nice :) |
@jbevain thoughts on this one? want me to rebase it? |
@SimonCropp yeah I like it, I think it should go in 0.11. |
Is any work happening on this? Or is another approach recommended? |
@jbevain When do you plan to publish '0.11' version with this change? |
Are there any docs on how to use this? I'm trying to stumble my way through this. Even sample code that shows its use... |
When you want to write a strong-named module in a portable manner, put either the content of the |
Do we need to also still set assembly.Name.HasPublicKey and assembly.Name.PublicKey? Also would be good to update the wiki: https://github.com/jbevain/cecil/wiki/StrongName assembly.Name.PublicKey is a byte[], but I couldn't find any external way to get that public key from a snk. I had to copy/paste code from this PR to do it. Is there a public method to get the public key from an snk that is available (or could be exposed)? I had to copy the GetPublicKey from // https://github.com/atykhyy/cecil/blob/291a779d473e9c88e597e2c9f86e47e23b49be1e/Mono.Security.Cryptography/CryptoService.cs and CryptoConvert to get the RSA from the snk. |
FWIW, this came up in my PR here for StrongNamer while adding support for .NET Core: dsplaisted/strongnamer#41. You can see the files I had to add/code I had to copy. |
@onovotny the PublicKey will be computed from the pair if you pass a set of pair to the parameters: cecil/Mono.Cecil/AssemblyWriter.cs Line 106 in 12da1bf
|
@jbevain thanks. Is there an API to get the public key from an snk if I need it for something else? In the PR, I need to get the full public key in .NET Core so that it can rewrite the InternalsVisibleTo attribute. If there's an API for that, I wouldn't have to duplicate any of the code from here. |
@onovotny not that I know of. You should be able to extract what you need from CryptoService.cs and CryptoConvert.cs without too much troubles. |
i have this is the fody fork of cecil Fody@e541e2b |
@SimonCropp it would be useful to have that directly in Cecil. @jbevain I do have the code copied, but given that .NET Core has no other way to deal with this data structure, it speaks to a need for it elsewhere. |
shoudnt that code exist in netcore and not cecil? |
Probably, but Microsoft doesn't seem to care about supporting anything to do with Strong Names in .NET Core. It's explicitly all PNSE's. Any support will have to come externally. |
agreed. happy for someone to take the code and merge into cecil, if @jbevain is ok with that. i wont have the capacity in the short term |
I second this - I came here to report the |
Also note that using any non-null value for |
Improving on netstandard1.3, netstandard2.0 provides the type
System.Reflection.StrongNameKeyPair
, but on .NET Core it is merely a stub that throwsPlatformNotSupportedException
from all methods and properties. This pull request extendsWriterParameters
with two new properties for strong name key blob and strong name key container, using them in preference toStrongNameKeyPair
when set, ports a couple of crypto routines from Mono, and marksWriterParameters.StrongNameKeyPair
as obsolete as it is not usable on .NET Core. The code in this PR has been in use on .NET Core 2.0.