Skip to content

Commit

Permalink
create test to ensure interoperability with openssl tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcb committed Nov 4, 2020
1 parent 5fc65f7 commit 953febc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN apk add --update --no-cache \
less \
make \
openssl \
openssh-keygen \
shellcheck \
util-linux

Expand Down Expand Up @@ -86,7 +87,14 @@ secretshare-all:
COPY +secretshare-darwin/secretshare ./secretshare-darwin-amd64
SAVE ARTIFACT ./*

test:
COPY +secretshare-linux/secretshare ./secretshare
RUN ./secretshare
RUN bash -c "echo -n hello | openssl pkeyutl -encrypt -pubin -inkey <(ssh-keygen -f ~/.secretshare.pub -e -m PKCS8) -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256 -pkeyopt rsa_mgf1_md:sha256 | base64 | ./secretshare decrypt > output"
RUN bash -c "diff output <( echo -n hello)"

release:
BUILD +test
FROM node:13.10.1-alpine3.11
RUN npm install -g [email protected]
WORKDIR /release
Expand Down
Binary file modified build/linux/amd64/secretshare
Binary file not shown.
4 changes: 2 additions & 2 deletions cmd/secretshare/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func main() {
fmt.Fprintf(os.Stderr, "failed while decrypting: %s", err.Error())
os.Exit(1)
}
fmt.Println(data2)
fmt.Printf("%s", data2)
return
}

Expand All @@ -197,5 +197,5 @@ func main() {
fmt.Fprintf(os.Stderr, "failed while encrypting: %s", err.Error())
os.Exit(1)
}
fmt.Println(encrypted)
fmt.Printf("%s", encrypted)
}

0 comments on commit 953febc

Please sign in to comment.