Skip to content

What is the replacement for X509Certificate.CreateFromSignedFile? #108740

Answered by bartonjs
bgrainger asked this question in Q&A
Discussion options

You must be logged in to vote

That package is not the recommended answer, because I don't know where it comes from. It might be fine, I just couldn't establish confidence in its maintenance with 2 minutes of looking.

The recommended answer, if you're wanting to extract the Authenticode signer, is to combine GetCertContentType and the ctor and suppress the warning. The reason CreateFromSignedFile is included in the obsoletion is that it doesn't only load Authenticode, it's always been a poorly named vanity wrapper around the "do everything" constructor (it's just implemented as return new X509Certificate2(path))

private static X509Certificate2 LoadAuthenticode(string path)
{
    if (X509Certificate2.GetCertContentType(p…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@bgrainger
Comment options

@bartonjs
Comment options

Answer selected by bartonjs
@whiskhub
Comment options

@bartonjs
Comment options

@chrarnoldus
Comment options

@bartonjs
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants