Symmetric cipher question

David Smith Dave.Smith at
Mon Feb 7 20:50:19 CET 2011

m999 at wrote:
> Hello
> I have a question. I want to encrypt file that consists of one word for
> example 'home with AES'. When I did encryption I got file that is 49
> bytes. How can I separate my encrypted 4-byte word from the rest of
> file. I need only encrypted part of my word, I don't want to implement
> AES on my own.

Well, for a start, you're unlikely to get an output from AES that
exactly matches the number of bytes you put in, unless your input is an
exact multiple of 128 bits (16 bytes).  This is because AES is a block
cipher algorithm, in that it only works on 128-bit blocks.  If your
input (cleartext) is not a multiple of 128 bits, some extra stuffing
will be added to the last part-block to make it up to a full 128 bits
before the block is encrypted.

As for why you're getting 49 bytes, I'm not sure.  I guess GnuPG is
adding some extra metadata (e.g. the ID of the key that was used to do
the encryption), but I'm afraid the exact behaviour is beyond my
knowledge.  Perhaps if you were to post the precise gpg command line you
are running, it will give us more info.

More information about the Gnupg-users mailing list