Skip to content

Commit

Permalink
Correct packages names
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdiooa committed Jan 27, 2024
1 parent 84ff5e7 commit d7cd9a5
Show file tree
Hide file tree
Showing 20 changed files with 47 additions and 140 deletions.
Binary file removed avata.png
Binary file not shown.
18 changes: 3 additions & 15 deletions cmd/clsdapp/buckets.go → cmd/zeroward/buckets.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
*/
package clsdapp
package zeroward

import (
"fmt"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
listingbuckets "github.com/Abdiooa/CLSDAPP/pkg/clsdapp/listingbuckets"
listingbuckets "github.com/Abdiooa/zeroward/pkg/zeroward/buckets"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -55,13 +52,4 @@ var bucketsCmd = &cobra.Command{
func init() {
rootCmd.AddCommand(bucketsCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// bucketsCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// bucketsCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
14 changes: 2 additions & 12 deletions cmd/clsdapp/decrypt.go → cmd/zeroward/decrypt.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package clsdapp
package zeroward

import (
"encoding/hex"
"fmt"
"os"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/decryption"
"github.com/Abdiooa/zeroward/pkg/zeroward/decryption"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -52,14 +52,4 @@ func init() {
rootCmd.AddCommand(decryptCmd)

decryptCmd.Flags().StringP("dekkey", "k", "", "DEK Key to decrypt the file please!")

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// decryptCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// decryptCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
21 changes: 4 additions & 17 deletions cmd/clsdapp/download.go → cmd/zeroward/download.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
*/
package clsdapp
package zeroward

import (
"fmt"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/downloading"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/genekeys"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/downloading"
"github.com/Abdiooa/zeroward/pkg/zeroward/genekeys"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -95,14 +92,4 @@ var downloadCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(downloadCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// downloadCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// downloadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
23 changes: 6 additions & 17 deletions cmd/clsdapp/encrypt.go → cmd/zeroward/encrypt.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package clsdapp
package zeroward

import (
"encoding/hex"
"fmt"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/encryption"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/genekeys"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/encryption"
"github.com/Abdiooa/zeroward/pkg/zeroward/genekeys"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -49,12 +49,12 @@ var encryptCmd = &cobra.Command{
dek, err := genekeys.GenerateDek()
cobra.CheckErr(err)
if filePath != "" {
if err := encryption.Encrypt(filePath, dek); err != nil {
if err := encryption.EncryptFile(filePath, dek); err != nil {
fmt.Println("Error encrypting File:", err)
return
}
}
if err := encryption.Encrypt(dek, kekBytes); err != nil {
if err := encryption.EncryptKey(dek, kekBytes, filePath); err != nil {
fmt.Println("Error encrypting DEK:", err)
return
}
Expand All @@ -64,15 +64,4 @@ var encryptCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(encryptCmd)

// encryptCmd.Flags().StringP("filePath", "f", "", "Path of the file that you want to encrypt")
// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// encryptCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// encryptCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
19 changes: 3 additions & 16 deletions cmd/clsdapp/objects.go → cmd/zeroward/objects.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
/*
Copyright © 2024 NAME HERE <EMAIL ADDRESS>
*/
package clsdapp
package zeroward

import (
"fmt"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/listingobjects"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
listingobjects "github.com/Abdiooa/zeroward/pkg/zeroward/objects"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -62,14 +59,4 @@ var ObjectsCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(ObjectsCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// ObjectsCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// ObjectsCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
25 changes: 4 additions & 21 deletions cmd/clsdapp/root.go → cmd/zeroward/root.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/*
Copyright © 2024 Abdi Omar martelluiz125@gmail.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package clsdapp
package zeroward

import (
"fmt"
Expand Down Expand Up @@ -45,14 +30,14 @@ var (
cfgFile string

rootCmd = &cobra.Command{
Use: "CLSDAPP",
Use: "zeroward",
Short: "Client-Side Data Encryption Cloud Security Application",
Long: `CLSDAPP is a command-line application developed in Golang that implements a client-centric
Long: `zeroward is a command-line application developed in Golang that implements a client-centric
approach to ensuring the security of data in cloud environments. It provides a robust solution
for encrypting client data locally before uploading it to a cloud storage server. The application
implements secure transmission protocols, ensuring data remains encrypted during transfer.
Once stored, it adheres to security policies set by the cloud service provider, including additional
encryption layers, access management, and continuous monitoring. CLSDAPP empowers users to actively
encryption layers, access management, and continuous monitoring. zeroward empowers users to actively
participate in securing their data, offering full control and confidence in maintaining the
confidentiality and integrity of their information.`,
// Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -116,11 +101,9 @@ func CreateConfigFile() error {
fmt.Printf("Error getting user's home directory: %v", err)
}

// Create CLSD folder path
clsdFolderPath := filepath.Join(homeDir, ".config", clsdFolderName)

if _, err := os.Stat(clsdFolderPath); os.IsNotExist(err) {
// CLSD folder does not exist, create and generate KEK key
err := os.Mkdir(clsdFolderPath, 0700) // Set read-write-execute for the owner only
if err != nil {
fmt.Printf("Error creating CLSD folder: %v", err)
Expand Down
22 changes: 6 additions & 16 deletions cmd/clsdapp/upload.go → cmd/zeroward/upload.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package clsdapp
package zeroward

import (
"encoding/hex"
"fmt"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/encryption"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/genekeys"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/uploading"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/encryption"
"github.com/Abdiooa/zeroward/pkg/zeroward/genekeys"
"github.com/Abdiooa/zeroward/pkg/zeroward/uploading"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -62,7 +62,7 @@ var uploadCmd = &cobra.Command{
cobra.CheckErr(err)

if filePath != "" {
if err := encryption.Encrypt(filePath, dek); err != nil {
if err := encryption.EncryptFile(filePath, dek); err != nil {
fmt.Println("Error encrypting File:", err)
return
}
Expand Down Expand Up @@ -130,14 +130,4 @@ var uploadCmd = &cobra.Command{

func init() {
rootCmd.AddCommand(uploadCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// uploadCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// uploadCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Abdiooa/CLSDAPP
module github.com/Abdiooa/zeroward

go 1.20

Expand Down
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@ package main
import (
"fmt"

"github.com/Abdiooa/CLSDAPP/cmd/clsdapp"
"github.com/Abdiooa/zeroward/cmd/zeroward"
)

func main() {
// Create the config file and store KEKkey
if err := createConfigFile(); err != nil {
fmt.Println("Error creating config file:", err)
return
}

// Execute the CLSDAPP command
clsdapp.Execute()
// Execute the zeroward command
zeroward.Execute()
}

func createConfigFile() error {
// Attempt to create the config file and CLSD folder
return clsdapp.CreateConfigFile()
return zeroward.CreateConfigFile()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"time"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"os"
"path/filepath"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/decryption"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/decryption"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/aws/smithy-go"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,25 @@ import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"errors"
"fmt"
"io"
"os"
"path/filepath"
)

func Encrypt(input interface{}, key []byte) error {
switch v := input.(type) {
case []byte:
return EncryptKey(v, key)
case string:
return EncryptFile(v, key)
default:
return errors.New("unsupported input type")
}
}

func EncryptKey(dek []byte, kek []byte) error {

func EncryptKey(dek []byte, kek []byte, filePath string) error {
encryptedData, err := EncryptData(dek, kek)
if err != nil {
return err
}

file, err := os.Create("DEK.key.enc")
// Extract directory part of filePath
outputDEKDir := filepath.Dir(filePath)

// Create encrypted DEK file path by joining the directory and the new filename
outputDEKFilePath := filepath.Join(outputDEKDir, "DEK.key.enc")

file, err := os.Create(outputDEKFilePath)
if err != nil {
return err
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/s3"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"os"
"path/filepath"

"github.com/Abdiooa/CLSDAPP/pkg/clsdapp/common"
"github.com/Abdiooa/zeroward/pkg/zeroward/common"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/aws/smithy-go"
Expand Down

0 comments on commit d7cd9a5

Please sign in to comment.