Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Encrypt/Decrypt archives #2

Merged
merged 4 commits into from
Sep 5, 2024
Merged

Conversation

angelsolaorbaiceta
Copy link
Owner

@angelsolaorbaiceta angelsolaorbaiceta commented Sep 5, 2024

Summary

Two new commands are added:

  • encrypt
  • decrypt

These commands are used to encrypt and decrypt archive files respectively.
They only work with angel archives by checking the passed in file magic.

Encrypted archives have the "AARX" file magic.

Example

Let's say you have an archive.aarch file with two files in it:

$ aar list -f archive.aarch

Archive has the following files:
> fib.go (Offset: 45 bytes, Compressed size: 332 bytes)
> photo.jpg (Offset: 377 bytes, Compressed size: 53852 bytes)

To encrypt it:

$ aar encrypt -f archive.aarch
Password: <enter a password>
Confirm password: <enter the same password>

Archive encrypted successfully to archive.aarch.enc

This removes the archive.aarch file and creates the encrypted version in its place: archive.aarch.enc.

To decrypt it:

$ aar decrypt -f archive.aarch.enc
Password: <enter a password>
Confirm password: <enter the same password>

Archive decrypted successfully to archive.aarch

This removes the encrypted file and brings back the original archive.aarch file.

@angelsolaorbaiceta angelsolaorbaiceta merged commit 2787c37 into main Sep 5, 2024
1 check passed
@angelsolaorbaiceta angelsolaorbaiceta deleted the feat/encryption branch September 5, 2024 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant