/// <summary> /// Redacts the value of the 'Secret' field /// </summary> /// <param name="b"></param> /// <returns></returns> public static string ToRedactedString(this ILicenseBlob b) { return(string.Join("\n", b.Fields().Pairs().Select(pair => "secret".Equals(pair.Key, StringComparison.OrdinalIgnoreCase) ? string.Format("{0}: ****redacted****", pair.Key) : string.Format("{0}: {1}", pair.Key, pair.Value)))); }
public static bool Revalidate(this ILicenseBlob b, IEnumerable <RSADecryptPublic> trustedKeys) { var ourCopy = LicenseBlob.Deserialize(b.Original); return(ourCopy.VerifySignature(trustedKeys, null) && ourCopy.Fields().DataMatches(b.Fields())); }