-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
'eyaml decrypt' requires public key #137
Comments
This is due to the way OpenSSL is designed, unfortunately. From the documentation for PKCS7_decrypt(3):
It might be possible to work around this by generating a new public certificate at decryption if one isn't available, but that's adding a lot of complication (not to mention latency; generating certificates is slow) for minimal gain. |
Yes, when I implemented this, I noted that the public key and the private key are necessary to decrypt, and only the public key is necessary to encrypt. If you know otherwise, please let me know and will investigate |
elyscape, Yes I see what you mean now. Thanks for the reference. Perhaps it's not worth generating again but I like the idea if the private key is found and the public isn't. |
There must be a way to work this out, I'm able to decrypt hiera-eyaml encrypted keys with the openssl cli, just by adding BEGIN PKCS7, END PKCS7 headers to the message:
|
In PKCS7 RFC, the recipient certificate is not mandatory when decrypting. This is also how it is implemented in OpenSSL PKCS7_decrypt(). However, it is only since version 2.2.0 of ruby-openssl that it is possible to call OpenSSL::PKCS7#decrypt with only the private key. Ref: ruby/openssl#183 The issue of hiera-eyaml requiring the public key when decrypting has been brought before in voxpupuli#137, but ruby-openssl was yet patched.
In PKCS7 RFC, the recipient certificate is not mandatory when decrypting. This is also how it is implemented in OpenSSL PKCS7_decrypt(). However, it is only since version 2.2.0 of ruby-openssl that it is possible to call OpenSSL::PKCS7#decrypt with only the private key. Ref: ruby/openssl#183 The issue of hiera-eyaml requiring the public key when decrypting has been brought before in voxpupuli#137, but ruby-openssl was yet patched.
In PKCS7 RFC, the recipient certificate is not mandatory when decrypting. This is also how it is implemented in OpenSSL PKCS7_decrypt(). However, it is only since version 2.2.0 of ruby-openssl that it is possible to call OpenSSL::PKCS7#decrypt with only the private key. Ref: ruby/openssl#183 The issue of hiera-eyaml requiring the public key when decrypting has been brought before in voxpupuli#137, but ruby-openssl was yet patched.
In PKCS7 RFC, the recipient certificate is not mandatory when decrypting. This is also how it is implemented in OpenSSL PKCS7_decrypt(). However, it is only since version 2.2.0 of ruby-openssl that it is possible to call OpenSSL::PKCS7#decrypt with only the private key. Ref: ruby/openssl#183 The issue of hiera-eyaml requiring the public key when decrypting has been brought before in voxpupuli#137, but ruby-openssl was yet patched.
Attempting to run:
results in an innapropriate error:
I'm considering this error to be innappropriate as I've specified the path to the private key and eyaml should no longer be looking in the default directory of ./keys
However, if I include a path to the public key and run:
The file will be decrypted. This is also an error to me as the public key should not be necessary to decrypt.
The text was updated successfully, but these errors were encountered: