Hi!
I am learning how to use the PSA Cryptography API and there's something I don't understand. I have imported an ECDSA public key in uncompressed format (x + y coordinates), and when I try to export it I have realized they are not the same.
Here is my code. It is a modification of ecdsa sample, I just inicialize the API and then try to import and export the public key. The key is extracted from a certificate which is stored in an array.
Here is the log. As you can see, although the key is imported successfully, the first three bytes change.
00> [00:00:00.000,305] <inf> ecdsa: Starting ECDSA example...
00> [00:00:00.000,335] <inf> ecdsa: Verifying ECDSA signature...
00> [00:00:00.000,335] <inf> ecdsa: ---- Peer's coordinates (len: 65): ----
00> [00:00:00.000,366] <inf> ecdsa: Content:
00> 04 b4 61 e0 0b bd 4d 49 8d 41 00 e1 f3 14 76 80 |..a...MI .A....v.
00> 5d c1 11 ad 1c ea 42 52 50 de 68 2f 80 1e 8a 75 |].....BR P.h/...u
00> 0f 33 2d 24 65 ca ac 5d e4 6b fe 94 c1 34 ed a0 |.3-$e..] .k...4..
00> ff 31 c3 ce 21 fa 01 d5 ec 96 23 e5 53 51 d0 d2 |.1..!... ..#.SQ..
00> 18 |.
00> [00:00:00.000,366] <inf> ecdsa: ---- Peer's coordinates end ----
00> [00:00:00.000,396] <inf> ecdsa: peer_id_key: 2147483616
00> [00:00:00.000,427] <inf> ecdsa: ---- Exported public key (len: 65): ----
00> [00:00:00.000,457] <inf> ecdsa: Content:
00> 00 00 00 e0 0b bd 4d 49 8d 41 00 e1 f3 14 76 80 |......MI .A....v.
00> 5d c1 11 ad 1c ea 42 52 50 de 68 2f 80 1e 8a 75 |].....BR P.h/...u
00> 0f 33 2d 24 65 ca ac 5d e4 6b fe 94 c1 34 ed a0 |.3-$e..] .k...4..
00> ff 31 c3 ce 21 fa 01 d5 ec 96 23 e5 53 51 d0 d2 |.1..!... ..#.SQ..
00> 18 |.
00> [00:00:00.000,457] <inf> ecdsa: ---- Exported public key end ----[0m
00> [00:00:00.000,457] <inf> ecdsa: Example finished successfully!
Thank you in advance!