diff --git a/src/lib/adapters/GoogleDrive.ts b/src/lib/adapters/GoogleDrive.ts index 71d8a0c204..b87d0fc74b 100644 --- a/src/lib/adapters/GoogleDrive.ts +++ b/src/lib/adapters/GoogleDrive.ts @@ -322,7 +322,9 @@ export default class GoogleDriveAdapter extends CachingAdapter { let xbel = createXBEL(this.bookmarksCache, this.highestId) if (this.server.password) { - xbel = await Crypto.encryptAES(this.server.password, xbel, this.server.bookmark_file) + const salt = Crypto.bufferToHexstr(Crypto.getRandomBytes(64)) + const ciphertext = await Crypto.encryptAES(this.server.password, xbel, salt) + xbel = JSON.stringify({ciphertext, salt}) } if (!this.fileId) { diff --git a/src/lib/adapters/WebDav.ts b/src/lib/adapters/WebDav.ts index a0a148a342..b18f9ab76e 100644 --- a/src/lib/adapters/WebDav.ts +++ b/src/lib/adapters/WebDav.ts @@ -332,7 +332,9 @@ export default class WebDavAdapter extends CachingAdapter { const fullUrl = this.getBookmarkURL() let xbel = this.server.bookmark_file_type === 'xbel' ? createXBEL(this.bookmarksCache, this.highestId) : createHTML(this.bookmarksCache, this.highestId) if (this.server.passphrase) { - xbel = await Crypto.encryptAES(this.server.passphrase, xbel, this.server.bookmark_file) + const salt = Crypto.bufferToHexstr(Crypto.getRandomBytes(64)) + const ciphertext = await Crypto.encryptAES(this.server.passphrase, xbel, salt) + xbel = JSON.stringify({ciphertext, salt}) } await this.uploadFile(fullUrl, this.server.bookmark_file_type === 'xbel' ? 'application/xml' : 'text/html', xbel) } else {