[Json] Wrapped objects

Phillip Hallam-Baker <phill@hallambaker.com> Fri, 27 May 2016 13:43 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DC58412DAA7 for <json@ietfa.amsl.com>; Fri, 27 May 2016 06:43:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.4
X-Spam-Level:
X-Spam-Status: No, score=-2.4 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.198, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, 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 (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 Oz2Cb59jI1Kb for <json@ietfa.amsl.com>; Fri, 27 May 2016 06:43:48 -0700 (PDT)
Received: from mail-qk0-x235.google.com (mail-qk0-x235.google.com [IPv6:2607:f8b0:400d:c09::235]) (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 D5DCE12D10D for <json@ietf.org>; Fri, 27 May 2016 06:43:47 -0700 (PDT)
Received: by mail-qk0-x235.google.com with SMTP id h185so46455492qke.2 for <json@ietf.org>; Fri, 27 May 2016 06:43:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to; bh=8ehx8GokUsrF9B/knla12a11jwoB7O/R2MrxfyUiqaw=; b=Dmrag9vIoY5rFFLkmQfE5Qzx0E/xrNxuwUUZAg4YfXBLuOmnXA9GDtaOJfFYj0NGy7 dFi+z132wIR+e6xPkModQOnoWIQ4lpjsSMjgNE1XkbYB13Kz94SOHl3TMlWK8xfZjKJC lYaJH/l7cWYpusiTqvADKZLOINDsfsz6NNHTvCLb5ISq1f3nlaBjZGWPuKPuOBLJ/KRe y5PkBEyce2rJrDjjYGyugDPFoR/dUf8/YN2csvk17CLogNa0vg6Ta1kvtedtskF4kEdg mY7/Pf2qlK2Ra3BSTsO4WS/86HNFMYb+wEzmpw1QGqKIHQgdVqRynCCkxCTvA/f64eUI WqIA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:date:message-id:subject:from :to; bh=8ehx8GokUsrF9B/knla12a11jwoB7O/R2MrxfyUiqaw=; b=BFl8lhcBBUavfXkyungfkgszO1p60iFTb5smCDoMR5CLn1Zub+zacEt8m40JsCpwNH zC2xuIrybsLTo5EN0TBT1r5Dy0UHJafpuj/ljM8/gyrBlMvM2Sp9tCb8duqN9PcJ4c/E gaWsxjll4/DpdjXehb5ZpAqWenszP+OduXxCCtFRPZF3Ci+KHVLpPvqzGl8mKxa0LY7u H7qe5elbuyb5ANHWuTKNdoa6rdcGEa1LLO3LQ+QlmbyoXJ2NC7l42CSgr1OJb3y+nrOQ KXcPZyLI+6/b2HKin83Ojlv8cbBJJAm+OI+EnTrVgZhlT6FnxMNQTYuCh54cgBQdA9jP zKSQ==
X-Gm-Message-State: ALyK8tJilECzfQLI+lIHXx7qhtF8gbHrfUGaz2JYuriv65ocLCOupuIw394KgE7s11wXBsMSw2ODxN+Z4sClQA==
MIME-Version: 1.0
X-Received: by 10.55.165.11 with SMTP id o11mr14262181qke.196.1464356627017; Fri, 27 May 2016 06:43:47 -0700 (PDT)
Sender: hallam@gmail.com
Received: by 10.55.25.85 with HTTP; Fri, 27 May 2016 06:43:46 -0700 (PDT)
Date: Fri, 27 May 2016 09:43:46 -0400
X-Google-Sender-Auth: Xw3WC7eVtJ7KroieInABZgc0IoM
Message-ID: <CAMm+LwhNuGZkt_K3tCKuEM+6OVHtkM=bWBJNj7RyHLK0SbiZbg@mail.gmail.com>
From: Phillip Hallam-Baker <phill@hallambaker.com>
To: JSON WG <json@ietf.org>
Content-Type: multipart/alternative; boundary=001a114d8fdc93f7ff0533d3186f
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/A4wlAMxxKIetGLRrjUyCIWkXO1U>
Subject: [Json] Wrapped objects
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 27 May 2016 13:43:50 -0000

One of the ugliest features in Assinine.1 is Macros. The mechanism is
horrible. But it does come in very handy when you want to do encryption or
signature.

Since I have written a JSON based PKI, I am very interested in having such
features and keep the ability to do type checking. Consider the following

CurrentProfile Class
    Master SignedObject
    Devices List SignedObject
    Applications List SignedObject

Obviously the three slots require the lists to contain signed objects of
specific types. But I can't express that right now.

I would like to be able to integrate JOSE signing and encryption into the
serializer/deserializer and have the code do the work of unwrapping and
wrapping signed and encrypted blobs for me. And for that to happen I have
to be able to express what type of data the blobs contain.

The serializaion is going to look something like

{ "CurrentProfile" : {
   "Master" : {
       "Data" : "base64 deadbeef", ...}
   .... } }


"base64 deadbeef" =

{ "ProfileMaster" : {  .... } }


My current plan is to introduce parameterized types into the schema for
handling these wrapped objects. So my schema now becomes:

CurrentProfile Class
    Master SignedObject <MasterProfile>
    Devices List <SignedObject <DeviceProfile>>
    Applications List <SignedObject <ApplicationProfile>>

I haven't yet decided on whether the <> syntax is desirable or not. Or for
that matter how to map it to JSON-X.

CurrentProfile Class
    Master SignedObject
        Of MasterProfile
    Devices List
        Of SignedObject
           Of DeviceProfile
    Applications List
        Of SignedObject
            Of ApplicationProfile