STSAFE-A110 Key establishment (NIST P-256)
Hello,
I'm trying to implement the Key Establishment workflow on my hardware based on STM32U5 MCU and STSAFE-A110 secure chip. The ephemeral key pair generation (StSafeA_GenerateKeyPair) works fine and the establishing key (StSafeA_EstablishKey) with the ephemeral private key and the remote host public key gives me a 48-byte shared secret by using NIST P-256 as curve ID.
In the ST library provided, it is mentioned that the StSafeA_EstablishKey function provides a shared secret. In cryptography, a key agreement should return a shared secret on 32 bytes for NIST P-256 curve ID and then this shared secret may be used to compute a 48-byte shared key using HKDF with SHA-256 for example by providing salt and info.
So what does exactly return the StSafeA_EstablishKey function of library? A shared secret or a shared key?
Remote-side (Linux-OS computer), if I compute a key agreement using the remote private key and the STSAFE ephemeral public key, I get a 32-bytes shared secret (with OpenSSL tool) but nothing matches between the computed secret of remote and stsafe. Do I have to use a stsafe remote-side?
Best regards,
Alex
