<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118938/spake2-example-psa-library</link><description>Hello everyone, 
 I was looking at SPAKE2+ example (NCS v2.6.99) and trying to understand where the password used to derived the shared secret is set or used. Can anyone help me? 
 BR.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Feb 2025 09:29:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118938/spake2-example-psa-library" /><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/524276?ContentTypeID=1</link><pubDate>Mon, 24 Feb 2025 09:29:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d349e7d-35f1-423a-a503-a5df64f05d04</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;We mainly support Matter version of SPAKE2+ which is HMAC based. You could try to follow the logic in sdk-oberon-psa-crypto to change to &lt;a href="https://github.com/nrfconnect/sdk-oberon-psa-crypto/blob/d66c20787f82b9469439fb7c1436463c02ca3b10/oberon/drivers/oberon_spake2p.c#L173"&gt;CMAC-AES-128&lt;/a&gt;. For intermediate values, please note that PAKE is basically implementing APIs from PSA. You can look at this&amp;nbsp;&lt;a href="https://arm-software.github.io/psa-api/crypto/1.2/ext-pake/about.html"&gt;PSA API&lt;/a&gt;&amp;nbsp;document.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523655?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2025 09:44:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cdf34519-c7de-48fa-840e-49efde3fbd13</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;I will discuss your questions with our developers. I expect to get back to you by the end of the next week.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523453?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2025 10:17:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b7c5eb0-0e48-4358-aa7a-7c3619c108d4</guid><dc:creator>Portilha</dc:creator><description>&lt;p&gt;I want to have something like this example:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1739873791493v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;Where the CMAC output (confirmP and confirmV) are both 16 bytes.&lt;/p&gt;
&lt;p&gt;BR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523298?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 14:06:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd40f27c-32ec-4fda-99c8-6a2dbfc94151</guid><dc:creator>Portilha</dc:creator><description>&lt;p&gt;The second message exchange (different values for verifier and prover), before the final message that has the same K_shared. Also, I want to know if there is any way to adjust the example to use CMAC-AES-128.&lt;/p&gt;
&lt;p&gt;BR.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523261?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 12:58:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:378e3b72-ab44-4854-87bf-d1d0daefa4a8</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Portilha"]Next, I see that the following pair of messages consists of 32-byte messages. Could you clarify what exactly these intermediate messages represent?[/quote]
&lt;p&gt;Which intermediate messages and 32-byte messages do you refer to?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523215?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 09:57:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e04c920c-efdb-46bc-a2ce-10b9b191f956</guid><dc:creator>Portilha</dc:creator><description>&lt;p data-start="137" data-end="145"&gt;Hello,&lt;/p&gt;
&lt;p data-start="147" data-end="177"&gt;Thank you for your response.&lt;/p&gt;
&lt;p data-start="179" data-end="449"&gt;Does your example follow the&amp;nbsp;&lt;a href="https://datatracker.ietf.org/doc/rfc9383/"&gt;RFC 9383&lt;/a&gt; specification? In your example, the first two exchanged messages are both 65-byte messages (0x04 followed by 64 bytes), which I assume represent the X and Y coordinates - each 32 bytes. These first two messages should correspond to:&lt;/p&gt;
&lt;ul data-start="450" data-end="503"&gt;
&lt;li data-start="450" data-end="476"&gt;&lt;strong data-start="452" data-end="457"&gt;X&lt;/strong&gt; = x * P + w₀ * M&lt;/li&gt;
&lt;li data-start="477" data-end="503"&gt;&lt;strong data-start="479" data-end="484"&gt;Y&lt;/strong&gt; = y * P + w₀ * N&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="505" data-end="852"&gt;Next, I see that the following pair of messages consists of 32-byte messages. Could you clarify what exactly these intermediate messages represent? I understand that both parties need to compute the shared secret curve points (Z and V) and then derive a shared secret from these points, but I&amp;rsquo;m unsure of the role of these intermediate messages.&lt;/p&gt;
&lt;p data-start="854" data-end="1362"&gt;Finally, the last set of messages should serve as confirmation or &amp;quot;evidence&amp;quot; that both parties possess the password and that the process was successful. In your example, this confirmation message is also 32 bytes long, but I was expecting (and require) a 16-byte message instead. Would it be possible to adjust this? Specifically, I need to use the last configuration from the table in the provided link:&lt;br data-start="1258" data-end="1261" /&gt;&lt;strong data-start="1261" data-end="1290"&gt;G: P-256 and CMAC-AES-128&lt;/strong&gt; (I need CMAC instead of HMAC) to obtain a 16-byte confirmation value.&lt;/p&gt;
&lt;p data-start="1364" data-end="1401"&gt;I appreciate your guidance on this.&lt;/p&gt;
&lt;p data-start="1403" data-end="1432"&gt;Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523187?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2025 08:46:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:030d5c40-90b6-434a-9443-b9146b30b139</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Our PSA Crypto API Implementation implements the&amp;nbsp;&lt;a href="https://arm-software.github.io/psa-api/crypto/"&gt;PSA Crypto API specification&lt;/a&gt;. You could consider opening discussion on specification there.&lt;br /&gt;&lt;br /&gt;Here is relevant&amp;nbsp;&lt;a href="https://github.com/athoelke/psa-api/blob/999f3b2afcdc97ac9da3ae7cdebcaad72fc2ae6b/doc/ext-pake/api/pake.rst#key-formats"&gt;discussion&lt;/a&gt;&amp;nbsp;on the use of public key.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523112?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2025 23:32:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ecf3a257-ea7d-4822-9c56-d994ee91e4df</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;The SPAKE2+ algorithm itself does not operate on a password, but rather an already hashed password; where the first half of the hash is denoted w0 and the second half w1.&lt;/p&gt;
&lt;p&gt;Typically, a nordic chip acts as the verifier and a smartphone/tablet/computer acts as the prover (typically with a user interface with a password field or qr code camera). The cpu at the prover is powerful enough to perform a slow hash operation such as scrypt or Argon2. The verifier only stores a pre-hashed verifier entry and thus does not perform any hashing. Therefore, you will not see any API function taking a password.&lt;/p&gt;
&lt;p&gt;The API takes w0 concatenated by w1*P for the verifier instead of a password. The idea is to pre-hash this value on a different device and then transfer this data over to the verifier device and store it on flash. I suggest that you read RFC9383 to get familiar how the mechanism works.&lt;/p&gt;
&lt;p&gt;The example code as well as the PSA API unfortunately calls the verifier &amp;quot;public_key&amp;quot;. This is certainly not a public key but the password hash and should hence not be leaked, since an attacker in the possession of this can perform a brute force attack to recover the password. Remember that SPAKE2+ is designed to operate on passwords with low entropy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPAKE2+ example (PSA library)</title><link>https://devzone.nordicsemi.com/thread/523106?ContentTypeID=1</link><pubDate>Fri, 14 Feb 2025 19:25:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a36a52eb-3e80-4d99-b58e-d8c0c3e1b958</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;&lt;a href="https://datatracker.ietf.org/doc/rfc9383/"&gt;RFC9383&lt;/a&gt;, mentions that w0 and w1 are obtained by hashing the password with identities of the participants. In the crypto spake2+ sample, you can see that w0||w1 is given in the key_pair[]. Some additional information about PAKE can be found in&amp;nbsp;v2.7.0\modules\crypto\oberon-psa-crypto\include\psa\crypto_types.h and in v2.7.0\modules\crypto\oberon-psa-crypto\include\psa\crypto_extra.h. You can also look at&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-nrfxlib/blob/main/crypto/nrf_oberon/include/ocrypto_spake2p_p256.h"&gt;ocrypto_spake2p_p256.h&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>