Skip to main content
Associate III
March 5, 2024
Solved

SBSFU | KMS | How to use KMS_GenerateKeyPair()

  • March 5, 2024
  • 2 replies
  • 2420 views

Hello all.
I have a question about how to use KMS_GenerateKeyPair() function. There are no examples in the code, and API description is not really enough for my little brain. Could somebody provide me an example on how it should be used? What kind of parameters, how to initialize them and so on. I would be grateful!

This topic has been closed for replies.
Best answer by Jocelyn RICARD

Hello @Jakub Standarski ,

KMS is implementing PKCS#11 standard.

So, you should find an example somewhere.

Using google I found a video and example in associated gihub here

Best regards

Jocelyn

2 replies

Jocelyn RICARD
Jocelyn RICARDBest answer
ST Employee
March 6, 2024

Hello @Jakub Standarski ,

KMS is implementing PKCS#11 standard.

So, you should find an example somewhere.

Using google I found a video and example in associated gihub here

Best regards

Jocelyn

Associate III
March 6, 2024

Much appreciated! That's what I needed.

Jocelyn RICARD
ST Employee
March 12, 2024

Hello @Jakub Standarski ,

first regarding debugging capability, you must change optimization level at least for the files that are involved.

About your issue, I could find something in the code in file 

Projects\B-L4S5I-IOT01A\Applications\2_Images_KMS\2_Images_SBSFU\SBSFU\App\sfu_scheme_x509_mbedtls_ecdsa_verify.c

 else if(p_grp->id == MBEDTLS_ECP_DP_SECP384R1)
 {
 ref_secp[0] = 0x81;
 ref_secp[1] = 0x2b;
 ref_secp[2] = 0x05;
 ref_secp[3] = 0x06;
 ref_secp[4] = 0x22;
 ref_secp[5] = 0x00;
 ref_secp[6] = 0x04;
 }

So, it looks like buffer needs to be adapted to little endian.

Best regards

Jocelyn

Associate III
March 12, 2024

Regarding debugging capabilities - yes, I'm aware of a need to change optimization level, the thing is that we don't have enough space so I had to operate on what was currently available.

 

Regarding the main issue though, that looks like potential solution (I will give it a try soon). I've been wondering why is that, because I've seen same numbers but in different order while debugging. On the other hand I took example from pkcs11 tutorial and was a bit confused. Thanks for clarification!