Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serialization pub key #491

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

esabedo
Copy link

@esabedo esabedo commented Dec 23, 2024

Currently, EVP_PKEY_print_public specifies an incorrect key class for the generated EVP_PKEY.
Now selection is also used to get the key class.

@esabedo esabedo force-pushed the fix-serialization-pub-key branch 2 times, most recently from ce1a190 to 20e91a4 Compare December 23, 2024 10:26
@Jakuje
Copy link
Contributor

Jakuje commented Dec 26, 2024

Do you have example outputs and reproducer that could be used in the tests to make sure we do not regress?

@esabedo esabedo force-pushed the fix-serialization-pub-key branch from 20e91a4 to 8e6ce77 Compare December 27, 2024 08:53
@esabedo
Copy link
Author

esabedo commented Dec 27, 2024

  1. When receiving information about the public key (EVP_PKEY_print_public), the information was output in the following format:
PKCS11 RSA Public Key (1024 bits)
    Modulus:
        00:d0:84:e1:59:fa:69:3d:38:54:92:7c:77:a9:74:
        5e:9f:4d:e9:f7:12:9a:ab:89:77:bf:c5:d7:63:e5:
        9b:16:89:a6:cb:c6:cd:71:16:ed:da:3c:93:a4:76:
        63:6d:65:99:e8:02:40:80:86:0e:92:3f:3a:5e:51:
        fe:ba:86:aa:c7:45:cc:30:c1:61:c0:7f:7b:fa:af:
        78:54:8e:4b:09:03:70:fc:e1:61:ae:3c:88:ba:f3:
        dc:a0:8c:6d:b4:be:da:af:74:26:a9:ca:b1:0e:c3:
        7e:9c:c2:84:36:86:4e:e5:37:31:b3:6b:2a:c4:b2:
        21:a8:e6:e0:64:8d:03:dd:53
    Exponent: 65537 (0x10001)
    URI pkcs11:model=Abracadabra;manufacturer=Abracadabra%20Co.;serial=44444444;token=Test%20custom;id=%67%6C%6F%62%61%6C%52%53%41%31%30%32%34%4B%65%79;type=private

In this output, we are specifically interested in the type=private part.
However, this is not true, since it was the public key that was requested. After this fix, the output is the expected type=public.

  1. A bug has also been fixed with the release of the object's memory (free), for which the memory is allocated using openssl.

A commit with test has also been added

Eduard Sabirov added 3 commits December 27, 2024 12:15
Currently, EVP_PKEY_print_public specifies an incorrect key class for the generated EVP_PKEY.
Now selection is also used to get the key class.

Signed-off-by: Eduard Sabirov <[email protected]>
… allocated using openssl

Signed-off-by: Eduard Sabirov <[email protected]>
@esabedo esabedo force-pushed the fix-serialization-pub-key branch from 8e6ce77 to 70f5d83 Compare December 27, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants