Navigation Menu

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

Add examples in doctests for ring::aead API #418

Open
briansmith opened this issue Jan 20, 2017 · 14 comments
Open

Add examples in doctests for ring::aead API #418

briansmith opened this issue Jan 20, 2017 · 14 comments

Comments

@briansmith
Copy link
Owner

The AEAD API is one of the few that doesn't have example code. Let's add the example code, in a similar style as the existing examples for other features.

We're likely to remove the in_prefix_len parameter, so if we only have resources to write two examples, one with in_prefix_len zero and one where it is non-zero, it's best to write one where in_prefix_len is zero.

A good example would be TLS records, which have a 5 byte AAD prefix of { type: u8, ProtocolVersion: u16, length: u16 }.

It would also be good to have an example where there's no ciphertext, and there's only AAD.

@Philipp91
Copy link
Contributor

Proper nonce generation should be explained somewhere. Especially if random nonces aren't secure, as that would be surprising to most users.

@briansmith briansmith added this to the 0.7.n milestone Mar 6, 2017
@briansmith
Copy link
Owner Author

briansmith commented Mar 6, 2017

[wrongly-added comment removed]

@Philipp91
Copy link
Contributor

Are you sure you closed the right issue?

@briansmith briansmith reopened this Mar 6, 2017
@briansmith
Copy link
Owner Author

Thanks @Philipp91. Reopened.

@briansmith briansmith removed this from the 0.7.n milestone Apr 10, 2017
@dsprenkels
Copy link

If possible, I would like to take this issue. 😄

@briansmith
Copy link
Owner Author

My understanding is that there is at least one PR and maybe two different PRs that attempt to fix this issue. Additionally, there are some other patches that completely change the API. So basically I need to decide which direction to go. I imagine I'll just replace the API with a better one. I'll be discussing this with some users of the API soon and I'll update this issue when I've made a decision.

@dsprenkels
Copy link

Ok. Thanks for your quick reply! Do you have any good suggestions on which issues are ready to be tackled by a beginner like me?

@briansmith
Copy link
Owner Author

See #805 where the beginning of the refactoring of the AEAD API has started. Feedback appreciated.

@artosan
Copy link

artosan commented Dec 6, 2019

Any news on this issue? I am having problems using the AEAD API and it would be super nice to have some working examples which show correct nonce use and so on.

@ghost
Copy link

ghost commented Jan 18, 2020

Any update?

@ghost
Copy link

ghost commented Jan 18, 2020

Btw i found this
https://gist.github.com/jaysonsantos/117c1f7623a2fb2c39e47f6cf87860a3
but it's outdated

@rsdy
Copy link

rsdy commented Jan 18, 2020

FWIW, zerostash uses the AEAD API from ring, although the nonces are not following standard practice.

@ghost
Copy link

ghost commented Jan 19, 2020

I'm playing around with the AEAD's API and created this
https://github.com/briansmith/ring/compare/master...xliiv:aead-example?expand=1

It's a meaningless example, but maybe it helps someone.

@ghost
Copy link

ghost commented Jan 20, 2020

Another example could be found in Elichai's Lorenz project
https://github.com/elichai/Lorenz/blob/13032dc8a9cdacbf767008aaa506b07c02007c81/src/encryption.rs#L14-L46

Actually I just finished my example because Elichai pointed me out the link above and gave some hints.

@briansmith briansmith changed the title Add examples for using the AEAD API Add examples in doctests for ring::aead API Oct 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants