Skip to content

Commit

Permalink
changed encoding to rawURL
Browse files Browse the repository at this point in the history
  • Loading branch information
enrichman committed Feb 27, 2024
1 parent a2ebd87 commit 6f17860
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
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

0 comments on commit 6f17860

Please sign in to comment.