Comments (5)
My library provides the basic building blocks for creating larger protocols like PEM, SSL/TLS, Noise, etc but it doesn't currently implement any of them.
Ed25519 is for signatures only. It doesn't provide any encryption facilities. A separate mechanism needs to be provided to encrypt the message contents. The usual method would be to use Curve25519 to establish a shared secret between the parties, and then hash that to create a key for AES-CTR or something similar. Then ed25519 is used to sign the encrypted message that is sent under the shared secret to verify the origin.
In general, encrypt-then-sign is the better choice because if an attacker manages to break the signature scheme, all they learn is statistical information about the ciphertext - which they already have. With sign-then-encrypt, if the signature scheme is broken then the attacker may learn some statistical information about the plaintext. The same applies to authenticated encryption modes like GCM and EAX.
from arduinolibs.
Hello. I found this issue while searching for the following link I referenced to a friend.
https://theworld.com/~dtd/sign_encrypt/sign_encrypt7.html
This article describes why you don't want either sign-then-encrypt nor encrypt-then-sign and offers (dated) alternatives.
Short version. If Alice signs a message "I love you" and encrypts it to Bob, then Bob may re-encrypt the signed message and send Alice' love letter to Carol, who now believes Alice loves Carol. If Alice encrypts the same message for Bob and signs it, an active attacker may intercept the message and replace the signature with her own.
The "simple solution" (one of several offered in the article) is to sign the message along with a tag saying who the intended recipient is, then encrypt it.
The typical modern solution is hybrid encryption, meaning you asymmetrically exchange a key you then use to symmetrically authenticate and encrypt the messages. For one-offs use libsodium's crypto_box
. To auth-encrypt a sequence of related messages and detect messages being dropped, duplicated, reordered, or truncated; use libsodium's secret_stream
interface. Unlike crypto_box
the secret_stream
consumes a preshared key, so you'll need to do the key exchange yourself. For this I recommend 3DH (triple Diffie-Hellman) with static and ephemeral keypairs on both sides, using curve25519. This gives you 3 uniform keys, hash them together with blake2 to establish the shared session key.
(Ignore the X [dotted line] of Signal's X3DH to get the simpler and stronger 3DH.)
from arduinolibs.
Thank you @rweather. I understand only bits and pieces of your comment (no fault of yours, of course), and by now my lack of understanding of encryption should be evident. Do you have examples demonstrating simple interfaces for encrypting, signing, and decrypting? Similar to these: PyNaCl public key encryption and PyNaCl digital signatures.
from arduinolibs.
In general, encrypt-then-sign is the better choice because if an attacker manages to break the signature scheme
If you sign then encrypt one would need to first break the outer encryption before having access to the signature scheme. This article makes a pretty good case for sign then encrypt: https://www.quora.com/Which-one-is-more-preferable-encrypt-then-sign-or-sign-then-encrypt
from arduinolibs.
In general, encrypt-then-sign is the better choice because if an attacker manages to break the signature scheme
If you sign then encrypt one would need to first break the outer encryption before having access to the signature scheme. This article makes a pretty good case for sign then encrypt: https://www.quora.com/Which-one-is-more-preferable-encrypt-then-sign-or-sign-then-encrypt
Thanks for the comment. However, I don't agree with you. Or I should say, experts don't agree with you. This is a good reference on the subject : https://docs.google.com/viewer?url=https%3A%2F%2Fwww.iacr.org%2Farchive%2Fcrypto2001%2F21390309.pdf
from arduinolibs.
Related Issues (20)
- Encrypt String longer than blockSize() HOT 5
- Asymmetric encryption/decryption? HOT 3
- Error compiling for new Arduino core for the ESP32 HOT 4
- Support for XChaCha20 Poly1305 HOT 2
- Need help with ChaCha and Strings HOT 1
- TestSpeck.ino fails on samd21 M0 after changing the plaintext HOT 1
- Asymmetric encryption HOT 1
- Including libraries does not work in platformio HOT 1
- default key? HOT 4
- Bug of Ascon128.c++ in Arduino Cryptography Library HOT 3
- TestSpeck.ino - Decryption fails for SpeckTiny with all key sizes HOT 1
- Crypto doesn't support next generation AVRs HOT 18
- ’SHA256‘ was not declared in this scope ESP32S3 HOT 6
- Crypto library "Hash.h" conflicting with ESP866 Arduino package "Hash.h" HOT 5
- Ascon128::decrypt doesn't seem to allow for inplace decryption, despite documentation saying so
- Support for SHA-512/256?
- crypto_feed_watchdog was not declared in this scope [ESP8266 & ESP32] HOT 3
- RNG.cpp include of <Arduino.h> makes native builds for unit testing and debugging fail
- Error Compiling for ESP8266 or ESP32 clean() not declared in scope AES CFB example
- calculated shared secret doesn't match (Diffie-Hellman, Curve25519)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduinolibs.