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

Added OpenSSL::Cipher Documentation #9934

Merged
merged 6 commits into from
May 9, 2021
Merged

Conversation

sol-vin
Copy link
Contributor

@sol-vin sol-vin commented Nov 19, 2020

https://crystal-lang.org/api/0.35.1/OpenSSL/Cipher.html

There's no docs so I added them. Let me know if I need to be clearer.

@@ -1,6 +1,41 @@
require "random/secure"
require "openssl"

# A class which can be used to encrypt and decrypt string data using a specified cipher.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not only for string, is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I wasn't sure what is allowed for input into OpenSSL::Cipher#update. I'm guessing it's anything that can be turned into Bytes, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the only technical requirement seems to be having a #to_slice method. The practical idea is obviously to allow String | Bytes. Maybe that should be added as a type restriction to communicate this clearly. This would prevent you from passing any other type that implements #to_slice but that's not common and you can just convert it to a slice at the callsite.

src/openssl/cipher.cr Outdated Show resolved Hide resolved
src/openssl/cipher.cr Outdated Show resolved Hide resolved
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
Co-authored-by: Johannes Müller <[email protected]>
@asterite asterite merged commit cdf1af5 into crystal-lang:master May 9, 2021
@asterite asterite added this to the 1.1.0 milestone May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants