Re: [Hipsec] Help needed - text to octet for HIP-DEX

Jeff Ahrenholz <j.ahrenholz@Tempered.io> Thu, 19 March 2020 21:55 UTC

Return-Path: <j.ahrenholz@Tempered.io>
X-Original-To: hipsec@ietfa.amsl.com
Delivered-To: hipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 193F03A1095 for <hipsec@ietfa.amsl.com>; Thu, 19 Mar 2020 14:55:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.615
X-Spam-Level:
X-Spam-Status: No, score=-1.615 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, KHOP_HELO_FCRDNS=0.274, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01] autolearn=no 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 VBre8cuyqF2v for <hipsec@ietfa.amsl.com>; Thu, 19 Mar 2020 14:55:42 -0700 (PDT)
Received: from out.west.exch081.serverdata.net (cas081-co-3.exch081.serverdata.net [199.193.204.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A7E913A108E for <hipsec@ietf.org>; Thu, 19 Mar 2020 14:55:31 -0700 (PDT)
Received: from MBX081-W5-CO-1.exch081.serverpod.net (10.224.129.84) by MBX081-W5-CO-1 (10.224.129.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 19 Mar 2020 14:55:30 -0700
Received: from MBX081-W5-CO-1.exch081.serverpod.net ([10.224.129.84]) by MBX081-W5-CO-1.exch081.serverpod.net ([10.224.129.84]) with mapi id 15.00.1497.006; Thu, 19 Mar 2020 14:55:30 -0700
From: Jeff Ahrenholz <j.ahrenholz@Tempered.io>
To: Robert Moskowitz <rgm@htt-consult.com>, HIP <hipsec@ietf.org>
Thread-Topic: [Hipsec] Help needed - text to octet for HIP-DEX
Thread-Index: AQHV/ZjXAISjdNAlOUqdqcAW/hK2nahQdwOA
Date: Thu, 19 Mar 2020 21:55:30 +0000
Message-ID: <AC96FE11-18F3-4060-BC1C-23A2A232D4E4@tempered.io>
References: <1e300767-361a-9032-80a3-2a5ec205af77@htt-consult.com>
In-Reply-To: <1e300767-361a-9032-80a3-2a5ec205af77@htt-consult.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [73.254.156.159]
Content-Type: text/plain; charset="utf-8"
Content-ID: <6771BE333FA87F40A6A3BD79077EDE67@exch081.serverpod.net>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/hipsec/_lNttpL51VcArZnv1J23Br525E4>
Subject: Re: [Hipsec] Help needed - text to octet for HIP-DEX
X-BeenThere: hipsec@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is the official IETF Mailing List for the HIP Working Group." <hipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/hipsec>, <mailto:hipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/hipsec/>
List-Post: <mailto:hipsec@ietf.org>
List-Help: <mailto:hipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/hipsec>, <mailto:hipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Mar 2020 21:55:46 -0000

Bob et al.,

>    There are two strings used in the KEYMAT process i HIP-DEX:
>    
>    CKDF-Extract
>    and
>    CKDF-Expand
>    
>    The draft says that they are "an octet string".
>    
>    Thing is that depending on which google found tool, I get different text 
>    to octet values!
>    
>    So to those implementors out there:
>    
>    What is the proper octet strings for the above two text strings?

From an implementation perspective, here are some Python3 snippets:
(ord() returns the Unicode codepoint for a character, 
 oct() returns the octal representation, and
 hex() returns the hexadecimal representation)

input="CKDF-Extract"

# the values Roman suggested, shown as ASCII decimal values:
>>> list(map(lambda i: ord(i), input))
[67, 75, 68, 70, 45, 69, 120, 116, 114, 97, 99, 116]

# the tool you were using showed octal values:
>>> list(map(lambda i: oct(ord(i)), input))
['0o103', '0o113', '0o104', '0o106', '0o55', '0o105', '0o170', '0o164', '0o162', '0o141', '0o143', '0o164']

# hex representation of the above:
>>> list(map(lambda i: hex(ord(i)), input))
['0x43', '0x4b', '0x44', '0x46', '0x2d', '0x45', '0x78', '0x74', '0x72', '0x61', '0x63', '0x74']

In the appendix of e.g. RFC 5201, we show hexadecimal values... in this case you could put:
input text: "CKDF-Extract"
hex string: 0x434b44462d45787472616374

input text: "CKDF-Expand"
hex string: 0x434b44462d457870616e64

So the hex looks good to me, but you could use either of the other representations as long as we explicitly state what they are.

-Jeff