I'm using this kind of technique instead of padding of cipher buffer (here goes pseudo-code):
struct {
int size; //size of cipher buffer
byte[32] vector; //random IV (block size is 256 bits)
byte[] buffer; //encrypted buffer
}
Cipher data encrypted using block cipher with CBC chaining using IV specified as vector
I'm storing this structure "as-is" and in order to decrypt it decrypting buffer block by block then just cutting buffer byto size
.
Question is: is it safe/secure? Any hints/criticizm?