Re: [jose] Canonical JSON form

Nathaniel McCallum <npmccallum@redhat.com> Wed, 10 October 2018 19:15 UTC

Return-Path: <nmccallu@redhat.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CB010126BED for <jose@ietfa.amsl.com>; Wed, 10 Oct 2018 12:15:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 1C-sSt3D7ZF6 for <jose@ietfa.amsl.com>; Wed, 10 Oct 2018 12:15:13 -0700 (PDT)
Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (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 C92A1120072 for <jose@ietf.org>; Wed, 10 Oct 2018 12:15:12 -0700 (PDT)
Received: by mail-qt1-f171.google.com with SMTP id o17-v6so7042012qtr.1 for <jose@ietf.org>; Wed, 10 Oct 2018 12:15:12 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NvPRouvusMIXXJhMwYjFVT8qxWeCj3VstYyTQPB1yuc=; b=Ecuehi0JtK8B4EYo7CPfVWS5mfvHD+AOOgw+HUTq15MMakMWw6ywMMMrBOS1vJrXWE le6/UxI3j/8/gm7K0kWz+LnsITlvQSisbLlIdkwUeHOoG70Wcijv0PAhaJTvfyNGeLrH 2nRbPEtPSNFWc74GtAUoEGGnuvB8eNqBP7HTPPjVCalfpbpuG96i590m3DpwRMkccssA uwzIzvbM3+AbGXuaCT8BXdiuYEvhttcQUKiKdiXahnVkLIczXO7BebcX26J9vqEXemCg vdUuZh5iz6J8zS3BqHvZN7XETsIiR9hEfaPzmYyS/W446ositxHbC9aavJ8DMbNsmsNt kpcQ==
X-Gm-Message-State: ABuFfoigsjNXGSR6pXZHzesE3Hu1en2veI/7zj0oaGg1fVbFGMtmu4fh EC6DqM5RXfjbiRi/WQj+bgDGlxQZlZyBpjnHGw1RyQLg
X-Google-Smtp-Source: ACcGV619cFZzDiYV2uAsyELx996dq+0f5+Kyk4gGHrs/RTJ+Na0OtM5A3zZIQ+yrfqJhO/ILkrq38MbD9uiJGuSOU9A=
X-Received: by 2002:a0c:988a:: with SMTP id f10-v6mr28039389qvd.178.1539198911645; Wed, 10 Oct 2018 12:15:11 -0700 (PDT)
MIME-Version: 1.0
References: <12DD2F97-80C3-4606-9C6B-03F7A4BF19DE@gmail.com>
In-Reply-To: <12DD2F97-80C3-4606-9C6B-03F7A4BF19DE@gmail.com>
From: Nathaniel McCallum <npmccallum@redhat.com>
Date: Wed, 10 Oct 2018 15:15:00 -0400
Message-ID: <CAOASepNX4aYVmPWXyODn0E2Om_rimACPECqJBvZSOXVVd_p8LA@mail.gmail.com>
To: jordan.ietf@gmail.com
Cc: jose@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/IcrUcamJZc-jlUZdKJVj3NSRUtk>
Subject: Re: [jose] Canonical JSON form
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 10 Oct 2018 19:15:15 -0000

JWS signs a byte stream, not JSON. If you want to use a JWS to sign
JSON data it is your responsibility to ensure that both sides produce
an equivalent byte stream.
On Wed, Oct 10, 2018 at 3:04 PM Bret Jordan <jordan.ietf@gmail.com> wrote:
>
> Dear WG,
>
> I was reading through RFC 7515 to see if it would work for a project I am working on.  Basically the need to sign and resign a JSON object.  However, in RFC 7515 there does not seem to be any definition for serializing a canonical form of JSON. This means that two organizations that serialize it differently would produce two different signatures.
>
> Super simple example
>
> { “type” : “house”, “size” : “1000 sq feet” }
>
>
>
> Or
>
> {
>   “type” : “house”,
>   “size” : “1000 sq feet”
> }
>
>
>
> Or
>
> {“type”:“house”,“size”:“1000 sq feet”}
>
>
>
> Or (tabs not spaces)
>
> {
> “type” : “house”,
> “size” : “1000 sq feet”
> }
>
>
> All four of these JSON structures would produce a different signature as defined by RFC 7515. What am I missing?
>
>
> Thanks,
> Bret
> PGP Fingerprint: 63B4 FC53 680A 6B7D 1447  F2C0 74F8 ACAE 7415 0050
> "Without cryptography vihv vivc ce xhrnrw, however, the only thing that can not be unscrambled is an egg."
>
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose