Re: [jose] Base64 encoded JWS Payload Example seems wrong

"Manger, James" <James.H.Manger@team.telstra.com> Sun, 30 September 2018 23:13 UTC

Return-Path: <James.H.Manger@team.telstra.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 56FD8126CB6 for <jose@ietfa.amsl.com>; Sun, 30 Sep 2018 16:13:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.601
X-Spam-Level:
X-Spam-Status: No, score=-2.601 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=teamtelstra.onmicrosoft.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 z3g8RGvMM58f for <jose@ietfa.amsl.com>; Sun, 30 Sep 2018 16:12:59 -0700 (PDT)
Received: from ipxavo.tcif.telstra.com.au (ipxavo.tcif.telstra.com.au [203.35.135.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6FDF712872C for <jose@ietf.org>; Sun, 30 Sep 2018 16:12:55 -0700 (PDT)
X-IronPort-AV: E=Sophos;i="5.54,325,1534773600"; d="scan'208,217";a="260131744"
X-Amp-Result: SKIPPED(no attachment in message)
Received: from unknown (HELO ipcavi.tcif.telstra.com.au) ([10.97.217.200]) by ipoavi.tcif.telstra.com.au with ESMTP; 01 Oct 2018 09:12:43 +1000
Received: from wsmsg3706.srv.dir.telstra.com ([172.49.40.80]) by ipcavi.tcif.telstra.com.au with ESMTP; 01 Oct 2018 09:12:43 +1000
Received: from wsapp5870.srv.dir.telstra.com (10.75.139.12) by wsmsg3706.srv.dir.telstra.com (172.49.40.80) with Microsoft SMTP Server (TLS) id 8.3.485.1; Mon, 1 Oct 2018 09:12:41 +1000
Received: from wsapp5585.srv.dir.telstra.com (10.75.3.67) by wsapp5870.srv.dir.telstra.com (10.75.139.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 1 Oct 2018 09:12:41 +1000
Received: from AUS01-ME1-obe.outbound.protection.outlook.com (10.172.101.126) by wsapp5585.srv.dir.telstra.com (10.75.3.67) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 1 Oct 2018 09:12:40 +1000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=teamtelstra.onmicrosoft.com; s=selector1-team-telstra-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fzdOOG5pONB42/taKla/M7w9t8ZbnvN0TLeY7CCxNdQ=; b=rb5ly6GUNat9XCTW4dNMVAjMpav92Np2SMmDR4uz0mmP1s3MmK9L/bQo9TwRFlugDu6YU3tJkMHAz9GsZ6kLjOgegYs6GuTl/yynDoVmr1ubjVDdp5qU3cr7Wmk/PxiR6gSMppbr7/NvfBbP2WOVRr/zjPPT8U6OHg+oAAaNNdA=
Received: from MEAPR01MB3542.ausprd01.prod.outlook.com (52.134.216.9) by MEAPR01MB3766.ausprd01.prod.outlook.com (52.134.217.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1185.23; Sun, 30 Sep 2018 23:12:39 +0000
Received: from MEAPR01MB3542.ausprd01.prod.outlook.com ([fe80::f55b:7a8b:68ed:5b83]) by MEAPR01MB3542.ausprd01.prod.outlook.com ([fe80::f55b:7a8b:68ed:5b83%2]) with mapi id 15.20.1185.024; Sun, 30 Sep 2018 23:12:39 +0000
From: "Manger, James" <James.H.Manger@team.telstra.com>
To: Kengo Suzuki <kengoscal@gmail.com>, "jose@ietf.org" <jose@ietf.org>
Thread-Topic: [jose] Base64 encoded JWS Payload Example seems wrong
Thread-Index: AQHUWC1QGJSCOz0iykGjpc68wPaUS6UJdDjg
Date: Sun, 30 Sep 2018 23:12:38 +0000
Message-ID: <MEAPR01MB354208CDB978D06A5182AB60E5EE0@MEAPR01MB3542.ausprd01.prod.outlook.com>
References: <CA+CobDwudE+GmxJT5SLFchnattwiejExwv0G18gNxiYG0pOjJQ@mail.gmail.com>
In-Reply-To: <CA+CobDwudE+GmxJT5SLFchnattwiejExwv0G18gNxiYG0pOjJQ@mail.gmail.com>
Accept-Language: en-AU, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
dlp-product: dlpe-windows
dlp-version: 10.0.500.19
dlp-reaction: no-action
authentication-results: spf=none (sender IP is ) smtp.mailfrom=James.H.Manger@team.telstra.com;
x-originating-ip: [203.41.142.253]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; MEAPR01MB3766; 6:Xc6sdFWxRVauKlSuZ0W+mh8e0HiL2Gqt5TmaDrsUj/5blvOBhXlIgK7hfZxmozKmU1AMKu+5CI8Jn8PyMYUAOwTpVeM6RvWfqVADeNIyjV+GSBfsZ8pFRo3RrwUSq0QknsAmLWeW/N1jx4R2iImAXoo8qrwZm6FRaoYbt3vk5mplxNyjGHtm6g9DYBBvkPIph4Mx4VFSxjizQFZfN/BQdmjwkIZOC8mboFQvuDAVhsfUm/6385+3o+kXDXaf16BiqgkDsfgbaBy87IV7JJbpBaPxKY3vc802MpiXVLVzz+3IDPj2KCWr6/xwIRhi85WS17IwK6cQFPBKOrAPx+USkBqUIiAGpgZrhfEMVf/4XeBlbEbaxudQXiMPGNE5aUFSSdd5Y+2DDuz++stgokwJIytiDuN2jnADh7N/im9rjYJvMWuGR64itkACJQcQNROTYlSoicSu1d6PxnDMdqX9CA==; 5:3hzQGw47sDH+ImtSGbQFyMmJ2M8e5TArXJnQCsNBPqoHJuqV3R/mkfMlYAZQKjMdgrzny5RM/PTzKVY7hPLAW8JTI0oRG3BYH39K8DzunJ7a2LA5ciAkQ8gBuK7vt7LTGC0EcT6fzdiHiPKSYeCXUR/+UIWnFnXW4kOO8IuWrKI=; 7:lMz0I1jSEk4BXh6ptOyNScqQJIoL31u0h46/Eh/JUcVfd3Z/D9EvbP5iDTxTCOCRxgiUOX3Il3aidhgBDi3AGLvSfV4ZsT9OZ1hJB4GuMJCQwmRQ0ZYUOJSiDdR37/Uc7+CuJ2uibbdjDaxqDGAuU5U1oUD1Yb8QsdHPaOoEPQApU6vU8cvPT0TjgRyFoDaa/R1WluBGN3R0dM0wZ+xK/Tm8lkhrRwGyy8cRbgIs+2YZfsyDK+6MxSngNhS5rl8f
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: c7ba4c26-6612-4b6b-7437-08d6272a3761
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:MEAPR01MB3766;
x-ms-traffictypediagnostic: MEAPR01MB3766:
x-microsoft-antispam-prvs: <MEAPR01MB3766FF920D21506DBDA9D5B5E5EE0@MEAPR01MB3766.ausprd01.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(21748063052155)(28532068793085)(190501279198761)(227612066756510);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(4982022)(52105095)(3002001)(93006095)(93001095)(10201501046)(149066)(150057)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(201708071742011)(7699051); SRVR:MEAPR01MB3766; BCL:0; PCL:0; RULEID:; SRVR:MEAPR01MB3766;
x-forefront-prvs: 08118EFC2B
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(366004)(376002)(136003)(346002)(396003)(39860400002)(199004)(189003)(97736004)(2906002)(9686003)(966005)(55016002)(53936002)(76176011)(236005)(2501003)(99286004)(316002)(575784001)(14444005)(256004)(86362001)(72206003)(33656002)(71190400001)(71200400001)(7736002)(790700001)(6116002)(6436002)(6306002)(66066001)(54896002)(3846002)(478600001)(229853002)(74316002)(81166006)(81156014)(486006)(11346002)(8676002)(476003)(446003)(53546011)(14454004)(34290500001)(606006)(39060400002)(102836004)(25786009)(6506007)(6246003)(5250100002)(26005)(68736007)(2900100001)(186003)(7696005)(8936002)(53376002)(106356001)(110136005)(105586002)(5660300001); DIR:OUT; SFP:1102; SCL:1; SRVR:MEAPR01MB3766; H:MEAPR01MB3542.ausprd01.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1;
received-spf: None (protection.outlook.com: team.telstra.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: lW1Y32QztLeKCGbbHWSlxfnpi2WoNU0FUac588+OrpT1WSpkSCKnBn2awsqzDOJb2C1PGw/SmPIjFOpCMNuGHo/OVHjaEQ2vLQ5CYMb5SzpGX/G8Xo5FdoKapi8zx7ka8g+7KKhsWJViV73sWGcHJnGxgV9mFKa6xhmtOHoNJ3j6LCZ6PA8jPt65aqtKeR6ccwc0R7Les3GophE6FUmL9RZ2kXFXgc7bcL0JBbZhyJDsM/QclRzGYZI36vOB1WuqMf+4aDmtEsxrJHVn7kRvEIlrc0HUSJK7ulikNryA3kpk6SLQz1/F8n43lsBbWnlbUGPZ5660RpS0hf+xJJb0n4vi7rbRVjg0PSKUCQNcYV4=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_MEAPR01MB354208CDB978D06A5182AB60E5EE0MEAPR01MB3542ausp_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: c7ba4c26-6612-4b6b-7437-08d6272a3761
X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2018 23:12:39.0016 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 49dfc6a3-5fb7-49f4-adea-c54e725bb854
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MEAPR01MB3766
X-OriginatorOrg: team.telstra.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/8UZjmcy8Ql7avnWUYAmoPsuacZo>
Subject: Re: [jose] Base64 encoded JWS Payload Example seems wrong
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: Sun, 30 Sep 2018 23:13:02 -0000

You don’t have to eliminate CR LF. The point of sending the base64url-encoding is so the other end can get back the exact bytes, without having to define a single canonical JSON encoding. Any valid JSON encoding will do.


3<https://tools.ietf.org/html/rfc7515#section-3>.  JSON Web Signature (JWS) Overview


   JWS represents digitally signed or MACed content using JSON data
   structures and base64url encoding.  These JSON data structures MAY
   contain whitespace and/or line breaks before or after any JSON values
   or structural characters, in accordance with Section 2 of RFC 7159<https://tools.ietf.org/html/rfc7159#section-2>
   [RFC7159<https://tools.ietf.org/html/rfc7159>].




--
James Manger

From: jose [mailto:jose-bounces@ietf.org] On Behalf Of Kengo Suzuki
Sent: Sunday, 30 September 2018 3:01 AM
To: jose@ietf.org; draft-ietf-jose-json-web-signature@ietf.org
Subject: [jose] Base64 encoded JWS Payload Example seems wrong

Hi

This is Kengo Suzuki.
I was just reading https://tools.ietf.org/html/rfc7515#section-3.3 and tried to verify my own code using the following sample as JWS Payload.


 {"iss":"joe","exp":1300819380,"http://example.com/is_root":true<http://example.com/is_root%22:true>}



The draft says the base64 encoded value will be "

eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ",

but I think the value you have provided seems forgettign to eliminate CR and LF.



I will post my sample codes in Golang.

https://play.golang.org/p/FivX_83glex



Thanks for your time