Comments (3)
from arduinolibs.
@prochat probably i did not explain my doubt very well.. i cannot find a mechanism in the library which add a specified padding to a block of data that isn't a multiple of the block size of a specified algorithm. Is there a way in the library to accomplish this or i have to specify this by myself? In the first case, can explain me how i can do it? Thanks.
from arduinolibs.
Hi there. The hash algorithms have in-built padding support compatible with their respective standards. Nothing special needs to be done for them.
I assume that you are referring to padding for block ciphers in CBC mode. There is no explicit support for padding in the Crypto library because there are many different padding schemes - pad with zeroes, pad with a byte set to N if there are N padding bytes, pad with a 1 bit followed by a zero bit and finally a 1 bit. Which one?
Also, dealing with the last block in CBC mode is a pain in the neck for both encryption and decryption, as an extra block needs to be added if the plaintext was block-aligned to begin with. So it was easier to say "the application pads the data itself and then passes the block-aligned data into the CBC mode".
In any case, CBC mode is not recommended for new designs as it is difficult to make the padding have constant-time behaviour. It is better to use CTR mode which doesn't require padding. Or better yet, EAX mode for encryption and authentication (AEAD).
If you do still want to use CBC mode, then you'll have to pad the block yourself before passing it to the library for encryption, and remove the padding yourself after decryption.
from arduinolibs.
Related Issues (20)
- Use of htobe64 and other non-standard functions HOT 3
- 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
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.