Re: [Secdispatch] [dispatch] [art] Plain text JSON digital signatures

Anders Rundgren <anders.rundgren.net@gmail.com> Thu, 29 April 2021 02:06 UTC

Return-Path: <anders.rundgren.net@gmail.com>
X-Original-To: secdispatch@ietfa.amsl.com
Delivered-To: secdispatch@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E715D3A2A28; Wed, 28 Apr 2021 19:06:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rh24c09-M3sV; Wed, 28 Apr 2021 19:06:18 -0700 (PDT)
Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2C8EA3A2A29; Wed, 28 Apr 2021 19:06:18 -0700 (PDT)
Received: by mail-wm1-x329.google.com with SMTP id 82-20020a1c01550000b0290142562ff7c9so5743699wmb.3; Wed, 28 Apr 2021 19:06:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zB0ww5WbhBaakRYwIOhQfl7GxxPU0HnZpVLdUTe2bpw=; b=KlUbK4R0H8N5BQB60zRLptIaYssejJdVeehs2P0uxyItN7izQCYJ0uGKfUVTG6xNsg V6Z2qyuKi0ACF2KdP2yVmbx7uAwCsnNlvbB9VMKkDjfeNiqD+PjmDlIr2P0oiydRA8ij BmYYR9l9d2/xnteAM6x4wQXma/eOICjRgIL5wrlPUEBe6RwfbAs3UZiVFwgpaVYodg+k XU3reMtet753lsblTev+ECtf6JD+Jm9aTj7NTldtvVA0tpmLb7anBx9Wn1lPykAutk97 zoKSveBw5H3gbnIE0cg7tLB9p2oaz0zNKACxNVuh2isd0zL5322w8WPltOSiksxw7pFZ LhWg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zB0ww5WbhBaakRYwIOhQfl7GxxPU0HnZpVLdUTe2bpw=; b=pRpg8AHfHIOS2rdcZM+Li8hDKBqdZG/gZtWLoMzbljDuFhfekko56/epeHnHFN3eEv sP4X4rTQszZeF4K7e2rdeaD0zZ0/RKb026UAwgJOSsYf0pPZh/6dJ/iMmW/Zz4w7+cAj wS+ZT0MqkDjoPJ3RPjlZPCjKxipUqh/TBhgsQaD85FStIDmefv9sor16nt99atF6tqDX xTAmDHoMtudG4ND3Blimxpga0rRg9Mm8F9BZD/15IwvPk5DfCSvLlS+lt9L0SPYle87Z 1wq4sh5DMmUagx368K4Hdq3u9HnA/PDKKaEyfQYNxaCqBFbmATiqdnVW7bQ+/piCmVf+ RwZw==
X-Gm-Message-State: AOAM53293mLrtgrmiv67Yxce18iBB53qbvSYUSdhlJoTOf7H6f3gn9TH vxK5TqkNS1jV1S1/aHCLqwg=
X-Google-Smtp-Source: ABdhPJwZwkI1+ZXOe+86em7xU7ja7BM81TY4BFYLU79ru4pJat53wUwZDasxenyVSiqd2/ULYSdFxw==
X-Received: by 2002:a05:600c:4f14:: with SMTP id l20mr4535486wmq.150.1619661974798; Wed, 28 Apr 2021 19:06:14 -0700 (PDT)
Received: from [192.168.1.67] (25.131.146.77.rev.sfr.net. [77.146.131.25]) by smtp.googlemail.com with ESMTPSA id q20sm13657783wmq.2.2021.04.28.19.06.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Apr 2021 19:06:14 -0700 (PDT)
To: Stefan Santesson <stefan@aaa-sec.com>
Cc: DISPATCH <dispatch@ietf.org>, art@ietf.org, IETF SecDispatch <Secdispatch@ietf.org>, rfc-ise@rfc-editor.org
References: <CAD9ie-v7uJOpjj+nbZCfQe+4JEQt-6=b6cm57iFPAn_enGeRCQ@mail.gmail.com> <3B394519-4061-43A8-8963-55A6ADEDF269@gmail.com> <19a99964-8495-2de9-b49a-52aa8321c12e@aaa-sec.com> <220475a6-1e04-107e-6327-366d48d8b420@gmail.com> <27833d9d-53c3-d01c-b01c-e7d53424b5ab@aaa-sec.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <e2eab563-a7ec-6800-f875-8d406ddc9472@gmail.com>
Date: Thu, 29 Apr 2021 04:06:11 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0
MIME-Version: 1.0
In-Reply-To: <27833d9d-53c3-d01c-b01c-e7d53424b5ab@aaa-sec.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/secdispatch/FsDjK7e-YemAgfp3ysGado2rLs0>
Subject: Re: [Secdispatch] [dispatch] [art] Plain text JSON digital signatures
X-BeenThere: secdispatch@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Security Dispatch <secdispatch.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/secdispatch>, <mailto:secdispatch-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/secdispatch/>
List-Post: <mailto:secdispatch@ietf.org>
List-Help: <mailto:secdispatch-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/secdispatch>, <mailto:secdispatch-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Apr 2021 02:06:23 -0000

On 2021-04-28 11:29, Stefan Santesson wrote:
> RFC 7797 is supported by common open source such as Nimbus and I use it
> for instances where you obviously do not need a URL safe token.

I see.

> As such it works for JWS but Not for JWT. But It works really well and
> saves space when URL safeness is not needed.

That's great.  Note though that this scheme require that '.' are escaped into \u002e as can be seen in the example below.  Data to sign:
{
   "payee": "Space Shop",
   "amount": {
     "currency": "EUR",
      "value": "100.00"
   }
}

Using RFC 7797 (with "b64":false,"crit":["b64"]):
eyJhbGciOiJFUzI1NiIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19.{"amount":{"currency":"EUR","value":"100\u002e00"},"payee":"Space Shop"}.KFOhCfpyZnW7RUpwOvZAJPKDfpF1R2uENirUW6Ew4v1HwQI5iFJaXKW0PsvTuVNpb-T_UjpOcv868qihMjeMwA

Using JWS/CT (here pretty-printed using standard JSON tools):
{
   "payee": "Space Shop",
   "amount": {
     "currency": "EUR",
      "value": "100.00"
   },
   "signature": "eyJhbGciOiJFUzI1NiJ9..aY27xoS5B3J-uZtUdJzXevqBbnNf4vNT1YN1_eHPOcILMXlVu3VjdExW17f66EGdt4mxQSnpAVLsUa4k2zSLQw"
}

> So I guess your answer is that it still encapsulates the signed JSON in
> the signature, and that the proposal really is about embedding signature
> in the JSON object being signed (and not about whether the JSON is in
> plaintext).

JWS/CT addresses several issues:
- Maintaining a consistent message structure
- Maintaining JSON notation
- Full compliance with JavaScript and browser APIs (including the "JSON" object).

However, from an IETF adoption point of view it is rather the validity and reliance on RFC 8785 that is the core issue.

> Could you elaborate why you think it is important to NOT embed signed
> data in the signature?

The example above may serve this purpose.

> What is the usecase?

See this response to Carsten: https://mailarchive.ietf.org/arch/msg/dispatch/3EX1uM9K_oCft7BoQfW3EQj_En4/

thanx,
Anders

> 
> /Stefan
> 
> 
> On 2021-04-28 11:00, Anders Rundgren wrote:
>> On 2021-04-28 8:52, Stefan Santesson wrote:
>>> How is this different/better than implementing RFC 7797 and apply the
>>> header b64=false in order to carry plaintext JSON in the payload?
>>
>> Good question!
>>
>> Apart from the fact that the data becomes embedded in the JWS
>> signature container (=changing the structure), you cannot really put
>> JSON there:
>> https://tools.ietf.org/html/rfc7797#section-5.2
>>
>> My guess that the only real-world use of this option is to save an
>> internal-only (but technically redundant) Base64Url-operation for
>> truly detached data, be it it JSON, PNG, etc.
>>
>> JWS/CT was designed for signing JSON Objects ({}), and let them remain
>> as such.
>>
>> Thanx,
>> Anders
>>