Skip to content

Authenticode formatter not updated for SHA256, 384, and 512 #7517

@glcjr

Description

@glcjr

I noticed that Authenticodedeformatter.cs under Mono.Security.Authenticode has been updated to include SHA256, SHA384, and SHA512 2 years ago.

But the Authenticodeformatter.cs has not been. It still throws an exception if anything other than MD5 or SHA1 is used.

I figure this just needs some additional case statements for the additional shas. But I'm probably being naive.

public string Hash {
			get { 
				if (hash == null)
					hash = "SHA1";
				return hash; 
			}
			set {
				if (value == null)
					throw new ArgumentNullException ("Hash");

				string h = value.ToUpper (CultureInfo.InvariantCulture);
				switch (h) {
					case "MD5":
					case "SHA1":
						hash = h;
						break;
					default:
						throw new ArgumentException ("Invalid Authenticode hash algorithm");
				}
			}
		}

I forked the project to see if adding the case statements would add the functionality but I got errors in places in the code that I didn't touch so I figured my inexperience with super large projects like this was probably showing and I'd just mention what I found.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions