Coder Social home page Coder Social logo

Comments (9)

tarcieri avatar tarcieri commented on September 18, 2024 1

All types have a blanket impl of impl<T> From<T> for <T>:

https://docs.rs/aead/0.3.2/aead/struct.Payload.html#impl-From%3CT%3E

...and all types that impl From have a blanket impl for Into:

https://doc.rust-lang.org/std/convert/trait.Into.html#impl-Into%3CU%3E

...so Payload receives a blanket impl of Into<Payload> as well.

I agree the documentation for aead::Aead could be better there.

from aeads.

alxiong avatar alxiong commented on September 18, 2024

Ah I see, thanks for the clarification!

Understood now, can close the issue. 👍🏻

from aeads.

tarcieri avatar tarcieri commented on September 18, 2024

I'll leave it open to track adding better documentation

from aeads.

alxiong avatar alxiong commented on September 18, 2024

hmm... 🤔 the following gives me Err, not sure why

// message: &[u8], assoc_data: &u8, nonce and recipient_box is properly constructed.
let ct = recipient_box.encrypt(&nonce,
                               Payload { msg: &message,
                                         aad: &assoc_data });

Just to double check with you @tarcieri , ☝️ this is the correct way to use Payload right?


update: if I set assoc_data to an empty slice, then it will pass. but if aad is non empty, it will fail. -- feels like a bug 🪲 ?

to reproduce it, see playground here: https://repl.it/repls/OutstandingWildNature#src/lib.rs

from aeads.

tarcieri avatar tarcieri commented on September 18, 2024

crypto_box and the xsalsa20poly1305 construction it's based on doesn't support AAD as an algorithm. Unfortunately it's unclear from the current API it's unsupported and you're getting an unhelpful error.

We have this tracking issue open for traits which better reflect constructions like xsalsa20poly1305 which don't support AAD: RustCrypto/traits#261

from aeads.

alxiong avatar alxiong commented on September 18, 2024

the xsalsa20poly1305 construction it's based on doesn't support AAD as an algorithm

so will the team add support for AAD in the near future (if so, mind me asking roughly when)? or this exclusion has some rationale behind?

We have this tracking issue open for traits which better reflect constructions like xsalsa20poly1305 which don't support AAD: RustCrypto/traits#261

so basically, xsalsa20poly1305 is "designed to not have AAD support"?

from aeads.

tarcieri avatar tarcieri commented on September 18, 2024

The design of the xsalsa20poly1305 algorithm itself has no support for AAD. It's the only such algorithm in this repo which doesn't.

The similar chacha20poly1305 construction supports it. We could potentially add support for it to crypto_box

from aeads.

alxiong avatar alxiong commented on September 18, 2024

I see.

The similar chacha20poly1305 construction supports it. We could potentially add support for it to crypto_box

that would be great

from aeads.

tarcieri avatar tarcieri commented on September 18, 2024

I think this was ultimately addressed in #225

from aeads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.