campeon23 / split-fetcher

The code is a concurrent file downloader in Go that splits a file into multiple parts, downloads them in parallel, and assembles the final file, with support for Etag validation to ensure file integrity.
MIT License
1 stars 0 forks source link

Introduce Versioning to Encrypted Data Format #158

Closed campeon23 closed 1 year ago

campeon23 commented 1 year ago

Description: Versioning encrypted data formats can significantly simplify future changes or updates to the encryption scheme. By appending a version tag to the data, it becomes more straightforward to support and distinguish between different encryption versions.

Recommendation: Implement a versioning system in the encrypted data format to easily manage and differentiate between data encrypted using different versions or schemes.

Example Fix: A simple implementation could prefix the encrypted data with a version byte or string:

const CURRENT_VERSION = "v1"

func VersionedEncrypt(data []byte, key []byte) ([]byte, error) {
    encryptedData, err := EncryptWithGCM(data, key)
    if err != nil {
        return nil, err
    }
    versionedData := append([]byte(CURRENT_VERSION), encryptedData...)
    return versionedData, nil
}

Acceptance Criteria:

Develop a versioning convention for the encrypted data format. Modify the encryption and decryption functions to handle version prefixes. Ensure backward compatibility by maintaining support for data encrypted using older versions or schemes.

Severity Level: Medium

campeon23 commented 1 year ago

Changes made:

If there are further concerns or revisions needed related to this ticket, please feel free to reopen or raise a new ticket for specific issues.