c# - Reading executing assembly signature pfx / cert -
this academic question trying understand new material. not academic in sense of formal school in sense of ongoing education , wanting handle on area of development have not been exposed before.
so in understanding create assembly , "signing it" have created strong name / x509certificate.
so create empty winapp. go project properties on signing tab , sign assembly using password.
a file testing.pfx added project.
in form load execute code thinking see assembly signing cert don't null...??
assembly ass = assembly.getexecutingassembly(); module mod = ass.getmodules().first(); x509certificate cert = mod.getsignercertificate();
cert null. why that? doing wrong retrieve cert or have things jumbled in head , looking isn't looking?
thank you
edit
@p e p have used next after reading post , msdn.
signtool sign /a c:/....../myfile.exe
signtool sign /f c:/....../mycert.pfx /p mypassword c:/....../myfile.exe
both said completed success. running code block above still produces null cert.
now may have missed or doing wrong working visual studio debug version , path exe used signing.
c:....\licensedcontroltest\obj\x86\debug
you need authenticode sign assembly. can using file signing tool (signcode.exe) sign assembly authenticode signature. run command using signcode
authenticode sign assembly.
if @ doc getsignercertificate
, see null
expected if assembly not authenticode signed.
signcode /spc mycertificate.spc /v mykey.pvk myassembly
that's basics, can find more info here on msdn http://msdn.microsoft.com/en-us/library/9sh96ycy(v=vs.80).aspx.
c# code-signing digital-signature digital-certificate
No comments:
Post a Comment