Git Product home page Git Product logo

Comments (5)

tarcieri avatar tarcieri commented on July 18, 2024 1

Key data needs to be frequently decoded from inout sources that can’t easily provide mutable references like key file formats (e.g. PKCS#8, OpenSSH)

from curve25519-dalek.

tarcieri avatar tarcieri commented on July 18, 2024

We can’t add trait impls for [u8; 32]: it’s just a byte array.

If you want it zeroized, you’ll need to do it yourself. There’s literally nothing this library can do.

from curve25519-dalek.

dmitry-markin avatar dmitry-markin commented on July 18, 2024

What about using a dedicated type for SecretKey? As users can misuse an array forgetting to zeroize it.

from curve25519-dalek.

tarcieri avatar tarcieri commented on July 18, 2024

And where do you get the bytes to make that SecretKey, and how do you ensure those are zeroed? At some point some bytes come into the library externally to what it can manage.

The main way SecretKey is used is as a &SecretKey reference here: https://docs.rs/ed25519-dalek/latest/ed25519_dalek/struct.SigningKey.html#method.from_bytes

Adding a SecretKey newtype would force those bytes to be copied from somewhere else, just so it could manage zeroing them. So it would actually result in an additional copy of the secret being made, which is strictly worse.

from curve25519-dalek.

dmitry-markin avatar dmitry-markin commented on July 18, 2024

Makes sense, thanks for the explanation. I was looking at SecretKey::try_from_bytes in libp2p that takes mutable reference and zeroes the user provided data after conversion, and though it might be a good idea for library to take care of destroying sensitive data.

from curve25519-dalek.

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.