bugDistributed Privacy Guard - Bugs: bug #57099, dkg-encrypt adds spurious newline

 
 

bug #57099: dkg-encrypt adds spurious newline

Submitter:  Justus Winter <teythoon>
Submitted:  Tue 22 Oct 2019 11:10:03 AM UTC
   
 
Category:  Source Code Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  stamer
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 22 Oct 2019 09:05:37 PM UTC, comment #3: 

Yes, it is fixed :)

Justus Winter <teythoon>
Tue 22 Oct 2019 08:51:06 PM UTC, comment #2: 

The commit 7e3784219fc37cb1340b83fa1a2fe5d50f5b4543 should fix this bug.

@teythoon Can you confirm that it is solved?

Heiko Stamer <stamer>
Group administrator
Tue 22 Oct 2019 08:18:55 PM UTC, comment #1: 

Thanks for reporting this bug. dkg-encrypt calls read_message() from dkg-io.cc, if option "-i" is used. However, this is a function reading whole lines such that the spurious newline has been added to each messages ending with a non-newline character.

I will fix this by providing another read function in dkg-io.cc.

Heiko Stamer <stamer>
Group administrator
Tue 22 Oct 2019 11:10:03 AM UTC, original submission:  


% echo -n 'Hello, World!' > h.wo
% hd h.wo
00000000  48 65 6c 6c 6f 2c 20 57  6f 72 6c 64 21           |Hello, World!|
0000000d
% dkg-encrypt --verbose -k alice.armored -r EB85BB5FA33A75E15E944E63F231550C4F47E38E -i h.wo >m
INFO: using LibTMCG version 1.4.0
WARNING: recipient does not state support for AEAD Encrypted Data Packet; AEAD disabled
WARNING: selected algorithm is none of the preferred AEAD algorithms
% dkg-decrypt --verbose -y data/certificates/alice-secret.pgp -i m | hd
INFO: using LibTMCG version 1.4.0
INFO: fork() = 17051
INFO: waitpid(17051)
INFO: decrypted message:
INFO: p_0: exit(0)
INFO: protocol instance 17051 terminated with exit status 0
00000000  48 65 6c 6c 6f 2c 20 57  6f 72 6c 64 21 0a        |Hello, World!.|
0000000e


The newline is added by dkg-encrypt, as demonstrated by decrypting it with Sequoia:


% sq decrypt --secret-key-file data/certificates/alice-secret.pgp m | hd
Encrypted using AES with 256-bit key
00000000  48 65 6c 6c 6f 2c 20 57  6f 72 6c 64 21 0a        |Hello, World!.|
0000000e
+verbatim+

At first I thought that dkg-encrypt might emit a literal data packet with the format set to text, which may or may not make the addition of the newline appropriate, but it does not:

% sq decrypt --secret-key-file data/certificates/alice-secret.pgp --dump m
New CTB, 94 bytes: Public-key Encrypted Session Key Packet
    Version: 3
    Recipient: 4766 F6B9 D5F2 1EB6
    Pk algo: ECDH public key algorithm

Encrypted using AES with 256-bit key
Hello, World!
New CTB, 63 bytes: Encrypted and Integrity Protected Data Packet
│   Version: 1

├── New CTB, 20 bytes: Literal Data Packet
│       Format: Binary data
│       Timestamp: 2019-10-22T11:03

└── New CTB, 20 bytes: Modification Detection Code Packet
        Hash: A81009FB0BAF9259B7E680074D850FB95528344A
        Computed hash: A81009FB0BAF9259B7E680074D850FB95528344A
-verbatim-

Justus Winter <teythoon>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by teythoon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-10-24 stamer CategoryNone Source Code
        Item GroupNone Bug
    2019-10-23 stamer StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-10-22 stamer StatusIn Progress Ready For Test
    2019-10-22 stamer StatusNone In Progress
        Assigned toNone stamer

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code