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

Changed encoding to rawURL #50

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/encrypt/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func (e *Encrypter) Encrypt(reader io.Reader, filename string) error {
e.Logger.Print("No parts provided. Only the master-key will be generated.")
}

e.Logger.Debug("Generated master-key:", base64.StdEncoding.EncodeToString(masterKey))
e.Logger.Debug("Generated master-key:", base64.RawURLEncoding.EncodeToString(masterKey))

err = e.encryptAndSaveMessage(masterKey, reader, filename)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/file/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func WriteChecksum(logger log.Logger, content []byte, filename string) error {
}

func WriteKey(logger log.Logger, key []byte, filename string) error {
base64EncodedKey := base64.StdEncoding.EncodeToString(key)
base64EncodedKey := base64.RawURLEncoding.EncodeToString(key)

return WriteFile(logger, []byte(base64EncodedKey), filename+".key")
}
Expand Down Expand Up @@ -92,7 +92,7 @@ func ReadKey(filename string) ([]byte, error) {
return nil, errors.Wrapf(err, "failed reading key file '%s'", filename)
}

decodedKey, err := base64.StdEncoding.DecodeString(string(encodedKey))
decodedKey, err := base64.RawURLEncoding.DecodeString(string(encodedKey))
if err != nil {
return nil, errors.Wrapf(err, "failed decoding file '%s' from base64", filename)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/stego/shamir.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (p Part) Bytes() []byte {
}

func (p Part) Base64() string {
return base64.StdEncoding.EncodeToString(p.Bytes())
return base64.RawURLEncoding.EncodeToString(p.Bytes())
}

func Split(secret []byte, parts, threshold uint8) ([]Part, error) {
Expand Down
Loading