windows: Don't crash and show a warning when FIPS is enabled. Closes #1298

This commit is contained in:
Hylke Bons 2013-06-01 20:54:01 +01:00
parent a95cd59f53
commit 65aa964e76
2 changed files with 23 additions and 2 deletions

View file

@ -33,8 +33,21 @@ namespace SparkleLib {
bool warn = true;
if (RequiredFingerprint != null) {
string host_fingerprint = DeriveFingerprint (host_key);
string host_fingerprint;
try {
host_fingerprint = DeriveFingerprint (host_key);
} catch (InvalidOperationException e) {
// "Unapproved cryptographic algorithms" won't work when FIPS is enabled on Windows.
// Software like Cisco AnyConnect can demand this feature is on, so we show an error
SparkleLogger.LogInfo ("Auth", "Unable to derive fingerprint: ", e);
this.errors.Add ("error: Can't check fingerprint due to FIPS being enabled");
return false;
}
if (host_fingerprint == null || !RequiredFingerprint.Equals (host_fingerprint)) {
SparkleLogger.LogInfo ("Auth", "Fingerprint doesn't match");
this.errors.Add ("error: Host fingerprint doesn't match");

View file

@ -695,7 +695,15 @@ namespace SparkleShare {
string avatars_path = new string [] { Path.GetDirectoryName (this.config.FullPath),
"avatars", size + "x" + size }.Combine ();
string avatar_file_path = Path.Combine (avatars_path, email.MD5 () + ".png");
string avatar_file_path;
try {
avatar_file_path = Path.Combine (avatars_path, email.MD5 () + ".png");
} catch (InvalidOperationException e) {
SparkleLogger.LogInfo ("Controller", "Error fetching avatar for " + email, e);
return null;
}
if (File.Exists (avatar_file_path)) {
if (new FileInfo (avatar_file_path).CreationTime < DateTime.Now.AddDays (-1))