Skip to content

Commit

Permalink
fix(Update): Make the signature checker less restrictive
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Jul 25, 2021
1 parent 44ba705 commit 19ccadd
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions SoundSwitch/Framework/Updater/SignatureChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,21 @@
* GNU General Public License for more details.
********************************************************************/

using System;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using AuthenticodeExaminer;

namespace SoundSwitch.Framework.Updater
{
public static class SignatureChecker
{
private static readonly string _certumSubject = "E=soundswitch@aaflalo.me, CN=\"Open Source Developer, Antoine Aflalo\", O=Open Source Developer, S=Quebec, C=CA";

/// <summary>
/// Does the given file have the right signature
/// </summary>
/// <param name="filename"></param>
/// <returns></returns>
public static bool IsValid(string filename)
{
return IsCertumSigned(filename);
}

private static bool IsCertumSigned(string filename)
{
var inspector = new FileInspector(filename);
return inspector.Validate() == SignatureCheckResult.Valid
&& inspector.GetSignatures().FirstOrDefault(signature => signature.SigningCertificate.Subject == _certumSubject) != null;
return inspector.Validate() == SignatureCheckResult.Valid;
}
}
}

0 comments on commit 19ccadd

Please sign in to comment.