Page MenuHome GnuPG

Why does GPG ciphertext length differ with fixed plaintext length?
Closed, InvalidPublic

Description

Step 1) Input string for encryption is UUID format Input data = c0c6f311-
a793-4d65-9374-1c0e45f5382c
Length = 36 bytes Step 2) encrypt UUID with gpg command gpg --encrypt -r
PublicKey c0c6f311-a793-4d65-9374-1c0e45f5382c Step3) encrypt gpg output
using base64 command /usr/bin/base64 -w 0 gpg-encrypted-data(step2 output)

I had been ran same 36 bytes input data (c0c6f311-a793-4d65-9374-
1c0e45f5382c) continuously(90000 times) using step2 and step3, observed
below possible outputs

1)gpg encrypted 36 bytes input data to 389 bytes and base64 encrypted 389
bytes input data to 520 bytes -- 89996 times out of 90000 2)gpg encrypted 36
bytes input data to 387 bytes and base64 encrypted 387 bytes input data to
516 bytes -- 4 times out of 90000 3)Able to decrypt the 516 0r 520 bytes
encrypted data with orginal Input text(c0c6f311-a793-4d65-9374-1c0e45f5382c)

Please find some of the base64 command outputs gathered from above
execution. 520 bytes output last few characters 1) LG1bEwdUt3Sh6ea6cUrDk= 2)
Gwpr0kClWzllff6KgNo= 3) FLyCFDlMDQD6GiKJITBIjg= 4)
NbJ6y3mayCiWN8yZ9HQsJV+KQ=

516 Bytes Output

  1. JpTKn/7yS/0JBhH9TVTRxRNwhmh 2) Vzlo7c2zH2y3kB3PK+ihAyBfA 3)

ZlvAgKJQFe39+IT6giO1nQxZcwkX

I have few more questions above execution

Q1) padding is happenings both encryption level(i.e gpg, base64) Q2) is
there any way to handle fixed length encryption? Q3) is there any way to
remove padding encryption in both levels(i.e gpg, base64)? Q4)Actually we
are assuming that base64 encryption happening with 520 bytes, even above
execution also 99% encrypted with 520 bytes. Is there any way to padding 516
bytes encrypt to 520 bytes encryption?

Event Timeline

werner lowered the priority of this task from High to Normal.
werner added a project: Support.
werner removed a project: Bug Report.

Please do not open another bug but comment on the very same bug you posted a few
days ago (issue2166).

In any case, this is a question and not appropriate for a bug tracker. Use one
of the mailing lists for such questions or see https://gnupg.org/service.html
for commercial support offers.