Is there any functionality to determine if an assembly is being called from a particular assembly?
I have the assembly a
which is the reference assembly b
to the assembly A
shows PowerShell cmdlets and output types That are found in B
. With the type of B
, some methods and properties are of interest, but PowerShell consumers or anyone b
directly and its Call inbound ways.
I have looked at InternalVisibleToAttribute
, but due to the use of the interface it would require a broader reconquet I was creating a shared key system that was later obscured but It seemed like
what is the B
only to A
?
You use a strong name key on your assemblies.
First make sure that the strong name of the assembly assembly (Assembly A) is signed (this can be done in the Project Property screen under the Signing tab)
The following code calling assemblies From the strong name will receive the key.
Internal Stable Strength GetStrongName (Evidence Proof) {foreach (in various e-proofs) {If (e is strong name) {return (strong name) e; }} Skip new logic exception (); }
The easiest way would be to sign the two assemblies with the same strong name, then confirm that assembly. Gate Colling Assembly () Evidence and assembly. Assess assembly Evidence is signed by the same Strongname.
var callerKey = GetStrongName (Assembly. Gate Calling Assembly (Evidence). PublicKey; Var execKey = GetStrongName (Assembly.GETExecutingAssembly (). Evidence). PublicKey; If (Collar! = Executioner) (New unauthorized access access ("The strong name of calling assembly is invalid.");}
This can be impractical to apply to an existing codebase Take a look at, you should be able to implement that feature, which can be linked to classes, valid collar.
Comments
Post a Comment