mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 531005 - Sync is not working after update IWeaveCrypto.unwrapSymmetricKey NS_ERROR_FAILURE
Check that the cryptometa is unwrappable when syncing; if not purge the key and data and make a new crypto record.
This commit is contained in:
parent
eab5c8f980
commit
13dc29cda6
@ -349,7 +349,26 @@ SyncEngine.prototype = {
|
|||||||
_syncStartup: function SyncEngine__syncStartup() {
|
_syncStartup: function SyncEngine__syncStartup() {
|
||||||
this._log.debug("Ensuring server crypto records are there");
|
this._log.debug("Ensuring server crypto records are there");
|
||||||
|
|
||||||
|
// Try getting/unwrapping the crypto record
|
||||||
let meta = CryptoMetas.get(this.cryptoMetaURL);
|
let meta = CryptoMetas.get(this.cryptoMetaURL);
|
||||||
|
if (meta) {
|
||||||
|
try {
|
||||||
|
let pubkey = PubKeys.getDefaultKey();
|
||||||
|
let privkey = PrivKeys.get(pubkey.privateKeyUri);
|
||||||
|
meta.getKey(privkey, ID.get("WeaveCryptoID"));
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
// Remove traces of this bad cryptometa
|
||||||
|
this._log.debug("Purging bad data after failed unwrap crypto: " + ex);
|
||||||
|
CryptoMetas.del(this.cryptoMetaURL);
|
||||||
|
meta = null;
|
||||||
|
|
||||||
|
// Remove any potentially tained data
|
||||||
|
new Resource(this.engineURL).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generate a new crypto record
|
||||||
if (!meta) {
|
if (!meta) {
|
||||||
let symkey = Svc.Crypto.generateRandomKey();
|
let symkey = Svc.Crypto.generateRandomKey();
|
||||||
let pubkey = PubKeys.getDefaultKey();
|
let pubkey = PubKeys.getDefaultKey();
|
||||||
|
Loading…
Reference in New Issue
Block a user