Comments (4)
Is the OpenSSL version including a null terminator?
Edit: Nevermind. It's because you have the wrong size for 'in'. You specify 13 bytes but give it a size of 16, so you're passing three random bytes into the AES encrypt routine.
Edit 2: Same for 'key' and 'iv'.
from tiny-aes-c.
OPENSSL uses PKCS7 padding.
PKCS7 padding does not pad with zeros; instead, it pads with the remainder. so, if there are 4 bytes missing to make it modulus 16; the input will be padded with 4 bytes containing the number 4. PKCS7 also requires at least ONE padding byte; so if your input length is exactly modulus 16 - you need to add 16 bytes, containing the value 16.
i implemented AES-128/192/256 working against openSSL (within PHP) initially based on the code in this repository; but in order to support 192/256 i had to make some minor changes in addition to dealing with PKCS7 padding.
http://ardiri.com/blog/utls_defining_lightweight_security_for_iot_part_5
from tiny-aes-c.
The fork by triangulum-com-au implements PKCS7 padding (look at the tests). I've used it with success.
from tiny-aes-c.
Thanks to @namreeb @ardiri @wvengen helps , I did not consider the padding at the first time and the program appears different result. Thank you!
from tiny-aes-c.
Related Issues (20)
- Storing IV after encryption HOT 2
- How to pass the data type as string for key and plain_test varibles in test_encrypt_ecb_verbose method HOT 5
- AES256 mode HOT 1
- Add AES-CFB.. HOT 1
- aes.h comment error
- AES reversing HOT 3
- Zenner default AES keys would be needed HOT 3
- Uninitialized AES key HOT 2
- Change bitrate at runtime, via Init ?
- USML or ECCN number? HOT 2
- openssl 1.1.1t support TLSv1 and TLSv1_1? or how to enable TLSv1 and TLSv1_1 on openssl 1.1.1t? HOT 1
- HOW TO IMPLEMENT IN STM32 MICROCONTROLLERS HOT 1
- tiny-AES-c AES256 CTR interoperability HOT 3
- heap overflow while decrypting HOT 1
- Different values in x64 and x32 HOT 1
- Issues with Include HOT 1
- Request for AES128_CBC Encryption Help HOT 1
- Maybe you want replace INT to UINT8_T here.
- Does tiny-AES-c support GCM mode?
- Reduce size even more: generate s-box table? HOT 4
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 tiny-aes-c.