Skip to content

Commit

Permalink
fix(backups): change file encryption from aes256 to chacha20
Browse files Browse the repository at this point in the history
  • Loading branch information
stephane-m-dev committed Jan 9, 2025
1 parent 93a11cf commit 88aab6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions @xen-orchestra/fs/src/_encryptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ const { pipeline } = require('node:stream')
const { readChunk } = require('@vates/read-chunk')
const crypto = require('crypto')

export const DEFAULT_ENCRYPTION_ALGORITHM = 'aes-256-gcm'
const CHACHA20 = 'chacha20-poly1305'
export const DEFAULT_ENCRYPTION_ALGORITHM = CHACHA20
export const UNENCRYPTED_ALGORITHM = 'none'

export function isLegacyEncryptionAlgorithm(algorithm) {
Expand Down Expand Up @@ -33,7 +34,8 @@ function getEncryptor(algorithm = DEFAULT_ENCRYPTION_ALGORITHM, key) {
throw error
}
const { ivLength, mode } = info
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) ? 16 : 0
const authTagLength = ['gcm', 'ccm', 'ocb'].includes(mode) || algorithm === CHACHA20
? 16 : 0

function encryptStream(input) {
return pipeline(
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [Backup] Fix "trying to add data in unsupported state" error on encrypted files size greater than 64GB

### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -31,4 +33,6 @@
<!--packages-start-->

- @xen-orchestra/fs patch

<!--packages-end-->

0 comments on commit 88aab6f

Please sign in to comment.