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

Create function returning bad Base64 values #8

Open
lordofscripts opened this issue Jul 19, 2024 · 3 comments
Open

Create function returning bad Base64 values #8

lordofscripts opened this issue Jul 19, 2024 · 3 comments

Comments

@lordofscripts
Copy link

lordofscripts commented Jul 19, 2024

  • First, the documentation should be updated to indicate that both Create() and Combine() return TWO parameters: data, error.
  • Second, the Create() function is returning an array of shards, but as it turns out each of the shards/secrets has the Base64 string twice, thus, attempts to decode the Base64 result in an error. Below a sample output of the first "secret" in the list:

Here is the result of the following statement prior to attempting Base64 decode:
fmt.Printf("\nShard #%d %T\n\t%s\n", i, shard, shard, shard)

Shard #0 string
	CxhWcKn2w3_TzcIbQZr0KQe7IBqLiL_9uZsT-_bWMkM=EkW1Z-EsCm3u061sXnK3_5N60hSP_bGmz7L4pX-eRww=
%!(EXTRA string=CxhWcKn2w3_TzcIbQZr0KQe7IBqLiL_9uZsT-_bWMkM=EkW1Z-EsCm3u061sXnK3_5N60hSP_bGmz7L4pX-eRww=)

As you can observe, each of the returned secrets has the Base64 value followed by what it appears to be the same value (repeated) as a result of a badly formatted SPrintf() statement.

@cipherboy
Copy link
Member

Hi @lordofscripts -- if you're looking for a mature and tested Shamir's library, I'd suggest checking out https://pkg.go.dev/github.com/openbao/openbao/[email protected]/helper/shamir

@lordofscripts
Copy link
Author

Hi @lordofscripts -- if you're looking for a mature and tested Shamir's library, I'd suggest checking out https://pkg.go.dev/github.com/openbao/openbao/[email protected]/helper/shamir

Thanks for the lead. I looked into it but unfortunately it drags a lot of other stuff with it. I settled for RSA Shamir Secret Sharing which is bare ones and has the necessary building blocks.

@cipherboy
Copy link
Member

If the disclaimer in the RSA one is an issue, I'd probably take a PR to add a separate go module for Shamir's upstream in OpenBao.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants