Bug 722434 - check for failure after JSON parsing. r=rnewman

This commit is contained in:
Richard Newman 2012-02-03 13:09:28 -08:00
parent 8ea74e7f50
commit fc3249a330

View File

@ -57,6 +57,7 @@ import org.mozilla.gecko.sync.crypto.CryptoInfo;
import org.mozilla.gecko.sync.crypto.Cryptographer;
import org.mozilla.gecko.sync.crypto.KeyBundle;
import org.mozilla.gecko.sync.cryptographer.CryptoStatusBundle.CryptoStatus;
import java.security.GeneralSecurityException;
/*
* This class acts as a wrapper for the Cryptographer class.
@ -192,6 +193,10 @@ public class SyncCryptographer {
e.printStackTrace();
}
if (json == null) {
throw new CryptoException(new GeneralSecurityException("Could not decrypt JSON payload"));
}
// Verify that this is indeed the crypto/keys bundle and that
// decryption worked.
String id = (String) json.get(KEY_ID);