Re: [TLS] TLS and hardware security modules - some issues related to PKCS11

Michael StJohns <> Mon, 23 September 2013 20:47 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 3810F21F9E69 for <>; Mon, 23 Sep 2013 13:47:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -3.441
X-Spam-Status: No, score=-3.441 tagged_above=-999 required=5 tests=[AWL=-0.157, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1, SARE_MILLIONSOF=0.315]
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id V093RUS-eS5f for <>; Mon, 23 Sep 2013 13:47:45 -0700 (PDT)
Received: from ( []) by (Postfix) with ESMTP id 343AB21F9D74 for <>; Mon, 23 Sep 2013 13:47:44 -0700 (PDT)
Received: by with SMTP id j7so1884975qaq.12 for <>; Mon, 23 Sep 2013 13:47:44 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=TH+vrfloit1EihkDhlEBaIqBDbi4bi4yaMj1Ydr7Ir4=; b=EVJGSnJmSNQt/ih3lAg9b9ie/WCSe64oYmTkkIp2nad18XRCwt7xHuoVJxsIOsWgSS uX3us+XywX5hFo1PMoCQy4U4OEpafqKm+Jio0VxiPbcC0GKvM6AfDwtB0hcXBbica/Wz YKjWv0WkwDRuTZXHbAViz0Y+DvzewdpxSZNFZB6yDFg24fTVfa15ERpsrh+6cbVnBL+f 4n3sVbbO72u88MlH5pFL0SOS7dVCgoria4MdnRs9BGU9QA1bE74Stc6cmBpxswhwGOvs Hsxbm/X57Uia6ucTWr/LE571jwlVwz+UGT5yn3tpJyDUJW3aYaYR4XPn5KNaz2hBaP+P n5Ag==
X-Gm-Message-State: ALoCoQmQd0wbmsrNV0Q8tIVRwT2OXGzk0SNy4oqG5KE8izb7qFAiCx98a9x3jgK1ThU3/hPPN5Qq
X-Received: by with SMTP id z14mr4546959qaw.90.1379969264442; Mon, 23 Sep 2013 13:47:44 -0700 (PDT)
Received: from [] ( []) by with ESMTPSA id i4sm47208902qan.0.1969. (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Sep 2013 13:47:44 -0700 (PDT)
Message-ID: <>
Date: Mon, 23 Sep 2013 16:47:44 -0400
From: Michael StJohns <>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
MIME-Version: 1.0
To: Nico Williams <>
References: <> <> <>
In-Reply-To: <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Cc: "" <>
Subject: Re: [TLS] TLS and hardware security modules - some issues related to PKCS11
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 23 Sep 2013 20:47:51 -0000

On 9/23/2013 4:00 PM, Nico Williams wrote:
> On Tue, Sep 17, 2013 at 10:45 AM, Michael StJohns
> <> wrote:
>> On 9/17/2013 8:49 AM, Martin Rex wrote:
>>> I fail to understand what you're trying to protect.
>>> The master secret of a session is never a secret that is hidding
>>> within the hardware module, instead, it is something known to the
>>> calling TLS protocol stack and part of the TLS session cache.
>> Um.  No, not if you designed things properly.  It should be possible for any
>> protocol the IETF designs to do all the crypto operation inside a hardware
>> module and not depend on the weak security of a general purpose computer.
> But evidently you must care about the application plaintext.  Why not
> move the application into the HSM as well then?
> That deserves a tongue-in-cheek smiley, of course :^)

There are SSL/TLS accelerators that move a whole bunch more of the 
crypto stuff inside the HSM, but PKCS11 is designed to be useful for 
more than just TLS.

>> I want to protect inside of the HSM all of the following:
>> a) the private keys related to the server or client identity
> Sure.
>> b) the pre-master key
>> c) the master key
>> d) the session keys.
>> I want to be able to do all the cryptographic processing inside that module
>> and only allow out true plain text.
> Why?  The HSM will become a cryptographic decelerator if you do that,
> unless it's a fantastically expensive HSM anyways, and even then there
> will be latency costs.  Meanwhile the session keys are of little or no
> additional value to the application plaintext, and you're leaving the
> application outside the HSM (of course, for obvious reasons).
> So why do this?  The one answer that comes to mind is: to make sure
> you get the crypto right, without possibility of screwups/backdoors in
> various OS components (e.g., RNG).  But the performance cost more than
> outweighs that answer in most of the use cases I can think of.

Consider a specific field of use - 10s of Millions of smart grid capable 
electric power meters.  Consider that I have a back office system that 
talks to each and every one of them securely.  Consider that I'm worried 
about insider threats with respect to reading and controlling (e.g. 
remote disconnection of the meters) these devices.  Consider that I 
never ever ever want a control key to be present outside of an HSM in 
plaintext form.  Consider that some smart grid technologies are using 
TLS as the sole credential layer for controlling substantial amounts of 

For TLS, I agree with you about performance, BUT, security is always a 
tradeoff with performance.  I may not always want to keep the session 
keys inside the HSM, but there are some times that prudence and good 
practice require this.

TLS should be designed so this is possible.  I believe it currently has 
a limitation that makes this goal difficult or impossible to achieve.


> Nico
> --