psa_import_key() documentation improvements #338

Open
opened 2019-12-23 17:21:08 -06:00 by laurencelundblade · 1 comment
laurencelundblade commented 2019-12-23 17:21:08 -06:00 (Migrated from github.com)

Description

Here's some things that were hard to figure out for psa_import_key() of an EC key for use with ECDSA that could be addressed with documentation. I figured them out from the source code and such and it took a long time.

  • When you import a private EC key, the public key is always created from the private key. So the import is either of a key pair or a public key, never just a private key. Design is fine, but it is not obvious. OpenSSL doesn't work this way for example.
  • For import to work, the one attribute you have to set is the key type, psa_set_key_type(), or it won't know what type of key you are importing.
  • To make the key you imported usable for sometime you have to set some policy, particularly what algorithms you want it to work with and what operations you want to perform.

I'm working off-target on MacOS with Xcode against MBed 2.0, MBed 1.1 and MBed 1.1 as integrated into TF-M.

(Sorry I can't actually make pull requests to improve the documentation. I just have too many projects going to get involved at that level here, though I'd like to.)

Issue request type

[ ] Question
[ X] Enhancement
[ ] Bug
<!-- ************************************** WARNING ************************************** The ciarcom bot parses this header automatically. Any deviation from the template may cause the bot to automatically correct this header or may result in a warning message, requesting updates. Please ensure that nothing follows the Issue request type section, all issue details are within the Description section and no changes are made to the template format (as detailed below). ************************************************************************************* --> ### Description Here's some things that were hard to figure out for psa_import_key() of an EC key for use with ECDSA that could be addressed with documentation. I figured them out from the source code and such and it took a long time. * When you import a private EC key, the public key is always created from the private key. So the import is either of a key pair or a public key, never just a private key. Design is fine, but it is not obvious. OpenSSL doesn't work this way for example. * For import to work, the one attribute you have to set is the key type, psa_set_key_type(), or it won't know what type of key you are importing. * To make the key you imported usable for sometime you have to set some policy, particularly what algorithms you want it to work with and what operations you want to perform. I'm working off-target on MacOS with Xcode against MBed 2.0, MBed 1.1 and MBed 1.1 as integrated into TF-M. (Sorry I can't actually make pull requests to improve the documentation. I just have too many projects going to get involved at that level here, though I'd like to.) <!-- Required Add detailed description of what you are reporting. Good example: https://os.mbed.com/docs/latest/reference/workflow.html Things to consider sharing: - What target does this relate to? - What toolchain (name + version) are you using? - What tools (name + version - is it mbed-cli, online compiler or IDE) are you using? - What is the SHA of Mbed OS (git log -n1 --oneline)? - Steps to reproduce. (Did you publish code or a test case that exhibits the problem?) --> ### Issue request type <!-- Required Please add only one X to one of the following types. Do not fill multiple types (split the issue otherwise.) Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front of them would change the meaning incorrectly. The only changes to be made are to add a description text under the description heading and to add a 'x' to the correct box. --> [ ] Question [ X] Enhancement [ ] Bug
ciarmcom commented 2019-12-24 00:44:58 -06:00 (Migrated from github.com)
*Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-1037*
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-ARMmbed/mbed-crypto#338
No description provided.