GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add missing timestamper cert to the newer catalog signing APIs by PaulHigin · Pull Request #4061 · PowerShell/PowerShell Conversation
|
| } | ||
| } | ||
|
|
||
| Diagnostics.Assert(((error == 0) && (signature != null)) || (error != 0), "GetSignatureFromWintrustData: general crypto failure"); |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Question about this case, will sync offline
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
|
|
||
| [ArchitectureSensitive] | ||
| private static bool TryGetProviderSigner(IntPtr wvtStateData, ref IntPtr pProvSigner, ref X509Certificate2 timestamperCert) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems to me both pProvSigner and timestamperCert are better to be an out parameter instead of a ref parameter.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| else | ||
| { | ||
| signature = new Signature(filename, error, cert); | ||
| } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Once the parameters pProvSigner and timestamperCert are changed to out parameters, you can use the new language feature in C# for out parameters:
if (int.TryParse(input, out int result)) WriteLine(result); else WriteLine("Could not parse input");
So this code block can be rewritten to:
if (TryGetProviderSigner(phStateData, out IntPtr pProvSigner, out X509Certificate2 timestamperCert) && timestamperCert != null) { signature = new Signature(filename, error, cert, timestamperCert); } else { signature = new Signature(filename, error, cert); }
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| X509Certificate2 signerCert = null; | ||
| IntPtr pProvSigner = IntPtr.Zero; | ||
| X509Certificate2 timestamperCert = null; | ||
| if (TryGetProviderSigner(wtd.hWVTStateData, ref pProvSigner, ref timestamperCert)) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Same here. Once change to out parameters, you can use the new feature in C# to make the code cleaner.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Will change.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I created issue #4087 to document the lack of tests |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Mike Richmond (@mirichmo) Is there anything preventing this from being merged? I also need to port this to internal branches. Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…t-AuthenticodeSignature (PowerShell#4061) * Fixed missing functionality to add timestamper cert for the newer catalog signing APIs for Get-AuthenticodeSignature
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.