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

Unable to add binary file to KamusSecret #246

Closed
Ant59 opened this issue Jul 8, 2019 · 7 comments · Fixed by #248
Closed

Unable to add binary file to KamusSecret #246

Ant59 opened this issue Jul 8, 2019 · 7 comments · Fixed by #248
Labels
enhancement New feature or request

Comments

@Ant59
Copy link

Ant59 commented Jul 8, 2019

In trying to add a DER-encoded certificate to a KamusSecret, it's proven to not be possible. With standard Kubernetes secrets, it would be a case of base64-encoding the file and applying that Secret manifest. With KamusSecret, the encryptor-api expects plaintext (non-base64-encoded) input.

I tried to just pass the DER file raw to the kamus-cli, but I was getting a different output each time it ran. I feel like this should be the correct workflow, but the inconsistent response that it was giving me was not leaving Kubernetes happy.

@shaikatz
Copy link
Contributor

shaikatz commented Jul 8, 2019

Hi,

When providing the CLI with long string with many special characters as certificate, it gets confused.
In order to encrypt certificates with kamus-cli, you better use the --secret-file option.
Just dump the certificate into a file, and let the kamus-cli read that file.

Please let me know if it helps.

@Ant59
Copy link
Author

Ant59 commented Jul 8, 2019

As explained, when passing a file to kamus-cli, we get inconsistent responses. Seems to be random.

@shaikatz
Copy link
Contributor

shaikatz commented Jul 8, 2019

Sorry I've probably misunderstood your issue.
The encrypted value will never be the same, Kamus is using random IV for each encryption operation resulting in different encrypted strings.

After the decryption, you supposed to get the same value, isn't that the case?

@Ant59
Copy link
Author

Ant59 commented Jul 8, 2019

Oh, my bad. Yeah, we're not seeming to get the correct value upon decryption.

@shaikatz
Copy link
Contributor

shaikatz commented Jul 8, 2019

Can you supply me with an example of the DER certificate file you trying to encrypt?
I would like to try and reproduce that.
You can find me at shai@soluto.com

@Ant59
Copy link
Author

Ant59 commented Jul 8, 2019

Yes. I'll try and send it over in the next hour or so. Thanks for your quick replies.

@omerlh
Copy link
Contributor

omerlh commented Jul 10, 2019

I was able to reproduce it - it is because we assume the data is always string, so we create it as string - and Kubernetes SDK wraps it in base64 encoding. Fixing it now - please take a look at the proposed solution!

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

Successfully merging a pull request may close this issue.

3 participants