-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
88b99c8
commit c746130
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Desktop Entry] | ||
Actions=DecryptAGE | ||
Type=Service | ||
Icon=preferences-security | ||
ServiceTypes=KonqPopupMenu/Plugin | ||
MimeType=application/age | ||
X-KDE-Priority=TopLevel | ||
X-KDE-StartupNotify=true | ||
X-KDE-Submenu=AGE Encryption | ||
|
||
[Desktop Action DecryptAGE] | ||
Name=Decrypt | ||
Icon=preferences-security | ||
Exec=age -d -i ~/.age-key/"$(whoami)".age-key %f > %f.tmp && rename 's/(.*).{8}/$1/' *.age.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[Desktop Entry] | ||
Actions=tarEncryptAGE;EncryptAGE | ||
Type=Service | ||
Icon=preferences-security | ||
ServiceTypes=KonqPopupMenu/Plugin | ||
MimeType=all/all | ||
X-KDE-Priority=TopLevel | ||
X-KDE-StartupNotify=true | ||
X-KDE-Submenu=AGE Encryption | ||
|
||
[Desktop Action tarEncryptAGE] | ||
Name=Compress & Encrypt | ||
Icon=preferences-security | ||
Exec=tar -pzcf "%f.tar.gz" %f && age -R ~/.age-key/"$(whoami)" "%f.tar.gz" > "%f.tar.gz.age" && rm -f "%f.tar.gz" | ||
|
||
[Desktop Action EncryptAGE] | ||
Name=Encrypt | ||
Icon=preferences-security | ||
Exec=age -R ~/.age-key/"$(whoami)" %f > "%f.age" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> | ||
<mime-type type="application/age"> | ||
<comment>AGE Encrypted File</comment> | ||
<icon name="encrypted"/> | ||
<glob-deleteall/> | ||
<glob pattern="*.age"/> | ||
</mime-type> | ||
</mime-info> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
check() { | ||
command -v $1 &> /dev/null | ||
} | ||
|
||
# Check if Curl is installed | ||
if ! check "curl"; then | ||
echo "Installing Curl.." | ||
if command -v apt &> /dev/null; then | ||
sudo apt update && sudo apt install -y curl | ||
elif command -v pacman &> /dev/null; then | ||
sudo pacman -Sy --noconfirm curl | ||
elif command -v yum &> /dev/null || command -v dnf &> /dev/null; then | ||
sudo yum -y install curl | ||
else | ||
echo "System not supported. Install curl manually." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Check if AGE is installed | ||
if ! check "age"; then | ||
echo "Installing AGE encryption tool.." | ||
sudo curl -s https://api.github.com/repos/FiloSottile/age/releases/latest | grep "browser_download_url.*linux-amd64.tar.gz" | cut -d : -f 2,3 | tr -d \" | wget -qi - -O - | tar -xz -C /tmp | ||
sudo mv /tmp/age/age /usr/bin/ | ||
sudo mv /tmp/age/age-keygen /usr/bin/ | ||
echo "AGE installed successfully." | ||
fi | ||
|
||
# Copy files to their respective directories. | ||
# .desktop files are copied to ServiceMenus dir for context menu on Dolphin | ||
# and an XML file to MIME dir for files with .age extension to distinguish with an icon and a description. | ||
echo "Copying files.." | ||
cp age-encrypt.desktop ~/.local/share/kservices5/ServiceMenus/ | ||
cp age-decrypt.desktop ~/.local/share/kservices5/ServiceMenus/ | ||
xdg-mime install --mode user --novendor age-mime.xml | ||
|
||
# Create AGE key for current user at home folder .age-key | ||
echo "Generating AGE key.." | ||
mkdir -p ~/.age-key && age-keygen -o ~/.age-key/"$(whoami).age-key" | ||
sed -n '2p' ~/.age-key/"$(whoami).age-key" > ~/.age-key/"$(whoami).pk" && sed 's/# public key: //' ~/.age-key/"$(whoami).pk" > ~/.age-key/"$(whoami)" && rm -f ~/.age-key/"$(whoami).pk" && sed -i '1i\# '$(whoami) ~/.age-key/"$(whoami)" | ||
echo "Installation completed." |