PFXDetector.cs 936 B

12345678910111213141516171819202122232425
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using System.Linq;
  4. using System.Reflection;
  5. using Masuit.Tools.Mime;
  6. namespace Masuit.Tools.Files.FileDetector.Detectors;
  7. [FormatCategory(FormatCategory.Document)]
  8. internal sealed class PFXDetector : AbstractSignatureDetector
  9. {
  10. private static readonly SignatureInformation[] PfxSignatureInfo = {
  11. new() { Position = 0, Signature = new byte [] { 0x30, 0x82, 0x06 } },
  12. };
  13. public override string Extension => "pfx";
  14. protected override SignatureInformation[] SignatureInformations => PfxSignatureInfo;
  15. public override string MimeType => new MimeMapper().GetMimeFromExtension("." + Extension);
  16. public override List<FormatCategory> FormatCategories => GetType().GetCustomAttributes<FormatCategoryAttribute>().Select(a => a.Category).ToList();
  17. public override string ToString() => "Microsoft Personal inFormation eXchange Certificate Detector";
  18. }