Page MenuHome GnuPG

sexp string including \0
Closed, ResolvedPublic

Description

During testing GnuPG, I encounter the private key with following content:

Created: 20231005T011020
Key: (protected-private-key (ecc (curve "NIST P-384")(q
  #048D507245E2292139CCA98EAB576E23A92407C16E6CE97DFFE91CA25EF5487252EC
 D280520CADD2FFA1CFBB6224E7A77F23D02E8482CD830690B1F88A2FE5AE304FE10A48
 0E83E882448888971270082DD6DA841AA717D486C0D08A8A6E003238#)(protected
  openpgp-s2k3-ocb-aes ((sha1 "/äè§)(z" "65536")#5AF8E583EC4317CDAF74E6
 F5#)#3E532DD799AAD8D00142BF39F3AC62326429682D87AAF7E475F6A67069F775E01
 17040CC281DD438FA6D4FB98CD15FFFDBAE55ADB98DA633D7128738BFF444C79B53A5C
 4E5EA1C20D922F9B4#)(protected-at "20231005T011020")))

And it is failed to be parsed, because the sha1 salt is length 7.

It is due to the bug of suitable_encoding in sexp.c.