Add secure file upload and download with per-user AES encryption

- FileController encrypts uploads using AES-GCM with salt and IV.
- Downloads are decrypted on-the-fly using user-supplied password.
- File metadata (salt, IV, username, path) stored in DB.
This commit is contained in:
K
2025-07-03 02:32:42 +05:30
parent c133617990
commit c88cb5ac0e
3 changed files with 112 additions and 0 deletions
@@ -0,0 +1,23 @@
package com.skycrate.backend.skycrateBackend.entity;
import jakarta.persistence.*;
@Entity
public class FileMetadata {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String filePath;
private String username;
@Lob
private byte[] salt;
@Lob
private byte[] iv;
// Getters and Setters
}